/* ==========================================================================
   Workloads: the Jobs list's filters, the Inference list's rows, the
   new-job and new-deployment pages, and a deployment's metric charts.
   ========================================================================== */

/* Jobs filter by kind too: the search and three pickers share one row down
   to a narrow desktop. */
.workloads-filters > .ui-toolbar__search {
  flex-basis: 12rem;
}

.workloads-filters > .ui-select {
  flex-basis: 10rem;
}

/* The kind picker, after the search: its longest word is "Inference". */
.workloads-filters > .ui-toolbar__search + .ui-select {
  flex-basis: 8rem;
  min-width: 8rem;
}

/* The Inference list's account, views, search and cluster share one row on
   a 1280px desktop; on a phone each takes a row of its own. */
@media (min-width: 481px) {
  .workloads-list-tools > .ui-toolbar__search {
    flex-basis: 10rem;
  }

  .workloads-list-tools > .ui-select:last-child {
    flex-basis: 9rem;
    min-width: 8rem;
  }
}

/* Inference rows: the model under the name, its maker's mark in a 14px
   slot so the ids line up. */
.workloads-model {
  flex-wrap: nowrap;
  gap: var(--space-2);
  font-size: var(--text-12);
}

.workloads-model > :is(.ui-brand, .ui-brand-monogram) {
  flex: none;
  justify-content: center;
  width: 14px;
  text-align: center;
}

/* The cluster reads as text, not a second name; the account badge below
   it shortens rather than widening the column. */
.workloads-where {
  font-weight: var(--weight-regular);
}

.workloads-where + span {
  display: flex;
  min-width: 0;
}

/* Why it is failing: two lines before it is cut, the rest on hover. */
.workloads-why {
  display: -webkit-box;
  max-width: none;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* The submit form, out of its drawer: one card. */
.workloads-form {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}

.workloads-form__actions {
  justify-content: flex-end;
}

/* Metric charts: two a row on a wide page, one on a narrow one. */
.workloads-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: var(--space-6) var(--space-5);
}

.workloads-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
}

.workloads-chart__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  color: var(--text-dim);
  font-size: var(--text-13);
  font-weight: var(--weight-medium);
}

/* New deployment: the job flow's steps over a deployment's choices. */

/* A phone shows only the current step's label; the others keep their
   number (which sets its own font size). */
@container main (max-width: 600px) {
  .deploy-flow .submit-flow__steps li:not([aria-current]) {
    font-size: 0;
  }

  .deploy-flow .submit-flow__steps li[aria-current] {
    flex: none;
  }
}

.deploy-flow__engine[aria-pressed="true"] {
  border-color: var(--text-faint);
  background: var(--bg-selected);
}

