/* Layouts that belong to one page: the dashboard, the fleet grid, one Android. */

/* --------------------------------------------------------------- dashboard */
.cols-machine { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-4); align-items: start; }
.gpu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.gpu-item { display: flex; flex-direction: column; gap: 4px; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.gpu-item .row { gap: var(--s-1) var(--s-2); }

.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.dash > .even { align-self: stretch; }
.dash > .span-4 { grid-column: span 4; }
.dash > .span-5 { grid-column: span 5; }
.dash > .span-6 { grid-column: span 6; }
.dash > .span-7 { grid-column: span 7; }
.dash > .span-8 { grid-column: span 8; }
.dash > .span-12 { grid-column: 1 / -1; }

.capacity { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5); }
.capacity-text { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.capacity-text .lead { font-size: 1.05rem; font-weight: 550; line-height: 1.35; }
.capacity-text .lead .num { font-weight: 700; }
.limits { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.fleet-total { display: flex; align-items: baseline; gap: var(--s-2); }
.fleet-total .n { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 2.3rem; font-weight: 650; letter-spacing: -.03em; line-height: 1; }

.alert { display: flex; align-items: flex-start; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.alert:last-child { border-bottom: 0; }
.alert .badge { flex: none; margin-top: 1px; }
.alert .body { min-width: 0; overflow-wrap: anywhere; }

.guide { position: relative; overflow: hidden; }
.guide::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); }
.guide-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.guide-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: start; gap: var(--s-1) var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.guide-step .mark {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--mono); font-size: .84rem; font-weight: 700;
  color: var(--muted); border: 1.5px solid var(--border-strong);
}
.guide-step.done .mark { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.guide-step.next .mark { color: var(--accent-text); border-color: transparent; background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); }
.guide-step .what { min-width: 0; }
.guide-step .what strong { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.guide-step.done .what strong { color: var(--muted); font-weight: 550; }
.guide-step .what p { color: var(--muted); }
.guide-step .fix { margin-top: var(--s-2); }
.guide-progress { display: flex; align-items: center; gap: var(--s-3); min-width: 160px; }
.guide-progress progress { width: 120px; }

/* ----------------------------------------------------- approvals, AI access */
.approvals { display: flex; flex-direction: column; gap: var(--s-4); }
.approval { position: relative; border-left: 4px solid var(--info); }
/* Destructive is marked three ways: the word, the warning sign, and a hatched red edge. */
.approval.destructive { border-color: var(--fail); border-left-width: 1px; padding-left: calc(var(--s-5) + 12px); }
.approval.destructive::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; border-radius: var(--r-lg) 0 0 var(--r-lg);
  background: repeating-linear-gradient(135deg, var(--fail) 0 5px, transparent 5px 10px);
}
.approval.decided { border-left-color: var(--border-strong); opacity: .85; }
.approval-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.approval-who { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.approval-who strong { color: var(--text); font-family: var(--mono); font-size: .92rem; }
.approval-clock { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.approval-clock .num { color: var(--text); font-weight: 650; min-width: 3.2ch; }
.approval.soon .approval-clock, .approval.soon .approval-clock .num { color: var(--warn); }
.approval-track { position: relative; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.approval-track .fill { position: absolute; inset: 0 auto 0 0; background: var(--muted); transition: width 1s linear; }
.approval.soon .approval-track .fill { background: var(--warn); }
.approval-summary { font-size: 1.3rem; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.approval.decided .approval-summary { font-size: 1.02rem; font-weight: 550; }
.approval-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding-top: var(--s-2); }
.approval-actions input { flex: 1 1 220px; height: 44px; min-width: 0; }
.approval-confirm { padding: var(--s-3) var(--s-4); border: 1px solid var(--fail); border-radius: var(--r-md); background: var(--surface-solid); }
.approval-confirm .row { margin-top: var(--s-3); }
.approval-confirm .btn.large { white-space: normal; height: auto; min-height: 44px; padding-block: 8px; text-align: left; line-height: 1.3; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.choice {
  display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-4); min-width: 0;
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.choice:hover { border-color: var(--border-strong); }
.choice[aria-checked="true"] { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: var(--glow); }
.choice[aria-disabled="true"] { opacity: .6; cursor: progress; }
.choice-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: 1.05rem; }
.choice[aria-checked="true"] .choice-head .icon { color: var(--accent); }
.choice-text { color: var(--muted); line-height: 1.4; }
.tools th[scope="row"] { min-width: 190px; }
.tools th[scope="row"] code { white-space: nowrap; }
.tools td:nth-child(2) { min-width: 260px; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); }

/* ------------------------------------------------- assistant, pilot, models */
.chat { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.chat-side .btn.grow { justify-content: flex-start; text-align: left; min-width: 0; overflow: hidden; }
.chat-side .btn.grow > .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item { flex-wrap: nowrap; }
.chat-main { display: flex; flex-direction: column; min-height: 60vh; }
.chat-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.chat-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 120px; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: var(--s-3); min-height: 280px; max-height: 62vh; overflow-y: auto; padding: var(--s-3) var(--s-1); }
.chat-start { display: flex; flex-direction: column; gap: var(--s-3); }
.chat-start .chips { justify-content: center; }
.chat-start .chip { height: auto; min-height: 30px; padding-block: 5px; white-space: normal; text-align: left; }
.chat-form { display: flex; flex-direction: column; gap: var(--s-2); }
.msg { max-width: min(100%, 860px); min-width: 0; }
.msg-who { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; font-weight: 620; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 3px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; padding: var(--s-2) var(--s-3); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg); }
.msg.model, .msg.final { padding: var(--s-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm); }
.msg.tool, .msg.result { padding: var(--s-2) var(--s-3); border-left: 3px solid var(--border-strong); font-size: .94rem; }
.msg.approval-slot { max-width: none; }
.result-text { margin-top: var(--s-1); max-height: 220px; overflow: auto; font-size: .86rem; color: var(--muted); }
/* What a device showed is fenced and labelled: it is data, never the farm speaking. */
.untrusted { margin-top: var(--s-1); padding: var(--s-2) var(--s-3); border: 1px dashed var(--warn); border-radius: var(--r-md); background: var(--warn-soft); }
.untrusted-label { display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: .82rem; font-weight: 620; }
.untrusted .result-text { color: var(--text); }
.final-actions { margin-top: var(--s-3); }
.final-actions ul { list-style: none; padding: 0; margin-top: var(--s-1); display: flex; flex-direction: column; gap: 4px; }
/* The farm's own record: a different voice from the model's, and it looks it. */
.farm-record { margin-top: var(--s-3); padding: var(--s-2) var(--s-3); border: 1px solid var(--accent-line); border-left-width: 4px; border-radius: var(--r-md); background: var(--surface-solid); font-family: var(--mono); font-size: .9rem; }
.farm-record-label { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; color: var(--accent); font-family: var(--font); font-size: .78rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.model.card h3 { margin: 0 auto 0 0; display: flex; align-items: center; gap: var(--s-2); }
.probe { padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); display: flex; flex-direction: column; gap: var(--s-2); }
.probe-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.probe-list li { display: flex; align-items: flex-start; gap: var(--s-2); }
.pilot-devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: var(--s-4); }
.pilot-device { display: flex; gap: var(--s-4); align-items: flex-start; }
.pilot-device > * + * { margin-top: 0; }
.pilot-shot { flex: none; width: 124px; }
.pilot-shot .thumb { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; object-position: top; background: var(--screen); border-radius: var(--r-md); border: 1px solid var(--border); }
.pilot-actions { display: flex; flex-direction: column; gap: 6px; padding-left: 2em; }
.pilot-actions .reason { overflow-wrap: anywhere; }
.pilot-top h2 { overflow-wrap: anywhere; }
.pilot-form textarea { min-height: 64px; }
.pilot-form fieldset > .field > .toolbar { margin-bottom: var(--s-1); }
.pilot-form fieldset > .field > .chips { margin-top: var(--s-1); }
.pilot-form > .row:last-child { margin-top: var(--s-1); }
.value-row input[type="text"], .value-row input[type="password"] { flex: 1 1 140px; min-width: 0; }

