/* ============================================================================
   What this console needs on top of the house kit. Nothing here restyles a
   house component; every rule below is a shape the kit does not have.
   ============================================================================ */

.rail-scroll::-webkit-scrollbar { width: 0; }
.rail-scroll { scrollbar-width: none; }

/* ── identity header: the facts about one object, on a rule ────────────────
   Not a row of cards. A card per fact is four borders around one string. */
.facts { display: flex; flex-wrap: wrap; gap: var(--s-5) var(--s-7); }
.facts .k {
  font-size: var(--t-xs); text-transform: uppercase;
  letter-spacing: var(--track-label); color: var(--fg-3);
}
.facts .v { margin-top: 2px; font-size: var(--t-md); }
.facts .v.mono { font-family: var(--font-mono); font-size: var(--t-sm); }

/* ── a figure that is a door. Underline on hover, never a button. ─────────── */
.door {
  border: 0; background: 0; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-2);
  text-underline-offset: 3px;
}
.door:hover { text-decoration-color: var(--fg-2); }

/* ── primary action. Exactly one per screen, per the house rules. ─────────── */
/* Pill, hairline, and the HEIGHT IS SET rather than derived from padding —
   a derived height is how one row ends up stacking a 27px button beside a
   30px chip. The solid variant is ink, not accent: the primary action on a
   console is the most-pressed thing on screen and a coloured one puts a hue
   in the chrome of every screen that has an action. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; height: var(--h-md); padding: 0 14px; gap: var(--s-2);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--raised); color: var(--fg-2);
  font: inherit; font-size: var(--t-sm); font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--fg-4); color: var(--fg); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.btn.sm { height: var(--h-sm); padding: 0 10px; font-size: var(--t-xs); }
/* Outlined, never solid red. Solid red is a confirmation, not an invitation. */
.btn.danger { color: var(--bad); }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }

/* A link is ink with a rule under it, never the user-agent blue. The default
   is the most common un-tokenised colour on any page and reads as unstyled —
   and #0000EE is an accent in content that no token chose. */
a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--border-2);
    text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--fg-2); }
a:visited { color: var(--fg); }

.row { display: flex; align-items: center; gap: var(--s-2); }
.row.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
.mono { font-family: var(--font-mono); font-size: var(--t-sm); }
.dim { color: var(--fg-3); }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: 0; padding: 0; margin-bottom: var(--s-3);
  font: inherit; font-size: var(--t-sm); color: var(--fg-3); cursor: pointer;
}
.back:hover { color: var(--fg); }

/* ── the phase bar: where a run's seconds went, and which phase stopped it ──
   Proportional widths, so a 75ms convert next to an 80s apply reads as what it
   was. The failed phase is the only coloured one — the rest are ink steps, so
   the eye lands on the phase that ended the run rather than on a rainbow. */
.phases { display: flex; height: 22px; border-radius: var(--r-sm); overflow: hidden; gap: 1px; }
.phases span {
  display: flex; align-items: center; justify-content: center;
  min-width: 3px; background: var(--bg-3); color: var(--fg-3);
  font-size: var(--t-xs); overflow: hidden; white-space: nowrap;
}
.phases span[data-outcome='ok']     { background: var(--bg-3); }
.phases span[data-outcome='failed'] { background: var(--bad); color: #fff; }
.phase-legend {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4);
  margin-top: var(--s-2); font-size: var(--t-xs); color: var(--fg-2);
}
.phase-legend span { display: inline-flex; align-items: baseline; gap: 5px; }
.phase-legend b { font-weight: 600; }
.phase-legend .ms { color: var(--fg-3); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.phase-legend .failed b { color: var(--bad); }

/* ── the refusal, as the platform states it ───────────────────────────────
   A left rule in the state colour, the key in monospace on its own line, the
   sentence under it at reading width. This is the shape a deploy failure gets
   INSTEAD of a toast: a toast is a result that scrolls away, and the one thing
   a person needs from a failed deploy is the sentence naming the key. */
.refusal { border-left: 2px solid var(--bad); padding-left: var(--s-3); }
.refusal.warn { border-left-color: var(--warn); }
.refusal + .refusal { margin-top: var(--s-3); }
.refusal .key {
  font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 600; color: var(--fg);
}
.refusal .svc { font-size: var(--t-xs); color: var(--fg-3); margin-left: var(--s-2); }
.refusal .msg { margin-top: 3px; font-size: var(--t-sm); color: var(--fg-2); max-width: 88ch; }

/* ── log pane: a terminal, monospaced, scrolled ───────────────────────────── */
.logs {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: var(--s-2) var(--s-3);
  font-family: var(--font-mono); font-size: var(--t-xs); line-height: 1.55;
  max-height: 44vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.logs .t { color: var(--fg-3); }
.logs .hit { color: var(--bad); }

/* ── form: a label column and an input column, on hairlines ─────────────────
   Not a stack of boxes. Each row is one rule wide, the label is a fixed column
   so the inputs align, and the help text is the contract's own description of
   the field — written for an agent, which turns out to be the same job. */
.form { border-top: 1px solid var(--border); }
.form-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; gap: var(--s-1); } }
.form-label {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  padding-top: 6px;
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.form-label .req {
  font-family: var(--font-sans);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--fg-3);
}
.form-input > .field { width: 100%; }
.form-input textarea.field.doc {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  line-height: 1.5;
  resize: vertical;
}
.form-help { margin-top: var(--s-1); font-size: var(--t-xs); color: var(--fg-3); max-width: 70ch; }
.form-error:empty { display: none; }
/* The rule is red; the SENTENCE is not. Red is reserved for controls in this
   system's state table, and this is the text beside one, not a control. */
