/* ==========================================================================
   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;
}

/* 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(--accent-line);
  background: var(--accent-soft);
}

/* 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: 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;
}

/* The precision chips keep their own width in the column. */
.deploy-flow__group > .ui-segmented {
  align-self: start;
}

/* 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;
}

/* Step 1's one row: the cluster at the start, the model search at the end. */
.deploy-flow__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.deploy-flow__cluster { flex: 0 1 22rem; min-width: min(100%, 16rem); }
.deploy-flow__search { flex: 0 1 16rem; min-width: min(100%, 12rem); }

/* 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 model card: the name is the button, stretched over the card; the
   Hugging Face link sits above it in the corner. */
.deploy-flow__model {
  position: relative;
  align-items: stretch;
}
.deploy-flow__model > .template-card__icon { align-self: flex-start; }
.deploy-flow__model > .template-card__text { flex: 1; padding-right: var(--space-5); }
.deploy-flow__model .template-card__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.deploy-flow__model .template-card__description { -webkit-line-clamp: 2; }
.deploy-flow__pick {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.deploy-flow__pick::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
}
.deploy-flow__pick:focus-visible { outline: none; }
.deploy-flow__pick:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.deploy-flow__model:has(.deploy-flow__pick[aria-pressed="true"]) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
/* A model no node group here runs: still there to pick, but quieter. */
.deploy-flow__model--unfit:not(:hover) > :is(.template-card__icon, .template-card__text) { opacity: 0.7; }

/* 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;
}

/* What it comes as: size and precisions as chips; then the card's foot: its
   engines on one line and, under them, whether this cluster runs it. The
   two never share a line, so the status sits in the same place on every card. */
.deploy-flow__meta,
.deploy-flow__engines {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  color: var(--text-dim);
  font-size: var(--text-12);
}
.deploy-flow__meta { gap: var(--space-1); margin-top: auto; padding-top: var(--space-2); }
.deploy-flow__foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding-top: var(--space-1);
}
.deploy-flow__foot > .ui-status-indicator { font-size: var(--text-12); }
.deploy-flow__chip--size { border-color: transparent; background: var(--bg-subtle); color: var(--text); }
.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;
}
.deploy-flow__engine-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.deploy-flow__hf {
  position: absolute;
  z-index: 1;
  top: var(--space-3);
  right: var(--space-3);
  display: grid;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  place-items: center;
}
.deploy-flow__hf .ui-brand { filter: grayscale(1); opacity: 0.55; }
.deploy-flow__hf:is(:hover, :focus-visible) .ui-brand { filter: none; opacity: 1; }
.deploy-flow__hf:hover { background: var(--bg-subtle); }
.deploy-flow__hf:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Another model is another path: an outline, not a card like the models. */
.deploy-flow__custom { border-style: dashed; background: transparent; }
.deploy-flow__custom > .template-card__icon { border-style: dashed; background: transparent; }
/* 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; }

/* Ways to run it: radio rows. The whole row picks; the chosen one carries
   the accent; one that fits nowhere here is quieter but still pickable. */
.deploy-flow__offerings td { height: auto; padding-block: var(--space-3); white-space: normal; overflow: visible; vertical-align: top; }
.deploy-flow__offerings .ui-cell-stack__primary { white-space: normal; }
.deploy-flow__offerings .ui-cell-stack__secondary { flex-wrap: wrap; white-space: normal; overflow-wrap: anywhere; }
.deploy-flow__offerings .ui-cell-stack__secondary.u-mono { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-flow__way { cursor: pointer; }
.deploy-flow__radio input { display: block; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.deploy-flow__offerings .ui-data-table tbody tr.deploy-flow__way:has(input:checked) td { background: var(--accent-soft); }
.deploy-flow__offerings .ui-data-table tbody tr.deploy-flow__way:has(input:checked) td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.deploy-flow__way--unfit:not(:has(input:checked)):not(:hover) td > * { opacity: 0.7; }
.deploy-flow__engine-cell { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--text); font-weight: var(--weight-medium); }
.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); }

/* Engine settings: a section to open, with what was changed from the catalog
   beside its name, and a way back to the catalog's settings inside. */
.deploy-flow__settings > 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__settings > summary:hover { background: var(--bg-subtle); }
.deploy-flow__settings > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.deploy-flow__settings > summary .u-dim { font-weight: var(--weight-regular); }
.deploy-flow__settings[open] > summary { margin-bottom: 0; }
.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; }
}

@container main (max-width: 720px) {
  .deploy-flow__offerings table { min-width: 0; }
  .deploy-flow__offerings :is(thead, colgroup) { display: none; }
  .deploy-flow__offerings tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .deploy-flow__offerings td {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    height: auto;
    min-width: 0;
    padding: var(--space-3);
    position: static;
    box-shadow: none;
    grid-column: 1 / -1;
  }
  .deploy-flow__offerings td::before { content: attr(data-label); font-size: var(--text-12); color: var(--text-dim); }
  .deploy-flow__offerings td:nth-child(2) { grid-column: 1; grid-row: 1; }
  .deploy-flow__offerings td.deploy-flow__radio { grid-column: 2; grid-row: 1; }
  .deploy-flow__offerings td.deploy-flow__radio::before { content: none; }
  .deploy-flow__offerings .ui-data-table tbody tr.deploy-flow__way:has(input:checked) td:first-child { box-shadow: none; }
  .deploy-flow__offerings .ui-data-table tbody tr.deploy-flow__way:has(input:checked) { box-shadow: inset 3px 0 0 var(--accent); }
  .deploy-flow__offerings tr:not(:last-child) { border-bottom: 2px solid var(--line-strong); }
}

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