/* ------------------------------------------------------------- fleet grid */
.fleet-tools { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
.fleet-tools .toolbar { margin: 0; }
.fleet-count { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: var(--s-4); }
.fleet > .empty { grid-column: 1 / -1; }
.acard {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: transform var(--t-med) var(--ease), border-color var(--t-fast), box-shadow var(--t-med);
}
.acard:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.acard.selected { border-color: var(--accent-line); box-shadow: var(--glow); }
.acard-shot { position: relative; display: block; aspect-ratio: 9 / 13; background: var(--screen); overflow: hidden; }
.acard-shot .thumb { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.acard-shot .off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); color: var(--faint); background: var(--surface-2); font-size: .88rem; }
.acard-shot .off .icon { width: 30px; height: 30px; opacity: .7; }
.acard-check { position: absolute; left: var(--s-2); top: var(--s-2); z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--on-screen-bg); }
.acard-check input { margin: 0; vertical-align: 0; }
.acard-state { position: absolute; right: var(--s-2); top: var(--s-2); z-index: 1; }
.acard-state .badge { background: var(--surface-solid); box-shadow: var(--shadow-1); }
.acard-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: var(--s-3); min-width: 0; }
.acard-title { display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; }
.acard-title a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 620; color: var(--text); text-decoration: none; }
.acard-title a:hover { text-decoration: underline; }
/* The whole card opens the Android; its own controls sit above that link. */
.acard-title a::after { content: ""; position: absolute; inset: 0; }
.acard-id { flex: none; font-family: var(--mono); font-size: .82rem; color: var(--faint); }
.acard-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .84rem; min-height: 1.3em; }
.acard-meta span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.acard-meta .icon { width: 13px; height: 13px; }
.acard-error { color: var(--fail); font-size: .84rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.acard-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--s-1); margin-top: auto; padding-top: 2px; }
.acard-actions .btn:first-child { flex: 1; }