/* Fields beside what the nodes have free; stacked when narrow. */
.deploy-flow__placement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.deploy-flow__fields,
.deploy-flow__group,
.deploy-flow__capacity,
.deploy-flow__review {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.deploy-flow__group {
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

/* A node group's row: its button sits level with the inputs. */
.deploy-flow__row {
  align-items: start;
}

@container main (max-width: 900px) {
  .deploy-flow__placement {
    grid-template-columns: minmax(0, 1fr);
  }
}

.deploy-flow__name {
  max-width: 24rem;
}

.deploy-flow__review {
  gap: var(--space-3);
}

.deploy-flow__summary {
  --facts-min: 10rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.deploy-flow__summary > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Review & deploy: the setup in lines, each its label, what is set and
   Change, which opens the line in place. */
.deploy-flow__panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.deploy-flow__line {
  --line-label: 9.5rem;
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
}
.deploy-flow__line:first-child { border-top: 0; }
.deploy-flow__line-head {
  display: grid;
  grid-template-columns: var(--line-label) minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-4);
  align-items: center;
}
.deploy-flow__line-label,
.deploy-flow__line--field > .ui-field > .ui-field__label {
  margin: 0;
  color: var(--text);
  font-size: var(--text-14);
  font-weight: var(--weight-semibold);
}
.deploy-flow__line-value { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-width: 0; }
.deploy-flow__line-need { color: var(--warning); }
.deploy-flow__line-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  margin: var(--space-4) 0 var(--space-1) calc(var(--line-label) + var(--space-4));
}
.deploy-flow__line-body[hidden] { display: none; }
/* A field's line: its label in the label column, the field and hint beside. */
.deploy-flow__line--field > .ui-field {
  display: grid;
  grid-template-columns: var(--line-label) minmax(0, 24rem);
  gap: var(--space-2) var(--space-4);
  align-items: center;
  max-width: none;
}
.deploy-flow__line--field > .ui-field > :not(.ui-field__label) { grid-column: 2; }
.deploy-flow__panel .deploy-flow__advanced { padding-top: 0; border-top: 0; }
@container main (max-width: 640px) {
  .deploy-flow__line { padding: var(--space-3) var(--space-4); }
  /* Change beside the label; what is set takes the full width below. */
  .deploy-flow__line-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label change" "value value"; }
  .deploy-flow__line-label { grid-area: label; }
  .deploy-flow__line-value { grid-area: value; }
  .deploy-flow__line-head > .ui-button { grid-area: change; }
  .deploy-flow__line-body { margin-left: 0; }
  .deploy-flow__line--field > .ui-field { grid-template-columns: minmax(0, 1fr); }
  .deploy-flow__line--field > .ui-field > :not(.ui-field__label) { grid-column: 1; }
}
/* A node group with no choice to make, named in its row. */
.deploy-flow__runs-in { grid-column: 1 / -1; margin: 0; }

/* Replicas: fewer and more beside the number. */
.deploy-flow__stepper {
  display: inline-flex;
  align-items: stretch;
  width: max-content;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  overflow: hidden;
}
.deploy-flow__stepper button {
  width: 2.25rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-16);
  cursor: pointer;
}
.deploy-flow__stepper button:hover { background: var(--bg-hover); }
.deploy-flow__stepper button[aria-disabled="true"] { background: transparent; color: var(--text-faint); cursor: not-allowed; }
.deploy-flow__stepper :is(button, input):focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.deploy-flow .deploy-flow__stepper input {
  width: 3.5rem;
  min-height: 2.25rem;
  padding: 0;
  border: 0;
  border-inline: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-variant-numeric: tabular-nums;
  text-align: center;
  appearance: textfield;
}
.deploy-flow__stepper input::-webkit-inner-spin-button,
.deploy-flow__stepper input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
@media (pointer: coarse), (max-width: 480px) {
  .deploy-flow__stepper button { width: 44px; min-height: 44px; }
  .deploy-flow .deploy-flow__stepper input { min-height: 44px; }
}

