/* Autonomous Hub (autonomous_hub.js) and the Pause-everything banner (shell.js). Tokens only — the palette
   lives in styles.css :root. Motion stays under 250 ms; reduced motion turns it off. */

.ah { display: flex; flex-direction: column; gap: 22px; max-width: 1280px; }
.ah-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ah-head-text { flex: 1; min-width: 260px; }
.ah-head-text h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.ah-head-text p { margin: 0; font-size: 13px; color: var(--text-2); max-width: 640px; line-height: 1.5; }
.ah-head-actions { display: flex; gap: 8px; }

.ah-machine { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ah-machine .ui-stat { min-width: 0; height: 100%; }
.ah-stat-wrap { display: flex; }
.ah-stat-wrap .ui-stat { flex: 1; }

.ah-section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ah-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.ah-section-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.ah-bulk { display: inline-flex; gap: 6px; margin-left: auto; }

.ah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.ah-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--sep); cursor: pointer; transition: box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out); }
.ah-card:hover { box-shadow: inset 0 0 0 1px var(--sep-strong); }
.ah-card:active { transform: scale(.99); }
.ah-card.is-open { box-shadow: inset 0 0 0 1px var(--accent-sep); }
.ah-card-head, .ah-drawer-head { display: flex; align-items: flex-start; gap: 10px; }
.ah-card-icon { flex: none; width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; font-size: 16px;
  color: var(--accent); background: var(--accent-fill); box-shadow: inset 0 0 0 1px var(--accent-sep); }
.ah-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ah-card-name { all: unset; font-size: 14px; font-weight: 700; cursor: pointer; border-radius: var(--r-xs); align-self: flex-start; }
.ah-card-name:hover { color: var(--accent-text); }
.ah-card-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ah-drawer-head .ah-card-title b { font-size: 14px; }
.ah-card-title span { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.ah-card-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.ah-card-note { display: flex; gap: 6px; align-items: center; margin: 0; font-size: 12px; color: var(--orange); }
.ah-card-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.ah-card-facts div { min-width: 0; }
.ah-card-facts dt { font-size: 11px; color: var(--text-3); }
.ah-card-facts dd { margin: 2px 0 0; font-size: 12.5px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-card-foot { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.ah-spark { width: 84px; height: 22px; flex: none; }
.ah-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.ah-pill-neutral { --tone: var(--text-2); }
.ah-pill-teal { --tone: var(--teal); }
.ah-pill-orange { --tone: var(--orange); }
.ah-pill-red { --tone: var(--red); }
.ah-pill-yellow { --tone: var(--yellow); }

.ah-switch { position: relative; flex: none; display: inline-flex; cursor: pointer; }
.ah-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ah-switch span { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--fill-3); transition: background-color var(--dur-fast) var(--ease-out); }
.ah-switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text);
  transition: transform var(--dur-fast) var(--ease-out); }
.ah-switch input:checked + span { background: var(--accent-strong); }
.ah-switch input:checked + span::after { transform: translateX(16px); }
.ah-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ah-switch input:disabled + span { opacity: .45; cursor: not-allowed; }

.ah-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ah-inbox, .ah-feed, .ah-budget { padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--sep); }
.ah-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ah-list > li + li { border-top: 1px solid var(--sep); }
.ah-feed .ah-list { max-height: 520px; overflow: auto; }

.ah-approval { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.ah-check { margin-top: 3px; accent-color: var(--accent); }
.ah-approval-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.ah-approval-body b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ah-approval-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.ah-feed-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 0; font-size: 12px; }
.ah-feed-row > i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--fill-2); color: var(--text-2); font-size: 12px; }
.ah-feed-row.is-bad > i { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.ah-feed-row div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ah-feed-row b { font-weight: 600; font-size: 12.5px; overflow-wrap: anywhere; }
.ah-feed-row span { color: var(--text-2); overflow-wrap: anywhere; }
.ah-feed-row time { color: var(--text-3); font-size: 11px; }

.ah-budget-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: end; }
.ah-budget-item { display: flex; flex-direction: column; gap: 8px; }
.ah-budget-save { display: flex; justify-content: flex-end; }
.ah-own-cap { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.ah-own-cap .ui-field { flex: 1; min-width: 160px; }
.ah-batch { margin: 4px 0 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text-2); }
.ah-batch li { overflow-wrap: anywhere; }

.ah-drawer-back { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 55%, transparent); animation: ah-fade var(--dur-ui) var(--ease-out); }
.ah-drawer { position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--surface-2); box-shadow: -1px 0 0 var(--sep), -24px 0 48px color-mix(in srgb, var(--bg) 60%, transparent);
  animation: ah-slide var(--dur-modal) var(--ease-drawer); }
.ah-drawer-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--sep); }
.ah-drawer-body { flex: 1; overflow: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.ah-drawer-body h4 { margin: 6px 0 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.ah-drawer-body p { margin: 0; font-size: 12.5px; line-height: 1.5; }
.ah-drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes ah-fade { from { opacity: 0; } }
@keyframes ah-slide { from { transform: translateX(24px); opacity: 0; } }

/* Pause everything, on every screen (shell.js rbPausedBannerHtml, rbStatusHtml) */
.rb-seg-pause { gap: 4px; color: var(--red); }
.rb-seg-pause i { font-size: 12px; }
.rb-paused { display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: 12.5px; color: var(--text);
  background: color-mix(in srgb, var(--orange) 14%, transparent); border-bottom: 1px solid var(--orange-sep); }
.rb-paused > i { font-size: 16px; color: var(--orange); }
.rb-paused span { flex: 1; min-width: 0; }

@media (max-width: 900px) {
  .ah-cols { grid-template-columns: minmax(0, 1fr); }
  .ah-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .ah-machine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ah-approval { flex-wrap: wrap; }
  .ah-approval-actions { width: 100%; justify-content: flex-start; padding-left: 24px; }
  .ah-card-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rb-paused { padding: 8px 12px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .ah-card, .ah-switch span, .ah-switch span::after { transition: none; }
  .ah-drawer, .ah-drawer-back { animation: none; }
}

/* Your tasks — what the operator assigned Jarvis (task_log) */
.ah-task { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.ah-task > .ui-pill { flex: none; margin-top: 1px; }
.ah-task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.ah-task-body b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ah-task-body .text-muted i { margin-right: 2px; }
.ah-task-next { display: inline-flex; align-items: baseline; gap: 5px; color: var(--text-2); overflow-wrap: anywhere; }
.ah-task-next i { flex: none; color: var(--accent-text); }
.ah-task.is-closed .ah-task-body b { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.ah-task-filter { display: inline-flex; gap: 4px; margin-left: auto; }
@media (max-width: 720px) {
  .ah-task { flex-wrap: wrap; }
  .ah-task .ah-approval-actions { width: 100%; justify-content: flex-start; padding-left: 0; }
}