/* ----------------------------------------------------------- one Android */
.detail { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.detail-chips { display: flex; flex-direction: column; gap: var(--s-2); }
.detail-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }

@media (max-width: 1180px) {
  .dash > .span-4, .dash > .span-5, .dash > .span-7, .dash > .span-8 { grid-column: span 6; }
  .dash > .wide-md { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-log { max-height: none; }
  .pilot-device { flex-direction: column; }
  .choices { grid-template-columns: minmax(0, 1fr); }
  .approval-actions .btn.large { flex: 1 1 130px; }
  .cols-machine { grid-template-columns: minmax(0, 1fr); }
  .dash > * { grid-column: 1 / -1 !important; }
  .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .fleet { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .guide-step { grid-template-columns: 28px minmax(0, 1fr); }
  .guide-step .go { grid-column: 2; justify-self: start; }
  .gauge { width: 124px; height: 124px; }
  .gauge-value { font-size: 1.9rem; }
}

/* ------------------------------------------------------------ super control */
/* The operations centre: a strip of figures, then bands of panels that share the width
   and wrap by themselves, so the page needs no breakpoint of its own until a phone.
   Every colour is a token; the light theme and reduced motion need nothing extra. */
.sc { display: flex; flex-direction: column; gap: var(--s-3); }
.sc .page-head { margin-bottom: var(--s-1); }
.sc .k, .sc-label {
  color: var(--faint); font-size: .7rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
}
.sc .track { display: block; flex: 1; min-width: 24px; height: 4px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.sc .track .fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); border-radius: inherit; transition: width var(--t-slow) var(--ease); }
.sc-note { color: var(--muted); font-size: .82rem; line-height: 1.4; margin-top: var(--s-2); }

.sc-clock { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .88rem; color: var(--muted); padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); white-space: nowrap; }
.sc-verdict { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; font-size: .86rem; font-weight: 620; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.sc-verdict .beacon { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px var(--surface-3); animation: sf-pulse 2.4s ease-in-out infinite; }
.sc-verdict[data-tone="ok"] { color: var(--ok); border-color: var(--ok-soft); }
.sc-verdict[data-tone="warn"] { color: var(--warn); border-color: var(--warn-soft); }
.sc-verdict[data-tone="fail"] { color: var(--fail); border-color: var(--fail-soft); }

/* figures */
.sc-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-3); }
.sc-kpi {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-width: 0; padding: 12px 14px;
  font: inherit; text-align: left; color: var(--text); text-decoration: none; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.sc-kpi:hover { border-color: var(--accent-line); box-shadow: var(--glow); transform: translateY(-1px); }
.sc-kpi-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sc-kpi .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; }
.sc-kpi .sub { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-kpi[data-tone="warn"] .v { color: var(--warn); }
.sc-kpi[data-tone="fail"] .v { color: var(--fail); }
.sc-kpi-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: var(--r-md); color: var(--accent); background: var(--accent-soft); }
.sc-kpi-icon .icon { width: 22px; height: 22px; }
.sc-kpi-icon[data-tone="info"] { color: var(--info); background: var(--info-soft); }
.sc-kpi-icon[data-tone="idle"] { color: var(--idle); background: var(--idle-soft); }
.sc-kpi-icon[data-tone="warn"] { color: var(--warn); background: var(--warn-soft); }
.sc-kpi[data-tone="fail"] .sc-kpi-icon { color: var(--fail); background: var(--fail-soft); }
.sc-kpi[data-tone="ok"] .sc-kpi-icon[data-tone="warn"] { color: var(--ok); background: var(--ok-soft); }
.sc-ring { flex: none; width: 46px; height: 46px; transform: rotate(-90deg); }
.sc-ring circle { fill: none; stroke-width: 5; }
.sc-ring .track { stroke: var(--surface-3); }
.sc-ring .value { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset var(--t-slow) var(--ease); }
.sc-bars { flex: none; display: inline-flex; align-items: flex-end; gap: 2px; width: 72px; height: 40px; }
.sc-bars span { flex: 1; min-height: 3px; background: linear-gradient(var(--accent-b), var(--accent-a)); border-radius: 1px; transition: height var(--t-slow) var(--ease); }
.sc-bars span.off { background: var(--surface-3); }

