@font-face {
  font-family: "COWS Terminal";
  src: url("/static/fonts/JetBrainsMonoNerdFontMono-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "COWS Terminal";
  src: url("/static/fonts/JetBrainsMonoNerdFontMono-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/*
 * Design tokens. COWS is an operations console for provisioning
 * containerized workspaces: the palette is dark and quiet so dense tabular
 * admin data doesn't fight the chrome, "ink" (used by the header/nav) and
 * the page body now sit in the same dark register instead of the header
 * being an isolated dark accent on a light page, and the monospace face
 * carries structure (headings, labels, data, state) while the sans face
 * carries prose. Status colors are semantic only and never doubled as
 * decoration.
 */
:root {
  color-scheme: dark;

  --font-mono: "COWS Terminal", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ink: #10161d;
  --ink-soft: #1b2530;
  --ink-line: #2c3b48;
  --ink-deep: #0b0f14;

  --paper: #14120f;
  --surface: #201d19;
  --surface-sunk: #1a1815;
  --line: #35302a;
  --line-strong: #453f37;

  --text: #ede8e1;
  --text-mute: #a39a8e;
  --text-faint: #7c766c;

  --accent: #c1622b;
  --accent-strong: #e2924f;
  --accent-soft: rgb(217 148 90 / 22%);
  --accent-ring: rgb(217 148 90 / 45%);

  --good: #4fbf85;
  --good-bg: #163326;
  --good-line: #2f6b4c;
  --warn: #e0a63e;
  --warn-bg: #3a2c10;
  --warn-line: #7a5c1f;
  --bad: #e2705a;
  --bad-bg: #3a1a13;
  --bad-line: #7a3b2c;

  font-family: var(--font-sans);
  color: var(--text);
  background: var(--paper);
  line-height: 1.5;
}

* { box-sizing: border-box; }

body { margin: 0; overflow-x: hidden; }

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

/* ---------- Header and navigation ---------- */

.site-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 4vw, 4rem);
  color: #ffffff;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-line);
}

.wordmark {
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
}
.wordmark-dot { color: var(--accent); }
.header-context { color: #8fa0ac; font-family: var(--font-mono); font-size: .82rem; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; max-width: 100%; margin-left: auto; }
.site-nav a, .link-button { color: #ffffff; font: inherit; font-size: .85rem; text-decoration: none; }
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 2.25rem;
  padding: .4rem .7rem;
  border: 1px solid transparent;
  border-radius: .25rem;
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-family: var(--font-mono);
  font-size: .85rem;
  cursor: pointer;
}
.nav-tab:hover, .nav-tab:focus-visible { border-color: var(--ink-line); background: var(--ink-soft); text-decoration: none; }
.nav-menu { position: relative; }
.nav-menu-trigger { cursor: pointer; }
.nav-menu-caret { font-size: .65rem; opacity: .75; }
.nav-menu-panel {
  position: absolute;
  top: calc(100% + .3rem);
  left: 0;
  z-index: 20;
  display: grid;
  min-width: 11rem;
  padding: .35rem;
  border: 1px solid var(--ink-line);
  border-radius: .3rem;
  background: var(--ink-soft);
  box-shadow: 0 .75rem 1.5rem rgb(0 0 0 / 35%);
}
.nav-menu-item {
  padding: .5rem .6rem;
  border-radius: .2rem;
  color: #e7ecef;
  font-family: var(--font-mono);
  font-size: .85rem;
  text-decoration: none;
}
.nav-menu-item:hover, .nav-menu-item:focus-visible { background: var(--ink-line); text-decoration: none; }
.sign-out-form { display: flex; align-items: center; margin-left: .35rem; padding-left: .65rem; border-left: 1px solid var(--ink-line); }
.link-button { min-height: 2.25rem; padding: .4rem .7rem; border: 1px solid #46596a; border-radius: .25rem; background: transparent; font-family: var(--font-mono); }
.link-button:hover, .link-button:focus-visible { background: var(--ink-soft); text-decoration: none; }

/* ---------- Page shell and typography ---------- */

.page-shell { width: min(88rem, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 4rem; }
.intro { margin-bottom: 2rem; }
.eyebrow {
  margin: 0 0 .4rem;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; color: var(--text); font-family: var(--font-mono); line-height: 1.2; }
h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
.lede { max-width: 42rem; margin: .7rem 0 0; color: var(--text-mute); font-size: 1.05rem; font-family: var(--font-sans); }
.panel {
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--surface);
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.panel-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.status-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.status-label { display: block; color: var(--text-mute); font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.status-ok { color: var(--good); }
.status-degraded, .status-unavailable, .status-disabled { color: var(--bad); }
.status-warning, .status-pending { color: var(--warn); }
.status-neutral { color: var(--text-mute); }
time { color: var(--text-mute); font-family: var(--font-mono); font-size: .8rem; }

/* ---------- Status dots (signature component) ----------
 * The one recurring motif for anything the app reports as *state*:
 * workspace lifecycle, image availability, connection status, health.
 * A colored dot plus a monospaced label, pulsing while an operation is
 * actively in progress. Colored only by semantics (ok/warn/bad/neutral).
 * Plain tag/role/group labels use .badge instead, deliberately undecorated,
 * so this component always means "this is a state," never "this is a
 * label." Built via the shared "status-dot-view" template
 * (web/templates/fragments/status-dot.html) from a statusDotView value -
 * see workspaceStatusDot/stateStatusDot/booleanStatusDot/statusDot in
 * internal/web/server.go for the various ways to build one.
 */
.status-dot-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .2rem .6rem .2rem .5rem;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-dot-mark { width: .4rem; height: .4rem; border-radius: 50%; }
.status-dot-mark.status-dot-pulse { animation: status-dot-pulse 1.4s ease-in-out infinite; }
.status-dot-chip.status-dot-ok { color: var(--good); background: var(--good-bg); }
.status-dot-chip.status-dot-ok .status-dot-mark { background: var(--good); }
.status-dot-chip.status-dot-warn { color: var(--warn); background: var(--warn-bg); }
.status-dot-chip.status-dot-warn .status-dot-mark { background: var(--warn); }
.status-dot-chip.status-dot-bad { color: var(--bad); background: var(--bad-bg); }
.status-dot-chip.status-dot-bad .status-dot-mark { background: var(--bad); }
.status-dot-chip.status-dot-neutral { color: var(--text-mute); background: var(--surface-sunk); }
.status-dot-chip.status-dot-neutral .status-dot-mark { background: var(--text-faint); }
@keyframes status-dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .status-dot-mark.status-dot-pulse { animation-duration: 2.8s; }
}

button {
  min-height: 2.5rem;
  padding: .55rem .85rem;
  border: 1px solid transparent;
  border-radius: .3rem;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: .55rem .9rem;
  border: 1px solid;
  border-radius: .3rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.primary-button { color: #ffffff; border-color: var(--accent); background: var(--accent); }
.secondary-button { color: var(--accent-strong); border-color: var(--line-strong); background: var(--surface); }
button:hover, .primary-button:hover, .secondary-button:hover { filter: brightness(.94); text-decoration: none; }
button:focus-visible, .primary-button:focus-visible, .secondary-button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: .2rem solid var(--accent-ring); outline-offset: .15rem; }
button:disabled, .table-action:disabled { opacity: .55; cursor: not-allowed; filter: none; }
/*
 * Per-button pending state: each action button carries its own resting
 * label and an in-progress label+spinner, toggled by htmx's own
 * "htmx-request" class (added to the form/button that issued the request -
 * see htmx's hx-indicator docs) rather than a separate indicator element
 * elsewhere on the row. The action is visible directly in the button that
 * was clicked, not next to it.
 */
.action-pending { display: none; align-items: center; gap: .35rem; }
.action-pending::before { content: ""; width: .6rem; height: .6rem; flex-shrink: 0; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: image-pull-spin .8s linear infinite; }
form.htmx-request .action-label, button.htmx-request .action-label { display: none; }
form.htmx-request .action-pending, button.htmx-request .action-pending { display: inline-flex; }
.details { margin-top: 1rem; padding: .9rem 1rem; color: var(--text-mute); border-left: .25rem solid var(--warn-line); background: var(--warn-bg); }
.details dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0; }
.details dt { color: var(--text-mute); font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; }
.details dd { margin: .15rem 0 0; font-weight: 700; }
.narrow-section { width: min(32rem, 100%); margin: 0 auto; }
.template-form-section { width: min(76rem, 100%); }
.form-panel { display: grid; gap: .55rem; min-width: 0; margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); }
.admin-edit-section { width: min(56rem, 100%); }
.form-panel label { margin-top: .5rem; color: var(--text-mute); font-size: .88rem; font-weight: 700; }
.form-panel input, .form-panel select, .form-panel textarea {
  width: 100%;
  min-height: 2.6rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: .25rem;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}
.form-panel textarea { resize: vertical; }
.template-form-section textarea { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.template-form-section #configuration-json { font-family: var(--font-mono); font-size: .84rem; line-height: 1.45; }
.form-panel input:focus, .form-panel select:focus, .form-panel textarea:focus { outline: .2rem solid var(--accent-ring); border-color: var(--accent); }
.form-panel input.is-inert { background: var(--surface-sunk); color: var(--text-mute); cursor: not-allowed; }
.form-panel fieldset { display: grid; gap: .6rem; min-width: 0; margin: 1rem 0 0; padding: 1rem; border: 1px solid var(--line); border-radius: .3rem; }
.form-panel legend { padding: 0 .35rem; color: var(--text-mute); font-family: var(--font-mono); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
.form-grid > div { display: grid; min-width: 0; gap: .35rem; }
.form-grid label { margin-top: 0; }
.host-overbooking-settings { grid-column: 1 / -1; display: grid; min-width: 0; gap: .35rem; }
.field-label { margin: 0; color: var(--text); font-weight: 700; }
.host-overbooking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.host-overbooking-field { display: grid; grid-template-columns: 1fr auto; gap: .35rem .65rem; align-items: center; }
.host-overbooking-field input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.host-overbooking-field input[type="number"] { width: 8rem; min-height: 2.25rem; padding: .35rem .5rem; }
.host-overbooking-grid > .muted, .host-overbooking-grid > .alert { grid-column: 1 / -1; }
.workspace-resource-options { display: grid; gap: .75rem; margin-top: 1rem; }
.resource-choice { display: grid; gap: .65rem; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .3rem; background: var(--surface-sunk); }
.resource-choice legend { padding: 0 .35rem; color: var(--text); font-family: var(--font-mono); font-weight: 700; }
.resource-range, .resource-fixed { margin: 0; color: var(--text-mute); font-size: .85rem; }
.resource-slider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.resource-slider-field { display: grid; grid-template-columns: 1fr auto; gap: .35rem .65rem; align-items: center; margin: 0; color: var(--text); font-weight: 700; }
.resource-slider-field input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.resource-slider-field input[type="number"] { width: 7rem; min-height: 2.25rem; padding: .35rem .5rem; }
.resource-slider-field output { color: var(--text-mute); font-size: .85rem; font-weight: 400; }
.resource-over { accent-color: var(--bad) !important; border-color: var(--bad) !important; color: var(--bad); }
.resource-warning { margin: 0; color: var(--bad); font-size: .85rem; font-weight: 700; }
.check-row { display: flex; align-items: center; gap: .55rem; margin-top: .25rem !important; color: var(--text) !important; font-weight: 500 !important; }
.check-row input { width: 1rem; min-height: 1rem; }
.form-actions, .title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.form-actions { margin-top: 1rem; justify-content: flex-end; }
.button-link { display: inline-flex; align-items: center; justify-content: center; }
.alert { margin: 1rem 0 0; padding: .75rem 1rem; border-left: .25rem solid; border-radius: 0 .2rem .2rem 0; }
.alert-error { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.alert-warning { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.table-panel h2 { margin-bottom: 1rem; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: .3rem; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .8rem .65rem; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--text-mute); font-family: var(--font-mono); font-size: .74rem; letter-spacing: .03em; text-transform: uppercase; }
tbody tr:hover { background: var(--surface-sunk); }
.table-subtext { display: block; max-width: 18rem; overflow-wrap: anywhere; color: var(--text-mute); font-size: .82rem; }
code { color: var(--text-mute); font-family: var(--font-mono); font-size: .82rem; }
.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border: 1px solid var(--line-strong);
  border-radius: .2rem;
  color: var(--text-mute);
  font-size: .78rem;
  font-weight: 600;
}
.runtime-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.runtime-facts strong { display: block; margin-top: .15rem; font-family: var(--font-mono); }
.capacity-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.capacity-meter { display: flex; flex-direction: column; gap: .5rem; }
.capacity-meter-head { display: flex; flex-direction: column; gap: .15rem; }
.capacity-meter-headline { font-family: var(--font-mono); font-size: .9rem; }
.capacity-progress { width: 100%; height: .45rem; accent-color: var(--accent); }
.capacity-progress.quota-progress-warning { accent-color: var(--warn); }
.capacity-progress.quota-progress-danger { accent-color: var(--bad); }
.capacity-progress-use { height: .3rem; accent-color: var(--text-mute); }
.capacity-facts { display: flex; flex-direction: column; gap: .2rem; margin: 0; font-size: .82rem; }
.capacity-facts > div { display: flex; justify-content: space-between; gap: .75rem; }
.capacity-facts dt { color: var(--text-mute); }
.capacity-facts dd { margin: 0; font-family: var(--font-mono); text-align: right; }
.runtime-workspace-link { display: flex; flex-direction: column; gap: .1rem; color: inherit; text-decoration: none; }
.runtime-workspace-link:hover strong { text-decoration: underline; }
.runtime-workspace-link code { color: var(--text-mute); font-size: .74rem; }
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 2.25rem;
  padding: .35rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: .25rem;
  color: var(--accent-strong);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.table-action:hover { filter: brightness(.95); text-decoration: none; }
.table-action:focus-visible { outline: .2rem solid var(--accent-ring); outline-offset: .15rem; }
.state-action { color: var(--accent-strong); border-color: var(--line-strong); background: var(--surface); }
.access-action { color: #7fd4d4; border-color: #2f6b6b; background: #132929; }
.action-stack { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.action-stack form { margin: 0; }
.workspace-table { min-width: 84rem; }
.timeout-cell { min-width: 11rem; }
.timeout-cell .table-subtext { overflow-wrap: normal; }
.timeout-cell.timeout-soon { color: var(--warn); font-weight: 700; }
.timeout-cell.timeout-urgent { color: var(--bad); font-weight: 700; }
.workspaces-summary { margin-top: .3rem; color: var(--text-mute); font-size: .9rem; }
.resources-cell { line-height: 1.5; }
.resource-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.35rem;
  margin: 1.25rem 0 0;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
}
.resource-strip-item { display: flex; align-items: center; gap: .5rem; }
.resource-strip-label { color: var(--text-mute); font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.resource-strip-value { font-family: var(--font-mono); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.resource-strip-progress { width: 4.5rem; height: .35rem; accent-color: var(--accent); }
.resource-strip-progress.quota-progress-warning { accent-color: var(--warn); }
.resource-strip-progress.quota-progress-danger { accent-color: var(--bad); }
.resource-strip-warning { color: var(--bad); font-size: .82rem; font-weight: 700; }
.resource-strip-empty { display: none; }
.panel-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.25rem 0 1rem; }
.filter-pills { display: flex; gap: .3rem; padding: .25rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); }
.filter-pill { min-height: 2.1rem; padding: .35rem .75rem; border: none; border-radius: .35rem; color: var(--text-mute); background: transparent; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.filter-pill.active { color: var(--text); background: var(--surface-sunk); }
.filter-pill:hover { color: var(--text); }
.filter-count { font-family: var(--font-mono); font-size: .74rem; opacity: .75; }
.table-search { min-height: 2.25rem; padding: .4rem .7rem; border: 1px solid var(--line-strong); border-radius: .4rem; color: var(--text); background: var(--surface); font: inherit; font-size: .85rem; width: 16rem; max-width: 100%; }
.table-search:focus { outline: .2rem solid var(--accent-ring); border-color: var(--accent); }
.table-pager { display: flex; align-items: center; justify-content: center; gap: .9rem; margin: 1rem 0; }
.table-pager[hidden] { display: none; }
.table-pager-status { color: var(--text-mute); font-size: .82rem; font-family: var(--font-mono); }
.table-pager-button { min-height: 2.1rem; padding: .35rem .9rem; border: 1px solid var(--line-strong); border-radius: .35rem; color: var(--text); background: var(--surface); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.table-pager-button:hover:not(:disabled) { background: var(--surface-sunk); }
.table-pager-button:disabled { color: var(--text-mute); cursor: not-allowed; opacity: .55; }
.workspace-cell-link { display: flex; align-items: center; gap: .7rem; min-width: 0; color: inherit; text-decoration: none; }
.workspace-cell-link:hover .workspace-cell-name { text-decoration: underline; }
.workspace-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border-radius: .5rem;
  border: 1px solid oklch(45% .06 var(--badge-hue));
  background: oklch(28% .04 var(--badge-hue));
  color: oklch(85% .08 var(--badge-hue));
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
}
.workspace-cell-text { display: grid; min-width: 0; gap: .1rem; }
.workspace-cell-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-cell-template { color: var(--text-mute); font-family: var(--font-mono); font-size: .76rem; }
.workspace-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: .5rem; min-width: max-content; }
.workspace-actions form { margin: 0; }
.workspace-actions .table-action { width: auto; }
.table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; min-width: max-content; }
.table-actions form { margin: 0; }
.actions-column { min-width: 18rem; }
.workspace-table .actions-column { min-width: 9rem; }
.inline-form { display: inline; margin: 0; }
.danger-action { color: var(--bad); border-color: var(--bad-line); }
.title-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.group-create-panel { margin-bottom: 1.5rem; }
.group-create-panel .panel-heading { margin-bottom: 1rem; }
.group-create-form { display: grid; grid-template-columns: minmax(12rem, .7fr) minmax(18rem, 1.5fr) auto; gap: 1rem; align-items: end; }
.group-create-form label { display: grid; gap: .35rem; color: var(--text-mute); font-size: .88rem; font-weight: 700; }
.group-create-form input { width: 100%; min-height: 2.6rem; padding: .55rem .65rem; border: 1px solid var(--line-strong); border-radius: .25rem; color: var(--text); background: var(--surface); font: inherit; }
.group-create-form input:focus { outline: .2rem solid var(--accent-ring); border-color: var(--accent); }
.group-create-form button { align-self: end; }
.checkbox-row { display: flex; gap: .5rem; align-items: center; margin: .45rem 0; }
.operation-progress { width: 7rem; height: .55rem; accent-color: var(--warn); }
.template-image-status { display: grid; gap: .2rem; margin-top: .35rem; }
.template-image-status form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
@keyframes image-pull-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .action-pending::before { animation-duration: 2.4s; }
}
.access-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem; margin-bottom: 1rem; }
.access-header-title { font-size: 1.3rem; }
.access-back { color: var(--accent-strong); font-family: var(--font-mono); font-size: .85rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.access-back:hover, .access-back:focus-visible { text-decoration: underline; }
.detail-breadcrumb { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; color: var(--text-mute); font-family: var(--font-mono); font-size: .85rem; }
.detail-breadcrumb a { color: var(--text-mute); }
.detail-breadcrumb a:hover { color: var(--accent-strong); }
.detail-breadcrumb span:last-child { color: var(--text); }
.detail-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem; }
.detail-identity { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.detail-identity-text { min-width: 0; }
.detail-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.detail-title-row h1 { margin: 0; font-size: 1.5rem; }
.detail-meta { margin: .35rem 0 0; color: var(--text-mute); font-family: var(--font-mono); font-size: .85rem; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; flex-shrink: 0; }
.detail-actions form { margin: 0; }
.workspace-badge-lg { width: 3.2rem; height: 3.2rem; border-radius: .65rem; font-size: 1.05rem; }
.detail-grid { display: grid; grid-template-columns: 1fr min(22rem, 32%); gap: 1.5rem; align-items: start; }
.detail-sidebar { display: grid; gap: 1rem; min-width: 0; }
.detail-card { padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); }
.detail-card-title { margin: 0 0 .85rem; color: var(--text-mute); font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.detail-card-text { margin: 0; font-size: .9rem; line-height: 1.6; }
.detail-resource-row { margin-bottom: .85rem; }
.detail-resource-row:last-child { margin-bottom: 0; }
.detail-resource-label { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: .3rem; font-size: .88rem; }
.detail-resource-progress { width: 100%; height: .4rem; accent-color: var(--accent); }
.detail-timeout-countdown { display: flex; align-items: center; gap: .5rem; margin: .85rem 0 0; color: var(--text-mute); font-family: var(--font-mono); font-size: .85rem; }
.detail-timeout-countdown.timeout-soon { color: var(--warn); font-weight: 700; }
.detail-timeout-countdown.timeout-urgent { color: var(--bad); font-weight: 700; }
.detail-storage-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem .7rem; border: 1px solid #2f6b6b; border-radius: .4rem; background: #132929; }
.detail-storage-item + .detail-storage-item { margin-top: .6rem; }
.detail-storage-name { font-weight: 600; }
.detail-storage-tag { color: #7fd4d4; font-family: var(--font-mono); font-size: .78rem; }
@media (max-width: 64rem) {
  .detail-grid { grid-template-columns: 1fr; }
}
.terminal-panel { padding-bottom: 1rem; }
.terminal { height: min(80vh, 58rem); min-height: 24rem; padding: .75rem; overflow: hidden; border: 1px solid var(--ink-line); border-radius: .3rem; color: #eef1f4; background: var(--ink-deep); font-family: 'COWS Terminal', 'JetBrainsMono Nerd Font', 'FiraCode Nerd Font', 'MesloLGS NF', 'JetBrains Mono', 'Fira Code', 'Symbols Nerd Font Mono', 'Cascadia Mono', 'DejaVu Sans Mono', monospace; }
.terminal .xterm { height: 100%; }
.terminal-panel .alert { margin-bottom: 0; }
.desktop-panel { padding-bottom: 1rem; }
.desktop-display { display: flex; width: 100%; max-width: 100%; height: min(84vh, 62rem); min-width: 0; min-height: 26rem; overflow: hidden; border: 1px solid var(--ink-line); border-radius: .3rem; background: var(--ink-deep); }
.desktop-display canvas { display: block; width: 100%; max-width: 100%; height: 100%; min-width: 0; margin: 0 auto; object-fit: contain; }
.desktop-panel .alert { margin-bottom: 0; }
.logs-panel { padding-bottom: 1rem; }
.logs-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.logs-toolbar button { margin-left: auto; }
.logs-output { height: min(70vh, 50rem); min-height: 20rem; padding: .75rem 1rem; overflow: auto; border: 1px solid var(--ink-line); border-radius: .3rem; background: var(--ink-deep); font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; }
.logs-line { display: flex; gap: .75rem; white-space: pre-wrap; word-break: break-word; }
.logs-timestamp { flex-shrink: 0; color: var(--text-faint); }
.logs-text { color: #eef1f4; }
.workspace-access-shell, .access-tabs, .access-panels, .access-panel, .access-service-panel { min-width: 0; max-width: 100%; }
.access-tabs { display: flex; flex-wrap: wrap; align-items: stretch; gap: .35rem; margin-bottom: .75rem; border-bottom: 1px solid var(--line-strong); }
.access-tab-list { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: .35rem; align-items: flex-end; min-width: 0; }
.access-tab { min-height: 2.25rem; margin-bottom: -1px; padding: .45rem .85rem; border: 1px solid transparent; border-bottom: 2px solid transparent; color: var(--text-mute); background: transparent; font-family: var(--font-mono); font: inherit; font-weight: 700; cursor: pointer; }
.access-tab:hover, .access-tab.active { border-bottom-color: var(--accent); color: var(--accent-strong); background: transparent; }
.access-tab:focus-visible { outline: .2rem solid var(--accent-ring); outline-offset: .1rem; }
.access-panel[hidden] { display: none; }
.access-service-panel { min-width: 0; padding: .75rem; border: 1px solid var(--line); border-radius: .3rem; background: var(--surface); }
.access-control-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; min-height: 2.25rem; }
.access-control-bar h2 { margin: 0 .35rem 0 0; font-size: 1rem; }
.access-control-bar .badge { margin-right: auto; }
.access-control-bar button { min-height: 1.95rem; padding: .3rem .6rem; font-size: .82rem; }
.access-tab-controls { flex: 1 1 22rem; width: auto; min-width: 0; padding: .2rem .35rem; border-left: 1px solid var(--line-strong); background: var(--surface-sunk); }
.access-tab-controls[hidden] { display: none; }
.access-tab-controls .badge { margin-right: 0; }
.terminal-identity { display: inline-flex; align-items: center; gap: .25rem; color: var(--text-mute); font-family: var(--font-mono); font-size: .78rem; font-weight: 700; }
.terminal-identity select { min-height: 1.95rem; padding: .25rem .4rem; border: 1px solid var(--line-strong); border-radius: .25rem; color: var(--text); background: var(--surface); font: inherit; }
.connection-status {
  display: inline-flex;
  align-items: center;
  padding: .15rem .25rem;
  border-radius: .2rem;
  color: var(--text-mute);
  background: var(--surface-sunk);
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.connection-status::before { content: "["; margin-right: .25rem; opacity: .5; }
.connection-status::after { content: "]"; margin-left: .25rem; opacity: .5; }
.connection-status-connected { color: var(--good); background: var(--good-bg); }
.connection-status-connecting { color: var(--warn); background: var(--warn-bg); }
.connection-status-disconnected, .connection-status-unavailable { color: var(--bad); background: var(--bad-bg); }
.connection-toggle { min-width: 5.8rem; }
.access-placeholder { margin: 0; }
.workspace-access-shell:fullscreen { position: relative; display: flex; flex-direction: column; width: 100vw; height: 100vh; padding: 0; overflow: hidden; background: var(--ink-deep); }
/*
 * The bar overlays the content instead of reserving a row, so it can slide
 * off the top edge with nothing else reflowing underneath it. JS toggles
 * .bar-hidden on the shell after a few seconds of no mouse movement;
 * :focus-within always wins so keyboard users can still reach the controls.
 */
.workspace-access-shell:fullscreen .access-tabs {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: .35rem .6rem;
  background: rgb(16 22 29 / 94%);
  border-bottom: 1px solid var(--ink-line);
  transition: transform .2s ease;
}
.workspace-access-shell.bar-hidden:fullscreen .access-tabs { transform: translateY(-100%); }
.workspace-access-shell.bar-hidden:fullscreen .access-tabs:focus-within { transform: translateY(0); }
.workspace-access-shell:fullscreen .access-tabs { gap: .15rem; }
.workspace-access-shell:fullscreen .access-tab { min-height: 1.8rem; padding: .25rem .55rem; font-size: .82rem; }
.workspace-access-shell:fullscreen .access-tab-controls { padding: .1rem .25rem; background: transparent; }
.workspace-access-shell:fullscreen .access-panels { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }
.workspace-access-shell:fullscreen .access-panel:not([hidden]) { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }
.workspace-access-shell:fullscreen .access-service-panel { display: flex; flex: 1 1 auto; flex-direction: column; width: 100%; height: auto; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.workspace-access-shell:fullscreen .access-control-bar { min-height: 1.8rem; gap: .25rem; }
.workspace-access-shell:fullscreen .access-control-bar h2 { font-size: .85rem; }
.workspace-access-shell:fullscreen .access-control-bar button { min-height: 1.7rem; padding: .2rem .4rem; font-size: .75rem; }
.workspace-access-shell:fullscreen .terminal-identity select { min-height: 1.7rem; padding: .15rem .3rem; }
.workspace-access-shell:fullscreen .terminal, .workspace-access-shell:fullscreen .desktop-display { flex: 1 1 auto; width: 100%; max-width: 100%; height: auto; min-width: 0; min-height: 0; border: 0; border-radius: 0; }
.workspace-access-shell:fullscreen [data-access-files] { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; }
.workspace-access-shell:fullscreen .file-panel { display: flex; flex: 1 1 auto; flex-direction: column; width: 100%; max-width: 100%; min-width: 0; min-height: 0; margin: 0; padding: .5rem; border: 0; border-radius: 0; overflow: hidden; }
.workspace-access-shell:fullscreen .file-panel .table-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.terminal, .terminal .xterm, .terminal .xterm-screen, .terminal .xterm-viewport { min-width: 0; max-width: 100%; }
.workspace-details summary { cursor: pointer; color: var(--accent-strong); font-weight: 700; }
.workspace-details dl { display: grid; grid-template-columns: max-content minmax(8rem, 1fr); gap: .25rem .75rem; margin: .65rem 0 0; font-size: .8rem; }
.workspace-details dt { color: var(--text-mute); font-family: var(--font-mono); font-weight: 700; }
.workspace-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.file-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.file-toolbar label { color: var(--text-mute); font-size: .88rem; font-weight: 700; }
.file-toolbar select { min-height: 2.4rem; padding: .45rem .6rem; border: 1px solid var(--line-strong); border-radius: .25rem; font: inherit; }
.file-breadcrumbs { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: 1rem; color: var(--text-mute); font-family: var(--font-mono); font-size: .88rem; }
.file-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.file-actions form, .file-entry-actions form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0; }
.file-actions input[type="text"], .file-entry-actions input[type="text"] { min-height: 2.25rem; min-width: 10rem; padding: .35rem .5rem; border: 1px solid var(--line-strong); border-radius: .25rem; font: inherit; }
.file-entry-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.file-panel th, .file-panel td { vertical-align: middle; }
.file-upload-form { flex-wrap: wrap; }
.file-upload-status { flex: 1 1 100%; min-width: min(32rem, 100%); padding: .7rem .8rem; border: 1px solid var(--line-strong); border-radius: .3rem; background: var(--surface-sunk); }
.file-upload-summary, .file-upload-stats { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; }
.file-upload-summary { margin-bottom: .35rem; color: var(--text); }
.file-upload-summary strong { overflow-wrap: anywhere; }
.file-upload-status progress { display: block; width: 100%; height: .65rem; accent-color: var(--accent); }
.file-upload-stats { margin-top: .35rem; color: var(--text-mute); font-size: .78rem; }
.form-note { margin: 1rem 0 0; color: var(--text-mute); text-align: center; }
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; margin-bottom: 1rem; }
.filter-form label { color: var(--text-mute); font-size: .85rem; font-weight: 700; }
.filter-form input { min-height: 2.4rem; min-width: min(20rem, 100%); padding: .45rem .6rem; border: 1px solid var(--line-strong); border-radius: .25rem; color: var(--text); background: var(--surface); font: inherit; }
.filter-form input:focus { outline: .2rem solid var(--accent-ring); border-color: var(--accent); }
.check-list { display: grid; gap: .35rem; margin-top: .35rem; }
.terminal-panel:fullscreen, .desktop-panel:fullscreen { display: flex; flex-direction: column; width: 100vw; height: 100vh; padding: 0; border: 0; border-radius: 0; }
.terminal-panel:fullscreen .terminal, .desktop-panel:fullscreen .desktop-display { flex: 1; height: auto; min-height: 0; }
.quota-table { min-width: 74rem; }
.quota-summary { display: grid; grid-template-columns: repeat(2, minmax(8rem, 1fr)); gap: .65rem 1rem; min-width: 18rem; }
.quota-summary div { display: grid; gap: .1rem; }
.quota-summary span, .quota-field span { color: var(--text-mute); font-size: .78rem; }
.quota-summary strong { font-family: var(--font-mono); font-size: .9rem; }
.quota-unassigned { display: grid; gap: .45rem; min-width: 18rem; color: var(--text-mute); font-size: .85rem; }
.quota-form { display: grid; grid-template-columns: repeat(4, minmax(8rem, 1fr)) auto; gap: .65rem; align-items: end; min-width: 48rem; }
.quota-field { display: grid; gap: .25rem; }
.quota-field label { color: var(--text-mute); font-size: .82rem; font-weight: 700; }
.quota-form input { min-height: 2.25rem; width: 100%; padding: .35rem .45rem; border: 1px solid var(--line-strong); border-radius: .25rem; font: inherit; }
.quota-form-actions { align-self: end; }
.quota-form .table-action { min-width: 6.5rem; }
.quota-editor { width: min(48rem, 100%); }
.quota-form-grid { display: grid; grid-template-columns: repeat(2, minmax(12rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.quota-form-grid label { display: grid; gap: .3rem; }
.quota-form-grid input { margin-top: .1rem; }
.quota-form-grid span { color: var(--text-mute); font-size: .78rem; font-weight: 400; }
.danger-button { justify-self: start; margin-top: .5rem; padding: .6rem .85rem; border: 1px solid var(--bad); border-radius: .25rem; color: #ffffff; background: var(--bad); font: inherit; font-weight: 700; cursor: pointer; }
.danger-button:hover { filter: brightness(.92); }
.muted { color: var(--text-mute); font-size: .85rem; }
[x-cloak] { display: none !important; }

@media (max-width: 42rem) {
  .site-header { display: block; }
  .header-context { display: block; margin-top: .3rem; }
  .site-nav { margin-top: 1rem; margin-left: 0; }
  .sign-out-form { margin-left: .2rem; padding-left: .45rem; }
  .nav-menu-panel { position: static; margin-top: .3rem; box-shadow: none; }
  .page-shell { width: min(100% - 1rem, 88rem); padding: 2rem 0; }
  .panel, .form-panel { padding: 1rem; }
  .intro { margin-bottom: 1.25rem; }
  h1 { font-size: 1.9rem; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-actions { justify-content: flex-start; width: 100%; }
  .terminal { height: 60vh; min-height: 20rem; }
  .desktop-display { height: 60vh; min-height: 20rem; }
  .status-row { grid-template-columns: 1fr; }
  .status-row button { width: 100%; }
  .details dl { grid-template-columns: 1fr; }
  .title-row { align-items: flex-start; flex-direction: column; }
  .title-row > .button-link, .title-actions { width: 100%; }
  .title-actions > * { flex: 1 1 10rem; }
  .group-create-form { grid-template-columns: 1fr; }
  .group-create-form button { width: 100%; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions > * { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .host-overbooking-grid { grid-template-columns: 1fr; }
  .resource-slider-grid { grid-template-columns: 1fr; }
  .runtime-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quota-form { min-width: 24rem; }
  .quota-form-grid { grid-template-columns: 1fr; }
  .access-tabs { gap: .15rem; }
  .access-tab-list { gap: .15rem; }
  .access-tab-controls { border-top: 1px solid var(--line-strong); border-left: 0; }
  .access-control-bar .badge { margin-right: 0; }
  .file-actions, .file-actions form { align-items: stretch; flex-direction: column; }
  .file-actions form > * { width: 100%; }
  /* Both actions columns now hold at most two small buttons (the runtime
     table holds exactly one: Start or Stop) - freezing them in place while
     scrolling is no longer pulling its weight the way it did with the
     larger button set, and reads as buttons visually detaching from
     their row instead. Let them scroll like every other column. */
}
