:root {
  color-scheme: dark;
  --bg: #0f1419;
  --bg-glow: #172033;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e6edf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --ok: #3fb950;
  --bad: #f85149;
  --paused: #e0922f;
  --on-ok: #0c1a10;
  --on-accent: #0d1420;
  --sidebar: rgba(15, 20, 25, 0.72);
  --input: #0f1419;
  --scroll-track: #152033;
  --scroll-thumb: #3d8bfd;
  --accent-soft: rgba(61, 139, 253, 0.16);
  --accent-softer: rgba(61, 139, 253, 0.08);
  --overlay: rgba(8, 12, 18, 0.72);
  --shadow: rgba(0, 0, 0, 0.28);
  --panel-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
  --grid-head: #0c1219;
  --grid-alt: rgba(255, 255, 255, 0.045);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at top, var(--bg-glow) 0%, var(--bg) 55%);
  color: var(--text);
}

a { color: inherit; }

.app {
  height: 100%;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  padding: 1.15rem 1.1rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.health-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--muted);
}

.health-dot[data-state="ok"] { background: var(--ok); }
.health-dot[data-state="warn"] { background: var(--paused); }
.health-dot[data-state="bad"] { background: var(--bad); }

.brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.nav {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 0.7rem;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.nav::-webkit-scrollbar { width: 8px; }

.nav::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 8px;
}

.nav::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 2px solid var(--scroll-track);
  border-radius: 8px;
}

.nav::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.nav-group + .nav-group { margin-top: 0.85rem; }

.nav-label {
  margin: 0 0.45rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  color: var(--text);
}