/* panel switches */
.sc-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sc-toggles .sc-label { margin-right: var(--s-1); }
.sc-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  font: inherit; font-size: .84rem; font-weight: 550; color: var(--faint); background: transparent;
  border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.sc-toggle .icon { width: 14px; height: 14px; }
.sc-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.sc-toggle[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: var(--accent-line); }
.sc-toggle[aria-pressed="true"] .icon { color: var(--accent); }

/* bands and panels: the two lower bands are four across, then two by two, then one
   under the other; a panel that is switched off leaves its room to its neighbours. */
.sc-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--s-3); }
.sc-row-1 > .sc-panel, .sc-row-2 > .sc-panel { flex: 1 1 0; }
.sc-panel {
  position: relative; flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; padding: 12px 14px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.sc-panel::before { content: ""; position: absolute; top: -1px; left: 16px; width: 44px; height: 2px; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); border-radius: var(--r-full); }
.sc-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); min-height: 30px; margin-bottom: var(--s-3); }
.sc-head h2 { margin-right: auto; font-size: 1.02rem; white-space: nowrap; }
.sc-list { display: flex; flex-direction: column; min-height: 0; max-height: 252px; overflow-y: auto; }
.sc-line, .sc-task, .sc-alert { display: flex; align-items: center; gap: var(--s-2); min-width: 0; padding: 7px 0; border-bottom: 1px solid var(--border); }
.sc-list > :last-child { border-bottom: 0; }
.sc-line .title, .sc-task .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; color: var(--text); }
.sc-line .rest { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--muted); font-size: .86rem; }
.sc-line .id { color: var(--faint); font-size: .8rem; }
.sc-list > .row { padding-bottom: var(--s-2); }

/* units */
.sc-units { flex: 3 1 460px; min-height: 500px; }
.sc-units .search { flex: 0 1 220px; }
.sc-units-wrap { position: relative; flex: 1; min-height: 260px; }
.sc-units-grid { position: absolute; inset: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: max-content; gap: var(--s-3); align-content: start; padding: 2px 4px 2px 2px; }
.sc-units-grid > .empty { grid-column: 1 / -1; }
.sc-unit { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.sc-unit:hover { border-color: var(--border-strong); }
.sc-unit.on { border-color: var(--accent-line); }
.sc-unit.focus { border-color: var(--accent); box-shadow: var(--glow); }
.sc-unit-shot { position: relative; display: block; flex: none; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0; background: var(--screen); cursor: pointer; overflow: hidden; }
.sc-unit-shot:focus-visible { outline-offset: -3px; }
.sc-unit-shot .thumb { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.sc-unit-shot .thumb:not([src]) { visibility: hidden; }
.sc-unit-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--faint); font-size: .78rem; }
.sc-live-tag { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font-size: .62rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--on-screen); background: var(--on-screen-bg); border-radius: var(--r-full); }
.sc-live-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); animation: sf-pulse 2s ease-in-out infinite; }
.sc-unit-check, .sc-unit-open { position: absolute; top: 6px; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--on-screen); background: var(--on-screen-bg); border-radius: var(--r-sm); }
.sc-unit-check { left: 6px; cursor: pointer; }
.sc-unit-check input { margin: 0; cursor: pointer; }
.sc-unit-open { right: 6px; }
.sc-unit-open .icon { width: 14px; height: 14px; }
.sc-unit-open:hover { color: var(--accent); }
.sc-units-grid.dense { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s-2); }
.sc-units-grid.dense .sc-unit-line, .sc-units-grid.dense .sc-use { display: none; }
.sc-units-grid.dense .sc-unit-info { padding: 6px 7px 7px; gap: 4px; }
.sc-units-grid.dense .sc-unit-id { font-size: .82rem; }
.sc-units-grid.dense .badge { height: 19px; padding: 0 6px; font-size: .72rem; }
.sc-units-grid.dense .sc-unit-check, .sc-units-grid.dense .sc-unit-open { top: 4px; width: 22px; height: 22px; }
.sc-units-grid.dense .sc-unit-check { left: 4px; }
.sc-units-grid.dense .sc-unit-open { right: 4px; }
.sc-units-grid.dense .sc-live-tag { display: none; }
.sc-units .segmented button { height: 24px; padding: 0 7px; }
.sc-unit-info { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; padding: 8px 10px 10px; }
.sc-unit-id { display: flex; align-items: baseline; gap: 6px; width: 100%; min-width: 0; }
.sc-unit-id .num { color: var(--faint); font-size: .8rem; }
.sc-unit-id .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 620; }
.sc-unit-line { width: 100%; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-use { display: flex; align-items: center; gap: 6px; width: 100%; font-size: .8rem; }
.sc-use .num { font-weight: 620; }
.sc-use .mem { color: var(--muted); font-weight: 400; }
.sc-use.wide .k { flex: none; width: 58px; }
.sc-use.wide .num { flex: none; min-width: 52px; text-align: right; }
.sc-selbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.sc-sel-info { flex: 1 1 200px; min-width: 0; color: var(--muted); font-size: .86rem; }
.sc-sel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }

