/* Pauli console styles, layered on the site design system (style.css).
   Same tokens, same instrument feel: thin borders, mono numerals, one accent,
   phosphor green for live/positive, red reserved for failure states. */

.console-main { padding: 28px 0 64px; }
.console-main h1 { font-size: 1.5rem; margin-bottom: 4px; }
.console-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.console-head .spacer { flex: 1; }

/* Tabs under the main nav. The hairline is an inset shadow, not a border:
   overflow-x:auto on .subnav-inner forces overflow-y to auto too, so the old
   margin-bottom:-1px underline-overlap trick was 1px of scrollable overflow
   (a stray scrollbar on classic-scrollbar platforms) with the underline's
   bottom pixel clipped. Children paint over the shadow, so the active tab's
   2px border covers the hairline exactly as the overlap intended. */
.subnav {
  box-shadow: inset 0 -1px 0 var(--border);
  background: var(--bg-raised);
}
.subnav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.subnav a {
  display: inline-block;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
/* [aria-current] not ="page": the job-detail page marks Jobs with
   aria-current="true" (right section, not this page). */
.subnav a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  white-space: nowrap;
  max-width: 100%;
}
.chip .live-dot { margin-right: 0; flex: none; }
/* Workspace names run to 64 chars; the label truncates rather than pushing
   the nav wider than a phone (nav-links carries the matching min-width: 0). */
.chip .chip-label { overflow: hidden; text-overflow: ellipsis; }

/* Panels & key-value grids */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.panel h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.panel-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); margin-bottom: 14px; }
@media (max-width: 820px) { .panel-grid { grid-template-columns: 1fr; } }
/* Without this, min-width:auto lets a nowrap table or wide circuit SVG grow
   the track past the viewport instead of scrolling inside .table-wrap /
   .circuit-scroll (same fix as .grid > * in style.css). */
.panel-grid > *, .circuit-grid > * { min-width: 0; }

/* The meta line under a page title carries one unbreakable token (a job id,
   or a 64-hex circuit fingerprint on the group page) far wider than a
   phone; wrap anywhere rather than growing the body sideways (same fix as
   .kv dd and .ev-label). */
p.mono { overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 0.88rem; }
.kv dt { color: var(--text-faint); white-space: nowrap; }
.kv dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
/* Long labels ("provider cost (billed to you by the provider)") are nowrap,
   so on a phone the auto label column swallows the viewport and the 1fr
   value column shreds ARNs/JSON into one-character lines. Stack the pairs
   instead: label above value, each at full row width. */
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { white-space: normal; }
  .kv dd { margin-bottom: 8px; }
}

.bignum {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  line-height: 1.2;
}
.bignum.positive { color: var(--live); }

/* State badges (job lifecycle, webhook delivery, key and credential states) */
.state-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 2px 10px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  white-space: nowrap;
}
.state-badge.completed, .state-badge.delivered, .state-badge.active {
  border-color: transparent;
  background: color-mix(in srgb, var(--live) 16%, transparent);
  color: var(--live);
}
.state-badge.failed, .state-badge.exhausted, .state-badge.invalid {
  border-color: transparent;
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  color: var(--bad);
}
.state-badge.cancelled, .state-badge.revoked { color: var(--text-faint); }
.state-badge.running, .state-badge.submitted, .state-badge.transpiling, .state-badge.pending {
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent-strong);
}

/* Timeline (job state history) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 17px;
  bottom: -2px;
  width: 1px;
  background: var(--border-strong);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline .t-state { font-family: var(--mono); font-size: 0.88rem; font-weight: 600; }
.timeline .t-at { font-family: var(--mono); font-size: 0.74rem; color: var(--text-faint); margin-left: 10px; }
.timeline .t-detail { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.timeline li.t-failed::before { background: var(--bad); }
.timeline li.t-completed::before { background: var(--live); }
.timeline li.t-cancelled::before { background: var(--text-faint); }

/* Counts histogram */
.histogram {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 180px;
  padding: 8px 4px 0;
  overflow-x: auto;
}
/* max-content, not a fixed floor: the count/key labels must never overlap a
   neighbor bar; the histogram scrolls instead. */
.hbar { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: max-content; flex: 1; }
.hbar .hbar-count { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); }
.hbar .hbar-track { display: flex; flex-direction: column; justify-content: flex-end; height: 130px; width: 100%; }
.hbar .hbar-fill {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.hbar.other .hbar-fill { background: var(--border-strong); }
.hbar .hbar-key { font-family: var(--mono); font-size: 0.74rem; color: var(--text); }

/* Automatic histogram-shape insights (server-derived, advisory) */
.insights { border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; margin: 4px 0 10px; }
.insight-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.insight-chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
}
.insight-conf { font-size: 0.74rem; color: var(--text-faint); }
.insight-headline { margin: 7px 0 0; font-size: 0.88rem; }
/* Hanging indent keeps wrapped observation lines behind their bullet. */
.insight-obs { margin: 5px 0 0; padding-left: 14px; text-indent: -14px; font-size: 0.8rem; color: var(--text-muted); }
.insight-obs::before { content: "· "; }