.nav-item-text {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.nav-ico {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.nav-ico svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

.nav-ico-dashboard { background: #3d8bfd; }
.nav-ico-tasks { background: #e0922f; }
.nav-ico-runs { background: #148f99; }
.nav-ico-aid { background: #7a4de0; }
.nav-ico-playbooks { background: #5b6ee1; }
.nav-ico-services { background: #2b9a5b; }
.nav-ico-tickets { background: #e07a2f; }
.nav-ico-reports { background: #2f7de1; }
.nav-ico-rl { background: #1f9d8a; }
.nav-ico-audit { background: #d64545; }
.nav-ico-billing { background: #d4a017; }
.nav-ico-settings { background: #6d7c93; }
.nav-ico-superadmin { background: #9a3d6a; }
.nav-ico-dev { background: #4458c7; }

.nav-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
  cursor: grab;
}

.nav-row:active { cursor: grabbing; }

.nav-row.is-dragging { opacity: 0.4; }

.nav-row.is-drop-before { box-shadow: inset 0 3px 0 var(--accent); }

.nav-row.is-drop-after { box-shadow: inset 0 -3px 0 var(--accent); }

.nav-row .nav-item {
  flex: 1;
  min-width: 0;
  padding-right: 0.1rem;
}

.nav-row:has(.nav-item.current) {
  background: var(--accent-soft);
}

.nav-item.current {
  background: transparent;
  font-weight: 600;
}

.nav-star {
  width: 1.7rem;
  height: 1.7rem;
  margin-right: 0.2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}

.nav-star svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.nav-star[aria-pressed="true"] {
  color: #e2b340;
}

.nav-star[aria-pressed="true"] svg {
  fill: currentColor;
  stroke: currentColor;
}

.nav-fav-empty {
  margin: 0 0.45rem 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.nav-favorites.has-items .nav-fav-empty { display: none; }

.nav-favorites {
  margin: 0 -0.1rem 0.2rem;
  padding: 0.45rem 0.4rem 0.6rem;
  border-radius: 12px;
  background: rgba(226, 179, 64, 0.12);
  border: 1px solid rgba(226, 179, 64, 0.34);
}

.nav-favorites .nav-label { color: #e7c56a; }

.nav-favorites + .nav-group {
  margin-top: 0.95rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(226, 179, 64, 0.4);
}

.page-dashboard .main-inner { max-width: 1120px; }

.page-dashboard .lanes {
  margin-top: 0.55rem;
  gap: 0.55rem;
}

.page-dashboard .lane h2 {
  margin: 0 0 0.28rem;
  font-size: 0.7rem;
}

.page-dashboard .ranges {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.page-dashboard .lane-sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.15rem 0 0.55rem;
}

.page-dashboard .card {
  padding: 0.38rem 0.65rem 0.42rem;
  border-radius: 8px;
}

.page-dashboard .card h3 {
  font-size: 0.78rem;
  line-height: 1.2;
}

.page-dashboard .card .value,
.page-dashboard a.value {
  margin-top: 0.08rem;
  font-size: 1.05rem;
  line-height: 1.15;
}

.page-dashboard .card p {
  margin: 0.08rem 0 0;
  font-size: 0.75rem;
  line-height: 1.25;
}

.page-dashboard .stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem 1.5rem;
  padding: 0.85rem 1rem 0.95rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
}

.page-dashboard .stat-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  row-gap: 0.1rem;
  align-items: center;
}

.page-dashboard .stat-cell-spin { grid-template-columns: 33px minmax(0, 1fr); }
.page-dashboard .stat-cell-rate { grid-template-columns: 36px minmax(0, 1fr); }

.page-dashboard .stat-mark {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
}

.page-dashboard .stat-label {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-dashboard .stat-value {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.page-dashboard .stat-spin {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: conic-gradient(#3d8bfd, #3fb950, #e0922f, #7a4de0, #3d8bfd);
  -webkit-mask: radial-gradient(circle, transparent 11.2px, #000 12.2px);
  mask: radial-gradient(circle, transparent 11.2px, #000 12.2px);
  animation: stat-spin-turn 4.5s linear infinite;
}

@keyframes stat-spin-turn { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .page-dashboard .stat-spin { animation: none; }
}

.page-dashboard .stat-gauge { width: 36px; height: 22px; overflow: visible; }

.page-dashboard .stat-gauge-track,
.page-dashboard .stat-gauge-value {
  fill: none;
  stroke-width: 4.8;
  stroke-linecap: round;
}

.page-dashboard .stat-gauge-track { stroke: color-mix(in srgb, var(--muted) 35%, transparent); }
.page-dashboard .stat-gauge-value { stroke: var(--ok); }
.page-dashboard .stat-pie-arrax { fill: var(--accent); }
.page-dashboard .stat-pie-msp { fill: color-mix(in srgb, var(--muted) 55%, var(--text)); }
.page-dashboard .stat-pie-track { fill: color-mix(in srgb, var(--muted) 28%, transparent); }

.chart-card { margin-top: 0.75rem; }

.chart-card h3 { margin: 0; font-size: 1rem; }

.chart-card > p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.chart-svg { width: 100%; height: auto; display: block; margin-top: 0.55rem; }

.page-dashboard .lane-metrics { margin-top: 0.75rem; }

.chart-gridline { stroke: var(--border); stroke-width: 1; }

.chart-axis { fill: var(--muted); font-size: 8px; font-family: "Segoe UI", system-ui, sans-serif; }

.chart-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }

.chart-area-ok { fill: #3fb950; fill-opacity: 0.28; stroke: none; }

.chart-line-ok, .chart-dot-ok { stroke: #3fb950; }
.chart-line-bad, .chart-dot-bad { stroke: #f85149; }
.chart-line-bad { stroke-width: 1.5; }
.chart-dot-ok { fill: #3fb950; }
.chart-dot-bad { fill: #f85149; }

.chart-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.35rem;
}

.chart-legend i, .swatch-ok, .swatch-bad {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  border-radius: 2px;
  vertical-align: -1px;
}

.swatch-ok { background: #3fb950; }
.swatch-bad { background: #f85149; }

/* How runs were chosen: donut + percentage legend, side by side, stacked on a narrow card. */
.chart-pie-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-top: 0.9rem;
}
.chart-pie-donut { flex: 0 1 150px; width: 150px; max-width: 100%; height: auto; }
.chart-pie-track { fill: none; stroke: var(--border); stroke-width: 15; opacity: 0.45; }
.chart-pie-donut .chart-slice { stroke-width: 15; transition: stroke-width 0.15s ease, opacity 0.15s ease; }
.chart-pie-donut:hover .chart-slice { opacity: 0.55; }
.chart-pie-donut .chart-slice:hover { opacity: 1; stroke-width: 18; }
.chart-pie-legend {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 220px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.chart-pie-legend li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 0.5rem;
}
.chart-pie-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; }
.chart-pie-dot-det { background: #3d8bfd; }
.chart-pie-dot-ai { background: #7a4de0; }
.chart-pie-name { color: var(--text); font-size: 0.86rem; }
.chart-pie-percent { font-size: 1.25rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-pie-count { grid-column: 2 / 4; color: var(--muted); font-size: 0.75rem; }
.chart-pie-none { margin-top: 0.9rem; }

.chart-slice {
  fill: none;
  stroke-width: 22;
}

.chart-slice-det { stroke: #3d8bfd; }
.chart-slice-ai { stroke: #7a4de0; }
.chart-note { fill: var(--muted); font-size: 11px; font-family: "Segoe UI", system-ui, sans-serif; }

.sla-chart { margin-top: 0.8rem; display: grid; gap: 0.35rem; }
.sla-chart p { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin: 0.35rem 0 0; font-size: 0.75rem; }
.sla-chart p span { min-width: 0; }
.sla-chart p b { flex: 0 0 auto; }
.sla-chart .muted { display: block; margin-top: 0.45rem; }
.sla-track { display: block; width: 100%; height: 0.7rem; border-radius: 999px; background: var(--input); }
.sla-det { fill: #3d8bfd; }
.sla-ai { fill: #7a4de0; }

.gauge-track { fill: none; stroke: var(--border); stroke-width: 14; stroke-linecap: round; }
.gauge-value { fill: none; stroke-width: 14; }
.gauge-needle { stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; }
.gauge-hub { fill: var(--text); }
.gauge-percent { fill: var(--text); font-size: 9px; font-weight: 700; font-family: "Segoe UI", system-ui, sans-serif; }

.chart-missing { margin-top: 1rem; }

@media (max-width: 980px) {
  .chart-grid { grid-template-columns: 1fr; }
}

.badge {
  min-width: 1.3rem;
  text-align: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.75rem;
  padding: 0.05rem 0.35rem;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 0.85rem 0.9rem 1rem;
}

.dev-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.dev-link .nav-item-text { flex: 1; }

.dev-link span { color: var(--muted); font-weight: 400; }

.main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 1.35rem 1.5rem 1.75rem;
}

.main-inner { max-width: 1080px; }

.page-head { padding-right: 3.2rem; }

.page-head h2 { margin: 0; font-size: 1.7rem; }

.page-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.45;
}

.banner {
  margin: 1rem 0 0;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--border);
}

.banner.error { border-color: var(--bad); }
.banner.ok { border-color: var(--ok); }

.ranges, .filters, .subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.ranges a, .filters a, .subnav a, .btn, button.btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--accent-softer);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

button.btn:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.ranges a.current, .filters a.current, .subnav a.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.page-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.page-tabs-bar .page-tabs {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
}

.page-tabs-bar .btn {
  flex: 0 0 auto;
  margin-bottom: 0.35rem;
}

.page-tabs,
.run-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-tab,
.run-tab {
  display: inline-flex;
  align-items: center;
  margin: 0 0.15rem -1px 0;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.page-tab:hover,
.run-tab:hover {
  color: var(--text);
}

.page-tab.current,
.run-tab.current {
  color: var(--text);
  font-weight: 600;
  background: var(--panel);
  border-color: var(--border);
  border-bottom-color: var(--panel);
}

.grid-table tbody tr.run-row,
.grid-table tbody tr.playbook-row { cursor: pointer; }

.playbook-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
  margin-bottom: 5px;
}

.playbook-toolbar .playbook-add {
  margin-left: auto;
}

.playbook-add {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  border-radius: 999px;
  border-color: #0a0e14;
  border-width: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.35);
}

.playbook-new-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.playbook-new-head h3 { margin: 0; }

.playbook-new-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.playbook-new-close:hover {
  color: var(--text);
  border-color: var(--accent);
}

.playbook-new-card textarea {
  min-height: 14rem;
  font-family: var(--mono, ui-monospace, Consolas, monospace);
  font-size: 0.82rem;
}

.playbook-leave-overlay {
  z-index: 46;
}

.playbook-leave-card {
  width: min(420px, 100%);
}

.playbook-leave-card p {
  margin: 0.75rem 0 0;
  line-height: 1.45;
}

.playbook-leave-card .vault-actions {
  margin-top: 1rem;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.sort-control .sort-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sort-control select {
  width: auto;
  min-width: 10rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
}

.lanes {
  margin-top: 1rem;
  display: grid;
  gap: 1.35rem;
}

.lane h2 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.lane .grid { margin-top: 0; }

.card.tone-ok {
  background: #d9f2df;
  border-color: #8fbf9a;
  color: #1c3324;
}

.card.tone-warn {
  background: #f8e7c4;
  border-color: #e0b56a;
  color: #3a2a12;
}

.card.tone-bad {
  background: #f8d6d3;
  border-color: #e09a94;
  color: #3d221f;
}

.card.tone-ok p,
.card.tone-warn p,
.card.tone-bad p {
  color: inherit;
  opacity: 0.78;
}

.card, .panel, .lock-card, .auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
}

.card,
.panel,
.lock-card,
.auth-card,
.aid-card,
.aid-advanced,
.aid-legend,
.aid-ticket,
.aid-reuse-card,
.aid-editor-card,
.aid-confirm-card,
.aid-processing,
.wait-card,
.ps-area,
.ps-deploy-card,
.vault-card,
.task-decision {
  box-shadow: var(--panel-shadow);
}

.card h3, .panel h3 { margin: 0; font-size: 0.95rem; }

.card .value, a.value {
  display: block;
  margin-top: 0.55rem;
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
}

.card p, .muted { color: var(--muted); }

.card p { margin: 0.45rem 0 0; font-size: 0.84rem; line-height: 1.4; }

.stack { margin-top: 1rem; display: grid; gap: 0.75rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th { color: var(--muted); font-weight: 600; font-size: 0.78rem; }

a.run-id,
.short-id {
  font-family: ui-monospace, Consolas, monospace;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.audit-detail {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  font-weight: 700;
}

.status-running,
.status-triaging { color: var(--accent); }

.status-paused { color: var(--paused); }

.status-success { color: var(--ok); }

.status-failed { color: var(--bad); }

.status-cancelled { color: var(--muted); }
/* Ticket lifecycle: open = blue, closed = green, reopen = red. */
.status-open { color: var(--accent); }
.status-closed { color: var(--ok); }
.status-reopened,
.status-reopen { color: var(--bad); }

.priority-high { color: var(--bad); font-weight: 700; }
.priority-normal,
.priority-medium { color: var(--paused); font-weight: 700; }
.priority-low { color: var(--ok); font-weight: 700; }

.status-approved,
.status-applied,
.status-scheduled { color: var(--ok); }

.status-new,
.status-acknowledged { color: var(--accent); }

.status-rejected { color: var(--bad); }

.status-pending { color: var(--paused); }

time.local-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

form.stack label, .lock-card label, .auth-card label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.84rem;
  color: var(--muted);
}

form.stack label[hidden],
.auth-card label[hidden],
.auth-card .btn[hidden],
.auth-card button.btn[hidden] {
  display: none !important;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}

input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--bad);
}

.field-error {
  color: var(--bad);
  font-size: 0.8rem;
}

input[type="checkbox"] {
  width: auto;
  margin: 0;
  justify-self: start;
}

label:has(input[type="checkbox"]) {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  justify-self: start;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
}

pre.json {
  overflow: auto;
  background: var(--input);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.graph { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.45rem; }

.graph-step {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  display: grid;
  gap: 0.15rem;
}

.graph-step.is-start { border-color: var(--accent); }
.graph-step.is-selected { background: rgba(61, 139, 253, 0.12); }
.graph-step span, .graph-step em { color: var(--muted); font-size: 0.82rem; font-style: normal; }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.6rem; }

.mail-account {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}
.mail-account dt { color: var(--muted); }
.mail-account dd { margin: 0; word-break: break-all; }

.cleanup-lead { margin: 1rem 0 0; }

.cleanup-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

a.btn.btn-danger,
button.btn.btn-danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.access-lead { margin: 1rem 0 0; }

.access-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.access-toolbar p { margin: 0; }

.access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.access-actions .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.78rem;
}

.access-name-cell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
}

.access-name {
  min-width: 0;
  flex: 1 1 auto;
}

.access-menu {
  position: relative;
  flex: 0 0 auto;
}

.access-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.access-menu-btn:hover,
.access-menu-btn[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--border);
  background: var(--accent-softer);
}

.access-menu-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.access-menu-panel {
  position: fixed;
  z-index: 40;
  min-width: 10.5rem;
  padding: 0.3rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px var(--shadow);
}

.access-menu-panel[hidden] {
  display: none !important;
}

.access-menu-panel a {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.84rem;
  white-space: nowrap;
}

.access-menu-panel a:hover,
.access-menu-panel a:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.access-menu-panel a.is-danger {
  color: var(--bad);
}

.grid-table tbody tr.access-user-row,
.grid-table tbody tr.access-group-row {
  cursor: pointer;
}

.grid-table tbody tr.access-user-row:hover,
.grid-table tbody tr.access-group-row:hover {
  background: rgba(61, 139, 253, 0.08);
}

.access-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.access-drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.access-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  width: min(36rem, 100%);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 28px var(--shadow);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

.access-drawer.is-open {
  transform: translateX(0);
}

.access-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 0 0 auto;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.access-drawer-head strong {
  font-size: 1rem;
  min-width: 0;
}

.access-drawer-body {
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding: 1.1rem 1.15rem 1.5rem;
}

.access-drawer .form-grid {
  grid-template-columns: 1fr;
}

.access-drawer .form-grid .span-2 {
  grid-column: 1;
}

@media (min-width: 720px) {
  .access-drawer .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .access-drawer .form-grid .span-2 {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .access-drawer,
  .access-drawer-scrim {
    transition: none;
  }
}

.role-source {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.member-picks {
  display: grid;
  gap: 0.35rem;
  max-height: 16rem;
  overflow: auto;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

.purge-warn {
  margin: 0.2rem 0 0;
  font-weight: 700;
}

.grid-table td[data-col="select"],
.grid-table th[data-col="select"] {
  width: 1%;
  white-space: nowrap;
}

.lock-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 1rem;
}

.wait-overlay[hidden] {
  display: none !important;
}

.wait-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--overlay);
}

.wait-card {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  min-width: 9rem;
  padding: 1.25rem 1.75rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.wait-card p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.wait-spin {
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: wait-spin 0.7s linear infinite;
}

@keyframes wait-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .wait-spin { animation: none; border-top-color: var(--accent); }
}

.lock-card, .auth-card { width: min(420px, 100%); }

.auth-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card h2 { margin: 0; }
.auth-card p { color: var(--muted); line-height: 1.45; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.empty { margin-top: 1rem; color: var(--muted); }

@media (max-width: 800px) {
  .app { flex-direction: column; height: auto; min-height: 100%; }
  .sidebar { width: auto; flex-basis: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding-right: 4.2rem; }
  .nav { display: flex; gap: 1rem; }
  .nav-group { min-width: max-content; }
  .split { grid-template-columns: 1fr; }
}

/* ---- AI Aid: the learning workspace ------------------------------------------------------------ */

:root {
  --aid-info: #9b8cff;
  --aid-write: #f2a25c;
  --aid-panel-2: #141c2a;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.mono-sm { font-family: var(--mono); font-size: 0.78rem; }

.aid-queue { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.55rem; }

.aid-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 46;
  display: grid;
  place-items: center;
  /* A margin wide enough to aim at: clicking it is how the dialog is left (Niv 2026-11-12). */
  padding: 2rem 4.5rem;
  background: var(--overlay);
}

.aid-editor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  /* The dialog fills the screen but for the overlay's small margin (Niv 2026-11-12): the map
     inside scales to the width it gets, so every pixel kept back made the steps smaller. */
  width: 100%;
  max-height: calc(100vh - 4rem);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
}

.aid-editor-bar {
  flex: 0 0 auto;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0.65rem 1.15rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.aid-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.9rem 1.15rem 1.25rem;
}

.aid-editor-close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  text-decoration: none;
  font-size: 1.35rem;
  line-height: 1;
}

.aid-editor-close:hover { border-color: var(--accent); color: var(--accent); }

.aid-editor-card .aid-head {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

html.aid-editor-open .main { overflow: hidden; }

.run-detail-row > td { padding: 0.3rem 0 0.2rem; border: 0; background: transparent; }
.btn .wait-spin { display: inline-block; vertical-align: -0.15em; width: 0.9em; height: 0.9em; border-width: 2px; margin-right: 0.35em; }
.run-selected, .aid-selected { scroll-margin-top: 0.75rem; }
.task-fail-table tbody tr.task-row { cursor: pointer; }
.task-fail-table tbody tr.task-row:hover { background: rgba(61, 139, 253, 0.08); }

.aid-ticket {
  display: grid;
  gap: 0.3rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  background: var(--aid-panel-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.aid-ticket:hover { border-color: var(--accent); }

.aid-ticket.current { border-left-color: var(--accent); background: rgba(61, 139, 253, 0.1); }

.aid-ticket-title { font-weight: 600; font-size: 0.95rem; }

.aid-ticket-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem 0.5rem; color: var(--muted); font-size: 0.8rem; }

.aid-tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.aid-tag.ok { background: rgba(63, 185, 80, 0.16); color: var(--ok); }
.aid-tag.wait { background: rgba(224, 146, 47, 0.16); color: var(--paused); }
.aid-tag.bad { background: rgba(248, 81, 73, 0.16); color: var(--bad); }
.aid-tag.info { background: rgba(155, 140, 255, 0.16); color: var(--aid-info); }

.aid-tag.drafting {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(61, 139, 253, 0.16);
  color: var(--accent);
}

.aid-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: aid-pulse-dot 1.1s ease-in-out infinite;
}

@keyframes aid-pulse-dot {
  0%, 100% { transform: scale(0.7); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
}

.aid-ticket.is-drafting { cursor: default; border-left-color: var(--accent); background: rgba(61, 139, 253, 0.1); }

/* the drafting state: unmissable, alive, and the queue is locked while it runs */
.aid-processing {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 1.1rem;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(61, 139, 253, 0.14), rgba(61, 139, 253, 0.04) 55%);
}

.aid-processing .wait-spin { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-width: 4px; }

.aid-processing-text { display: grid; gap: 0.3rem; min-width: 0; }

.aid-processing-title { margin: 0; font-size: 1.1rem; font-weight: 700; }

.aid-processing #aid-status { margin: 0; font-size: 0.86rem; line-height: 1.45; }

.aid-ellipsis i { font-style: normal; animation: aid-ellipsis 1.2s infinite; }
.aid-ellipsis i:nth-child(2) { animation-delay: 0.2s; }
.aid-ellipsis i:nth-child(3) { animation-delay: 0.4s; }

@keyframes aid-ellipsis {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}

.aid-processing.aid-failed { border-color: var(--paused); background: rgba(224, 146, 47, 0.08); box-shadow: none; }
.aid-processing.aid-failed .wait-spin { display: none; }
.aid-processing.aid-failed .aid-ellipsis { display: none; }
.aid-processing.aid-failed .aid-processing-title { font-size: 0.95rem; }

.aid-processing.aid-nudge { animation: aid-nudge 0.5s ease; }

/* approve asks twice */
.aid-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--overlay);
}

.aid-confirm-overlay[hidden] { display: none; }

.aid-confirm-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--ok);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  display: grid;
  gap: 0.7rem;
}

.aid-confirm-card h3 { margin: 0; font-size: 1.1rem; }

.aid-confirm-card p { margin: 0; font-size: 0.9rem; line-height: 1.5; }

.aid-confirm-card .row-actions { margin-top: 0.3rem; }

/* Run Control's popups (leave-with-edits, run-with-edits) reuse this card for one look
   everywhere, but must float above the run modal AND the drawer handle (.run-ai-float, z 41) —
   the base overlay's 40 is not enough there. Slightly wider than AI Aid's 460px so the three
   leave buttons (~425px with their icons) stay on ONE line. */
.aid-confirm-overlay.run-overlay-top { z-index: 90; }
.aid-confirm-overlay.run-overlay-top .aid-confirm-card { width: min(540px, 100%); }

@keyframes aid-nudge {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.02); box-shadow: 0 0 0 4px rgba(61, 139, 253, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
  .aid-pulse-dot, .aid-ellipsis i { animation: none; }
  .aid-processing.aid-nudge { animation: none; }
}

.aid-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.aid-head h4 { margin: 0; font-size: 1.25rem; line-height: 1.3; }

.aid-subtitle { margin: 0.3rem 0 0; font-size: 0.85rem; }

button.btn.aid-approve,
a.btn.aid-approve {
  border-color: var(--ok);
  background: var(--ok);
  color: var(--on-ok);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 1.3rem;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(63, 185, 80, 0.35);
}

button.btn.aid-approve:hover,
a.btn.aid-approve:hover { background: #4fd162; border-color: #4fd162; }

/* Promote: the blue sibling of the green approve — the maturity step forward. */
.btn.aid-promote {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 1.3rem;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(61, 139, 253, 0.35);
}

.btn.aid-promote:hover { background: #5ea1ff; border-color: #5ea1ff; color: #fff; }

/* A blocked Promote (unproven experimental): the button keeps its normal size and place in the
   header; the reason only appears while the pointer rests on it. Disabled buttons swallow mouse
   events, so the hover lives on the wrapper. */
.promote-gate { position: relative; display: inline-flex; }
.promote-gate .btn.aid-promote[disabled] { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.promote-gate .btn.aid-promote[disabled]:hover { background: var(--accent); border-color: var(--accent); }
.promote-gate-tip {
  /* Below the button, not above: the header sits at the top of the editor overlay, so an
     above-the-button tip clips against the card edge. */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: max-content;
  max-width: 280px;
  padding: 10px 13px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 6px 18px var(--shadow);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}
.promote-gate:hover .promote-gate-tip { opacity: 1; visibility: visible; }

.aid-board { display: grid; gap: 0.85rem; margin-top: 1rem; min-width: 0; }

.aid-card {
  background: var(--aid-panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  min-width: 0;
  overflow: hidden;
}

form.aid-card, details.aid-card { margin-top: 0.85rem; }

.aid-card-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.aid-card-head h4 { margin: 0; font-size: 0.95rem; }

.aid-card-head code { color: var(--muted); font-size: 0.75rem; }

.aid-card-head .muted { font-size: 0.78rem; }

.aid-advanced {
  background: var(--aid-panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem 0.85rem;
}

.aid-advanced summary {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}

.aid-advanced summary::-webkit-details-marker,
.aid-details summary::-webkit-details-marker { display: none; }

.aid-advanced summary::marker,
.aid-details summary::marker { content: none; }

.aid-advanced summary::before,
.aid-details summary::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  vertical-align: 0.12rem;
}

.aid-advanced[open] > summary::before,
.aid-details[open] > summary::before {
  transform: rotate(45deg);
  vertical-align: 0.18rem;
}

.aid-advanced-body {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.aid-advanced-body > .aid-card { margin-top: 0; }

.aid-details summary { cursor: pointer; font-size: 0.92rem; font-weight: 600; list-style: none; }

.aid-details[open] > summary { margin-bottom: 0.6rem; }

.aid-details > summary.aid-card-head {
  align-items: center;
  margin-bottom: 0;
}

.aid-details > summary.aid-card-head::before { margin-right: 0.15rem; vertical-align: 0; }

.aid-details[open] > summary.aid-card-head { margin-bottom: 0.7rem; }

/* the chat: every revision is a turn between the technician and Learning */
.aid-chat-card { border-color: rgba(61, 139, 253, 0.35); }

.aid-chat {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.aid-chat::-webkit-scrollbar { width: 8px; }
.aid-chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.aid-chat::-webkit-scrollbar-track { background: transparent; }

.aid-chat .msg {
  max-width: 82%;
  padding: 0.55rem 0.8rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.aid-chat .msg.user {
  align-self: flex-end;
  background: rgba(61, 139, 253, 0.18);
  border: 1px solid rgba(61, 139, 253, 0.5);
  border-bottom-right-radius: 4px;
}

.aid-chat .msg.agent {
  align-self: flex-start;
  display: grid;
  gap: 0.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--aid-info);
  border-bottom-left-radius: 4px;
}

.aid-chat .who-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--aid-info);
  margin-right: 0.35rem;
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.18);
}

.aid-step-panel[hidden] { display: none; }

.aid-history { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.7rem; }

.aid-history .btn { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

.aid-history .btn:disabled { opacity: 0.4; }

.aid-history-hint { font-size: 0.75rem; }

/* the auto-save chip: every change, undo and redo lands as a stored revision, and this says so */
.aid-autosave {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.aid-cloud {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  display: block;
}

.btn .aid-cloud { margin-right: 0.35rem; }

.aid-autosave .wait-spin { width: 0.85rem; height: 0.85rem; border-width: 2px; }

.aid-autosave.saved { color: var(--ok); animation: aid-saved-pop 0.35s ease; }

@keyframes aid-saved-pop {
  from { transform: scale(0.88); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

.aid-chat .msg-who {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* a turn above the head: undone, redo can bring it back, the next change deletes it */
.aid-chat .msg.undone { opacity: 0.45; }
.aid-chat .msg.system {
  align-self: center;
  color: var(--paused);
  font-style: italic;
  font-size: 0.8rem;
  text-align: center;
  background: rgba(224, 146, 47, 0.08);
  border: 1px dashed rgba(224, 146, 47, 0.4);
  border-radius: 10px;
  padding: 0.3rem 0.7rem;
}

.aid-chat .dots { display: inline-flex; gap: 4px; padding: 0.25rem 0; }

.aid-chat .dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: aid-bounce 1.2s infinite;
}

.aid-chat .dots i:nth-child(2) { animation-delay: 0.15s; }
.aid-chat .dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes aid-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .aid-chat .dots i { animation: none; }
}

.aid-chat-input {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  margin-top: 0.7rem;
}

.aid-chat-input textarea {
  flex: 1;
  resize: none;
  border-radius: 12px;
  min-height: 2.6rem;
}

.aid-chat-input textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.aid-send {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.22);
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
}

.aid-send:hover { background: rgba(61, 139, 253, 0.34); }

.aid-chat-status { margin: 0.4rem 0 0; font-size: 0.8rem; min-height: 1em; }

/* tables inside the aid cards keep their own rhythm */
.aid-table { font-size: 0.84rem; }

.aid-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }

.aid-table td { border-bottom-color: rgba(45, 58, 79, 0.6); overflow-wrap: anywhere; }

.aid-notes { margin: 0; padding-left: 1.1rem; font-size: 0.88rem; display: grid; gap: 0.3rem; }

.aid-bar {
  display: inline-block;
  width: 80px;
  height: 8px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 0.4rem;
  overflow: hidden;
}

.aid-bar i { display: block; height: 100%; background: var(--ok); }

/* the graph: one SVG scaled to the card width, laid out top to bottom */
.graph-wrap { padding: 0.2rem 0; overflow-x: auto; position: relative; }

/* overflow visible: a hover-revealed input box on the rightmost column may poke past the
   viewBox; everything permanent is laid out inside it. */
svg.graph { display: block; width: 100%; height: auto; min-width: 540px; margin-inline: auto; overflow: visible; }

svg.graph .node { cursor: pointer; }

/* drag one runnable step onto another and they trade places */
svg.graph .node.swappable { touch-action: none; }
.graph-wrap.swap-mode { cursor: grabbing; user-select: none; }
/* dragging a step that may not trade places: the step itself frames red, the whole drag says no */
.graph-wrap.swap-mode.swap-denied { cursor: not-allowed; }
svg.graph .node rect.box { fill: var(--panel); stroke: var(--border); stroke-width: 1.2; }
svg.graph .node.selected rect.box, svg.graph .node:hover rect.box { stroke: var(--accent); stroke-width: 2; }
/* the dragged step follows the pointer and lets it through, so the step underneath can be found */
svg.graph .node.dragging { pointer-events: none; opacity: 0.85; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35)); }
svg.graph .node.dragging rect.box { stroke: var(--accent); stroke-width: 2; }
/* the step underneath: green when the two may trade places, red when they may not */
svg.graph .node.swap-ok rect.box, svg.graph .node.swap-ok:hover rect.box { stroke: var(--ok); stroke-width: 3; }
svg.graph .node.swap-bad rect.box, svg.graph .node.swap-bad:hover rect.box { stroke: var(--bad); stroke-width: 3; }
svg.graph .node.dragging.swap-bad rect.box { stroke: var(--bad); stroke-width: 3; }
.graph-wrap.swap-mode svg.graph .node.swap-bad { cursor: not-allowed; }
svg.graph text { fill: var(--text); }
svg.graph .kind { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; fill: var(--muted); }
svg.graph .id { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
svg.graph .detail { font-size: 12px; fill: var(--muted); }
svg.graph .out-bg { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
svg.graph .out-title { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; fill: var(--accent); }
svg.graph .out-line { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
svg.graph .out-more { font-style: italic; fill: var(--accent); }
svg.graph .out-arrow { stroke: var(--border); stroke-width: 1.5; }
svg.graph .input-box { cursor: pointer; }
svg.graph .input-box:hover .out-bg { stroke: var(--accent); fill: var(--panel-hover, var(--panel)); }
/* The input peek (run control): the box beside a step hides behind an eye badge on the
   node's right edge; hovering or tapping the badge reveals it. A { } badge = no input.
   The bridge is an invisible hover area between badge and box so :hover survives the gap. */
svg.graph .input-peek .input-box, svg.graph .input-peek .out-arrow { display: none; }
svg.graph .input-peek:hover .input-box, svg.graph .input-peek:hover .out-arrow,
svg.graph .input-peek.peek-open .input-box, svg.graph .input-peek.peek-open .out-arrow { display: inline; }
svg.graph .peek-bridge { fill: none; pointer-events: all; }
svg.graph .peek-dot { cursor: pointer; }
svg.graph .peek-dot .peek-ring { fill: var(--panel); stroke: var(--accent); stroke-width: 1.5; }
svg.graph .peek-dot .peek-eye { fill: none; stroke: var(--accent); stroke-width: 1.6; }
svg.graph .peek-dot .peek-pupil { fill: var(--accent); }
svg.graph .input-peek:hover .peek-ring, svg.graph .input-peek.peek-open .peek-ring { stroke: var(--text); }
svg.graph .input-peek:hover .peek-eye, svg.graph .input-peek.peek-open .peek-eye { stroke: var(--text); }
svg.graph .input-peek:hover .peek-pupil, svg.graph .input-peek.peek-open .peek-pupil { fill: var(--text); }
svg.graph .peek-none { cursor: default; }
svg.graph .peek-none .peek-ring { fill: var(--panel); stroke: var(--border); stroke-width: 1.5; }
svg.graph .peek-none text { font-family: var(--mono); font-size: 10px; font-weight: 600; fill: var(--muted); }
/* the ⓘ on a step's right edge: hovering it floats the plain-words explanation over the map */
svg.graph .desc-dot { cursor: help; }
svg.graph .desc-dot circle { fill: var(--panel); stroke: var(--muted); stroke-width: 1.5; }
svg.graph .desc-dot text { font-family: var(--mono); font-size: 10.5px; font-weight: 700; font-style: italic; fill: var(--muted); }
svg.graph .desc-dot:hover circle { stroke: var(--text); }
svg.graph .desc-dot:hover text { fill: var(--text); }
/* the floating explanation: inverted neutral, so it reads as a tooltip — not a Learning chat
   bubble (purple) and not an input box (blue). Positioned by JS via the CSSOM (CSP). */
.graph-tip { position: absolute; z-index: 30; width: max-content; max-width: 340px; padding: 10px 13px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12.5px; line-height: 1.45; box-shadow: 0 6px 18px var(--shadow); pointer-events: none; }
.graph-tip b { display: block; font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-bottom: 3px; }
.graph-tip-title { font-weight: 700; font-size: 13px; color: var(--accent); margin-bottom: 4px; }
.graph-tip-line { margin: 3px 0 0; opacity: 0.95; }
.graph-tip-warn { font-weight: 650; }
/* the same sentence in the run step inspector */
#run-step-panel .run-step-desc { margin: 0.2rem 0 0.4rem; padding-left: 0.6rem; border-left: 3px solid var(--muted); }
svg.graph .err-bg { fill: color-mix(in srgb, var(--bad) 12%, var(--panel)); stroke: var(--bad); stroke-width: 1; }
svg.graph .err-title { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; fill: var(--bad); }
svg.graph .err-line { font-family: var(--mono); font-size: 10.5px; fill: var(--bad); }
/* the note the run left for the ticket, under the ending it reached (run-graph.js endNoteSvg) */
svg.graph .end-note-bg { fill: color-mix(in srgb, var(--bad) 10%, var(--panel)); stroke: var(--bad); stroke-width: 1; }
svg.graph .end-note-title { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; fill: var(--bad); }
svg.graph .end-note-line { font-size: 11.5px; fill: var(--text); }
svg.graph .end-note-ok .end-note-bg { fill: color-mix(in srgb, var(--ok) 10%, var(--panel)); stroke: var(--ok); }
svg.graph .end-note-ok .end-note-title { fill: var(--ok); }
svg.graph .num { font-family: var(--mono); font-size: 12px; font-weight: 600; fill: var(--muted); }
svg.graph path.edge { fill: none; stroke-width: 2; }
svg.graph path.edge { stroke: var(--muted); }
svg.graph path.edge.on_reject, svg.graph path.edge.on_timeout { stroke-dasharray: 6 5; }
svg.graph path.edge.catch { stroke-dasharray: 3 4; }
svg.graph .edge-clock circle, .legend-clock circle { fill: var(--panel); stroke: var(--paused); stroke-width: 2; }
svg.graph .edge-clock path, .legend-clock path { fill: none; stroke: var(--paused); stroke-width: 2; stroke-linecap: round; }
svg.graph .type-icon { font-size: 26px; }
svg.graph .type-icon.glyph { fill: var(--muted); font-weight: 700; }
svg.graph .edge-plus { cursor: pointer; }
svg.graph .edge-plus circle { fill: var(--panel); stroke: var(--line-strong); stroke-width: 1.5; }
svg.graph .edge-plus path { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
svg.graph .edge-plus:hover circle { stroke: var(--accent); fill: rgba(61, 139, 253, 0.18); }
svg.graph .edge-plus:hover path { stroke: var(--accent); }
svg.graph .edge-label rect { fill: var(--panel); stroke: var(--border); }
svg.graph .edge-label text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
svg.graph .start-flag text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
/* merged endings (graph-common.js mergeEndings): one Done box and one Failed box stand for every
   ending. Two outlines behind the box make it read as a stack; the ×N pill says how many. */
svg.graph .node.end-merged rect.stack { fill: var(--panel); stroke: var(--border); stroke-width: 1.2; }
svg.graph .node.end-ok rect.box, svg.graph .node.end-ok rect.stack { stroke: color-mix(in srgb, var(--ok) 60%, var(--border)); }
svg.graph .node.end-bad rect.box, svg.graph .node.end-bad rect.stack { stroke: color-mix(in srgb, var(--bad) 60%, var(--border)); }
svg.graph .node.end-ok .type-icon.glyph, svg.graph .node.end-ok .id { fill: var(--ok); }
svg.graph .node.end-bad .type-icon.glyph, svg.graph .node.end-bad .id { fill: var(--bad); }
svg.graph .node.end-merged.selected rect.box, svg.graph .node.end-merged:hover rect.box { stroke: var(--accent); }
svg.graph .end-count rect { fill: var(--panel); stroke: var(--border); }
svg.graph .end-count text { font-family: var(--mono); font-size: 11px; font-weight: 600; fill: var(--muted); }
svg.graph .end-more { cursor: pointer; }
svg.graph .end-more rect { fill: var(--panel); stroke: var(--border); }
svg.graph .end-more text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
svg.graph .end-more:hover rect { stroke: var(--accent); }
svg.graph .end-more:hover text { fill: var(--accent); }
/* the line a run actually took into its ending: red into a failed ending, green into success,
   with its label in the same colour — the "why" of a merged box */
svg.graph path.edge.taken-bad { stroke: var(--bad); stroke-width: 3; }
svg.graph path.edge.taken-ok { stroke: var(--ok); stroke-width: 3; }
svg.graph .edge-label.taken-bad rect { stroke: var(--bad); stroke-width: 1.5; }
svg.graph .edge-label.taken-bad text { fill: var(--bad); font-weight: 700; }
svg.graph .edge-label.taken-ok rect { stroke: var(--ok); stroke-width: 1.5; }
svg.graph .edge-label.taken-ok text { fill: var(--ok); font-weight: 700; }
/* hovering an ending in the list lights its line(s) and quiets the rest */
.graph-wrap.edges-focus svg.graph path.edge { opacity: 0.2; }
.graph-wrap.edges-focus svg.graph path.edge.edge-hot { opacity: 1; stroke: var(--accent); stroke-width: 3; }
.graph-wrap.edges-focus svg.graph .edge-label { opacity: 0.35; }
.endings-pop { position: absolute; z-index: 36; width: min(27rem, 80vw); max-height: 340px; overflow-y: auto; overscroll-behavior: contain; padding: 0.6rem 0.6rem 0.5rem; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 10px 28px var(--shadow); }
.endings-pop.endings-ok { border-color: var(--ok); }
.endings-pop.endings-bad { border-color: var(--bad); }
.endings-pop > b { display: block; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 0 0.3rem; }
.endings-pop.endings-ok > b { color: var(--ok); }
.endings-pop.endings-bad > b { color: var(--bad); }
.endings-sub { margin: 0.15rem 0 0.4rem; padding: 0 0.3rem; font-size: 0.76rem; color: var(--muted); }
.endings-row { display: block; width: 100%; margin: 0; padding: 0.4rem 0.45rem; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; }
.endings-row + .endings-row { margin-top: 2px; }
button.endings-row { cursor: pointer; }
.endings-row:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.endings-row.endings-reached { border-color: var(--border); }
.endings-id { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; overflow-wrap: anywhere; }
.endings-here { margin-left: 0.5rem; padding: 0.05rem 0.4rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
.endings-note { display: block; margin-top: 0.15rem; font-size: 0.8rem; line-height: 1.4; }
.endings-meta { display: block; margin-top: 0.15rem; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); overflow-wrap: anywhere; }
/* the "playbook start" sign above the first step: a label only — no clicks, no hover, no menu.
   Styled as a dashed accent pill so it reads as a marker, never as a step box. */
svg.graph .pstart { pointer-events: none; }
svg.graph .pstart-box { fill: rgba(61, 139, 253, 0.12); stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 7 5; }
svg.graph .pstart-label { font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; fill: var(--accent); }
svg.graph path.edge.pstart-edge { stroke: var(--accent); stroke-dasharray: 6 5; pointer-events: none; }
/* the message dot on a step's LEFT edge (and on the playbook-start pill): this step's own slice
   of the requester dialog. Green: it reads as messages with the client, never Learning (purple). */
svg.graph .convo-dot { cursor: pointer; }
svg.graph .convo-dot circle { fill: var(--panel); stroke: var(--ok); stroke-width: 1.6; }
svg.graph .convo-dot text { font-family: var(--mono); font-size: 9.5px; font-weight: 700; fill: var(--ok); }
svg.graph .convo-dot:hover circle { fill: color-mix(in srgb, var(--ok) 14%, var(--panel)); }
/* the floating per-step conversation: INTERACTIVE, unlike .graph-tip (no pointer-events:none) —
   the reader can move the mouse into it and scroll a long dialog. Positioned by JS via the
   CSSOM (CSP drops inline style attributes). */
.convo-tip { position: absolute; z-index: 35; width: min(26rem, 70vw); max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: 0.6rem 0.75rem; border: 1px solid var(--ok); border-radius: 12px; background: var(--panel); box-shadow: 0 10px 28px var(--shadow); }
/* The title stays pinned while a long dialog scrolls under it: the tip itself is the scroll
   container, so the header is sticky at its top. The negative margins stretch it over the tip's
   padding and its own background covers the rows sliding beneath. */
.convo-tip > b { display: block; position: sticky; top: -0.6rem; z-index: 1; font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin: -0.6rem -0.75rem 0.35rem; padding: 0.6rem 0.75rem 0.4rem; background: var(--panel); border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.convo-tip-sub { margin: -0.2rem 0 0.4rem; font-size: 0.78rem; }
/* the step the last run failed on, when the draft came back from a failed experimental run */
svg.graph .node.run-failed rect.box { stroke: var(--bad); stroke-width: 2; }
svg.graph .fail-flag text { font-family: var(--mono); font-size: 10.5px; font-weight: 600; fill: var(--bad); }
/* the skill matcher's preview: what approve would do with each step's action */
svg.graph .node.skill-missing rect.box { stroke: var(--bad); stroke-dasharray: 5 4; }
svg.graph .missing-flag text { font-family: var(--mono); font-size: 10.5px; font-weight: 600; fill: var(--bad); }
svg.graph .bind-flag text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
/* the technician's decision: the one thing the task page is for */
.task-decision {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--paused);
  border-left-width: 5px;
  border-radius: 10px;
  background: rgba(224, 146, 47, 0.08);
}
.task-decision .task-question { margin: 0; font-size: 1.15rem; font-weight: 650; line-height: 1.4; }
.task-decision .muted { margin: 0; }
.task-decide-form { display: grid; gap: 10px; }
.task-decide-form textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.task-decide-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.task-btn { font-size: 1rem; padding: 10px 26px; font-weight: 650; }

.task-fail-table td { vertical-align: top; }
.task-scale { white-space: nowrap; }

.task-level {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.task-level.high { background: rgba(248, 81, 73, 0.16); color: var(--bad); }
.task-level.mid { background: rgba(224, 146, 47, 0.16); color: var(--paused); }
.task-level.low { background: rgba(63, 185, 80, 0.16); color: var(--ok); }

.task-ellipsis {
  display: block;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-reason {
  max-width: 22rem;
  line-height: 1.4;
}

.task-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.task-row-actions .btn {
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
}
.task-reject { border-color: var(--bad); color: var(--bad); background: transparent; }
.task-reject:hover { background: rgba(248, 81, 73, 0.12); }

/* the run as a picture: what happened to each step (Run Control) */
svg.graph .node.run-done rect.box { stroke: var(--ok); stroke-width: 1.6; }
svg.graph .node.run-waiting rect.box { stroke: var(--paused); stroke-width: 2; stroke-dasharray: 7 4; }
svg.graph .node.run-dim { opacity: 0.45; }
svg.graph .state-flag text { font-family: var(--mono); font-size: 10.5px; font-weight: 600; }
svg.graph .state-flag.state-done text { fill: var(--ok); }
svg.graph .state-flag.state-failed text { fill: var(--bad); }
svg.graph .state-flag.state-waiting text { fill: var(--paused); }
/* Start + breakpoint markers are rendered on every node but hidden; the .start-pick and
   .has-bp classes reveal them. They sit AROUND the box so each step keeps its own
   green/red status colour — the markers never recolour the step. */
svg.graph .bp-ring, svg.graph .bp-badge, svg.graph .bp-label,
svg.graph .start-ring, svg.graph .start-banner,
svg.graph .paused-ring, svg.graph .paused-banner { display: none; }
svg.graph .node.has-bp .bp-ring,
svg.graph .node.has-bp .bp-badge,
svg.graph .node.has-bp .bp-label { display: inline; }
svg.graph .node.start-pick .start-ring,
svg.graph .node.start-pick .start-banner { display: inline; }
svg.graph .node.paused-here .paused-ring,
svg.graph .node.paused-here .paused-banner { display: inline; }
/* breakpoint = red dashed ring + pause badge on the left edge + label below */
svg.graph .bp-ring { fill: none; stroke: var(--bad); stroke-width: 2.4; stroke-dasharray: 7 5; }
svg.graph .bp-badge circle { fill: var(--bad); stroke: var(--panel); stroke-width: 2; }
svg.graph .bp-badge .bp-bar { fill: #fff; }
svg.graph .bp-label { font-family: var(--mono); font-size: 10.5px; font-weight: 600; fill: var(--bad); }
/* The ⏸ badge is each step's own pause SWITCH. Whenever pausing is allowed at all (.bp-can on
   the wrap — a live/paused run, or a finished run in Debug) it shows on every step: grey and
   hollow while the pause is OFF, the usual solid red once it is ON (.has-bp). */
.graph-wrap.bp-can svg.graph .bp-badge { display: inline; cursor: pointer; }
/* …but never where a pause is impossible: the chosen start (the RUN FROM HERE step) and the
   steps a re-run from it would never reach (.bp-na, set by run-graph.js). */
.graph-wrap.bp-can svg.graph .node.bp-na .bp-badge { display: none; }
.graph-wrap.bp-can svg.graph .node:not(.has-bp) .bp-badge circle { fill: var(--panel); stroke: var(--muted); stroke-width: 1.6; }
.graph-wrap.bp-can svg.graph .node:not(.has-bp) .bp-badge .bp-bar { fill: var(--muted); }
.graph-wrap.bp-can svg.graph .node:not(.has-bp) .bp-badge:hover circle { stroke: var(--bad); }
.graph-wrap.bp-can svg.graph .node:not(.has-bp) .bp-badge:hover .bp-bar { fill: var(--bad); }
.graph-wrap.bp-can svg.graph .node.has-bp .bp-badge:hover circle { fill: var(--panel); stroke: var(--bad); }
.graph-wrap.bp-can svg.graph .node.has-bp .bp-badge:hover .bp-bar { fill: var(--bad); }
/* the chosen start step = green ring + a big "START RUN HERE" banner pointing down at it */
svg.graph .start-ring { fill: none; stroke: var(--ok); stroke-width: 3; }
svg.graph .start-banner rect, svg.graph .start-banner path { fill: var(--ok); }
svg.graph .start-banner text { fill: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; }
/* On the run map the draggable RUN FROM HERE chip (parked beside the start step) IS that step's
   marker, so the old in-SVG "START RUN HERE" banner and ring are hidden there. */
#run-graph svg.graph .node.start-pick .start-banner,
#run-graph svg.graph .node.start-pick .start-ring { display: none; }
/* where the run is paused right now = amber ring + a big "PAUSED HERE" banner pointing at it */
svg.graph .paused-ring { fill: none; stroke: var(--paused); stroke-width: 3.4; }
svg.graph .paused-banner rect, svg.graph .paused-banner path { fill: var(--paused); }
svg.graph .paused-banner text { fill: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
/* the debug toolbar: a sticky bar DOCKED FLUSH under the frame header, like a code debugger's
   controls. It bleeds over the modal body's padding (1.1rem top + the .run-panel .stack's 1rem
   margin, 1.25rem sides) so the space above it is zero at rest AND while stuck. As a rounded
   floating card it sat ~2.1rem below the header until the scroll pinned it at 0 — the gap
   visibly jumped while scrolling, and the map slid past in the side gutters (Niv: bad UX). */
.run-debug-bar {
  position: sticky;
  /* -1.1rem: the scrollport is the PADDING box, so top:0 would pin the bar 1.1rem (the body's
     padding-top) below the header with the map sliding past in that strip. Pulling the stuck
     position up by exactly that padding keeps the bar glued to the header's border. */
  top: -1.1rem;
  z-index: 4;
  background: var(--panel);
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1.25rem;
  margin: -2.1rem -1.25rem 0.7rem;
  display: grid;
  gap: 0.45rem;
}
/* The Run/Debug TABS across the top of the bar: two worlds, one lit at a time. Picking the
   other tab switches worlds — leaving debug needs no button of its own. */
.run-mode-tabs {
  display: flex;
  gap: 0.3rem;
  margin: -0.55rem -1.25rem 0;  /* matches the bar's side padding, so the tab rail spans it */
  padding: 0.4rem 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.run-mode-tab {
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: none;
  color: var(--muted);
  padding: 0.4rem 1rem;
  margin-bottom: -1px;  /* the lit tab's edges meet the strip's border line */
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.run-mode-tab:hover { color: var(--text); }
.run-mode-tab.current {
  border-color: var(--border);
  border-bottom: 1px solid var(--panel);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
}

.run-debug-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.run-debug-btns .rdb-form { margin: 0; }
.run-debug-bar .btn { font-size: 0.85rem; }
/* .btn sets display:inline-flex, which beats the [hidden] attribute — restore hiding */
.run-debug-bar .btn[hidden] { display: none; }
/* the floating per-step menu in manual mode (same look as AI Aid's node actions) */
#run-node-actions {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
#run-node-actions .btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
#run-node-actions .run-menu-note { align-self: center; padding: 0 0.3rem; font-size: 0.75rem; color: var(--muted); }
/* a step whose parameters the technician edited for this run only */
svg.graph .edited-badge { display: none; }
svg.graph .node.step-edited .edited-badge { display: inline; }
svg.graph .edited-badge rect { fill: var(--accent); }
svg.graph .edited-badge text { fill: #fff; font-family: var(--mono); font-size: 10px; font-weight: 600; }
svg.graph .node.step-edited rect.box { stroke-dasharray: 5 3; }
/* the floating per-run edit panel (Edit input / Edit this step) */
#run-edit-panel {
  position: absolute;
  z-index: 6;
  display: grid;
  gap: 0.45rem;
  padding: 0.6rem 0.7rem;
  min-width: 280px;
  max-width: 440px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}
#run-edit-panel .run-edit-head { font-weight: 600; font-size: 0.85rem; }
.run-edit-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.run-edit-row span { flex: 0 0 9rem; color: var(--muted); font-family: var(--mono); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-edit-row input { flex: 1; min-width: 0; padding: 0.2rem 0.4rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.run-edit-json { width: 100%; min-height: 9rem; box-sizing: border-box; padding: 0.4rem; font-family: var(--mono); font-size: 0.78rem; resize: vertical; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.run-edit-err { margin: 0; color: var(--bad); font-size: 0.78rem; }
.run-edit-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
#run-edit-panel .btn { font-size: 0.8rem; padding: 0.2rem 0.6rem; }
/* the ask-the-assistant step editor: wider, scrollable */
#run-edit-panel.run-edit-wide { min-width: 340px; max-width: 460px; max-height: 70vh; overflow: auto; }
.run-edit-head .run-edit-tag { margin-left: 0.4rem; padding: 0.02rem 0.35rem; border-radius: 6px; background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 600; }
.run-edit-hint { margin: 0; font-size: 0.76rem; }
.run-edit-chats { display: grid; gap: 0.4rem; max-height: 14rem; overflow: auto; }
.run-edit-chat { display: grid; gap: 0.2rem; }
.run-edit-chat-you { align-self: end; justify-self: end; max-width: 90%; padding: 0.25rem 0.5rem; border-radius: 10px 10px 2px 10px; background: var(--accent); color: #fff; font-size: 0.8rem; }
.run-edit-chat-ai { align-self: start; max-width: 95%; padding: 0.25rem 0.5rem; border-radius: 10px 10px 10px 2px; background: color-mix(in srgb, var(--text) 8%, var(--panel)); color: var(--text); font-size: 0.8rem; }
.run-edit-ai { width: 100%; min-height: 4.5rem; box-sizing: border-box; padding: 0.4rem; font-size: 0.82rem; resize: vertical; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.run-edit-ai-status { align-self: center; font-size: 0.78rem; color: var(--muted); }
/* Run Control's in-page confirmations (run-with-edits, leave-with-edits) reuse AI Aid's
   .aid-confirm-overlay/.aid-confirm-card (one popup look everywhere) with the .run-overlay-top
   z-index modifier — see the aid confirm block. */
#run-edit-banner { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; margin: 0 0 0.5rem; padding: 0.35rem 0.7rem; border: 1px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); font-size: 0.8rem; }
#run-edit-banner .run-edit-banner-txt { min-width: 0; }
#run-edit-banner .btn { flex: 0 0 auto; font-size: 0.78rem; padding: 0.2rem 0.6rem; }
/* grouped run list: a ticket's earlier attempts, tucked under the latest run */
.attempt-toggle {
  margin-left: 0.5rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-softer);
  color: var(--muted);
  cursor: pointer;
}
.attempt-toggle:hover { border-color: var(--accent); color: var(--accent); }
tr.run-attempt-row > td { background: color-mix(in srgb, var(--muted) 6%, var(--panel)); }
tr.run-attempt-row .attempt-mark { color: var(--muted); font-size: 0.82rem; padding-left: 0.6rem; }
tr.attempt-collapsed { display: none; }
.run-debug-bar .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.run-debug-bar .rdb-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.run-debug-bar .rdb-primary:disabled { background: var(--panel); color: var(--text); border-color: var(--border); }
.run-debug-bar .rdb-stop { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
.run-debug-status { margin: 0; font-size: 0.82rem; color: var(--muted); }
/* Why a SUCCEEDED (closed) run's Run/Debug buttons are greyed out — shown inside the bar. */
.run-closed-note {
  margin: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.84rem;
  color: var(--text);
  background: color-mix(in srgb, var(--ok, #2e7d32) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--ok, #2e7d32) 35%, var(--border));
  border-radius: 8px;
}
.run-step-hint { font-size: 0.8rem; }
.run-scroll-hint { margin: 0 0 0.4rem; font-size: 0.8rem; }
/* the step inspector: sticks to the bottom of the run window while the map is in view,
   so clicking any step shows what it is and what you can do without scrolling */
#run-step-panel {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: var(--panel);
  box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.22);
  max-height: 45vh;
  overflow: auto;
}
.run-step-actions { display: grid; gap: 0.5rem; margin: 0.2rem 0; }
.run-step-action { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.run-step-action .btn { flex-shrink: 0; }
.run-step-action .muted { font-size: 0.8rem; }
.run-step-close { margin-left: auto; padding: 0.2rem 0.7rem; font-size: 0.78rem; }
.run-step-error { color: var(--bad); font-size: 0.85rem; }
.run-entry-head { margin: 10px 0 4px; font-size: 0.82rem; }

/* the reuse suggestion: a proven experimental that matches this ticket */
/* Feedback ticket 24: candidate outcome records and the "use as is" steer */
.aid-record { white-space: nowrap; }
.aid-dots { display: inline-flex; gap: 3px; margin: 0 4px; vertical-align: middle; }
.aid-dots i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.aid-dots i.ok { background: var(--ok); }
.aid-dots i.bad { background: var(--bad); }
.aid-steer {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: inherit;
}
.aid-steer:hover { text-decoration-thickness: 2px; }
.aid-passed-over { margin: 0 0 8px; }

.aid-reuse-card {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--ok);
  border-left-width: 4px;
  border-radius: 10px;
  background: rgba(63, 185, 80, 0.08);
}
/* The triage-match card as a collapsible below the retrieval table: collapsed by default so the
   graph keeps the focus; same green identity as .aid-reuse-card. */
details.aid-triage-details {
  margin-top: 0.85rem;
  padding: 10px 16px;
  border: 1px solid var(--ok);
  border-left-width: 4px;
  border-radius: 10px;
  background: rgba(63, 185, 80, 0.08);
}
.aid-triage-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
}
.aid-triage-details[open] summary { margin-bottom: 6px; }
.aid-triage-details .aid-reuse-body p { margin: 3px 0 0; font-size: 0.82rem; }
.aid-reuse-wrap { display: grid; gap: 10px; margin-bottom: 12px; }
.aid-reuse-lead { margin: 0; font-size: 0.9rem; }
.aid-reuse-card p { margin: 3px 0 0; font-size: 0.82rem; }
.aid-reuse-card form { margin: 0; }
.aid-reuse-body { flex: 1 1 320px; }
.aid-reuse-steps { margin-top: 6px; font-size: 0.8rem; }
.aid-reuse-steps summary { cursor: pointer; color: var(--accent); }
.aid-reuse-steps ol { margin: 6px 0 0; padding-left: 1.2rem; }
.aid-reuse-steps code { font-family: var(--mono); }

/* the inputs form inside the approve popup */
.aid-input-form { display: grid; gap: 8px; margin: 10px 0; text-align: start; }
.aid-input-form p { margin: 0; font-size: 0.8rem; }
.aid-input-form label { display: grid; gap: 3px; font-size: 0.8rem; }
.aid-input-form label span { font-family: var(--mono); color: var(--muted); }
.aid-input-form input { width: 100%; box-sizing: border-box; }
.aid-fail-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  padding: 10px 14px;
  border: 1px solid var(--bad);
  border-left-width: 4px;
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.08);
  font-size: 0.85rem;
}

.aid-graph-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: 0.45rem;
  padding: 0.15rem 0.05rem 0.25rem;
}

.aid-graph-row .graph-wrap { flex: 1; min-width: 0; }

/* The legend lives behind an (i) button in the map's top-left corner: it floats OVER the map
   when opened and takes no room from it — the map needs the full width to stay readable. */
.aid-graph-row { position: relative; }
.aid-legend-help { position: absolute; top: 0.35rem; left: 0.35rem; z-index: 6; }
.aid-legend-help > summary {
  list-style: none;
  width: 1.55rem;
  height: 1.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}
.aid-legend-help > summary::-webkit-details-marker { display: none; }
.aid-legend-help > summary:hover,
.aid-legend-help[open] > summary { border-color: var(--accent); color: var(--accent); }
.aid-legend-help > .aid-legend {
  position: absolute;
  top: 2rem;
  left: 0;
  width: 11.5rem;
  margin: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.aid-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 0 0 11.5rem;
  margin: 0.2rem 0 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  font-size: 0.74rem;
  color: var(--muted);
}

.aid-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

.aid-legend em { font-style: normal; font-size: 0.95rem; }

.aid-legend em.glyph { color: var(--muted); font-weight: 700; }

.aid-legend i.line { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--muted); }
.aid-legend i.line.reject { border-top-style: dashed; }
.aid-legend i.line.catch { border-top-style: dotted; }

body.page-aid .main-inner { max-width: 1460px; container-type: inline-size; }

.aid-flow-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.15rem;
  margin: 1.1rem 0 0;
}

.aid-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem 1.85rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--muted);
}

.aid-flow li {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--aid-panel-2);
}

.aid-flow li:not(:last-child)::after {
  content: "\2192";
  position: absolute;
  left: calc(100% + 0.4rem);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
}

.aid-flow li.current { border-color: var(--accent); color: var(--text); background: rgba(61, 139, 253, 0.12); }

.aid-flow-num {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 0.75rem;
}

.aid-flow li.current .aid-flow-num { background: var(--accent); }

.aid-layout {
  --drawer-w: min(390px, 100vw - 7rem);  /* the chat card's width — the handle's ride distance */
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  align-items: start;
}

.aid-main.aid-board { margin-top: 0; }

/* The assistant docks INSIDE the editor frame as a drawer handle: a purple tab with the
   Learning sparkle hugging the middle of the frame's inner right edge, with a chevron beside it
   pointing the way the drawer will move. CLICKING the handle opens the chat card flush against
   that edge and the handle slides to the card's left side with the chevron flipped; clicking
   again puts it away (no more hover/:focus-within popup). aid.js toggles .open on .aid-side.
   position:fixed escapes the frame's overflow:hidden; the right offset is the frame's inner
   edge — the dialog fills the screen (Niv 2026-11-12), so that is .aid-editor-overlay's side
   padding (4.5rem; 0.75rem at <=720px, overridden there), +1px the card's border, +14px so the tab parks just LEFT of the frame's own
   scrollbar instead of covering it (Niv 2026-10-21). Purple on purpose: this is the Learning
   assistant, not the client conversation (green) and not step data (blue). */
.aid-side {
  position: fixed;
  top: 50%;
  right: calc(4.5rem + 15px);
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
}

/* The handle RIDES the drawer (Niv 2026-10-20): it is an IN-FLOW flex child to the LEFT of the
   clip, so wherever the open panel actually lands (paddings, scrollbars) the tab hugs its left
   edge — no fixed-position math against the frame. Closed, the clip is 0 wide so the handle
   alone sits on the frame's inner edge. Opening plays a one-shot ride-in (from the clip's far
   edge, the same distance the panel travels, same 0.3s ease) so the tab slides out WITH the
   chat; closing transitions it back the same way while .aid-side-open holds the column. */
.aid-float-btn {
  flex: none;
  position: relative;  /* paints above the sliding card so the tab's flares hug its edge */
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.aid-side.open .aid-float-btn,
.run-ai-float.open .run-ai-fab {
  animation: ai-handle-ride-in 0.3s ease;
}
/* close: the grid folds AT ONCE (the board/map FLIPs to its true one-column layout in the
   same breath — ending on the real layout is what kills the end-of-close snap), while the
   aside is pinned for 320ms (.closing: position:fixed at the spot it stood, top/left set via
   CSSOM by aid.js / run-graph.js) so the panel finishes its slide floating above the growing
   graph — and the handle rides back with it */
.aid-side.closing,
.run-ai-float.closing {
  position: fixed;
  right: auto;
  transform: none;
}
/* the ride-back target is the handle's EXACT closed resting spot, measured at close start by
   aid.js / run-graph.js (--handle-dx/dy via CSSOM) — riding just the drawer width would end at
   the panel's old edge and hop (up + sideways) when the pin comes off */
.aid-side.closing .aid-float-btn,
.run-ai-float.closing .run-ai-fab {
  transform: translate(var(--handle-dx, var(--drawer-w)), var(--handle-dy, 0));
  transition: transform 0.3s ease;
}
@keyframes ai-handle-ride-in {
  from { transform: translateX(var(--drawer-w)); }
}

.aid-handle-arrow {
  width: 10px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.aid-float-btn:hover .aid-handle-arrow { stroke: var(--text); }
.aid-side.open .aid-handle-arrow { transform: rotate(180deg); }

.aid-handle-tab {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 4.8rem;
  background: var(--aid-info);
  border-radius: 1.2rem 0 0 1.2rem;
  box-shadow: 0 0 24px rgba(155, 140, 255, 0.55);
}

.aid-handle-tab svg { width: 1.4rem; height: 1.4rem; fill: #fff; }

/* the flared tips: concave corners that blend the tab into whatever it hugs — the screen edge
   when closed, the open card's left edge once the drawer is out */
.aid-handle-tab::before,
.aid-handle-tab::after {
  content: "";
  position: absolute;
  right: 0;
  width: 0.9rem;
  height: 0.9rem;
}

.aid-handle-tab::before {
  top: -0.9rem;
  border-bottom-right-radius: 0.9rem;
  box-shadow: 0 0.45rem 0 0 var(--aid-info);
}

.aid-handle-tab::after {
  bottom: -0.9rem;
  border-top-right-radius: 0.9rem;
  box-shadow: 0 -0.45rem 0 0 var(--aid-info);
}

/* The drawer panel slides out of a clipping window (.ai-drawer-clip — shared with Run Control's
   assistant): closed, the window is 0 wide; opening ANIMATES the width so the user sees the whole
   panel travel out of the handle, and the map give way with it, instead of snapping 0→1 (Niv).
   The panel keeps its full width inside, anchored to the frame edge (flex-end), so its content is
   revealed, never re-wrapped mid-slide. overflow-y stays visible so the panel's drop shadow isn't
   cut; visibility keeps the folded panel out of the tab order. */
.ai-drawer-clip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 0;
  overflow-x: clip;
  overflow-y: visible;
  visibility: hidden;
  transition: visibility 0s linear 0.3s;
}

/* The clip takes its full width in ONE step, together with the layout going two-column — so the
   map reflows/rescales once, not every frame. The width is driven by the LAYOUT open class (which
   aid.js/run-graph.js keep for the 320ms close fold), so the panel has room to slide back out
   before the clip collapses. The PANEL itself is what animates, on transform (GPU-composited), so
   the slide stays smooth no matter how large the map is. */
.aid-layout.aid-side-open > .aid-side > .ai-drawer-clip,
.run-flow-graph.run-ai-open > .run-ai-float > .ai-drawer-clip,
.aid-side.closing > .ai-drawer-clip,
.run-ai-float.closing > .ai-drawer-clip {
  visibility: visible;
  transition: visibility 0s;
}
/* exactly the panel's width: the in-flow handle to the clip's left adds its own ~3.4rem, so
   together they make the drawer column and the handle reads as the panel's pull. */
.aid-layout.aid-side-open > .aid-side > .ai-drawer-clip,
.aid-side.closing > .ai-drawer-clip { width: var(--drawer-w); }
.run-flow-graph.run-ai-open > .run-ai-float > .ai-drawer-clip,
.run-ai-float.closing > .ai-drawer-clip { width: var(--drawer-w); }

/* parked just off the right edge (clipped), slides in when the aside gets .open and back out when
   it loses it. transform only — no layout, no SVG re-raster per frame. Exactly 100%: the panel's
   travel then equals its own width, the same distance the handle travels, so the two move as one
   piece. */
.ai-drawer-clip > .aid-card,
.ai-drawer-clip > .run-ai-chat {
  transform: translateX(100%);
  transition: transform 0.3s ease;
  will-change: transform;
}
.aid-side.open > .ai-drawer-clip > .aid-card,
.run-ai-float.open > .ai-drawer-clip > .run-ai-chat {
  transform: translateX(0);
}

/* Docked (and while folding shut), the chat fills the body's visible height — run-graph.js sets
   the exact px height (sticky, so CSS can't know it); the 74vh cap must not clamp that. */
.run-flow-graph.run-ai-open .run-ai-chat,
.run-ai-float.closing .run-ai-chat { max-height: none; }

/* every side card (chat, review, publish) is the drawer's panel; [hidden] still wins so the
   wizard keeps showing one card at a time */
.aid-side .ai-drawer-clip > .aid-card {
  flex: none;
  width: min(390px, calc(100vw - 7rem));
  max-height: min(70vh, calc(100vh - 3rem));
  overflow-y: auto;
  border-radius: 12px;  /* free-standing beside the handle gap, so all four corners round */
  box-shadow: 0 10px 28px var(--shadow);
}

.aid-side .ai-drawer-clip > .aid-card[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ai-drawer-clip { transition: none; }
  .ai-drawer-clip > .aid-card,
  .ai-drawer-clip > .run-ai-chat { transition: none; }
  .aid-handle-arrow { transition: none; }
  .aid-float-btn, .run-ai-fab { transition: none; animation: none; }
  .aid-editor-body > .aid-head { transition: none; }
}

.aid-side .aid-chat { max-height: 45vh; overflow-y: auto; }

/* OPEN, the layout turns two-column: the graph column gives up the room (the SVG scales to its
   width) and the chat docks beside it. The second column only RESERVES the drawer's width
   (panel + ~3.4rem handle) — the aside itself is out of flow, pinned to the frame below.
   CLOSED, the handle alone rides the frame's inner edge and the graph has the full width back.
   aid.js toggles .aid-side-open on the layout together with .open on the aside. */
.aid-layout.aid-side-open { grid-template-columns: minmax(0, 1fr) calc(var(--drawer-w) + 3.4rem); }

.aid-layout.aid-side-open > .aid-side {
  /* The open panel NEVER scrolls with the body: it is pinned to the editor FRAME
     (.aid-editor-card, the nearest positioned ancestor — the frame itself does not scroll,
     only its body does), spanning it from under the bar to the bottom. So the panel always
     looks the same and the chat input is always on screen, graph small or tall; scrolling the
     body just slides the board under it (Niv 2026-10-22: sizing by 100vh was wrong — the
     frame is content-sized and smaller than the viewport, so the input sank below the fold). */
  position: absolute;
  top: 4rem;        /* the frame's top bar (~3.3rem) + air */
  right: 1.15rem;   /* the body's side padding */
  bottom: 1.25rem;  /* the body's bottom padding */
  transform: none;
  align-items: stretch;
}
.aid-layout.aid-side-open > .aid-side > .aid-float-btn { align-self: center; }

/* The pinned panel starts under the top bar, so it would paint over the header's right end —
   where Approve & Run lives — and the button vanished whenever the chat was open (Niv
   2026-11-03: the button must stay visible as long as approving is possible). The header gives
   up the panel's width while the drawer is open, so the button sits just LEFT of the chat; the
   padding eases over the same 0.3s the panel slides, so the button rides with it both ways.
   --drawer-w is restated on the body because .aid-layout (a sibling) scopes its own copy. */
.aid-editor-body { --drawer-w: min(390px, 100vw - 7rem); }
.aid-editor-body > .aid-head { transition: padding-right 0.3s ease; }
.aid-editor-card:has(.aid-layout.aid-side-open) > .aid-editor-body > .aid-head { padding-right: calc(var(--drawer-w) + 1rem); }
.aid-layout.aid-side-open > .aid-side > .ai-drawer-clip { align-items: stretch; }

.aid-layout.aid-side-open > .aid-side .ai-drawer-clip > .aid-card { border-radius: 12px; max-height: none; }
/* the chat card pins its input to the bottom; the log takes whatever height the card gives.
   flex-basis 0 keeps a LONG log from inflating the card (it scrolls inside instead). */
.aid-layout.aid-side-open > .aid-side .ai-drawer-clip > .aid-chat-card { display: flex; flex-direction: column; }
.aid-layout.aid-side-open > .aid-side .aid-chat { flex: 1 1 0; max-height: none; min-height: 8rem; }

/* Control run's "Edit with AI": the chat is a PERSISTENT side panel, not AI Aid's drawer
   (which would fold the conversation away mid-edit). */
/* The PAGE never scrolls here (Niv 2026-10-22, same ask as the drawer above): the layout fills
   the viewport's leftover height, the BOARD column scrolls inside itself, and the chat panel
   always sits whole on screen with its input at the bottom. page-run-aiedit comes from
   run-edit.php. */
body.page-run-aiedit .main { display: flex; flex-direction: column; }
body.page-run-aiedit .main-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.aid-layout.run-aiedit {
  grid-template-columns: minmax(0, 1fr) min(400px, 40%);
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
.run-aiedit .aid-main { min-height: 0; overflow-y: auto; }
.run-aiedit .aid-side { position: static; transform: none; z-index: auto; display: block; min-height: 0; }
.run-aiedit .aid-side .aid-float-btn { display: none; }
.run-aiedit .aid-side > .aid-card { display: block; width: auto; max-height: none; height: 100%; overflow-y: auto; border-radius: 12px; animation: none; }
.run-aiedit .aid-side > .aid-card[hidden] { display: none; }
/* the chat card pins its input to the bottom; the log soaks the slack and scrolls */
.run-aiedit .aid-side > .aid-chat-card { display: flex; flex-direction: column; }
.run-aiedit .aid-chat { flex: 1 1 0; max-height: none; min-height: 8rem; }
@media (max-width: 860px) {
  /* stacked under the graph on narrow screens: back to one normal scrolling page */
  body.page-run-aiedit .main, body.page-run-aiedit .main-inner { display: block; }
  .aid-layout.run-aiedit { grid-template-columns: 1fr; }
  .run-aiedit .aid-main { overflow: visible; }
  .run-aiedit .aid-side > .aid-card { height: auto; }
}

/* Chrome-less editor inside the Control run overlay (iframe): drop the backoffice sidebar/header. */
body.aid-embed .sidebar, body.aid-embed .page-head, body.aid-embed .profile { display: none !important; }
body.aid-embed .app { display: block; height: 100vh; }
body.aid-embed .main { height: 100vh; overflow: auto; }
body.aid-embed .main-inner { max-width: none; margin: 0; padding: 0.8rem 1rem 2rem; }

/* "Edit with AI" on Control run: the SAME drawer handle as AI Aid. CLOSED (the default on runs),
   a purple sparkle tab with a chevron rides the run modal frame's inner right edge, vertically
   centred (the old 💬 requester float is gone — per-node convo dots replaced it). CLICKING it
   (no more hover peek) docks the chat as a second grid column — the map shrinks to make room
   (the SVG scales to its width); clicking again folds it away. run-graph.js toggles .open here
   and .run-ai-open on .run-flow-graph. The frame spans the overlay, so: 4.5rem
   the overlay padding, +1px the frame border, +14px so the tab parks just LEFT of the modal's
   own scrollbar instead of covering it (Niv 2026-10-21). */
.run-ai-float {
  --drawer-w: min(380px, 60vw);  /* the chat's width — the handle's ride distance */
  position: fixed;
  top: 50%;
  right: calc(4.5rem + 15px);
  transform: translateY(-50%);
  z-index: 41;
  display: flex;
  align-items: center;
}
.run-ai-float[hidden] { display: none; }
/* Like .aid-float-btn, the handle is an IN-FLOW flex child left of the clip: it RIDES the
   drawer out and back (ride rules shared with .aid-float-btn above), hugging the chat's left
   edge while open and parking alone on the frame edge when closed. */
.run-ai-fab {
  flex: none;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.run-ai-fab:hover .aid-handle-arrow { stroke: var(--text); }
.run-ai-float.open .aid-handle-arrow { transform: rotate(180deg); }
/* The chat keeps its full width at all times — the .ai-drawer-clip around it is what animates
   (0 ↔ full width), so the panel slides out of the handle instead of popping in. */
.run-ai-chat { display: flex; flex: none; flex-direction: column; width: min(380px, 60vw); min-height: 0; max-height: 74vh; border: 1px solid var(--accent); border-radius: 12px; background: var(--panel); box-shadow: 0 12px 30px var(--shadow); }
/* open = part of the frame: .run-flow-graph turns two-column — map, "What ran" and the
   transcript narrow into the left column and the chat docks on the right. run-graph.js MOVES
   the aside up into .run-flow-graph for this (it lives in .run-graph-row when closed), because
   the aside is STICKY and needs the WHOLE flow column as its containing block: spanning every
   grid row gives it travel for the full scroll, so the chat stays pinned just below the sticky
   toolbar instead of sliding under it once the map ends. run-graph.js sets its top via the
   CSSOM (the toolbar's height varies with its hint text); z-index 3 keeps it under the
   toolbar (z 4). */
/* row-gap MUST stay 0: the chat spans 30 rows (sticky travel, below) and a row-gap is laid
   between every one of them even when the empty rows collapse to 0 height — 29 × 0.5rem of
   dead space under the map (Niv saw it). Vertical spacing comes from the children's own
   margins, same as the closed block layout. */
.run-flow-graph.run-ai-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 0.5rem;
  /* row 1 is the map row: it soaks up the frame's leftover height (the closed state does the
     same via the flex chain above), so the board still reaches the frame's bottom edge docked. */
  grid-template-rows: minmax(min-content, 1fr);
}
.run-flow-graph.run-ai-open > * { grid-column: 1; }
.run-flow-graph.run-ai-open > .run-ai-float {
  grid-column: 2;
  grid-row: 1 / span 30;  /* all the rows there are (extras collapse to 0) = full sticky travel */
  position: sticky;
  top: 0;
  align-self: start;
  transform: none;
  z-index: 3;
}

/* "RUN FROM HERE" draggable chip (Control run only): drag it onto a step to choose where the
   re-run starts. Green glow over a valid step, red over one you cannot run from. It replaces the
   old node-menu "Run from here" button. Home position: top-left corner of the map. */
.run-graph-row { position: relative; }
/* The run map gets the SAME framed card as the AI Aid playbook board (.aid-card), so the graph
   reads as one family across the app (Niv 2026-10-20). Keeps graph-wrap's own overflow-x scroll. */
#run-graph {
  background: var(--aid-panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
}
.run-runhere {
  /* z-index must stay BELOW the sticky toolbar's 4 (and the step panel's): the chip belongs to
     the map scene, so when its step scrolls under the toolbar the chip ducks under it too. */
  position: absolute; top: 0.5rem; left: 0.5rem; z-index: 3;
  display: inline-flex; align-items: center; cursor: grab;
  user-select: none; touch-action: none;
  filter: drop-shadow(0 0 4px rgba(88, 192, 255, 0.95)) drop-shadow(0 0 10px rgba(88, 192, 255, 0.5));
}
.run-runhere[hidden] { display: none; }
.run-runhere:active { cursor: grabbing; }
.run-runhere.dragging { opacity: 0.3; }
.run-runhere-box {
  display: grid; place-items: center; text-align: center;
  width: 3.5rem; height: 3.5rem; padding: 0.15rem;
  background: #8b9199; color: #fff; font-weight: 800; font-size: 0.72rem; line-height: 1.05;
  letter-spacing: 0.02em; border-radius: 0.7rem; border: 2px solid #ccd1d8;
}
/* The ↕ grip to the left of the box: a hint that the chip is draggable (move it up/down the steps).
   A gentle bob reinforces the affordance. */
.run-runhere-grip { width: 0.85rem; height: 2.6rem; margin-right: 0.12rem; display: block; flex: none; animation: run-runhere-bob 1.7s ease-in-out infinite; }
.run-runhere-grip polygon { fill: #dfe3ea; stroke: #9aa1ac; stroke-width: 1.2; stroke-linejoin: round; }
@keyframes run-runhere-bob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(2px); } }
.run-runhere.dragging .run-runhere-grip, .run-runhere-ghost .run-runhere-grip { animation: none; }
@media (prefers-reduced-motion: reduce) { .run-runhere-grip { animation: none; } }
.run-runhere-arrow { width: 2.4rem; height: 2.9rem; margin-left: -0.12rem; display: block; }
.run-runhere-arrow polygon { fill: var(--ok); stroke: #2e7d32; stroke-width: 6; stroke-linejoin: round; }
/* The clone that follows the cursor while dragging; green/red tints its glow by drop validity. */
.run-runhere-ghost {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0.96;
  transform: translate(-32%, -50%);
  filter: drop-shadow(0 0 5px rgba(88, 192, 255, 0.95)) drop-shadow(0 0 11px rgba(88, 192, 255, 0.5));
}
.run-runhere-ghost.ok { filter: drop-shadow(0 0 5px var(--ok)) drop-shadow(0 0 12px var(--ok)); }
.run-runhere-ghost.bad { filter: drop-shadow(0 0 5px var(--bad)) drop-shadow(0 0 12px var(--bad)); }
.run-runhere-ghost.bad .run-runhere-arrow polygon { fill: var(--bad); stroke: #8a2620; }
/* Drop-target outline on steps while the chip is being dragged (mirrors swap-ok/swap-bad). */
svg.graph .node.runhere-ok rect.box { stroke: var(--ok); stroke-width: 3; }
svg.graph .node.runhere-bad rect.box { stroke: var(--bad); stroke-width: 3; }
.run-ai-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); }
.run-ai-chat-title { font-weight: 600; font-size: 0.85rem; }
.run-ai-chat-tools { display: flex; gap: 0.25rem; align-items: center; }
.run-ai-tool { font-size: 0.95rem; line-height: 1; padding: 0.1rem 0.45rem; }
.run-ai-tool:disabled { opacity: 0.4; cursor: default; }
.run-ai-chat-x { font-size: 0.8rem; padding: 0.1rem 0.5rem; }
.run-ai-hand { margin: 0 0.7rem 0.6rem; font-size: 0.8rem; }
.run-ai-hand > summary { cursor: pointer; color: var(--muted); font-size: 0.76rem; }
.run-ai-hand textarea { width: 100%; box-sizing: border-box; margin-top: 0.4rem; min-height: 8rem; resize: vertical; padding: 0.4rem; font-family: var(--mono); font-size: 0.74rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.run-ai-hand-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.run-ai-json-err { margin: 0.3rem 0 0; color: var(--bad); font-size: 0.76rem; }
.run-ai-chat-lead { margin: 0.5rem 0.7rem; font-size: 0.76rem; }
.run-ai-chat-log { flex: 1 1 auto; min-height: 6rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.2rem 0.7rem; }
.run-ai-chat-msg { max-width: 92%; padding: 0.3rem 0.55rem; border-radius: 10px; font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.run-ai-chat-msg.you { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 2px; }
.run-ai-chat-msg.ai { align-self: flex-start; background: color-mix(in srgb, var(--text) 8%, var(--panel)); color: var(--text); border-bottom-left-radius: 2px; }
.run-ai-chat-msg.err { align-self: flex-start; background: color-mix(in srgb, var(--bad) 16%, var(--panel)); color: var(--text); }
.run-ai-typing { display: inline-flex; gap: 4px; align-items: center; padding: 0.45rem 0.6rem; }
.run-ai-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; animation: run-ai-blink 1.2s infinite ease-in-out both; }
.run-ai-dot:nth-child(2) { animation-delay: 0.2s; }
.run-ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes run-ai-blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.run-ai-chat-input { display: flex; gap: 0.4rem; align-items: flex-end; padding: 0.5rem 0.7rem; border-top: 1px solid var(--border); }
.run-ai-chat-input textarea { flex: 1; min-width: 0; resize: vertical; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 0.82rem; }
.run-ai-chat-status { margin: 0 0.7rem 0.5rem; font-size: 0.74rem; }
@media (max-width: 820px) {
  .run-ai-chat { width: min(380px, 90vw); max-height: 70vh; }
  .run-ai-float { --drawer-w: min(380px, 90vw); }
  /* narrow screens: the docked chat stacks under the map instead of squeezing it — there is no
     side drawer to ride, so the handle doesn't animate */
  .run-flow-graph.run-ai-open { grid-template-columns: 1fr; }
  .run-flow-graph.run-ai-open > .run-ai-float { grid-column: 1; grid-row: auto; position: static; }
  .run-ai-float.open .run-ai-fab { animation: none; }
  .run-ai-float.closing .run-ai-fab { transform: none; transition: none; }
}

.aid-chat-lead { margin: -0.3rem 0 0.6rem; font-size: 0.8rem; }

.aid-hint { margin: 0 0 0.6rem; font-size: 0.82rem; }

#aid-node-actions {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

#aid-node-actions .btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

/* the contextual composer: a little chat about one arrow or one step */
#aid-composer {
  position: absolute;
  z-index: 6;
  width: 320px;
  display: grid;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

#aid-composer .aid-composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

#aid-composer .aid-composer-head .btn { padding: 0.05rem 0.4rem; font-size: 0.75rem; }

#aid-composer textarea { resize: none; border-radius: 9px; font-size: 0.85rem; }

/* two ways to put a step here: ask Learning, or write it in by hand */
#aid-composer .aid-composer-choice { display: flex; gap: 0.4rem; }

#aid-composer .aid-composer-choice .btn { flex: 1; padding: 0.3rem 0.5rem; font-size: 0.8rem; }

#aid-composer .aid-composer-choice .btn.current { border-color: var(--accent); color: var(--accent); }

#aid-composer .aid-composer-ask,
#aid-composer .aid-composer-hand { display: grid; gap: 0.5rem; }

#aid-composer .aid-composer-ask[hidden],
#aid-composer .aid-composer-hand[hidden] { display: none; }

#aid-composer .aid-composer-hand label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

#aid-composer .aid-composer-hand input,
#aid-composer .aid-composer-hand select { font-size: 0.85rem; border-radius: 9px; }

#aid-composer .aid-composer-error { margin: 0; font-size: 0.78rem; color: var(--bad, #f85149); }

#aid-composer .row-actions { margin: 0; }

#aid-composer .aid-send { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

.aid-step-panel {
  margin-top: 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: rgba(61, 139, 253, 0.06);
  display: grid;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.aid-step-panel p { margin: 0; }

.aid-step-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-family: var(--mono); }

.aid-step-edges { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.15rem; font-size: 0.85rem; color: var(--muted); }

.aid-step-edges b { color: var(--text); font-family: var(--mono); font-weight: 500; }

.aid-step-panel .row-actions { margin-top: 0.15rem; }

.aid-delete { border-color: var(--bad); color: var(--bad); background: transparent; }

.aid-delete:hover, .aid-delete.confirming {
  background: rgba(248, 81, 73, 0.16);
  border-color: var(--bad);
  color: var(--text);
}

.aid-step-json { border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.7rem; }

.aid-step-json summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); }

.aid-step-json pre.json { margin-top: 0.5rem; max-height: 260px; }

.page-services .main-inner { max-width: 1120px; }

.ps-bar {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: end;
  justify-content: space-between;
}

.ps-customer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
  flex: 1;
  min-width: min(100%, 18rem);
}

.ps-customer label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.84rem;
  color: var(--muted);
  flex: 1;
  min-width: 14rem;
}

.ps-customer select.is-empty {
  border-color: var(--bad);
}

.ps-countline {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.ps-note { margin: 0.75rem 0 0; }

.ps-target {
  margin: 1rem 0 0;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.ps-target span { color: #f0c14a; }

.ps-board.is-disabled {
  margin-top: 0.35rem;
  opacity: 0.42;
  filter: grayscale(0.9);
  pointer-events: none;
  user-select: none;
}

.ps-areas {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.ps-area {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 8.6rem;
  text-decoration: none;
  color: #243044;
}

.ps-area-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.ps-icon {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.ps-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.ps-area h3 { font-size: 1.02rem; line-height: 1.3; color: #1b2838; }

.ps-area p { margin: 0; color: #4d6074; }

.ps-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6a7c90;
}

.ps-meter {
  margin-top: auto;
  font-size: 0.8rem;
  color: #5c7084;
}

.ps-tone-security { background: #fff1f1; border-color: #f3c9c9; }
.ps-tone-security .ps-icon { background: #e23b3b; }
.ps-tone-cloud { background: #eef6ff; border-color: #c5daf6; }
.ps-tone-cloud .ps-icon { background: #2f7de1; }
.ps-tone-support { background: #eefaf3; border-color: #c3e6d0; }
.ps-tone-support .ps-icon { background: #2b9a5b; }
.ps-tone-operations { background: #eef8f8; border-color: #c3e2e4; }
.ps-tone-operations .ps-icon { background: #148f99; }
.ps-tone-projects { background: #fff8ee; border-color: #f0ddb8; }
.ps-tone-projects .ps-icon { background: #d4880c; }
.ps-tone-ai { background: #f6f2ff; border-color: #d9ccf5; }
.ps-tone-ai .ps-icon { background: #7a4de0; }

.ps-area.current {
  border-width: 5px;
  outline: 3px solid #243044;
  outline-offset: 2px;
}
.ps-tone-security.current { border-color: #e23b3b; }
.ps-tone-cloud.current { border-color: #2f7de1; }
.ps-tone-support.current { border-color: #2b9a5b; }
.ps-tone-operations.current { border-color: #148f99; }
.ps-tone-projects.current { border-color: #d4880c; }
.ps-tone-ai.current { border-color: #7a4de0; }

.ps-stage { margin-top: 1rem; }

.ps-stage-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
}

.ps-stage-head h3 { margin: 0; font-size: 1.05rem; }

.ps-stage-head .row-actions { margin-top: 0; }

.ps-work {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(0, 1.35fr);
  gap: 0.75rem;
  align-items: start;
}

.ps-caps { display: grid; gap: 0.55rem; }

.ps-cap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
  padding: 0.2rem 0.65rem 0.2rem 0.15rem;
}

.ps-cap.is-open {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.12);
}

.ps-cap.is-deployed { box-shadow: inset 3px 0 0 var(--ok); }

.ps-cap-link {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  padding: 0.55rem 0.35rem 0.55rem 0.75rem;
  text-decoration: none;
}

.ps-cap-link strong {
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.3;
}

.ps-cap-link span {
  color: var(--muted);
  font-size: 0.78rem;
}

.ps-deploy {
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

span.ps-deploy { cursor: default; }

.ps-deploy.is-on {
  border-color: var(--ok);
  background: rgba(63, 185, 80, 0.18);
}

.ps-cap form {
  display: grid;
  justify-items: end;
  gap: 0.2rem;
}

.ps-cap:has(.ps-chat-list) { align-items: start; }

.ps-chat-list {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  padding: 0.45rem 0;
}

.ps-chat-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.ps-chat-chrome {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
}

.ps-chat-chrome input {
  margin: 0;
}

.ps-chrome-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.ps-chat-chrome-label {
  gap: 0.45rem;
}

.ps-chat-chrome-label span {
  line-height: 1.3;
}

.ps-chat-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}

.ps-chat-remove:hover,
.ps-chat-remove:focus-visible {
  color: var(--bad);
  background: rgba(209, 36, 47, 0.12);
}

.ps-trash-icon {
  width: 1rem;
  height: 1rem;
  display: block;
}

.ps-chat-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: right;
}

.ps-saas-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
}

.ps-audience {
  max-width: 9rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: right;
}

.ps-deploy-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--overlay);
}

.ps-deploy-overlay[hidden] { display: none; }

.ps-deploy-card {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 2rem));
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid #2a3a52;
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--panel-shadow);
}

.ps-deploy-card > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.ps-deploy-head {
  margin: 0;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid #2a3a52;
  background: linear-gradient(180deg, rgba(61, 139, 253, 0.12), transparent);
}

.ps-deploy-card h3 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.ps-deploy-lead,
.ps-deploy-empty,
.ps-deploy-error,
.ps-deploy-card > [data-saas-phase],
.ps-deploy-card > [data-onboard-phase],
.ps-deploy-card > [data-chatbot-phase],
.ps-deploy-card > .ps-deploy-scopes,
.ps-deploy-card > .ps-deploy-loading,
.ps-deploy-card > .ps-deploy-picker {
  margin: 0;
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

.ps-deploy-card > .ps-deploy-scopes,
.ps-deploy-card > .ps-deploy-loading,
.ps-deploy-card > .ps-deploy-picker {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.ps-deploy-lead {
  padding-top: 0.85rem;
  padding-bottom: 0.35rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.45;
}

.ps-deploy-card > [data-saas-phase],
.ps-deploy-card > [data-onboard-phase],
.ps-deploy-card > [data-chatbot-phase] {
  padding-top: 0.55rem;
  padding-bottom: 0.35rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.ps-deploy-card > [data-saas-phase][hidden],
.ps-deploy-card > [data-onboard-phase][hidden],
.ps-deploy-card > [data-chatbot-phase][hidden] {
  display: none !important;
}

.ps-deploy-error {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.ps-deploy-scopes,
.ps-deploy-options {
  display: grid;
  gap: 0.35rem;
}

.ps-deploy-scopes label,
.ps-deploy-options label {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  font-size: 0.92rem;
  line-height: 1.35;
  text-align: left;
}

.ps-deploy-scopes input[type="radio"],
.ps-deploy-options input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.ps-deploy-options label small {
  color: var(--muted);
  font-size: 0.78rem;
}

.ps-deploy-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.45rem;
  padding: 0.45rem 0.6rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid #243044;
  border-radius: 8px;
}

.ps-deploy-options {
  max-height: 240px;
  overflow: auto;
  padding: 0.45rem 0.6rem;
  border: 1px solid #243044;
  border-radius: 8px;
}

.ps-deploy-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ps-deploy-loading[hidden] { display: none; }

.ps-deploy-loading .wait-spin {
  width: 1.05rem;
  height: 1.05rem;
  border-width: 2px;
  flex: 0 0 auto;
}

.ps-deploy-empty { color: var(--muted); font-size: 0.86rem; }

.ps-deploy-error { color: var(--bad); font-size: 0.86rem; }

.ps-deploy-start-hint {
  margin: -0.15rem 0 0.55rem;
  padding-left: 1.35rem;
  padding-right: 1.35rem;
  color: green;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.ps-deploy-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding: 0.85rem 1.35rem 1.1rem;
  border-top: 1px solid #2a3a52;
  background: rgba(0, 0, 0, 0.14);
}

.ps-deploy-actions .btn[hidden] {
  display: none !important;
}

.ps-deploy-actions .btn,
.ps-deploy-actions button.btn {
  color: #111;
  background: #f4f6f8;
  border: 1px solid #6b7785;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

.ps-deploy-actions .btn:hover:not(:disabled),
.ps-deploy-actions button.btn:hover:not(:disabled) {
  color: #111;
  background: #ffffff;
  border-color: #4a5563;
}

.ps-deploy-actions .btn:disabled,
.ps-deploy-actions button.btn:disabled {
  color: #8b949e;
  background: #2a3340;
  border-color: #3d4654;
  opacity: 1;
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.ps-deploy-cancel {
  margin-right: auto;
}

[data-theme="light"] .ps-deploy-actions {
  border-top-color: #d5dde6;
  background: #eef1f5;
}

[data-theme="light"] .ps-deploy-actions .btn,
[data-theme="light"] .ps-deploy-actions button.btn {
  color: #111;
  background: #fff;
  border-color: #5c6773;
}

[data-theme="light"] .ps-deploy-actions .btn:disabled,
[data-theme="light"] .ps-deploy-actions button.btn:disabled {
  color: #9aa3ad;
  background: #e4e8ed;
  border-color: #c5cdd6;
  opacity: 1;
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.ps-saas-done,
.ps-saas-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ps-saas-done li,
.ps-saas-steps li {
  display: grid;
  grid-template-columns: 1.35rem minmax(0, auto) minmax(0, 1fr);
  gap: 0.45rem 0.55rem;
  align-items: start;
  line-height: 1.4;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ps-saas-done li {
  grid-template-columns: 1.35rem minmax(0, 1fr);
}

.ps-saas-done .is-done {
  border-color: rgba(63, 185, 80, 0.28);
  background: rgba(63, 185, 80, 0.08);
}

.ps-saas-done .is-done .ps-step-icon {
  color: #fff;
  background: var(--ok);
}

.ps-saas-done .ps-step-text {
  color: var(--text);
  font-size: 0.9rem;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ps-step-icon {
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.05rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.ps-saas-steps .ps-step-status {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.9;
  white-space: nowrap;
}

.ps-saas-steps .ps-step-text {
  color: var(--text);
  font-size: 0.9rem;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ps-saas-steps .is-done {
  border-color: rgba(63, 185, 80, 0.28);
  background: rgba(63, 185, 80, 0.08);
}

.ps-saas-steps .is-done .ps-step-icon {
  color: #fff;
  background: var(--ok);
}

.ps-saas-steps .is-done .ps-step-status { color: var(--ok); }

.ps-saas-steps .is-failed {
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.08);
}

.ps-saas-steps .is-failed .ps-step-icon {
  color: #fff;
  background: var(--bad);
}

.ps-saas-steps .is-failed .ps-step-status { color: var(--bad); }

.ps-saas-steps .is-doing {
  border-color: rgba(61, 139, 253, 0.4);
  background: var(--accent-softer);
}

.ps-saas-steps .is-doing .ps-step-icon {
  color: var(--accent);
  background: var(--accent-soft);
}

.ps-saas-steps .is-doing .ps-step-status { color: var(--accent); }

.ps-saas-steps .is-pending .ps-step-icon,
.ps-saas-steps .is-waiting .ps-step-icon {
  color: var(--muted);
  background: rgba(139, 156, 179, 0.16);
}

.ps-saas-steps .is-pending .ps-step-status,
.ps-saas-steps .is-waiting .ps-step-status {
  color: var(--muted);
}

.ps-store-list {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  max-height: 16rem;
  overflow: auto;
}

.ps-store-list > p {
  margin: 0;
  font-size: 0.9rem;
}

.ps-store-site {
  display: block;
  color: var(--muted, #5c6b7a);
  font-size: 0.78rem;
}

.ps-onboard-field {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.ps-onboard-field input,
.ps-onboard-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line, #c9d3db);
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
}

/* Beat global label:has(checkbox) { width:max-content; white-space:nowrap } */
label.ps-saas-check:has(input[type="checkbox"]),
.ps-saas-check {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: stretch;
  align-items: start;
  column-gap: 0.55rem;
  row-gap: 0;
  line-height: 1.4;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal !important;
}

label.ps-saas-check:has(input[type="checkbox"]) > input,
.ps-saas-check > input {
  margin-top: 0.15rem;
}

label.ps-saas-check:has(input[type="checkbox"]) > span,
.ps-saas-check > span {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

label.ps-saas-check:has(input[type="checkbox"])[hidden],
.ps-saas-check[hidden] {
  display: none !important;
}

[data-saas-proceed],
[data-onboard-proceed],
[data-chatbot-proceed] {
  display: grid;
  gap: 0.55rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

[data-saas-proceed][hidden],
[data-onboard-proceed][hidden],
[data-chatbot-proceed][hidden] {
  display: none !important;
}

[data-saas-proceed] > p,
[data-onboard-proceed] > p,
[data-saas-approve-lead],
[data-onboard-approve-lead] {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ps-saas-approve {
  list-style: none;
  margin: 0.35rem 0 0.75rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  line-height: 1.4;
}

.ps-saas-approve li {
  display: grid;
  grid-template-columns: 1.35rem 1fr;
  gap: 0.55rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(61, 139, 253, 0.28);
  background: var(--accent-softer);
}

.ps-saas-approve .ps-step-icon {
  color: #fff;
  background: var(--accent);
}

.ps-saas-notes {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  line-height: 1.4;
  border-radius: 8px;
  border: 1px solid #2a3a52;
  background: rgba(0, 0, 0, 0.12);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ps-saas-notes p,
.ps-saas-notes a {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.vault-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.vault-head p { margin: 0.35rem 0 0; }

.vault-add {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.7rem;
}

.vault-use small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.vault-overlay,
.playbook-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--overlay);
}

.vault-overlay[hidden],
.playbook-overlay[hidden] { display: none; }

.vault-card {
  width: min(520px, 100%);
  max-height: min(640px, calc(100vh - 2rem));
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
}

.vault-card h3 { margin: 0; font-size: 1.15rem; }

.vault-card form.stack { margin-top: 0; }

.vault-card textarea { min-height: 8rem; }

.vault-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.vault-cancel {
  background: transparent;
  color: var(--text);
}

.ps-props {
  position: sticky;
  top: 0.75rem;
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.ps-props h3 { font-size: 1.05rem; }

.ps-props h4 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ps-props p { margin: 0; line-height: 1.45; }

.ps-status { color: var(--muted); font-size: 0.86rem; }

.ps-prop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.ps-props ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.page-rl .rl-primary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-rl .rl-signals {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.page-rl .stack { margin-top: 0.35rem; }

@media (max-width: 980px) {
  .page-rl .rl-primary,
  .page-rl .rl-signals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-areas { grid-template-columns: 1fr 1fr; }
  .ps-work, .ps-prop-grid { grid-template-columns: 1fr; }
  .ps-props { position: static; }
}

@media (max-width: 640px) {
  .page-rl .rl-primary,
  .page-rl .rl-signals { grid-template-columns: 1fr; }
  .ps-areas { grid-template-columns: 1fr; }
}

/* Technician tasks: jump pills to the page sections, distinct from the status tabs above them. */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.section-nav a,
.section-nav .section-off {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.section-nav a:hover { background: rgba(61, 139, 253, 0.12); }

.section-nav .count {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3rem;
}

.section-nav .section-off { border-color: var(--border); color: var(--muted); }
.section-nav .section-off .count { background: var(--border); color: var(--muted); }

.section-nav a.current { background: var(--accent); color: var(--on-accent); }
.section-nav a.current .count { background: var(--bg); color: var(--accent); }
.section-nav a.section-off { border-color: var(--border); color: var(--muted); }
.section-nav a.section-off .count { background: var(--border); color: var(--muted); }

/* Compact green approve, for decision rows (the big one is .aid-approve). */
button.btn.approve-green {
  border-color: var(--ok);
  background: var(--ok);
  color: var(--on-ok);
  font-weight: 700;
}

button.btn.approve-green:hover { background: #4fd162; border-color: #4fd162; }

.section-nav { align-items: center; }

.section-nav .group-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.1rem;
}

.section-nav .sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 0 0.5rem;
}

/* "Waiting on others" pills: informational, never the accent blue of your own tasks. */
.section-nav a.info { border-color: var(--border); color: var(--muted); }
.section-nav a.info .count { background: var(--border); color: var(--text); }
.section-nav a.info:hover { background: rgba(139, 156, 179, 0.1); }
.section-nav a.info.current { background: var(--border); color: var(--text); }
.section-nav a.info.current .count { background: var(--panel); color: var(--text); }

/* Account control, fixed at the top right of the screen. */
.profile {
  position: fixed;
  top: 0.7rem;
  right: 1.1rem;
  z-index: 40;
}

.profile::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.7rem -1.1rem -0.85rem -1.6rem;
  background: radial-gradient(circle at top right, var(--bg) 0 42%, transparent 74%);
  pointer-events: none;
}

.profile-btn {
  display: block;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--border);
}

.profile-btn:hover,
.profile-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

.profile-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.profile-portrait {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.profile-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1.18);
}

.profile-ribbon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0.72rem;
  padding: 0 0.15rem 0.06rem;
  text-align: center;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fff;
  background: rgba(8, 16, 32, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.profile-ribbon.is-long {
  font-size: 0.56rem;
  letter-spacing: 0.03em;
}

.profile-tip {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 0.4rem 0.65rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 22px var(--shadow);
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.profile-tip strong { display: block; font-size: 0.84rem; }

.profile-tip span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.profile:hover .profile-tip,
.profile-btn:focus-visible ~ .profile-tip {
  opacity: 1;
  visibility: visible;
}

.profile.is-open .profile-tip {
  opacity: 0;
  visibility: hidden;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 3;
  width: 14.5rem;
  padding: 0.35rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px var(--shadow);
}

.profile-menu[hidden],
.profile-settings[hidden] {
  display: none !important;
}

.profile-menu form { margin: 0; }

.profile-item,
.profile-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.profile-item:hover,
.profile-item:focus-visible,
.profile-theme:hover,
.profile-theme:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.profile-caret {
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.2rem;
  flex: 0 0 auto;
}

.profile-settings-toggle[aria-expanded="true"] .profile-caret {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.profile-settings {
  margin: 0.1rem 0.25rem 0.3rem 0.7rem;
  padding: 0.15rem 0 0.15rem 0.65rem;
  border-left: 2px solid var(--border);
}

.profile-sublabel {
  margin: 0.15rem 0.35rem 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-theme[aria-checked="true"] {
  font-weight: 700;
  background: var(--accent-soft);
}

.profile-theme[aria-checked="true"]::after {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.7rem;
  margin-left: auto;
  margin-bottom: 0.15rem;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.grid-tools {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 0.65rem;
}

.grid-search {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0;
  text-align: left;
  color: var(--muted);
  font-size: 0.84rem;
}

.grid-search input {
  width: 16rem;
  max-width: 100%;
  text-align: left;
}

.grid-scroll { overflow-x: auto; }

/* Shared ticket-title style. Add class="ticket-title" on any grid or dialog that shows a ticket name. */
.ticket-title {
  font-style: italic;
  color: darkcyan;
}

/* The ticket's description under its title, wherever a ticket is listed: quiet, two lines at
   most (the full text is the hover title); "is-head" is the roomier version in a dialog head. */
.ticket-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-width: 70ch;
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.35;
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.ticket-desc.is-head { -webkit-line-clamp: 4; max-width: 120ch; font-size: 0.82rem; }

.ticket-status-filters,
.playbook-maturity-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
  margin: 1rem 0 0.75rem;
  padding: 0;
  border: 0;
}

.playbook-toolbar .playbook-maturity-filters {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.ticket-status-filters legend,
.playbook-maturity-filters legend {
  padding: 0;
  margin-right: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ticket-status-filters label,
.playbook-maturity-filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.ticket-status-filters input,
.playbook-maturity-filters input {
  margin: 0;
}

.grid-table tbody tr.is-status-filtered,
.grid-table tbody tr.is-maturity-filtered {
  display: none;
}

/* Tickets / Playbook Repository / Reports / Audit / Super Admin / AI Aid: page chrome stays put; only the list/grid body scrolls under a sticky header. */
body.page-tickets .main,
body.page-playbooks .main,
body.page-reports .main,
body.page-audit .main,
body.page-superadmin .main,
body.page-aid .main,
body.page-tasks .main,
body.page-runs .main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-tickets .main-inner,
body.page-playbooks .main-inner,
body.page-reports .main-inner,
body.page-audit .main-inner,
body.page-superadmin .main-inner,
body.page-aid .main-inner,
body.page-tasks .main-inner,
body.page-runs .main-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.page-tickets .page-head,
body.page-tickets .banner,
body.page-tickets .ticket-status-filters,
body.page-playbooks .page-head,
body.page-playbooks .banner,
body.page-playbooks .playbook-toolbar,
body.page-playbooks .empty,
body.page-reports .page-head,
body.page-reports .banner,
body.page-reports .page-tabs-bar,
body.page-reports .muted,
body.page-reports .empty,
body.page-audit .page-head,
body.page-audit .banner,
body.page-audit .page-tabs-bar,
body.page-audit .empty,
body.page-superadmin .page-head,
body.page-superadmin .banner,
body.page-superadmin .page-tabs,
body.page-superadmin .cleanup-lead,
body.page-superadmin .cleanup-bar,
body.page-superadmin .access-toolbar,
body.page-superadmin .empty,
body.page-superadmin .muted,
body.page-aid .page-head,
body.page-aid .banner,
body.page-tasks .page-head,
body.page-tasks .banner,
body.page-tasks .section-nav,
body.page-tasks h2,
body.page-tasks .empty,
body.page-tasks .muted,
body.page-tasks .run-tabs,
body.page-runs .page-head,
body.page-runs .banner,
body.page-runs .run-tabs,
body.page-runs .empty {
  flex: 0 0 auto;
}

body.page-tasks #tasks-live,
body.page-tasks [data-live-fragment="tasks"],
body.page-tasks #runs-live,
body.page-tasks [data-live-fragment="runs"],
body.page-runs #runs-live,
body.page-runs [data-live-fragment="runs"] {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.page-superadmin form[data-cleanup-form],
body.page-superadmin form[data-product-form] {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.page-tickets .panel,
body.page-playbooks .panel,
body.page-reports .panel,
body.page-audit .panel,
body.page-superadmin .panel,
body.page-tasks .panel,
body.page-runs .panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Edit/confirm forms without a data grid still need to scroll inside the pane. */
body.page-superadmin .panel:not(:has(.grid-wrap)) {
  overflow: auto;
}

body.page-superadmin .panel > :not(.grid-wrap) {
  flex: 0 0 auto;
}

body.page-tickets .grid-wrap,
body.page-playbooks .grid-wrap,
body.page-reports .grid-wrap,
body.page-audit .grid-wrap,
body.page-superadmin .grid-wrap,
body.page-tasks .grid-wrap,
body.page-runs .grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.page-tickets .grid-tools,
body.page-tickets .grid-empty,
body.page-playbooks .grid-tools,
body.page-playbooks .grid-empty,
body.page-reports .grid-tools,
body.page-reports .grid-empty,
body.page-audit .grid-tools,
body.page-audit .grid-empty,
body.page-superadmin .grid-tools,
body.page-superadmin .grid-empty,
body.page-tasks .grid-tools,
body.page-tasks .grid-empty,
body.page-runs .grid-tools,
body.page-runs .grid-empty {
  flex: 0 0 auto;
}

body.page-tickets .grid-scroll,
body.page-playbooks .grid-scroll,
body.page-reports .grid-scroll,
body.page-audit .grid-scroll,
body.page-superadmin .grid-scroll,
body.page-tasks .grid-scroll,
body.page-runs .grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

body.page-tickets .grid-table thead th,
body.page-playbooks .grid-table thead th,
body.page-reports .grid-table thead th,
body.page-audit .grid-table thead th,
body.page-superadmin .grid-table thead th,
body.page-tasks .grid-table thead th,
body.page-runs .grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--grid-head);
  box-shadow: 0 1px 0 var(--border);
}

/* AI Aid queue (and the same page opened from Tasks / Playbook Repository). */
body.page-aid .panel:has(.aid-queue),
body.page-playbooks .panel:has(.aid-queue),
body.page-tasks .panel:has(.aid-queue) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-aid .panel:has(.aid-queue) > :not(.aid-queue),
body.page-playbooks .panel:has(.aid-queue) > :not(.aid-queue),
body.page-tasks .panel:has(.aid-queue) > :not(.aid-queue) {
  flex: 0 0 auto;
}

body.page-aid .aid-queue,
body.page-playbooks .aid-queue,
body.page-tasks .aid-queue {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  align-content: start;
}

body.page-aid .panel:not(:has(.aid-queue)) {
  flex: 0 0 auto;
}

.grid-table th {
  background: var(--grid-head);
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
}

.grid-table th:active { cursor: grabbing; }

.grid-table th .grid-th { font-weight: 700; }

.grid-table th .grid-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.4rem;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.grid-table th.is-sorted-asc .grid-arrow { border-bottom: 6px solid currentColor; }
.grid-table th.is-sorted-desc .grid-arrow { border-top: 6px solid currentColor; }

.grid-table th.is-drop { box-shadow: inset 3px 0 0 var(--accent); }

.grid-table tbody tr:nth-child(even):not(.grid-detail) { background: var(--grid-alt); }

.grid-table tbody tr:hover:not(.grid-detail) { background: var(--accent-soft); }

.grid-empty {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-glow: #ffffff;
  --panel: #ffffff;
  --border: #d5dbe3;
  --text: #1c2430;
  --muted: #5c6b80;
  --accent: #1a73e8;
  --ok: #137333;
  --bad: #c5221f;
  --paused: #b06000;
  --on-ok: #ffffff;
  --on-accent: #ffffff;
  --sidebar: #ffffff;
  --input: #ffffff;
  --scroll-track: #e6ebf2;
  --scroll-thumb: #8aa0b8;
  --accent-soft: rgba(26, 115, 232, 0.14);
  --accent-softer: rgba(26, 115, 232, 0.07);
  --overlay: rgba(15, 23, 42, 0.45);
  --shadow: rgba(15, 23, 42, 0.16);
  --aid-panel-2: #f7f9fc;
  --grid-head: #d5dce6;
  --grid-alt: #f3f6fa;
}

[data-theme="light"] .nav-favorites .nav-label { color: #8a6410; }
[data-theme="light"] .ps-target span { color: #8a5a00; }
[data-theme="light"] button.btn.aid-approve:hover,
[data-theme="light"] a.btn.aid-approve:hover,
[data-theme="light"] button.btn.approve-green:hover {
  background: #0f5c28;
  border-color: #0f5c28;
}

[data-theme="light"] .btn.aid-promote:hover {
  background: #1c5fc4;
  border-color: #1c5fc4;
}

[data-theme="contrast"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-glow: #000000;
  --panel: #000000;
  --border: #ffffff;
  --text: #ffffff;
  --muted: #ffff00;
  --accent: #00e5ff;
  --ok: #00ff66;
  --bad: #ff5a5a;
  --paused: #ffd000;
  --on-ok: #000000;
  --on-accent: #000000;
  --sidebar: #000000;
  --input: #000000;
  --scroll-track: #000000;
  --scroll-thumb: #ffff00;
  --accent-soft: #1a1a00;
  --accent-softer: #000000;
  --overlay: rgba(0, 0, 0, 0.92);
  --shadow: transparent;
  --aid-info: #d0c4ff;
  --aid-panel-2: #000000;
  --grid-head: #000000;
  --grid-alt: #000000;
}

[data-theme="contrast"] body {
  background: #000000;
}

[data-theme="contrast"] :focus-visible {
  outline: 3px solid #ffff00;
  outline-offset: 2px;
}

[data-theme="contrast"] .grid-table th {
  color: #ffff00;
  border-bottom: 3px solid #ffff00;
}

[data-theme="contrast"] .card,
[data-theme="contrast"] .panel,
[data-theme="contrast"] .lock-card,
[data-theme="contrast"] .auth-card,
[data-theme="contrast"] .aid-card,
[data-theme="contrast"] .aid-advanced,
[data-theme="contrast"] .aid-legend,
[data-theme="contrast"] .aid-ticket,
[data-theme="contrast"] .aid-reuse-card,
[data-theme="contrast"] .aid-editor-card,
[data-theme="contrast"] .aid-confirm-card,
[data-theme="contrast"] .aid-processing,
[data-theme="contrast"] .wait-card,
[data-theme="contrast"] .ps-area,
[data-theme="contrast"] .ps-deploy-card,
[data-theme="contrast"] .vault-card,
[data-theme="contrast"] .task-decision,
[data-theme="contrast"] .profile-menu,
[data-theme="contrast"] input,
[data-theme="contrast"] select,
[data-theme="contrast"] textarea,
[data-theme="contrast"] .btn,
[data-theme="contrast"] .ranges a,
[data-theme="contrast"] .filters a,
[data-theme="contrast"] .subnav a,
[data-theme="contrast"] .dev-link {
  border-width: 2px;
  border-color: #ffffff;
  box-shadow: none;
}

[data-theme="contrast"] .ps-customer select.is-empty {
  border-color: #ff5a5a;
}

[data-theme="contrast"] .profile-btn {
  box-shadow: 0 0 0 3px #ffff00;
}

[data-theme="contrast"] .nav-row:has(.nav-item.current) {
  background: #000000;
  box-shadow: inset 0 0 0 2px #ffff00;
}

[data-theme="contrast"] .nav-row.is-drop-before { box-shadow: inset 0 3px 0 #ffff00; }

[data-theme="contrast"] .nav-row.is-drop-after { box-shadow: inset 0 -3px 0 #ffff00; }

[data-theme="contrast"] .nav-item.current,
[data-theme="contrast"] .ranges a.current,
[data-theme="contrast"] .filters a.current,
[data-theme="contrast"] .subnav a.current,
[data-theme="contrast"] .page-tab.current,
[data-theme="contrast"] .run-tab.current {
  color: #ffff00;
  border-color: #ffff00;
  background: #000000;
}

[data-theme="contrast"] .nav-favorites .nav-label,
[data-theme="contrast"] .nav-star[aria-pressed="true"],
[data-theme="contrast"] .ps-target span {
  color: #ffff00;
}

[data-theme="contrast"] .card.tone-ok,
[data-theme="contrast"] .card.tone-warn,
[data-theme="contrast"] .card.tone-bad,
[data-theme="contrast"] .ps-area {
  background: #000000;
  color: #ffffff;
  border-color: #ffffff;
  border-width: 3px;
}

[data-theme="contrast"] .ps-area h3,
[data-theme="contrast"] .ps-area p,
[data-theme="contrast"] .ps-kicker,
[data-theme="contrast"] .ps-meter {
  background: transparent;
  color: #ffffff;
}

[data-theme="contrast"] .card.tone-ok,
[data-theme="contrast"] .card.tone-ok p { color: #00ff66; border-color: #00ff66; }
[data-theme="contrast"] .card.tone-warn,
[data-theme="contrast"] .card.tone-warn p { color: #ffd000; border-color: #ffd000; }
[data-theme="contrast"] .card.tone-bad,
[data-theme="contrast"] .card.tone-bad p { color: #ff5a5a; border-color: #ff5a5a; }

[data-theme="contrast"] .profile-theme[aria-checked="true"] {
  color: #000000;
  background: #ffff00;
}

[data-theme="contrast"] .profile-theme[aria-checked="true"]::after {
  border-color: #000000;
}

[data-theme="contrast"] .aid-legend {
  background: #000000;
  border: 2px solid #ffffff;
  box-shadow: none;
}

/* Production editor wizard: the flow steps are real buttons, and the review list shows the diff. */
.aid-flow li[data-step] { cursor: pointer; }
.aid-flow li[data-step]:hover { border-color: var(--accent); }
.aid-review-row { margin: 0.35rem 0; display: flex; align-items: center; gap: 0.5rem; }

/* The flow is the LAST child of the modal's .run-panel and takes all the leftover height, handing
   it down to the map card: the graph's framed board reaches the frame's bottom edge like the AI
   Aid editor's, instead of leaving blank modal space below (Niv). */
.run-flow { position: relative; margin-top: 0.75rem; flex: 1 1 auto; display: flex; flex-direction: column; }
.run-flow-graph { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.run-flow-graph > .run-graph-row { flex: 1 1 auto; display: flex; flex-direction: column; }
.run-flow-graph > .run-graph-row > .graph-wrap,
.run-flow-graph > .graph-wrap { flex: 1 1 auto; }  /* 2nd selector: old runs' reconstructed map (no row) */

/* Conversation with the requester (run-control): the clarification / user_input dialog,
   rendered inside .convo-tip (the per-step popup run-graph.js floats over the map). NOT a
   left/right chat: a flat log, one row per message, led by who wrote it — the Arrax favicon
   (same as the browser tab) or the end-user face from the graph's user_input nodes. */
.convo-list { display: flex; flex-direction: column; }
.convo-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.convo-row:first-child { border-top: 0; }
.convo-ava {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  font-size: 0.95rem;
  line-height: 1;
  overflow: hidden;
}
.convo-ava img { width: 100%; height: 100%; object-fit: cover; }
.convo-ava-arrax { border-color: var(--accent); }
.convo-ava-user { border-color: var(--ok); }
.convo-body { min-width: 0; }

.convo-meta {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.convo-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

/* The clarification case (the one-node end_needs_information playbook): the graph is NEVER
   drawn. A quiet grey banner fills the map area instead — everything here waits for the
   requester to explain their ticket — and the small 💬 opens the same End User Conversation
   log as the run map's message dots. Grey on purpose (Niv): nothing failed and no one on our
   side has to act, so no red and no amber. */
.clarify-banner {
  position: relative;
  height: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 3rem 1.5rem;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, var(--panel));
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--muted) 10%, transparent) 0%, transparent 60%),
    color-mix(in srgb, var(--muted) 6%, var(--panel));
  text-align: center;
}
.clarify-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 64px;
  height: 46px;
  margin-bottom: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--muted) 30%, var(--panel));
  border-radius: 16px 16px 16px 4px;
  background: color-mix(in srgb, var(--muted) 18%, var(--panel));
}
.clarify-bubble i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: clarify-dot 1.4s infinite ease-in-out;
}
.clarify-bubble i:nth-child(2) { animation-delay: 0.18s; }
.clarify-bubble i:nth-child(3) { animation-delay: 0.36s; }
@keyframes clarify-dot {
  0%, 70%, 100% { opacity: 0.35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-4px); }
}
.clarify-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}
.clarify-dots i { font-style: normal; animation: aid-ellipsis 1.2s infinite; }
.clarify-dots i:nth-child(2) { animation-delay: 0.2s; }
.clarify-dots i:nth-child(3) { animation-delay: 0.4s; }
.clarify-sub { margin: 0; font-size: 0.88rem; color: var(--muted); }
/* Ticket split: the same quiet frame, listing the tickets the requests moved to. */
.split-list { margin: 0.75rem 0 0; padding: 0; list-style: none; text-align: left; font-size: 0.9rem; }
.split-list li { padding: 0.2rem 0; }
.clarify-round {
  display: inline-block;
  margin-inline-start: 0.3rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--muted) 40%, var(--panel));
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.clarify-convo-btn {
  position: absolute;
  top: 0.8rem;
  inset-inline-end: 0.8rem;
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
}
.clarify-convo-btn:hover { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
/* AI Aid: the banner's card is just a quiet frame. */
.aid-clarify-card { padding: 0.75rem; }
.aid-clarify-card .graph-wrap { border: 0; background: transparent; }
/* AI Aid queue: a ticket that is only waiting on its requester reads grey, not like work. */
.aid-tag.clarify { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.aid-ticket.clarify-wait { border-style: dashed; background: color-mix(in srgb, var(--muted) 7%, var(--panel)); }
.aid-ticket.clarify-wait .aid-ticket-title { color: var(--muted); font-weight: 500; }
.aid-clarify-note { font-size: 0.75rem; font-style: italic; color: color-mix(in srgb, var(--muted) 80%, var(--text)); }
/* Run Control: no map, so the map's side tools make no sense here. */
.run-graph-row.clarify-mode #run-ai-float,
.run-graph-row.clarify-mode #run-runhere { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .clarify-bubble i, .clarify-dots i { animation: none; }
}

/* Run Control: the selected run's details open in a dialog frame over the list. */
.run-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 2.5rem 4.5rem;  /* side margin wide enough to click out of the dialog */
}

.run-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.run-modal-frame {
  position: relative;
  /* Fills the screen but for the overlay's margin (Niv 2026-11-12, was 66rem): the map scales
     to the width it gets. */
  width: 100%;
  /* FIXED height, not content-sized (Niv): the frame must not grow/shrink when the ✨ drawer
     opens or closes (or the map changes) — like the AI Aid editor, the dialog is a stable
     canvas and only its content reflows inside. */
  height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(4, 8, 14, 0.5);
  overflow: hidden;
  animation: run-modal-in 0.18s ease-out;
}

@keyframes run-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .run-modal-frame { animation: none; }
}

.run-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.run-modal-title-wrap { display: grid; gap: 0.3rem; min-width: 0; }

.run-modal-head h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }

.run-modal-title-wrap p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.run-modal-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
}

.run-modal-close:hover { color: var(--text); border-color: var(--accent); }

/* flex:1 + min-height:0: the body always spans down to the fixed frame's bottom edge and
   scrolls inside it, whether the content is shorter or taller than the frame.
   The body is itself a flex column so the content FILLS the fixed frame (Niv): a short run must
   not leave dead white space under the map — the map card stretches to the bottom edge instead.
   Every link in the chain below is flex:1 1 auto with the default min-height:auto, so when the
   content is TALLER than the frame nothing gets squashed — the body just scrolls as before. */
.run-modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1.1rem 1.25rem 1.4rem; display: flex; flex-direction: column; }

.run-modal-body .panel.run-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  /* .stack's grid can't hand the slack to one row; a flex column can (gap carries over). */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  /* The list page's pane rule (body.page-runs .panel: min-height 0 + overflow hidden, for the
     data grid that scrolls inside a fixed pane) also matches THIS panel inside the modal, so a
     tall run (approver card + a long map) got clipped at the frame's bottom with no scrollbar
     (Niv 2026-11-08). Undo it here: the panel grows with its content and the modal BODY is the
     one that scrolls. .panel.run-panel outranks body.page-runs .panel on specificity. */
  min-height: auto;
  overflow: visible;
}

@media (max-width: 720px) {
  .run-modal { padding: 0.75rem; }
  .aid-editor-overlay { padding: 0.75rem; }
  .aid-side { right: calc(0.75rem + 15px); }  /* follows the overlay padding above */
  .aid-editor-card { max-height: calc(100vh - 1.5rem); }
  .run-modal-frame { height: calc(100vh - 1.5rem); }
}

/* Feedback ticket 20, layout review 2026-11-04: the promotion recommendations section. */
.rec-panel > summary { cursor: pointer; font-weight: 600; list-style-position: outside; }
.rec-panel > summary::marker { color: var(--muted); }
.rec-panel > p { margin-top: 10px; }
.rec-table td, .rec-history td { vertical-align: middle; }
.rec-actions { text-align: right; white-space: nowrap; }
.rec-actions .vault-actions { justify-content: flex-end; margin: 0; }
.rec-confirm { display: inline-flex; gap: 8px; align-items: center; }
.rec-history { margin-top: 12px; }
.rec-history > summary { cursor: pointer; color: var(--muted); }
.sync-progress { width: 100%; height: 0.7rem; }

/* ==============================================================================================
   Learning page (feedback ticket 26). Charts are PHP-built inline SVG (learning_charts.php);
   data lines carry pathLength="1" + .chart-draw so they draw in on load with CSS alone (the
   CSP allows no inline style or script). Dashed guides never get .chart-draw.
   ============================================================================================== */

.page-learning .learning-basis { margin: 0.5rem 0 0; font-size: 0.8rem; }

.page-learning .learning-split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.page-learning .learning-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.page-learning .legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }

.page-learning .legend-chip {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
}

.page-learning .learning-progress {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.page-learning .learning-progress b { color: var(--text); font-weight: 600; }

.page-learning .chart-under { margin: 0.4rem 0 0; font-size: 0.8rem; }

.page-learning .learning-insight {
  margin: 0.45rem 0 0;
  font-size: 1.02rem;
  line-height: 1.5;
}

.page-learning .learning-insight b { color: var(--ok); }

.page-learning .learning-tiles { margin-top: 0.75rem; }

.page-learning .big-figure { font-size: 1.9rem; font-weight: 700; margin: 0.4rem 0 0; }

.page-learning .big-figure .muted { font-size: 0.84rem; font-weight: 400; }

.page-learning .learning-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.9rem;
  margin-top: 0.4rem;
}

.page-learning .delta-up { color: var(--ok); font-size: 0.82rem; font-weight: 600; }
.page-learning .delta-down { color: var(--bad); font-size: 0.82rem; font-weight: 600; }

.page-learning .learning-count { color: var(--muted); font-size: 0.84rem; }
.page-learning .learning-count b { color: var(--text); }

.page-learning .fan-headline { margin: 0.4rem 0 0; }
.page-learning .fan-headline .big-figure { margin-right: 0.5rem; }

.page-learning .fan {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr);
  gap: 1rem;
  margin-top: 0.7rem;
  align-items: start;
}

.page-learning .fan-src {
  display: grid;
  gap: 0.3rem;
  border: 1px solid var(--paused);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-size: 0.88rem;
}

.page-learning .fan-playbook { font-weight: 600; }

.page-learning .fan-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
}

.page-learning .fan-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

.page-learning .fan-list li.muted { border: none; padding: 0.1rem 0.6rem; }

.page-learning .learning-monthly { margin-top: 0.7rem; }

.page-learning .lineage-table {
  width: 100%;
  margin-top: 0.6rem;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.page-learning .lineage-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.page-learning .lineage-table td {
  padding: 0.42rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.page-learning .lineage-table .lineage-group td {
  padding-top: 0.75rem;
  border-bottom: none;
  font-size: 0.88rem;
}

.page-learning .lineage-status {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.page-learning .lineage-status.chip-ok { border-color: var(--ok); color: var(--ok); }
.page-learning .lineage-status.chip-warn { border-color: var(--paused); color: var(--paused); }
.page-learning .lineage-status.chip-wait { border-color: var(--paused); }
.page-learning .lineage-status.chip-muted { color: var(--muted); }

.page-learning .lineage-more { margin-top: 0.6rem; }
.page-learning .lineage-more > summary { cursor: pointer; color: var(--muted); font-size: 0.84rem; }

.page-learning .lineage-link { font-size: 0.8rem; }

.page-learning .learning-replay { margin: 0.8rem 0 0; font-size: 0.92rem; }

.page-learning .learning-why { margin: 0.2rem 0 0; font-size: 0.98rem; line-height: 1.6; }

/* Chart marks shared by the Learning SVGs. */
.chart-line-acc, .chart-dot-acc { stroke: #3d8bfd; }
.chart-dot-acc { fill: #3d8bfd; }

/* The combined learning-curve chart: fixed categorical order (Okabe–Ito, CVD-safe), identity
   never color alone — each series also carries a direct line-end label and a legend chip. */
.chart-series-0 { stroke: #56b4e9; }
.chart-series-1 { stroke: #e69f00; }
.chart-series-2 { stroke: #009e73; }
.chart-series-3 { stroke: #cc79a7; }
.chart-series-4 { stroke: #f0e442; }
.chart-dotfill-0 { fill: #56b4e9; stroke: #56b4e9; }
.chart-dotfill-1 { fill: #e69f00; stroke: #e69f00; }
.chart-dotfill-2 { fill: #009e73; stroke: #009e73; }
.chart-dotfill-3 { fill: #cc79a7; stroke: #cc79a7; }
.chart-dotfill-4 { fill: #f0e442; stroke: #f0e442; }
.chart-fill-0 { fill: #56b4e9; }
.chart-fill-1 { fill: #e69f00; }
.chart-fill-2 { fill: #009e73; }
.chart-fill-3 { fill: #cc79a7; }
.chart-fill-4 { fill: #f0e442; }
.legend-chip-0 { background: #56b4e9; }
.legend-chip-1 { background: #e69f00; }
.legend-chip-2 { background: #009e73; }
.legend-chip-3 { background: #cc79a7; }
.legend-chip-4 { background: #f0e442; }
.chart-axis-lg { font-size: 11px; }
.chart-label { font-size: 13.5px; font-weight: 600; font-family: "Segoe UI", system-ui, sans-serif; }
/* Plain-words chart furniture, sized to stay readable once the viewBox scales down. */
.chart-tick { fill: var(--muted); font-size: 13px; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-zone { fill: var(--muted); font-size: 13.5px; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-zone-ok { fill: var(--ok); font-weight: 600; }
.chart-zone-auto { fill: var(--ok); opacity: 0.08; }
.chart-callout { fill: var(--text); font-size: 13.5px; font-weight: 600; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-threshold { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.chart-diagonal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
/* White casing drawn under the apply chart's diagonal so its dashes stay readable when the
   correction line lies exactly on it (dash pattern matches .chart-diagonal tick for tick). */
.chart-diagonal-casing { stroke: #fff; stroke-width: 3.6; stroke-dasharray: 4 4; opacity: 0.9; }
.chart-cal { fill: none; stroke: #3d8bfd; stroke-width: 1.6; stroke-linejoin: round; }
.chart-cal-active { stroke-width: 2.8; }
.chart-ring { fill: none; stroke-width: 2; } /* stroke comes from the series class */
.chart-event-promo { fill: #3fb950; }
.chart-event-ex { fill: var(--paused); }
.chart-figure { fill: var(--text); font-size: 11px; font-weight: 700; font-family: "Segoe UI", system-ui, sans-serif; }
.chart-square { max-width: 300px; }

/* The invisible hit layer: big targets over every mark, each carrying a data-tip that
   learning.js renders as an instant styled tooltip (native SVG <title> is not used). */
.chart-hitdot { fill: transparent; stroke: none; }
.chart-hitarea { fill: transparent; stroke: none; }
.chart-hitline { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; }
.chart-zone-auto, .chart-hitdot, .chart-hitarea, .chart-hitline { cursor: default; }

/* The floating tooltip box learning.js moves under the pointer (position set via CSSOM). */
.chart-tipbox {
  position: fixed;
  z-index: 70;
  max-width: 320px;
  background: rgba(17, 24, 39, 0.96);
  color: #f3f6fb;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 90ms ease-out;
}
.chart-tipbox.on { opacity: 1; }
.chart-tipbox b { display: block; margin-bottom: 0.15rem; font-size: 0.9rem; }

/* Quick jumps to the dev consoles, pushed to the right of the range toggle. */
.page-learning .ranges .console-link { color: var(--muted); background: transparent; }
.page-learning .ranges a:not(.console-link) + a.console-link { margin-left: auto; }
.page-learning .ranges .console-link:hover { color: var(--text); }

/* The sweep heartbeat line + recent-runs list under the range toggle. */
.page-learning .learning-sweep { margin: 0.3rem 0 0; font-size: 0.88rem; }
.page-learning .sweep-history { margin: 0.25rem 0 0.4rem; font-size: 0.86rem; }
.page-learning .sweep-history > summary { cursor: pointer; color: var(--muted); }
.page-learning .sweep-history ul { list-style: none; margin: 0.4rem 0 0; padding: 0 0 0 0.25rem; }
.page-learning .sweep-history li { padding: 0.12rem 0; color: var(--muted); }
.page-learning .sweep-history .local-time { color: var(--text); font-variant-numeric: tabular-nums; }
.page-learning .sweep-warn { color: var(--bad, #f85149); font-weight: 600; margin-left: 0.4rem; }

/* The "how to read this" strip under each chart. */
.page-learning .chart-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  align-items: center;
  margin-top: 0.55rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.page-learning .chart-key span { display: inline-flex; align-items: center; gap: 0.4rem; }
.page-learning .chart-key .key-hint { font-style: italic; }
.page-learning .key-swatch { display: inline-block; flex: none; }
.page-learning .key-dot { width: 10px; height: 10px; border-radius: 50%; background: #56b4e9; }
.page-learning .key-ring { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #56b4e9; }
.page-learning .key-zoneband { width: 18px; height: 11px; border-radius: 3px; background: var(--ok); opacity: 0.25; }
.page-learning .key-line-bold { width: 18px; height: 0; border-top: 3px solid #3d8bfd; border-radius: 2px; }
.page-learning .key-line-faded { width: 18px; height: 0; border-top: 2px solid rgba(61, 139, 253, 0.4); }
.page-learning .key-line-acc { width: 18px; height: 0; border-top: 3px solid #3d8bfd; border-radius: 2px; }
.page-learning .key-dashed { width: 18px; height: 0; border-top: 2px dashed var(--muted); }
.page-learning .key-diamond { width: 9px; height: 9px; background: #3fb950; transform: rotate(45deg); border-radius: 1px; }
.page-learning .key-ex { width: 9px; height: 9px; border-radius: 50%; background: var(--paused); }
.page-learning .key-apply-dot { width: 10px; height: 10px; border-radius: 50%; background: #e69f00; }
.page-learning .key-apply-ring { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #e69f00; }
.page-learning .key-bucket-dot { width: 10px; height: 10px; border-radius: 50%; background: #3d8bfd; }

/* The "how the correction is applied" fold inside the trust panel. */
.chart-apply-dot { fill: #e69f00; stroke: #fff; stroke-width: 1.2; }
.chart-apply-ring { fill: none; stroke: #e69f00; stroke-width: 2; }
.chart-apply-link { stroke: #e69f00; stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.7; }
.chart-bucket-dot { fill: #3d8bfd; stroke: #fff; stroke-width: 1.5; }
.page-learning .apply-how { margin-top: 0.7rem; }
.page-learning .apply-how > summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.page-learning .apply-how > p { margin: 0.5rem 0 0.3rem; font-size: 0.88rem; }
.page-learning .apply-showing { margin: 0.45rem 0 0.2rem; font-size: 0.84rem; }
.page-learning .apply-showing b { color: var(--text); }

/* Trust per area (per-cluster calibration, 2026-11-10): which areas judge themselves on their
   own tickets and what their table makes of a 90% score. */
.page-learning .area-trust { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.page-learning .area-trust h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.page-learning .area-trust > p { margin: 0 0 0.5rem; font-size: 0.84rem; }
.page-learning .area-trust-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.page-learning .area-trust-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--border); }
.page-learning .area-trust-table td { padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.page-learning .area-runs { color: #2e8b57; font-weight: 600; }
/* Spec 4.18b: the read-only "trust that measures the pick" preview. */
.page-learning .shadow-chip { font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--line); color: var(--muted); margin-left: 0.4rem; }
.page-learning .shadow-legend { margin: 0 0 0.5rem; padding-left: 1.1rem; font-size: 0.82rem; }
.page-learning .shadow-ok { margin: 0 0 0.5rem; font-size: 0.84rem; color: #2e8b57; }
.page-learning .shadow-alert { margin: 0 0 0.5rem; font-size: 0.84rem; color: #b42318; }
.page-learning .shadow-tickets { margin-top: 0.6rem; font-size: 0.84rem; }
.page-learning .shadow-flagged td { background: rgba(180, 35, 24, 0.08); }

/* Version click-through: the self-check lines above swap the fold's block; the picked
   earlier version is tinted purple (the Learning accent) until today's line is clicked. */
.page-learning .chart-hitline[data-vidx] { cursor: pointer; }
.page-learning .chart-cal-viewed { stroke: #7a4de0; stroke-opacity: 1; stroke-width: 2.4; }

/* The draw-in: pathLength="1" normalizes every animated line, one keyframe serves them all. */
.chart-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: learning-draw 1.1s ease-out forwards;
}

.chart-fade {
  opacity: 0;
  animation: learning-fade 0.5s ease-out 0.85s forwards;
}

@keyframes learning-draw { to { stroke-dashoffset: 0; } }
@keyframes learning-fade { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .chart-draw, .chart-fade {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .page-learning .learning-split { grid-template-columns: 1fr; }
  .page-learning .fan { grid-template-columns: 1fr; }
}

/* ---- approver page (approve.php): the customer's authorised approver, no login ---- */
.approve-page .auth-card { max-width: 34rem; }
.approve-message { font-size: 1.05rem; margin: 0; }
.approve-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}
.approve-facts dt { color: var(--muted); }
.approve-facts dd { margin: 0; overflow-wrap: anywhere; }
.approve-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.approve-actions .btn { min-width: 7rem; justify-content: center; }
.approve-page form.is-busy .btn { cursor: progress; }
.approve-page form.is-busy .btn[aria-busy="true"] { opacity: 1; filter: none; }
.approve-busy { margin: 0; }

/* One-time sign-in details shown to a technician once (technician-tasks.php, reveal action). */
.panel.reveal-once { border: 2px solid #d29922; margin-bottom: 1rem; }
.panel.reveal-once dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0.75rem 0 0; }
.panel.reveal-once dt { color: var(--muted); }
.panel.reveal-once dd { margin: 0; }
.panel.reveal-once code { font-size: 1.25rem; letter-spacing: 0.08em; user-select: all; }
/* The task page turns every .panel into a shrinking, clipped flex pane (body.page-tasks .panel).
   The one-time details box must never shrink or clip: a hidden row is a password nobody can read
   and it is shown only once (seen live 2026-11-16, ticket "My phone was stolen"). */
body.page-tasks .panel.reveal-once {
  display: block;
  flex: 0 0 auto;
  min-height: auto;
  max-height: none;
  overflow: visible;
}