/* live feed */
.sc-live { flex: 2 1 440px; }
.sc-live-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); font-weight: 620; }
.sc-live-title .num { color: var(--faint); font-weight: 400; }
.sc-live .sc-head h2 { margin-right: 0; }
.sc-live-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-4); }
.sc-live-stage { flex: 1 1 250px; min-width: 0; display: flex; justify-content: center; }
.sc-live-stage .live { width: 100%; }
.sc-live-stage .live-surface { max-width: 264px; }
.sc-live-stage .live.side .live-keys { margin-top: 0; }
.sc-live-stage > .empty { padding: var(--s-6) var(--s-3); }
.sc-live-off { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); width: 100%; max-width: 264px; aspect-ratio: 9 / 16; padding: var(--s-4); text-align: center; color: var(--muted); font-size: .88rem; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md); }
.sc-live-off strong { color: var(--text); overflow-wrap: anywhere; }
.sc-live-off .icon { color: var(--faint); }
.sc-live-side { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.sc-live-use { display: flex; flex-direction: column; gap: 6px; }
.sc-live-use:empty { display: none; }
.sc-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sc-group { display: flex; flex-direction: column; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--border); min-width: 0; }
.sc-group select, .sc-group input[type="text"], .sc-group input[type="number"] { min-width: 0; max-width: 100%; }
.sc-target { color: var(--muted); font-size: .84rem; line-height: 1.4; }

/* resources, capacity, tasks, status */
.sc-res-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.sc-res { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--accent); }
.sc-res.memory { color: var(--ok); }
.sc-res.gpu { color: var(--accent-2); }
.sc-res.vram { color: var(--warn); }
.sc-res-text { display: flex; flex-direction: column; min-width: 0; }
.sc-res .k { overflow: hidden; text-overflow: ellipsis; }
.sc-res .v { color: var(--text); font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.2rem; font-weight: 650; line-height: 1.2; }
.sc-res .sub { color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-res .spark { height: 30px; color: inherit; }
.sc-cap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }
.sc-cap .gauge { width: 124px; height: 124px; }
.sc-cap .gauge-value { font-size: 1.9rem; }
.sc-limits { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.sc-limit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--s-2); align-items: center; font-size: .82rem; }
.sc-limit .track { grid-column: 1 / -1; flex: none; }
.sc-limit .num { color: var(--muted); }
.sc-limit.first .k { color: var(--warn); }
.sc-mix { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.sc-mix:empty { display: none; }
.sc-mix .sc-limit .k { overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; font-size: .8rem; font-weight: 550; color: var(--muted); }
.sc-limit.first .fill { background: var(--warn); }
.sc-task { flex-wrap: wrap; }
.sc-task .title { flex: 1 1 90px; }
.sc-task .count { flex: none; color: var(--muted); font-size: .8rem; }
.sc-task .track { flex: 1 0 100%; }
.sc-task-icon { flex: none; display: inline-flex; color: var(--muted); }
.sc-task.done .sc-task-icon, .sc-task.done .fill { color: var(--ok); }
.sc-task.done .fill { background: var(--ok); }
.sc-task.failed .sc-task-icon { color: var(--fail); }
.sc-task.running .sc-task-icon { color: var(--info); }
.sc-row-1 > .sc-resources { flex-grow: 1.2; }
.sc-status-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: center; gap: var(--s-4); }
.donut { position: relative; flex: none; width: 132px; height: 132px; }
.donut svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 13; }
.donut .donut-track { stroke: var(--surface-3); }
.donut .donut-part { transition: stroke-dasharray var(--t-slow) var(--ease), stroke-dashoffset var(--t-slow) var(--ease); }
.donut .gauge-value { font-size: 1.9rem; }
.part-ok { stroke: var(--ok); background: var(--ok); }
.part-info { stroke: var(--info); background: var(--info); }
.part-warn { stroke: var(--warn); background: var(--warn); }
.part-fail { stroke: var(--fail); background: var(--fail); }
.part-idle { stroke: var(--idle); background: var(--idle); }
.sc-legend { flex: 1 1 120px; max-width: 260px; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: .88rem; }
.sc-legend li { display: flex; align-items: center; gap: 8px; }
.sc-legend .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.sc-legend .num { font-weight: 620; min-width: 1.6em; }
.sc-legend .l { flex: 1; color: var(--muted); }
.sc-legend .pct { color: var(--faint); font-weight: 400; font-size: .8rem; text-align: right; }