/* Expectation values (centered axis, error whiskers) */
.ev-chart { display: grid; gap: 8px; }
.ev-row { display: grid; grid-template-columns: 90px 1fr minmax(90px, 130px); gap: 12px; align-items: center; } /* fixed 90+130+gaps exceeds a 320px phone panel; the value column gives first */
.ev-row .ev-label { font-family: var(--mono); font-size: 0.84rem; overflow-wrap: anywhere; } /* Pauli strings outgrow the fixed column; wrapping keeps the tracks aligned */
.ev-row .ev-value { font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted); text-align: right; }
.ev-track { position: relative; height: 14px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: 7px; }
.ev-track::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.ev-fill { position: absolute; top: 2px; bottom: 2px; background: var(--accent); border-radius: 5px; }
.ev-fill.negative { background: var(--warn); }
.ev-err { position: absolute; top: 50%; height: 1px; background: var(--text); opacity: 0.7; }

/* Spend chart */
.spend-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; }
.spend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.spend-col .spend-fill { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: 0.85; }
.spend-col:hover .spend-fill { background: var(--accent-strong); opacity: 1; }
.spend-col .spend-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 5;
}
/* Nonzero days are focusable (console.js sets tabindex + aria-label), so the
   per-day figures are reachable without a pointer. */
.spend-col:hover .spend-tip, .spend-col:focus-visible .spend-tip { display: block; }
/* Edge columns anchor the tip to the chart edge; centering would draw it
   outside the panel. */
.spend-col:nth-child(-n+4) .spend-tip { left: 0; transform: none; }
.spend-col:nth-last-child(-n+4) .spend-tip { left: auto; right: 0; transform: none; }