/* Review: a fact with a mark beside it (engine, GPU), not mono. */
.deploy-flow__mark-fact { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
/* The value, then what qualifies it (scope, the group's GPUs) on a quieter line. */
.deploy-flow__stack-fact { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.deploy-flow__stack-fact > .u-dim { font-size: var(--text-13); }

.deploy-flow__summary h4 {
  font-size: var(--text-14);
  font-weight: var(--weight-semibold);
}

/* The page's own form: steps, the stage, then the actions at its foot. */
.deploy-flow {
  display: flex;
  flex-direction: column;
}

/* Cancel at the start; Back and Continue at the end. */
.deploy-flow__cancel {
  margin-right: auto;
}
/* On a phone a label never wraps: a button that has no room takes the next row. */
@container main (max-width: 520px) {
  .deploy-flow .submit-drawer__actions .ui-button { flex: 1 1 auto; white-space: nowrap; }
}

/* Keep the wizard's actions still when clicking away from an edited field.
   Hiding its hint on blur can move Continue between pointerdown and pointerup. */
.deploy-flow .template-field:not(:focus-within) .template-field__hint {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

/* The picker's one row: the task filter, the search, then Recipes at the end. */
.deploy-flow__catalog-head .deploy-flow__search { flex: 1 1 14rem; max-width: 22rem; }
.deploy-flow__catalog-head .deploy-flow__recipes { margin-left: auto; }

/* One replica's ask in a line, with the way to change it. */
.deploy-flow__ask { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0; }

/* A model typed by hand, above the engines that can serve it. */
.deploy-flow__typed-model { max-width: 32rem; }
/* An engine that can't serve the typed model. */
.deploy-flow__engine:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* Step 3 names the cluster chosen in step 1, with a way back to it. */
.deploy-flow__cluster-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

/* A picker card, the whole card its button: a head (mark, name, a badge at
   the end), then lines of one line each, the fit line last. */
.deploy-flow__card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  min-height: 8.25rem;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}
.deploy-flow__card:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.deploy-flow__card[aria-pressed="true"] { border-color: var(--text-faint); background: var(--bg-selected); }
/* The badge drops below a long name rather than cutting it short. */
.deploy-flow__card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); min-width: 0; margin-bottom: 2px; }
.deploy-flow__card-mark {
  display: inline-grid;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-dim);
  place-items: center;
}
.deploy-flow__card-mark--plus { border: 1px dashed var(--line-strong); background: none; }
.deploy-flow__card-name {
  min-width: 0;
  overflow: hidden;
  font-size: var(--text-14);
  font-weight: var(--weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deploy-flow__card-text,
.deploy-flow__meta {
  overflow: hidden;
  color: var(--text-dim);
  font-size: var(--text-13);
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The GPU an optimized build targets: a quiet pill at the head's end. */
.deploy-flow__optimized,
.deploy-flow__pill {
  flex: none;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  color: var(--text-dim);
  font-size: var(--text-11);
  line-height: 18px;
  white-space: nowrap;
}
.deploy-flow__optimized { margin-left: auto; }
/* Whether the cluster runs it: the card's only coloured text. */
.deploy-flow__card-fit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  font-size: var(--text-13);
  font-weight: var(--weight-medium);
}
.deploy-flow__card-fit > svg { flex: none; }
.deploy-flow__card-fit--runs { color: var(--success); }
.deploy-flow__card-fit--waits { color: var(--warning); }
.deploy-flow__card-fit--needs { color: var(--text-dim); font-weight: var(--weight-regular); }
/* One that can't run here: still there to pick, but quieter. */
.deploy-flow__model--unfit { background: var(--bg-subtle); }
.deploy-flow__model--unfit:not(:hover) .deploy-flow__card-name { color: var(--text-dim); }
.deploy-flow__model--unfit:not(:hover) .deploy-flow__card-mark { opacity: 0.55; }
.deploy-flow__custom { justify-content: center; border-style: dashed; background: transparent; }
/* What it takes is said in full: it is not one of a list to scan. */
.deploy-flow__custom .deploy-flow__card-text { white-space: normal; }

/* The catalog: what runs here, then, folded, what needs more. */
.deploy-flow__catalog { display: flex; flex-direction: column; gap: var(--space-5); }
.deploy-flow__models { display: flex; flex-direction: column; gap: var(--space-3); }
.deploy-flow__models-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  color: var(--text);
  font-size: var(--text-14);
  font-weight: var(--weight-semibold);
}
.deploy-flow__count { color: var(--text-faint); font-weight: var(--weight-regular); font-variant-numeric: tabular-nums; }
details.deploy-flow__models > summary { align-items: center; width: fit-content; cursor: pointer; list-style: none; }
details.deploy-flow__models > summary::-webkit-details-marker { display: none; }
details.deploy-flow__models > summary > svg { color: var(--text-dim); transition: transform var(--duration-fast) var(--ease-out); }
details.deploy-flow__models[open] > summary > svg { transform: rotate(90deg); }
.deploy-flow__shared-why, .deploy-flow__empty { margin: 0; color: var(--text-dim); }
.deploy-flow__empty { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* The cluster the picker reads, in a line: its name or a choice of
   several, its scope and what it has. */
.deploy-flow__context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  color: var(--text-dim);
}
.deploy-flow__context strong { color: var(--text); font-weight: var(--weight-semibold); }
.deploy-flow__context > svg { flex: none; }
.deploy-flow__context .deploy-flow__cluster { flex: 1 1 12rem; min-width: 0; max-width: 18rem; }
/* On a phone the task filter spans its row, the options sharing it. */
@media (max-width: 480px) {
  .deploy-flow__catalog-head .ui-segmented { width: 100%; }
  .deploy-flow__catalog-head .ui-segmented__option { flex: 1 0 auto; padding: 0 6px; }
}

/* Another model's way to an audio build already on a node. */
.deploy-flow__local-audio { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0; }

/* The repo under the name: one line, cut short rather than wrapped. */
.deploy-flow__repo {
  overflow: hidden;
  color: var(--text-dim);
  font-size: var(--text-12);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deploy-flow__repo a { color: inherit; text-decoration: none; }
.deploy-flow__repo a:hover { color: var(--text); text-decoration: underline; }
.deploy-flow__repo .ui-brand { margin-right: 5px; vertical-align: -2px; }

/* A build's summary is a line of facts: it wraps inside its card. */
.deploy-flow__build {
  height: auto;
  min-height: var(--control-sm);
  max-width: 100%;
  padding-block: var(--space-1);
  justify-content: flex-start;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}
.deploy-flow__chip {
  padding: 1px var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-11);
  line-height: 1.5;
}

/* The engine step: "Run <logo> Qwen3 0.6B", its repo on the line below. */
.deploy-flow__run { display: flex; align-items: center; gap: var(--space-2); }
.submit-flow__stage-heading > .deploy-flow__repo { margin: 0 0 var(--space-1); }

/* One precision: a fact on a line, not a one-option control. */
.deploy-flow__fact { display: flex; align-items: center; gap: var(--space-2); margin: 0; }

/* How it runs: one option per way, a line and what sets it apart. The
   whole option picks it; one that fits nowhere here is quieter but can still
   be picked. */
.deploy-flow__how { display: flex; flex-direction: column; gap: var(--space-2); }
.deploy-flow__way {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}
.deploy-flow__way:hover { border-color: var(--line-strong); }
.deploy-flow__way:has(> input:checked) { border-color: var(--text-faint); background: var(--bg-selected); }
.deploy-flow__way > input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--text); cursor: pointer; }
.deploy-flow__way-body { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.deploy-flow__way-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); }
.deploy-flow__way-name { font-size: var(--text-14); font-weight: var(--weight-medium); }
.deploy-flow__way-note { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); color: var(--text-dim); font-size: var(--text-13); }
/* The dot ends the line before a wrapped item, never starts the next. */
.deploy-flow__way-note > :not(:last-child)::after { display: inline-block; margin-left: var(--space-2); color: var(--text-faint); content: "·"; }
.deploy-flow__way--unfit:not(:has(> input:checked)):not(:hover) .deploy-flow__way-body { opacity: 0.7; }
.deploy-flow__how-unfit > summary {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: fit-content;
  color: var(--text-dim);
  font-size: var(--text-13);
  cursor: pointer;
  list-style: none;
}
.deploy-flow__how-unfit > summary::-webkit-details-marker { display: none; }
.deploy-flow__how-unfit > summary:hover { color: var(--text); }
.deploy-flow__how-unfit > summary > svg { transition: transform var(--duration-fast) var(--ease-out); }
.deploy-flow__how-unfit[open] > summary { margin-bottom: var(--space-2); }
.deploy-flow__how-unfit[open] > summary > svg { transform: rotate(90deg); }
.deploy-flow__weights {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-dim);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}
.deploy-flow__weights:hover { color: var(--text); }