/* timeline, alerts, console */
.sc-events { list-style: none; margin: 0; padding: 0 0 0 4px; max-height: 252px; overflow-y: auto; font-size: .84rem; }
.sc-events li { position: relative; display: flex; gap: var(--s-3); padding: 5px 0 5px 16px; border-left: 1px solid var(--border); }
.sc-events li::before { content: ""; position: absolute; left: -4px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--idle); }
.sc-events li.ok::before { background: var(--ok); }
.sc-events li.warn::before { background: var(--warn); }
.sc-events li.fail::before { background: var(--fail); }
.sc-events li.you::before { background: var(--accent); }
.sc-events .at { flex: none; color: var(--faint); font-family: var(--mono); font-size: .78rem; line-height: 1.6; }
.sc-events .what { min-width: 0; overflow-wrap: anywhere; }
.sc-alerts .segmented button { height: 24px; padding: 0 8px; font-size: .82rem; }
.sc-alert { align-items: flex-start; color: var(--text); text-decoration: none; font-size: .88rem; line-height: 1.4; }
.sc-alert:hover strong { text-decoration: underline; }
.sc-alert .icon { margin-top: 2px; color: var(--warn); }
.sc-alert.fail .icon { color: var(--fail); }
.sc-alert .body { min-width: 0; overflow-wrap: anywhere; }
.sc-clear { color: var(--muted); font-size: .88rem; }
.sc-console-out { flex: 1; min-height: 150px; max-height: 214px; overflow-y: auto; padding: 8px 10px; font-family: var(--mono); font-size: .78rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md) var(--r-md) 0 0; }
.sc-console-out .cmd { color: var(--text); }
.sc-console-out .ok { color: var(--ok); }
.sc-console-out .err { color: var(--fail); }
.sc-console-in { display: flex; align-items: center; gap: var(--s-2); padding: 0 10px; background: var(--surface-2); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); }
.sc-console-in .prompt { color: var(--accent); font-family: var(--mono); font-weight: 650; }
.sc-console-in input { flex: 1; min-width: 0; height: 32px; padding: 0; font-family: var(--mono); font-size: .82rem; background: transparent; border: 0; border-radius: 0; }
.sc-console-in input:focus-visible { outline-offset: -1px; }
.sc-nothing { padding: var(--s-6); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }

@media (max-width: 1500px) {
  .sc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sc-row-1 > .sc-panel, .sc-row-2 > .sc-panel { flex: 1 1 calc(50% - var(--s-3)); }
}
@media (max-width: 760px) {
  .sc-row-1 > .sc-panel, .sc-row-2 > .sc-panel { flex-basis: 100%; }
}
@media (max-width: 640px) {
  .sc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
  .sc-kpi { padding: 10px; }
  .sc-kpi .v { font-size: 1.4rem; }
  .sc-kpi-icon, .sc-ring { width: 34px; height: 34px; }
  .sc-bars { width: 44px; }
  .sc-units { min-height: 460px; }
  .sc-units-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc-units .search { flex-basis: 100%; max-width: none; }
}