/* Tables: row expanders + action buttons */
tr.expand-row > td { background: var(--bg-inset); }
tr.expand-row pre {
  margin: 0;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.74rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* .btn-row lives in style.css: one definition for site, console, and
   JS-built button groups alike. */
.btn-danger { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); background: transparent; }
.btn-danger:hover { border-color: var(--bad); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
td .row-actions { display: flex; gap: 6px; }

/* Forms */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-row .field label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
/* .login-wrap inputs are bare <input>s (login key, signup identity fields);
   without the extra selectors they fall through to UA defaults (gray
   fill, ~2.4:1 placeholder in dark). Same skin as the console forms. */
.form-row input[type="text"], .form-row input[type="password"], .form-row input[type="number"],
.form-row select, .form-row textarea,
.login-wrap input[type="text"], .login-wrap input[type="password"],
.login-wrap input[type="email"], .login-wrap select {
  background: var(--bg-inset);
  border: 1px solid var(--border-input);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.92rem;
  border-radius: 8px;
  padding: 9px 12px;
  min-width: 140px;
}
.check-row { display: flex; gap: 8px; align-items: baseline; font-size: 0.86rem; margin-bottom: 12px; cursor: pointer; }
.check-row input[type="checkbox"] { accent-color: var(--accent); }
/* Text-shaped <button>: discloses an optional form section (the signup org
   toggle) without reading as a second submit. */
.linklike { background: none; border: none; padding: 0; font: inherit; font-size: 0.86rem; color: var(--accent); cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
/* Money inputs: $ lives in the box so labels don't repeat "(USD)". Fields
   flex from a 140px floor (narrower rows wrap whole fields) to a 200px cap,
   so a row shares any panel width evenly; hints wrap under their own input
   instead of widening the row. .field-wide takes a full row: text inputs
   like URLs must never fight a money field for leftover space. */
.field-money { flex: 1 1 140px; max-width: 200px; }
.field-wide { flex: 1 1 100%; min-width: 0; }
.field-wide input { width: 100%; box-sizing: border-box; min-width: 0; }
.usd { position: relative; display: block; }
.usd::before {
  content: "$";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.92rem;
  pointer-events: none;
}
.form-row .usd input[type="number"] { padding-left: 25px; width: 100%; box-sizing: border-box; min-width: 120px; }
/* Badges keep their own lowercase look inside the uppercase panel headings. */
.panel h2 .state-badge { text-transform: none; margin-left: 8px; vertical-align: middle; }
.hint { font-size: 0.72rem; line-height: 1.5; color: var(--text-faint); margin: 5px 0 0; overflow-wrap: anywhere; }
/* Rows whose fields carry hints top-align (the default align-end would
   stagger labels when neighboring hints wrap to different line counts). */
.form-row:has(.field .hint) { align-items: flex-start; }
.hint code { font-size: 0.7rem; background: none; border: none; padding: 0; color: inherit; }
.form-row input[disabled], .check-row input[disabled] { opacity: 0.45; cursor: not-allowed; }
.field:has(input[disabled]) .hint, .field:has(input[disabled]) label { opacity: 0.55; }

/* Jobs filter bar. The advanced filters sit one disclosure level down;
   console.js opens the details when a shared URL arrives with one active,
   so an applied filter is never invisible. */
.filter-bar { margin-bottom: 14px; }
.filters-more { flex-basis: 100%; min-width: 0; }
.filters-more > summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
  padding: 2px 0; /* keeps the summary a comfortable pointer target */
}
.filters-more > summary:hover { color: var(--text); }
.filters-more[open] > summary { margin-bottom: 8px; }

/* Tag/metadata chips under a job row's name: a capped preview whose long
   values ellipsize; the job page renders everything in full. */
.row-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.row-chips .chip { font-size: 0.72rem; padding: 1px 8px; max-width: 240px; }

/* One-time secret reveal */
.secret-box {
  background: var(--bg-inset);
  border: 1px solid color-mix(in srgb, var(--live) 45%, transparent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
}
.secret-box code { display: block; font-size: 0.86rem; background: none; border: none; padding: 6px 0; overflow-wrap: anywhere; }
.secret-box pre { overflow-x: auto; } /* the Braket trust-policy JSON scrolls rather than escaping the box */

/* Login */
.login-wrap { max-width: 460px; margin: 72px auto; padding: 0 24px; }
.login-wrap .panel { padding: 26px; }
/* width:100% + border-box keeps every field inside the panel at any
   viewport; a <select> otherwise takes the intrinsic width of its longest
   option ("South Georgia and the South Sandwich Islands" overflows 320px).
   Checkboxes are excluded: stretching one paints its glyph mid-row and
   shoves the .check-row label text to the right edge. */
.login-wrap input:not([type="checkbox"]), .login-wrap select {
  width: 100%; box-sizing: border-box; margin: 6px 0 14px;
}

/* Notices */
.notice {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  background: var(--bg-raised);
  padding: 10px 14px;
  font-size: 0.86rem;
  margin-bottom: 16px;
}
.notice.error { border-left-color: var(--bad); }

.console-status { font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); min-height: 1.3em; margin-top: 8px; }
.console-main .table-wrap { margin-bottom: 12px; }
.console-main table { min-width: 0; }
.cal-table-wrap { max-height: 320px; overflow-y: auto; }

/* Circuit drawing (job page). Colors ride the theme tokens so the SVG works
   in both schemes without a redraw. */
.circuit-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .circuit-grid { grid-template-columns: 1fr; } }
.circuit-pane h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap; /* "Transpiled → <device-id>" + chip outgrow a phone column */
  overflow-wrap: anywhere;
}
.eq-chip {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.eq-chip.ok { color: var(--live); border-color: color-mix(in srgb, var(--live) 45%, transparent); }
.circuit-scroll {
  overflow-x: auto;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.circuit-svg { display: block; }
.circuit-svg .wire { stroke: var(--border-strong); stroke-width: 1; fill: none; }
.circuit-svg .wlabel { fill: var(--text-muted); font: 11px var(--mono); }
.circuit-svg .gate { fill: var(--bg-raised); stroke: var(--accent); stroke-width: 1; }
.circuit-svg .glabel { fill: var(--text); font: 12px var(--mono); }
.circuit-svg .gnum { fill: var(--text-faint); font: 9px var(--mono); }
.circuit-svg .cdot { fill: var(--text); }
.circuit-svg .cline { stroke: var(--text); stroke-width: 1.2; }
.circuit-svg .target { stroke: var(--text); stroke-width: 1.2; fill: none; }
.circuit-svg .marrow { fill: var(--text-muted); }
.circuit-svg .barrier { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.circuit-caption { font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint); margin: 6px 0 0; }
.circuit-pre {
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.5;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  max-height: 320px;
  overflow: auto;
}

/* Account lifecycle + receipts (billing) and the credentials fleet strip */
.journal-spacer { flex: 1; } /* pushes the statement export to the row's end */
.btn-row input[type="month"] {
  background: var(--bg-inset);
  border: 1px solid var(--border-input);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 0; /* the row wraps on phones; the input must not force overflow */
}
.panel-danger { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.panel-danger h2 { color: var(--bad); }
.fleet-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fleet-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.fleet-chip:hover:not([disabled]) { border-color: var(--border-strong); color: var(--text); }
.fleet-chip[disabled] { cursor: default; opacity: 0.7; }