/* Advanced settings: a section to open, with how many it holds and what was
   changed from the catalog beside its name, and a way back to the catalog's
   settings inside. One column; each hint on one line, all of it in its title
   and read out with its field. */
.deploy-flow__advanced > summary {
  align-self: flex-start;
  margin-inline-start: calc(-1 * var(--space-2));
  padding: var(--space-1) var(--space-2);
  color: var(--text);
  font-size: var(--text-14);
  font-weight: var(--weight-medium);
}
.deploy-flow__advanced > summary:hover { background: var(--bg-subtle); }
.deploy-flow__advanced > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.deploy-flow__advanced > summary .u-dim { font-weight: var(--weight-regular); }
.deploy-flow__advanced[open] > summary { margin-bottom: 0; }
/* Closed, its hidden content still takes a gap. */
.deploy-flow__advanced:not([open]) { gap: 0; }
.deploy-flow__advanced-fields { display: flex; flex-direction: column; gap: var(--space-3); max-width: 36rem; }
/* One line each; the token's hint ends in a link, so it never cuts. */
.deploy-flow .deploy-flow__advanced-fields .template-field:not(.deploy-flow__token) .template-field__hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-flow__token .template-field__hint a { white-space: nowrap; }
.deploy-flow__front { max-width: 44rem; }
.deploy-flow__reset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: var(--text-13);
}
/* Placement: nothing to chart is a quiet box, not a bare line; the fit
   notice keeps one line per thing it checked. */
.deploy-flow__no-capacity {
  margin: 0;
  padding: var(--space-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: var(--text-13);
}
.deploy-flow__fit .ui-inline-notice__message { white-space: pre-line; }
.deploy-flow__stage { scroll-margin-top: 5rem; }
.deploy-flow__stage > * { animation: deploy-stage-in 140ms var(--ease-out); }
.deploy-flow__stage h3:focus { outline: none; }

@keyframes deploy-stage-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .deploy-flow__stage > * { animation: none; }
}

/* Inference list: the name clients send, a line under the model. */
.workloads-called { font-size: var(--text-12); }
/* A failed row's way to its log, under why. */
.workloads-why-action { display: inline-block; margin-top: var(--space-1); font-size: var(--text-12); }
/* Why the platform stopped it, or what holds it back: a note, not a fault. */
.workloads-why--note { color: var(--text-dim); }
