/* Orbit Strategy — definition management, run controls, and drilldown */
.strategy-filterbar { align-items: center; }
.strategy-filterbar .meta { white-space: nowrap; }
.strat-row { cursor: pointer; outline: 0; }
.strat-row:focus-visible { box-shadow: inset 3px 0 var(--accent); background: var(--accent-soft); }
.strat-row.is-selected { background: color-mix(in oklch, var(--accent-soft) 70%, transparent); }
.strat-row[hidden] { display: none !important; }
.strat-row .ctl .btn { position: relative; z-index: 1; }

.strategy-drawer {
  position: fixed;
  z-index: 60;
  top: var(--topbar, 58px);
  right: 0;
  bottom: 0;
  width: min(440px, calc(100vw - var(--rail-w, 236px)));
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -18px 0 48px color-mix(in oklch, var(--fg) 12%, transparent);
  overflow: auto;
}
.strategy-drawer[hidden] { display: none; }
.strategy-drawer-head {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 76px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.strategy-drawer-head h2 { margin: 4px 0 0; font-size: 18px; font-weight: 620; letter-spacing: -.015em; }
.strategy-drawer-meta { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.strategy-stage-list { padding: 16px 18px; display: grid; gap: 9px; }
.strategy-stage {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: color-mix(in oklch, var(--bg) 48%, var(--surface));
}
.strategy-stage-index { color: var(--muted); font: 10px/30px var(--font-mono); text-align: center; }
.strategy-stage strong { display: block; font-size: 12.5px; font-weight: 600; }
.strategy-stage p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.run-context { margin: 0 18px 16px; padding: 13px; border: 1px solid var(--border); border-radius: 7px; }
.run-context h3 { margin: 0; font-size: 12.5px; font-weight: 600; }
.run-context-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.run-context-grid span { display: block; color: var(--muted); font: 10px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; }
.run-context-grid strong { display: block; margin-top: 4px; font-size: 12px; font-weight: 550; }
.strategy-drawer-actions { position: sticky; bottom: 0; padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface); display: flex; gap: 8px; }
.strategy-drawer-actions .btn { flex: 1; }

.strategy-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 24px 70px color-mix(in oklch, var(--fg) 30%, transparent);
}
.strategy-dialog::backdrop { background: color-mix(in oklch, var(--fg) 32%, transparent); backdrop-filter: blur(3px); }
.strategy-dialog form { padding: 18px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.dialog-head h2 { margin: 4px 0 0; font-size: 20px; font-weight: 620; }
.dialog-copy { margin: 14px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dialog-span { grid-column: 1 / -1; }
.strategy-dialog .field { margin: 0; }
.strategy-dialog label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 550; }
.strategy-dialog .input,
.strategy-dialog .select { width: 100%; }
.strategy-dialog [aria-invalid='true'] { border-color: var(--no); box-shadow: 0 0 0 2px color-mix(in oklch, var(--no) 12%, transparent); }
.field-error { margin: 6px 0 0; color: var(--no); font-size: 11px; line-height: 1.35; }
.dialog-note { margin-top: 15px; padding: 11px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.dialog-note strong { color: var(--fg); }
.dialog-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 860px) {
  .strategy-drawer { top: 0; width: 100%; max-width: 520px; }
}
@media (max-width: 560px) {
  .strategy-drawer { max-width: none; }
  .strategy-drawer-actions { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
  .dialog-grid { grid-template-columns: 1fr; }
  .dialog-span { grid-column: auto; }
  .dialog-actions .btn { flex: 1; }
}
