/* =======================================================
   Orchestrator — Conversion System + Agents pages
   ======================================================= */

/* ---------- toggle switch ---------- */
.tog { width: 36px; height: 21px; border-radius: 999px; background: var(--faint); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; border: none; padding: 0; }
.tog::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); box-shadow: var(--card-shadow); transition: left .15s; }
.tog.on { background: var(--brand); }
.tog.on::after { left: 17px; }
.tog.sm { width: 30px; height: 18px; }
.tog.sm::after { width: 14px; height: 14px; }
.tog.sm.on::after { left: 14px; }

/* ---------- Playbooks (master/detail) ---------- */
.pb-stage { border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 12px; overflow: hidden; }
.pb-stage-head { display: flex; align-items: center; gap: 11px; padding: 12px 15px; background: var(--sunken); }
.pb-stage-head .num { width: 22px; height: 22px; border-radius: 7px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--brand-strong); border: 1px solid var(--border); }
.pb-stage-head .nm { font-size: 13px; font-weight: 700; color: var(--fg-strong); }
.pb-stage-head .goal { font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.pb-tasks { padding: 6px 15px 12px; }
.pb-task { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 12.5px; color: var(--fg); border-bottom: 1px solid var(--hairline); }
.pb-task:last-child { border-bottom: none; }
.pb-task .ch-step { font-family: var(--mono); font-size: 10.5px; color: var(--dim); width: 30px; }
.pb-check { width: 17px; height: 17px; border-radius: var(--r-xs); border: 1.5px solid var(--faint); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--brand-fg); cursor: pointer; }
.pb-check.done { background: var(--brand); border-color: var(--brand); }
.pb-check.ai.done { background: var(--ai); border-color: var(--ai); }
.pb-check.ghost { border-style: dashed; color: var(--dim); cursor: default; }
.pb-task-label { flex: 1; }
.pb-task-label.done { color: var(--muted); text-decoration: line-through; }
.pb-task-x { color: var(--dim); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; opacity: 0; transition: opacity .12s; }
.pb-task:hover .pb-task-x { opacity: 1; }
.pb-task-x:hover { color: var(--alert); }
.pb-task-add { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.pb-task-add input { flex: 1; border: none; outline: none; background: transparent; font-family: inherit; font-size: 12.5px; color: var(--fg); }
.pb-task-add input::placeholder { color: var(--dim); }
.pb-gate-count { margin-left: auto; font-size: 10px; font-weight: 700; font-family: var(--mono); color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.pb-stage-head .goal { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-autonomy { display: flex; gap: 22px; padding: 11px 15px; border-top: 1px solid var(--hairline); background: color-mix(in oklch, var(--surface) 60%, var(--sunken)); }
.pb-aut { display: flex; align-items: center; gap: 9px; }
.pb-aut .lbl { font-size: 11.5px; font-weight: 600; color: var(--fg); }
.pb-aut .sub { font-size: 10px; color: var(--muted); }

/* ---------- Goals page v2: inline edit, segmented controls, composer, follow-ups ---------- */
.seg { display: inline-flex; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.seg button { font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); background: transparent; border: none; padding: 5px 11px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; }
.seg button.is-active { background: var(--surface); color: var(--fg-strong); box-shadow: var(--card-shadow); }
.seg.sm button { font-size: 11px; padding: 4px 9px; }

.inline-edit { cursor: text; border-radius: 4px; padding: 0 2px; }
.inline-edit:hover { background: color-mix(in oklch, var(--brand) 9%, transparent); box-shadow: inset 0 -1px 0 var(--border); }
.ie-ph { color: var(--dim); font-style: italic; font-weight: 400; }
.inline-edit-inp { font: inherit; color: var(--fg-strong); border: 1px solid var(--brand); border-radius: 5px; padding: 1px 5px; background: var(--surface); outline: none; min-width: 90px; }
.pb-stage-head .nm.inline-edit { font-size: 13px; font-weight: 700; color: var(--fg-strong); }
.goal-title-edit { font: inherit; }

/* task rows */
.pb-task { align-items: flex-start; }
.pb-task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pb-task-l1 { display: flex; align-items: center; gap: 8px; }
.pb-task-label { font-weight: 500; }
.pb-task.is-optional { opacity: 0.62; }
.task-type { font-size: 9.5px; font-weight: 700; letter-spacing: .02em; }
.task-type.manual { color: var(--muted); background: var(--sunken); border: 1px solid var(--border); padding: 1px 6px; border-radius: 999px; }
.pb-task-l1 .pb-task-x { margin-left: 4px; }
.pb-task-reorder { display: inline-flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity .12s; }
.pb-task:hover .pb-task-reorder { opacity: 1; }
.pb-task-reorder button { width: 18px; height: 18px; border: 1px solid var(--border); background: var(--surface); border-radius: 5px; cursor: pointer; color: var(--muted); font-size: 10px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.pb-task-reorder button:hover { color: var(--fg-strong); }
.pb-task-reorder + .pb-task-x { margin-left: 4px; }
.pb-task-convert { font-family: inherit; font-size: 9.5px; font-weight: 700; color: var(--brand); background: transparent; border: 1px dashed color-mix(in oklch, var(--brand) 40%, var(--border)); border-radius: 999px; padding: 2px 8px; cursor: pointer; }
.pb-task-convert:hover { background: color-mix(in oklch, var(--brand) 8%, transparent); }
.pb-task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-task-sub { font-size: 10.5px; color: var(--dim); }
.pb-task-note { font-size: 10.5px; color: var(--ai); margin-top: 3px; display: flex; align-items: center; gap: 4px; line-height: 1.4; }
.pb-task-note svg { width: 10px; height: 10px; flex-shrink: 0; }

/* Post-Qualify handoff simulator (Goal 1 ▸ Stage 3 → Workflow 2) */
.pqh { margin-top: 16px; border: 1.5px dashed color-mix(in oklch, var(--ai) 30%, var(--border)); background: var(--ai-bg); }
.pqh .sect-h { display: flex; align-items: center; gap: 9px; }
.pqh-live { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ai); background: color-mix(in oklch, var(--ai) 14%, transparent); padding: 2px 8px; border-radius: 999px; }
.pqh-help { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 4px 0 12px; }
.pqh-inputs { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pqh-inputs > label { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.pqh-result { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--hairline); }
.pqh-rule { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.pqh-rule svg { width: 11px; height: 11px; color: var(--ai); }
.pqh-route { font-size: 13.5px; color: var(--fg); margin-top: 6px; }
.pqh-goal { font-weight: 700; color: var(--fg-strong); }
.pqh-owner { color: var(--muted); font-size: 12px; }
.lib-missing { font-size: 9.5px; color: var(--warn); font-weight: 600; }
.req-pill { font-family: inherit; font-size: 9.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; cursor: pointer; border: 1px solid var(--border); }
.req-pill.req { color: var(--fg-strong); background: var(--sunken); }
.req-pill.opt { color: var(--muted); background: transparent; border-style: dashed; }
.task-comp { font-family: inherit; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px; cursor: pointer; border: 1px solid var(--border); }
.task-comp.auto { color: var(--ai); background: color-mix(in oklch, var(--ai) 10%, transparent); border-color: color-mix(in oklch, var(--ai) 30%, transparent); }
.task-comp.review { color: var(--muted); background: var(--sunken); }
.task-comp.human { color: var(--muted); background: var(--sunken); font-weight: 600; cursor: default; }

/* add-task affordances + composer */
.pb-add-gate { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--brand); background: transparent; border: none; cursor: pointer; padding: 9px 0 4px; }
.pb-add-stage { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--brand); background: transparent; border: 1px dashed var(--border); border-radius: var(--r-md); cursor: pointer; padding: 10px 14px; width: 100%; margin-top: 2px; }
.pb-add-stage:hover { background: color-mix(in oklch, var(--brand) 5%, transparent); }
.pb-empty { font-size: 12px; color: var(--dim); padding: 10px 0; }
.pb-empty.sm { padding: 6px 0; }
.task-composer { padding: 10px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.composer-manual { display: flex; gap: 8px; align-items: center; }
.composer-manual input, .composer-search { flex: 1; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 7px 10px; font-family: inherit; font-size: 12.5px; color: var(--fg); background: var(--surface); outline: none; }
.composer-manual input:focus, .composer-search:focus { border-color: var(--brand); }
.composer-ai { display: flex; flex-direction: column; gap: 8px; }
.composer-liblist { display: flex; flex-direction: column; gap: 3px; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); padding: 5px; }
.lib-opt { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border: none; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left; font-family: inherit; }
.lib-opt:hover { background: var(--sunken); }
.at-ic.sm { width: 24px; height: 24px; flex: none; font-size: 12px; }
.lib-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lib-opt-nm { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); display: flex; align-items: center; gap: 7px; }
.lib-opt-desc { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-custom { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--sunken); border: 1px solid var(--border); padding: 1px 5px; border-radius: var(--r-xs);x; border-radius: 3px; }
.mode-chip { font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.mode-chip.auto { color: var(--ai); background: color-mix(in oklch, var(--ai) 12%, transparent); }
.mode-chip.review { color: var(--muted); background: var(--sunken); border: 1px solid var(--border); }
.lib-empty { font-size: 11.5px; color: var(--dim); padding: 10px; text-align: center; }
.lib-create { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--brand); background: transparent; border: 1px dashed var(--border); border-radius: var(--r-sm); padding: 8px; cursor: pointer; }
.lib-create:hover { background: color-mix(in oklch, var(--brand) 6%, transparent); }
.composer-cancel { align-self: flex-start; }

/* stage menu + transition */
.pb-stage-menu { display: inline-flex; gap: 3px; margin-left: 8px; }
.pb-stage-menu button { width: 22px; height: 22px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 12px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.pb-stage-menu button:hover { color: var(--fg-strong); }
.pb-stage-menu button.del:hover { color: var(--alert); border-color: color-mix(in oklch, var(--alert) 40%, var(--border)); }
.pb-transition { display: flex; align-items: center; gap: 10px; padding: 10px 15px; border-top: 1px solid var(--hairline); background: var(--surface); flex-wrap: wrap; }
.pb-trans-label { font-size: 11.5px; font-weight: 600; color: var(--fg); }

/* per-stage autonomy v2 + follow-ups expander */
.pb-autonomy.v2 { display: flex; flex-direction: column; gap: 0; padding: 0; background: color-mix(in oklch, var(--surface) 60%, var(--sunken)); }
.pb-autonomy.v2 .aut-row { display: flex; align-items: center; gap: 14px; padding: 11px 15px; border-top: 1px solid var(--hairline); }
.aut-label { flex: 1; min-width: 0; }
.aut-label .lbl { font-size: 11.5px; font-weight: 600; color: var(--fg); }
.aut-label .sub { font-size: 10px; color: var(--muted); }
.aut-followups.is-open { background: var(--sunken); }
.fu-options { padding: 4px 15px 14px; display: flex; flex-direction: column; gap: 12px; }
.fu-field { display: flex; align-items: center; gap: 12px; }
.fu-field.col { align-items: flex-start; flex-direction: column; gap: 7px; }
.fu-field > label { font-size: 11px; font-weight: 600; color: var(--muted); min-width: 120px; }
.fu-field.col > label { min-width: 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.stepper button { width: 28px; height: 28px; border: none; background: transparent; cursor: pointer; font-size: 15px; color: var(--muted); }
.stepper button:hover { background: var(--sunken); color: var(--fg-strong); }
.stepper span { min-width: 30px; text-align: center; font-size: 12.5px; font-weight: 700; font-family: var(--mono); }
.fu-gaps { display: flex; flex-direction: column; gap: 6px; }
.fu-gap { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--fg); }
.fu-gap input { width: 52px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 7px; font-family: var(--mono); font-size: 12px; text-align: center; color: var(--fg); background: var(--surface); }
.fu-field select { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 9px; font-family: inherit; font-size: 12px; color: var(--fg); background: var(--surface); }
.fu-summary { font-size: 11px; color: var(--muted); font-style: italic; line-height: 1.5; padding: 8px 11px; background: var(--surface); border-radius: var(--r-sm); border: 1px solid var(--border); }

/* goal CRUD: create form + kebab menu */
.goal-create { display: flex; flex-direction: column; gap: 7px; padding: 12px; border: 1px solid var(--brand); border-radius: var(--r-md); margin: 0 8px 10px; background: var(--surface); }
.goal-create input { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 7px 10px; font-family: inherit; font-size: 12.5px; color: var(--fg); outline: none; }
.goal-create input:focus { border-color: var(--brand); }
.goal-create-acts { display: flex; gap: 7px; }
.goal-kebab-wrap { position: relative; }
/* goal list-item: name + small inline lead count on one line, desc full-width below */
.goal-li { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.goal-li-top { display: flex; align-items: center; gap: 8px; }
.goal-li-top .nm { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--fg-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-li-leads { flex-shrink: 0; font-size: 10px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-li-desc { font-size: 11.5px; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.goal-li.is-active .goal-li-desc { color: var(--fg); }
.goal-li-meta { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); }
.goal-li .goal-kebab { opacity: 0; }
.goal-li:hover .goal-kebab { opacity: 1; }
.goal-kebab { width: 24px; height: 24px; border: none; background: transparent; color: var(--dim); cursor: pointer; border-radius: 6px; font-size: 16px; line-height: 1; opacity: 0; }
.crm-li:hover .goal-kebab { opacity: 1; }
.goal-kebab:hover { background: var(--sunken); color: var(--fg-strong); }
.goal-menu { position: absolute; right: 0; top: 26px; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--card-shadow); padding: 4px; display: flex; flex-direction: column; min-width: 130px; }
.goal-menu button { text-align: left; padding: 7px 10px; border: none; background: transparent; font-family: inherit; font-size: 12px; color: var(--fg); cursor: pointer; border-radius: var(--r-sm); }
.goal-menu button:hover { background: var(--sunken); }
.goal-menu button.danger { color: var(--alert); }

/* AI Tasks page: persisted builder, card menu, deeplink banner/toast */
.aitask { position: relative; }
.at-menu-wrap { position: relative; }
.at-kebab { width: 24px; height: 24px; border: none; background: transparent; color: var(--dim); cursor: pointer; border-radius: var(--r-sm); font-size: 16px; line-height: 1; }
.at-kebab:hover { background: var(--sunken); color: var(--fg-strong); }
.aitask-builder .field input.inp, .aitask-builder .field textarea.inp { font-family: inherit; outline: none; width: 100%; box-sizing: border-box; color: var(--fg); }
.aitask-builder .field textarea.inp.area { color: var(--fg); resize: vertical; }
.aitask-builder .field input.inp:focus, .aitask-builder .field textarea.inp:focus { border-color: var(--brand); }
.aitask-banner { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ai); background: color-mix(in oklch, var(--ai) 9%, transparent); border: 1px solid color-mix(in oklch, var(--ai) 26%, transparent); border-radius: var(--r-md); padding: 10px 13px; margin-bottom: 14px; }
.aitask-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--fg-strong); color: var(--surface); font-size: 12.5px; font-weight: 500; padding: 10px 16px; border-radius: var(--r-lg); box-shadow: 0 8px 28px color-mix(in oklch, var(--fg-strong) 22%, transparent); display: flex; align-items: center; gap: 12px; }
.aitask-toast button { background: color-mix(in oklch, var(--surface) 18%, transparent); color: var(--surface); border: none; border-radius: var(--r-sm); padding: 4px 10px; font-family: inherit; font-weight: 700; font-size: 11.5px; cursor: pointer; }
.aitask-split { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.aitask-builder-note { font-size: 11px; color: var(--muted); line-height: 1.5; }
.aitask-builder .orch-btn { width: 100%; justify-content: center; }

/* ---------- Routing rules ---------- */
/* folder + flow library layout */
.route-layout { display: grid; grid-template-columns: 244px 1fr; gap: 18px; align-items: start; }
.route-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg, 12px); padding: 8px; position: sticky; top: 8px; }
.route-sidebar-h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 8px 10px; }
.route-sidebar-cnt { margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--dim); background: var(--sunken); border-radius: 999px; padding: 1px 8px; }
.route-folder { margin-bottom: 2px; }
.route-folder-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: none; background: transparent; cursor: pointer; font-family: inherit; border-radius: var(--r-sm, 7px); }
.route-folder-h:hover { background: var(--sunken); }
.route-folder-caret { color: var(--dim); transition: transform .12s ease; flex: none; }
.route-folder-caret.is-open { transform: rotate(90deg); }
.route-folder-ic { color: var(--muted); flex: none; }
.route-folder-nm { font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.route-folder-cnt { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--dim); }
.route-flow-list { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 4px 12px; margin-left: 9px; border-left: 1px solid var(--border); }
.route-flow-item { display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 8px 9px; border: none; background: transparent; cursor: pointer; font-family: inherit; border-radius: var(--r-sm, 7px); text-align: left; }
.route-flow-item:hover { background: var(--sunken); }
.route-flow-item.is-active { background: color-mix(in oklch, var(--brand) 11%, transparent); }
.route-flow-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--dim); margin-top: 4px; }
.route-flow-dot.active { background: var(--ok); }
.route-flow-dot.draft { background: transparent; border: 1.5px solid var(--dim); }
.route-flow-dot.paused { background: var(--warn); }
.route-flow-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.route-flow-nm { font-size: 12px; font-weight: 500; color: var(--fg); line-height: 1.3; }
.route-flow-item.is-active .route-flow-nm { font-weight: 700; color: var(--fg-strong); }
.route-flow-stat { font-size: 10px; color: var(--dim); }
.route-flow-kebab-wrap { position: relative; }
.route-flow-kebab { width: 22px; height: 22px; border: none; background: transparent; color: var(--dim); cursor: pointer; border-radius: 5px; font-size: 14px; line-height: 1; opacity: 0; }
.route-flow-item:hover .route-flow-kebab { opacity: 1; }
.route-flow-kebab:hover { background: var(--surface); color: var(--fg-strong); }
.route-folder-add { margin-left: 6px; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; color: var(--dim); font-size: 15px; opacity: 0; }
.route-folder-h:hover .route-folder-add { opacity: 1; }
.route-folder-add:hover { background: var(--surface); color: var(--brand); }
.route-folder-kebab-wrap { position: relative; display: inline-flex; }
.route-folder-kebab { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; color: var(--dim); font-size: 14px; opacity: 0; cursor: pointer; }
.route-folder-h:hover .route-folder-kebab { opacity: 1; }
.route-folder-kebab:hover { background: var(--surface); color: var(--fg-strong); }
.route-folder-rename { font: inherit; font-size: 12.5px; font-weight: 600; border: 1px solid var(--brand); border-radius: 5px; padding: 1px 5px; background: var(--surface); color: var(--fg-strong); outline: none; width: 120px; }
.route-newfolder { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); background: transparent; border: none; cursor: pointer; padding: 9px 9px 4px; }
.route-newfolder:hover { color: var(--brand); }
.route-main { min-width: 0; position: relative; }