.form-error {
  margin-top: var(--s-2);
  border-left: 2px solid var(--bad);
  padding: 4px var(--s-2);
  background: var(--bad-soft);
  color: var(--fg-2);
  font-size: var(--t-sm);
}
.form-row.bad .form-label { color: var(--bad); }
.form-row.bad .field { border-color: var(--bad); }

/* ── the result of an operation, under the form that caused it ───────────── */
.result { border-left: 2px solid var(--ok); padding-left: var(--s-3); }
.result.bad { border-left-color: var(--bad); }

/* ── the write-only field. It is not a masked value: there is nothing behind
      the mask to reveal, and a UI that implies otherwise teaches people this
      platform can give a secret back. ───────────────────────────────────────── */
.writeonly { display: flex; flex-direction: column; gap: 2px; }
.writeonly .hint { font-size: var(--t-xs); color: var(--fg-3); max-width: 88ch; }
input.field.grow { flex: 1; min-width: 0; }

/* ── our own confirmation. `confirm()` can be answered by the browser and a
      refusal is then indistinguishable from a decline, so the destructive
      controls here open this instead. ──────────────────────────────────────── */
.confirm {
  border: 1px solid var(--bad); border-left-width: 2px;
  background: var(--bad-soft); padding: var(--s-2) var(--s-3);
  font-size: var(--t-sm); display: flex; align-items: center; gap: var(--s-3);
}

/* ── teardown: the slug has to be typed. A destructive button one click from a
      list is a button that gets clicked from a list. ───────────────────────── */
.danger-zone { border: 1px solid var(--bad); border-left-width: 2px; padding: var(--s-4); }
.danger-zone h3 { margin: 0 0 var(--s-2); font-size: var(--t-sm); font-weight: 600; }
.destroys { list-style: none; margin: var(--s-2) 0 0; padding: 0; font-size: var(--t-sm); }
.destroys li {
  display: flex; gap: var(--s-3); align-items: baseline;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.destroys li:last-child { border-bottom: 0; }
.destroys .what { color: var(--fg-2); flex: 1; }
.destroys .qty {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--fg);
}

/* ── consumption: a figure and its unit, on a rule ───────────────────────── */
/* A caption over a log pane names the pod and the container, and both are long.
   `.cell-sub` truncates at 46ch because it lives in a table cell; here there is
   a whole row to use, and a caption that ends in an ellipsis is a caption that
   did not say which container it is about. */
.cell-sub.wide { max-width: none; white-space: normal; }

.uses { display: flex; flex-wrap: wrap; gap: var(--s-6) var(--s-7); }
.uses .v {
  font: 600 var(--t-2xl) / var(--leading-tight) var(--font-mono);
  letter-spacing: var(--track-display);
  font-variant-numeric: tabular-nums;
}
.uses .u { font-size: var(--t-sm); color: var(--fg-3); font-weight: 400; margin-left: 3px; }
.uses .k {
  margin-top: var(--s-1); font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: var(--track-label); color: var(--fg-3);
}

/* ── connecting a repository ──────────────────────────────────────────────

   Three classes, all of them for things that did not exist while a credential
   was a JSON textarea: the public half of a minted key, and a list of
   hostnames with an Add button.                                             */

/* The public half, shown once. Bordered in the OK colour because it is the
   thing that WORKED, and framed rather than inline so nobody mistakes it for
   an editable field — it is `readonly`, and looking like an input would invite
   somebody to type over the key they are meant to copy. */
.keyblock {
  border: 1px solid var(--ok);
  background: var(--ok-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-top: var(--s-3);
  display: grid;
  gap: var(--s-2);
}

/* An ssh public key is one long unbroken token. `break-all` so it wraps inside
   the box instead of forcing the page to scroll sideways, and a readonly
   textarea rather than a <pre> so select-all and copy work as expected. */
.keyline {
  width: 100%;
  resize: vertical;
  word-break: break-all;
  background: var(--bg);
  font-size: var(--t-xs);
}

/* One hostname per row. `.bad` keys a refusal to the row it names —
   `domains[1].hostname` belongs against the second one, not the whole list. */
.domain-row { margin-bottom: var(--s-2); }
.domain-row .field { flex: 1; }
.domain-row.bad .field { border-color: var(--bad); }
.domain-row .form-error:empty { display: none; }
