/* onepane-tower.css — the OnePane control tower (onepane-index / -client / -partner).
   One stylesheet for all three shells. Operate surface: the page opens on a verdict (what needs
   Craig), then the machine's condition, then the controls. Every figure names its source.
   Scoped under .op so nothing leaks into the shared portal chrome. */

.op {
  --op-surface: #0a0b11;
  --op-surface-2: #0f1118;
  --op-line: rgba(255, 255, 255, .075);
  --op-line-strong: rgba(255, 255, 255, .13);
  --op-tx: #ecebe6;
  --op-tx2: rgba(236, 235, 230, .66);
  --op-tx3: rgba(236, 235, 230, .5);
  --op-gold: #d4a843;
  --op-gold-soft: rgba(212, 168, 67, .12);
  --op-ok: #3fcf8e;
  --op-warn: #e9b44c;
  --op-bad: #f2636f;
  --op-info: #8aa9f5;
  --op-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --op-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --op-radius: 12px;
  --op-ease: cubic-bezier(.16, 1, .3, 1);

  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 32px 72px;
  font-family: var(--op-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--op-tx);
  font-feature-settings: 'cv11', 'ss01';
}
.op *, .op *::before, .op *::after { box-sizing: border-box; }
.op :focus-visible { outline: 2px solid var(--op-gold); outline-offset: 2px; border-radius: 4px; }
.op .num, .op td.num, .op .mono { font-family: var(--op-mono); font-variant-numeric: tabular-nums; font-size: 12px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.op-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.op-title { font-family: 'Syne', var(--op-sans); font-weight: 800; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; color: #fff; margin: 0; }
.op-lede { margin: 8px 0 0; max-width: 68ch; color: var(--op-tx2); font-size: 13.5px; text-wrap: pretty; }
.op-top-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.op-back { display: inline-flex; align-items: center; gap: 6px; color: var(--op-tx2); text-decoration: none; font-size: 12px; margin-bottom: 14px; }
.op-back:hover { color: var(--op-tx); }
.op-back svg { width: 14px; height: 14px; }

/* ── Status chip (colour is never the only signal: every chip carries a word) ── */
.op-chip { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--op-line-strong); background: var(--op-surface); color: var(--op-tx2); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.op-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--op-tx3); flex: none; }
.op-chip.ok .dot { background: var(--op-ok); box-shadow: 0 0 0 3px rgba(63, 207, 142, .16); }
.op-chip.warn .dot { background: var(--op-warn); }
.op-chip.bad .dot { background: var(--op-bad); }
.op-chip.bad { color: #ffc5ca; border-color: rgba(242, 99, 111, .35); }
.op-chip.live .dot { animation: op-pulse 2.4s var(--op-ease) infinite; }
@keyframes op-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(63, 207, 142, .35); } 60% { box-shadow: 0 0 0 5px rgba(63, 207, 142, 0); } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.op-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--op-line-strong); background: var(--op-surface-2); color: var(--op-tx); font: 500 12px/1 var(--op-sans); cursor: pointer; white-space: nowrap; transition: background .18s var(--op-ease), border-color .18s var(--op-ease), color .18s var(--op-ease); }
.op-btn:hover { background: #161924; border-color: rgba(255, 255, 255, .2); }
.op-btn:active { transform: translateY(1px); }
.op-btn[disabled] { opacity: .5; cursor: default; transform: none; }
.op-btn svg { width: 14px; height: 14px; }
.op-btn.primary { background: var(--op-gold); border-color: var(--op-gold); color: #17130a; font-weight: 600; }
.op-btn.primary:hover { background: #e2b955; border-color: #e2b955; }
.op-btn.ghost { background: transparent; border-color: transparent; color: var(--op-tx2); }
.op-btn.ghost:hover { color: var(--op-tx); background: rgba(255, 255, 255, .05); }
.op-btn.sm { height: 24px; padding: 0 9px; font-size: 11.5px; }
.op-btn.arming { background: rgba(233, 180, 76, .14); border-color: rgba(233, 180, 76, .55); color: #ffd98c; }
.op-btn.is-done { border-color: rgba(63, 207, 142, .45); color: #9ff0c8; }
.op-btn.is-fail { border-color: rgba(242, 99, 111, .5); color: #ffb3ba; }
.op-btn .spin { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: op-spin .7s linear infinite; }
@keyframes op-spin { to { transform: rotate(360deg); } }

/* ── Verdict: the first thing on the page ─────────────────────────────────── */
.op-verdict { border: 1px solid var(--op-line); border-radius: var(--op-radius); background: var(--op-surface); margin-bottom: 20px; overflow: hidden; }
.op-verdict-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 18px 22px 14px; flex-wrap: wrap; }
.op-verdict-line { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.012em; color: #fff; text-wrap: balance; }
.op-verdict-line .count-bad { color: var(--op-bad); }
.op-verdict-line .count-warn { color: var(--op-warn); }
.op-verdict-note { color: var(--op-tx3); font-size: 12px; }
.op-attn { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--op-line); }
.op-attn li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 13px 22px; border-bottom: 1px solid var(--op-line); }
.op-attn li:last-child { border-bottom: 0; }
.op-attn .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--op-info); }
.op-attn li.bad .sev { background: var(--op-bad); box-shadow: 0 0 0 3px rgba(242, 99, 111, .15); }
.op-attn li.warn .sev { background: var(--op-warn); }
.op-attn .what { color: var(--op-tx); font-weight: 500; }
.op-attn .why { grid-column: 2; color: var(--op-tx2); font-size: 12px; overflow-wrap: anywhere; }
.op-attn .src { grid-column: 2; color: var(--op-tx3); font-size: 11px; font-family: var(--op-mono); }
.op-attn .act { grid-column: 3; grid-row: 1 / span 3; display: flex; gap: 6px; align-items: center; }
.op-attn li.info { padding-top: 10px; padding-bottom: 10px; }
.op-attn li.info .what { color: var(--op-tx2); font-weight: 500; }
.op-attn li.info .why { font-size: 11.5px; color: var(--op-tx3); }
.op-attn-clear { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--op-line); color: var(--op-tx2); }

/* ── Vitals ledger: a ruled row of measurements, each with its qualifier ─── */
.op-ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--op-line); border-radius: var(--op-radius); background: var(--op-surface); margin: 0 0 28px; }
.op-ledger > div { padding: 14px 18px 15px; border-right: 1px solid var(--op-line); min-width: 0; }
.op-ledger > div:last-child { border-right: 0; }
.op-ledger dt { color: var(--op-tx2); font-size: 11.5px; margin: 0 0 6px; }
.op-ledger dd { margin: 0; }
.op-ledger .v { font-family: var(--op-mono); font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 500; letter-spacing: -.02em; color: #fff; }
.op-ledger .v small { font-size: 13px; color: var(--op-tx3); font-weight: 400; margin-left: 2px; }
.op-ledger .q { display: block; margin-top: 3px; color: var(--op-tx3); font-size: 11px; }
.op-ledger .v.bad { color: var(--op-bad); }
.op-ledger .v.warn { color: var(--op-warn); }

/* ── Panels + section headings ────────────────────────────────────────────── */
.op-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.op-stack { display: grid; gap: 20px; }
.op-panel { border: 1px solid var(--op-line); border-radius: var(--op-radius); background: var(--op-surface); min-width: 0; margin-bottom: 20px; }
.op-grid .op-panel, .op-stack .op-panel { margin-bottom: 0; }
.op-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--op-line); flex-wrap: wrap; }
.op-panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.005em; color: #fff; }
.op-panel-head .sub { display: block; font-size: 11.5px; color: var(--op-tx3); font-weight: 400; margin-top: 2px; }
.op-panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-panel-body { padding: 4px 0; }
.op-panel-body.pad { padding: 16px 18px; }
.op-panel-foot { padding: 10px 18px; border-top: 1px solid var(--op-line); color: var(--op-tx3); font-size: 11.5px; }
.op-section-title { margin: 36px 0 12px; font-size: 18px; font-weight: 600; letter-spacing: -.012em; color: #fff; }
.op-section-lede { margin: -6px 0 14px; color: var(--op-tx2); max-width: 70ch; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.op-table-wrap { overflow-x: auto; }
table.op-t { width: 100%; border-collapse: collapse; }
table.op-t th { text-align: left; font-size: 11px; font-weight: 500; color: var(--op-tx3); padding: 9px 18px 8px; border-bottom: 1px solid var(--op-line); white-space: nowrap; }
table.op-t th.r, table.op-t td.r { text-align: right; }
table.op-t td { padding: 10px 18px; border-bottom: 1px solid rgba(255, 255, 255, .045); color: var(--op-tx); vertical-align: middle; }
table.op-t tr:last-child td { border-bottom: 0; }
table.op-t tbody tr { transition: background .15s var(--op-ease); }
table.op-t tbody tr:hover td { background: rgba(255, 255, 255, .022); }
table.op-t tr.is-link { cursor: pointer; }
table.op-t .muted { color: var(--op-tx3); }
table.op-t .sub { display: block; color: var(--op-tx3); font-size: 11px; margin-top: 1px; }
table.op-t a { color: inherit; text-decoration: none; }
table.op-t a.go { color: var(--op-gold); font-weight: 500; }
table.op-t a.go:hover { text-decoration: underline; text-underline-offset: 3px; }
.op-err-line { color: #ffb3ba; font-size: 11px; font-family: var(--op-mono); overflow-wrap: anywhere; }

/* state label: dot + word */
.op-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.op-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--op-tx3); }
.op-state.ok::before { background: var(--op-ok); }
.op-state.warn::before { background: var(--op-warn); }
.op-state.bad::before { background: var(--op-bad); }
.op-state.bad { color: #ffc5ca; }

/* meters: a measured quantity, drawn to scale */
.op-meter { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.op-meter .bar { position: relative; flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.op-meter .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--op-tx2); transform-origin: left; animation: op-grow .6s var(--op-ease) both; }
.op-meter.ok .bar i { background: var(--op-ok); }
.op-meter.warn .bar i { background: var(--op-warn); }
.op-meter.bad .bar i { background: var(--op-bad); }
.op-meter.gold .bar i { background: var(--op-gold); }
.op-meter .pct { font-family: var(--op-mono); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--op-tx2); min-width: 44px; text-align: right; }
@keyframes op-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ── Filters: segmented + search ─────────────────────────────────────────── */
.op-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: rgba(255, 255, 255, .04); border: 1px solid var(--op-line); }
.op-seg button { height: 24px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--op-tx2); font: 500 11.5px/1 var(--op-sans); cursor: pointer; white-space: nowrap; transition: background .15s var(--op-ease), color .15s var(--op-ease); }
.op-seg button:hover { color: var(--op-tx); }
.op-seg button[aria-pressed="true"], .op-seg button[aria-selected="true"] { background: var(--op-surface-2); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .4), inset 0 0 0 1px var(--op-line-strong); }
.op-seg button .n { font-family: var(--op-mono); font-size: 10.5px; color: var(--op-tx3); margin-left: 5px; }
.op-search { position: relative; }
.op-search svg { position: absolute; left: 9px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%); color: var(--op-tx3); pointer-events: none; }
.op-search input { height: 28px; width: 220px; padding: 0 10px 0 28px; border-radius: 7px; border: 1px solid var(--op-line-strong); background: var(--op-surface-2); color: var(--op-tx); font: 12px var(--op-sans); }
.op-search input::placeholder { color: var(--op-tx3); }
.op-search input:focus { outline: none; border-color: rgba(212, 168, 67, .6); box-shadow: 0 0 0 3px var(--op-gold-soft); }