.route-flow-head { display: flex; align-items: flex-start; gap: 24px; margin: 2px 0 12px; flex-wrap: wrap; }
.rfh-main { min-width: 0; flex: 1; }
.rfh-name { font-size: 15px; font-weight: 700; color: var(--fg-strong); display: flex; align-items: center; gap: 10px; }
.rfh-name-edit { font: inherit; }
.rfh-status { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 9px; border-radius: 999px; color: var(--brand); background: color-mix(in oklch, var(--brand) 12%, transparent); border: 1px solid color-mix(in oklch, var(--brand) 28%, transparent); }
.rfh-desc { font-size: 12px; color: var(--muted); margin-top: 5px; max-width: 640px; line-height: 1.5; }
.rfh-meta { display: flex; align-items: center; gap: 14px; margin-top: 11px; flex-wrap: wrap; }
.rfh-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.rfh-acts { display: flex; gap: 7px; }
.rfh-livenote { font-size: 11px; color: var(--ok); background: var(--ok-bg); border-radius: var(--r-sm); padding: 4px 9px; font-weight: 600; margin: 0 0 10px; display: inline-flex; align-items: center; gap: 6px; }
.rfh-stats { display: flex; gap: 22px; }
.rfh-stat { display: flex; flex-direction: column; gap: 1px; }
.rfh-stat .v { font-size: 13px; font-weight: 700; color: var(--fg-strong); font-variant-numeric: tabular-nums; }
.rfh-stat .k { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); }
.rule-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--hairline); }
.rule-row:last-child { border-bottom: none; }
.rule-row .pri { width: 24px; height: 24px; border-radius: 7px; background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); cursor: grab; }
.rule-cond { font-size: 12.5px; color: var(--fg); }
.rule-cond b { font-weight: 700; color: var(--fg-strong); }
.rule-cond .arrow { color: var(--dim); margin: 0 8px; }
.rule-cond .assignee { display: inline-flex; align-items: center; gap: 6px; }
.rule-cond .route-target { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-cond .goal-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--brand); background: color-mix(in oklch, var(--brand) 12%, transparent); border: 1px solid color-mix(in oklch, var(--brand) 28%, transparent); }
.rule-cond .route-dot { color: var(--dim); }
.rule-row.is-default { background: color-mix(in oklch, var(--brand) 4%, transparent); }
.rule-row.is-default .pri { background: color-mix(in oklch, var(--brand) 14%, transparent); color: var(--brand); }
.kill-switch { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: var(--r-md); border: 1px solid color-mix(in oklch, var(--alert) 30%, var(--border)); background: var(--alert-bg); }
.kill-switch .t { flex: 1; }
.kill-switch .t .nm { font-size: 13px; font-weight: 700; color: var(--alert); }
.kill-switch .t .sub { font-size: 11.5px; color: oklch(0.45 0.10 30); }