/* ── Control console ─────────────────────────────────────────────────────── */
.op-console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
.op-console > div { padding: 18px; min-width: 0; }
.op-console > div + div { border-left: 1px solid var(--op-line); }
.op-actions { display: grid; gap: 6px; }
.op-action { display: grid; grid-template-columns: 16px 1fr; gap: 2px 10px; align-items: start; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--op-line); cursor: pointer; transition: border-color .15s var(--op-ease), background .15s var(--op-ease); }
.op-action:hover { border-color: var(--op-line-strong); }
.op-action input { margin: 3px 0 0; accent-color: var(--op-gold); }
.op-action b { font-weight: 500; color: var(--op-tx); }
.op-action span { grid-column: 2; color: var(--op-tx3); font-size: 11.5px; }
.op-action:has(input:checked) { border-color: rgba(212, 168, 67, .5); background: var(--op-gold-soft); }
.op-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.op-field { display: grid; gap: 5px; }
.op-field.full { grid-column: 1 / -1; }
.op-field label { font-size: 11.5px; color: var(--op-tx2); }
.op-field input, .op-field select { height: 32px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--op-line-strong); background: var(--op-surface-2); color: var(--op-tx); font: 12.5px var(--op-sans); }
.op-field input::placeholder { color: var(--op-tx3); }
.op-field input:focus, .op-field select:focus { outline: none; border-color: rgba(212, 168, 67, .6); box-shadow: 0 0 0 3px var(--op-gold-soft); }
.op-field .hint { font-size: 11px; color: var(--op-tx3); }
.op-field[hidden] { display: none; }
.op-preview { margin: 16px 0 14px; padding: 12px 14px; border-radius: 9px; background: rgba(255, 255, 255, .03); border: 1px solid var(--op-line); color: var(--op-tx2); font-size: 12.5px; }
.op-preview b { color: var(--op-tx); font-weight: 500; }
.op-console-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.op-result { font-size: 12px; color: var(--op-tx2); }
.op-result.ok { color: #9ff0c8; }
.op-result.bad { color: #ffb3ba; }

/* ── Key/value (entity panes) ────────────────────────────────────────────── */
.op-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; margin: 0; }
.op-kv > div { padding: 12px 18px; border-bottom: 1px solid rgba(255, 255, 255, .045); min-width: 0; }
.op-kv dt { font-size: 11px; color: var(--op-tx3); margin-bottom: 3px; }
.op-kv dd { margin: 0; color: var(--op-tx); overflow-wrap: anywhere; }

/* ── Empty / loading / error ─────────────────────────────────────────────── */
.op-empty { padding: 18px; color: var(--op-tx2); font-size: 12.5px; }
.op-empty b { color: var(--op-tx); font-weight: 500; }
.op-gap { padding: 14px 18px; color: var(--op-tx2); font-size: 12.5px; }
.op-gap::before { content: 'Gap'; display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 4px; background: rgba(255, 255, 255, .06); color: var(--op-tx2); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }
.op-fail { margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(242, 99, 111, .3); background: rgba(242, 99, 111, .07); color: #ffc5ca; font-size: 12.5px; }
.op-fail code { font-family: var(--op-mono); font-size: 11px; color: #ffd6da; overflow-wrap: anywhere; }
.op-skel { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .09), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: op-shimmer 1.3s linear infinite; }
.op-skel-block { padding: 18px 22px; display: grid; gap: 12px; }
@keyframes op-shimmer { to { background-position: -200% 0; } }

.op-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; }
.op-links .op-chip { height: 24px; }
.op-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .op-grid { grid-template-columns: 1fr; }
  .op-console { grid-template-columns: 1fr; }
  .op-console > div + div { border-left: 0; border-top: 1px solid var(--op-line); }
}
@media (max-width: 720px) {
  .op { padding: 18px 16px 56px; }
  .op-title { font-size: 24px; }
  .op-verdict-line { font-size: 16px; }
  .op-verdict-head, .op-attn li, .op-attn-clear { padding-left: 16px; padding-right: 16px; }
  .op-attn li { grid-template-columns: 12px minmax(0, 1fr); }
  .op-attn .act { grid-column: 2; grid-row: auto; margin-top: 8px; }
  .op-ledger { grid-template-columns: 1fr 1fr; }
  .op-ledger > div { border-right: 0; border-bottom: 1px solid var(--op-line); }
  .op-ledger > div:nth-child(odd) { border-right: 1px solid var(--op-line); }
  .op-fields { grid-template-columns: 1fr; }
  .op-search input { width: 100%; }
  .op-search { flex: 1 1 100%; }
  table.op-t th, table.op-t td { padding-left: 12px; padding-right: 12px; }
  .op-hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .op *, .op *::before, .op *::after { animation: none !important; transition: none !important; }
}
.op-more { padding: 8px 18px 10px; border-top: 1px solid rgba(255, 255, 255, .045); }
.op-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1080px) { .op-grid.even { grid-template-columns: 1fr; } }
table.op-t td time { white-space: nowrap; }
table.op-t td.nw { white-space: nowrap; }