/* ---------- Connections / field map ---------- */
.conn-card { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
.conn-card .logo { width: 40px; height: 40px; border-radius: var(--r-lg); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: var(--brand-fg); }
.conn-card .logo.hs { background: oklch(0.62 0.16 35); }
.conn-card .logo.sf { background: oklch(0.55 0.13 245); }
.conn-card .nm { font-size: 13px; font-weight: 700; color: var(--fg-strong); }
.conn-card .sub { font-size: 11.5px; color: var(--muted); }
.fieldmap { display: grid; grid-template-columns: 1fr 30px 1fr; gap: 10px 14px; align-items: center; }

/* ---------- Sources ---------- */
.src-divider { display: flex; align-items: center; gap: 14px; margin: 24px 0 4px; }
.src-divider::before, .src-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.src-divider span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.src-row { display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--hairline); }
.src-logo { width: 32px; height: 32px; border-radius: var(--r-md); flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; text-transform: uppercase; color: #fff; letter-spacing: 0.02em; }
.src-logo.eb { background: oklch(0.55 0.16 280); }
.src-logo.wf { background: oklch(0.55 0.13 200); }
.src-logo.gm { background: oklch(0.60 0.17 25); }
.src-main { flex: 1; min-width: 0; }
.src-nm { font-size: 13px; font-weight: 700; color: var(--fg-strong); display: flex; align-items: center; gap: 9px; }
.src-kind { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--sunken); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.src-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.src-add { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; padding: 12px; border: none; border-top: 1px dashed var(--border); background: transparent; color: var(--brand); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.src-add:hover { background: color-mix(in oklch, var(--brand) 5%, transparent); }
.src-rules { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.src-rule { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; }
.src-rule-num { width: 24px; height: 24px; border-radius: 7px; background: var(--sunken); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); }
.src-rule-from { font-size: 12.5px; font-weight: 700; color: var(--fg-strong); display: flex; align-items: center; gap: 8px; }
.src-rule-txt { font-size: 12px; color: var(--muted); margin: 3px 0 7px; line-height: 1.45; }
.src-rule-chip { display: inline-flex; align-items: center; font-size: 11.5px; font-family: var(--mono); color: var(--fg); background: var(--sunken); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 10px; }
.src-rule-chip b { font-weight: 700; color: var(--fg-strong); font-family: var(--font); }
.fieldmap .f { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 12px; background: var(--surface); display: flex; align-items: center; gap: 8px; }
.fieldmap .f .tagk { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.fieldmap .arrow { text-align: center; color: var(--dim); }
.mailbox-row { display: grid; grid-template-columns: 32px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
.mailbox-row:last-child { border-bottom: none; }
.mailbox-row .em { font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--fg-strong); }
.mailbox-row .meta { font-size: 9.5px; color: var(--muted); }
.mailbox-row .cls { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.mailbox-row .cls.alias { background: var(--info-bg); color: var(--info); }
.mailbox-row .cls.shared { background: var(--sunken); color: var(--muted); }

/* ---------- Agents ---------- */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.agent-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 11px; }
.agent-card .ag-top { display: flex; align-items: center; gap: 12px; }
.agent-card .av { position: relative; flex-shrink: 0; }
.agent-card .av .live { position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--info); border: 2px solid var(--surface); }
.agent-card .ag-nm { font-size: 13px; font-weight: 700; color: var(--fg-strong); }
.agent-card .ag-role { font-size: 11.5px; color: var(--muted); }
.agent-card .ag-kind { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; }
.agent-card .ag-kind.rep { background: var(--info-bg); color: var(--info); }
.agent-card .ag-kind.persona { background: var(--ai-bg); color: var(--ai); }
.voice-bar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); background: var(--sunken); }
.voice-bar .wave { display: flex; align-items: center; gap: 2px; height: 22px; }
.voice-bar .wave i { width: 3px; border-radius: 2px; background: var(--ai); }
.voice-bar .vt { font-size: 11.5px; color: var(--fg); }
.voice-bar .vt b { color: var(--fg-strong); font-weight: 600; }
.agent-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.agent-meta .guardrail { margin-left: auto; }
.agent-stat { display: flex; gap: 20px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.agent-stat .s .v { font-size: 18px; font-weight: 700; color: var(--fg-strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.agent-stat .s .k { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- Resources ---------- */
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.res-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.res-card .rc-top { display: flex; align-items: center; gap: 9px; }
.res-card .rc-tt { min-width: 0; overflow: hidden; }
.res-card .rc-ic { width: 34px; height: 34px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; font-size: 9.5px; letter-spacing: 0.03em; font-weight: 700; }
.res-card .rc-ic.case { background: var(--info-bg); color: var(--info); }
.res-card .rc-ic.price { background: var(--warn-bg); color: var(--warn); }
.res-card .rc-ic.doc { background: var(--warn-bg); color: var(--warn); }
.res-card .rc-ic.claim { background: var(--warn-bg); color: var(--warn); }
.res-card .rc-nm { font-size: 13px; font-weight: 700; color: var(--fg-strong); }
.res-card .rc-sub { font-size: 11px; color: var(--muted); }
.res-card .rc-body { font-size: 12px; color: var(--fg); line-height: 1.45; }
.res-card .rc-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--hairline); font-size: 11px; color: var(--muted); }
.res-card .rc-uses { margin-left: auto; font-size: 9.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- AI Tasks ---------- */
.aitask-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.aitask { padding: 11px 13px; display: flex; gap: 13px; align-items: flex-start; }
.aitask .ai-mark { margin-bottom: 6px; }
.aitask .at-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--ai-bg); color: var(--ai); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.aitask .at-nm { font-size: 13px; font-weight: 700; color: var(--fg); }
.aitask .at-desc { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.aitask .at-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 10.5px; color: var(--muted); }
.aitask-builder { padding: 16px 18px; border: 1.5px dashed var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.aitask-builder .field { display: flex; flex-direction: column; gap: 5px; }
.aitask-builder .field label { font-size: 11px; font-weight: 600; color: var(--muted); }
.aitask-builder .field .inp { height: 34px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 11px; font-size: 12.5px; color: var(--fg); background: var(--surface); display: flex; align-items: center; }
.aitask-builder .field .inp.area { height: auto; min-height: 60px; padding: 9px 11px; align-items: flex-start; color: var(--muted); }
