/* ==================================================================
   Threshold - Authoring > Routing
   ------------------------------------------------------------------
   Lifted from the approved Routing Policy canon (Routing Policy.dc.html
   inline values) and the handoff's routing classes (handoff/threshold-
   ops.css: th-rule-*, th-drop, th-moveto, th-rule-menu, th-rule-picker),
   with the handoff's names mapped onto production tokens exactly as
   threshold-operational-components.css maps them:

     --th-sunk -> --th-paper-sunk     --th-radius / -sm -> --th-radius-5 / -3
     --th-mono / sans / serif -> --th-font-mono / sans / serif
     --ruleAcc / --ruleSoft -> --th-rule / --th-rule-soft

   Cards, banners' base, the scrim, modal parts, fields and pills come from
   the shared operational primitives and production atoms (th-card, cc-btn,
   cc-pill); this file holds the routing screen's own layout and its deltas.
   No token is declared here. Shadows and scrims are literal values, as
   the canon writes them.
   ================================================================== */

.th-route-page { container-type: inline-size; container-name: th-route; position: relative; } /* contains the visually hidden live region, so an open picker never lengthens the document */
.th-route-sub { margin-top: 4px; font-size: 12.5px; color: var(--th-ink-2); max-width: 680px; line-height: 1.5; }
.th-route-body { padding: 0 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.th-route-gutter { padding: 0 24px 24px; }
.th-route-restricted { margin: 0; }
.th-route-restricted .th-empty__title { font-size: 14.5px; }
.th-route-restricted .th-empty__body { max-width: 460px; font-size: 12.5px; }
.th-route-mono { font-family: var(--th-font-mono); font-size: 11.5px; }

/* ---------- banners (the routing canon's: an 18px icon column, 11/14 padding, 12.5px) ---------- */
.th-route-banner {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--th-radius-5);
  font-size: 12.5px;
  line-height: 1.5;
}
.th-route-banner > svg { margin-top: 2px; }
.th-route-banner b { font-weight: 600; }
.th-route-banner.has-action { grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; }
.th-route-banner.has-action > svg { margin-top: 0; }
.th-route-banner.is-warn { border: 1px solid var(--th-warn); background: var(--th-warn-soft); color: var(--th-warn-ink); }
.th-route-banner.is-risk { border: 1px solid var(--th-risk); background: var(--th-risk-soft); color: var(--th-risk-ink); }
.th-route-banner__action {
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: var(--th-radius-3);
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.th-route-banner__action:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-route-offline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--th-warn);
  border-radius: var(--th-radius-5);
  background: var(--th-warn-soft);
  color: var(--th-warn-ink);
  font-size: 12.5px;
}

/* ---------- current version strip ---------- */
.th-route-current {
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-5);
  background: var(--th-paper-sunk);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.th-route-current__item { display: flex; flex-direction: column; gap: 2px; }
.th-route-current__label { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--th-ink-2); font-weight: 600; }
.th-route-current__value { font-size: 13px; color: var(--th-ink); display: inline-flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.th-route-current__value.is-mono { font-family: var(--th-font-mono); }
.th-route-current__version { font-family: var(--th-font-mono); font-weight: 600; }
.th-route-current__divider { width: 1px; height: 26px; background: var(--th-line); flex: none; }
.th-route-current__mono {
  flex-basis: 100%;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--th-font-mono);
  font-size: 11px;
  color: var(--th-ink-2);
  border-top: 1px solid var(--th-line-soft);
  padding-top: 8px;
  margin-top: 2px;
}

/* ---------- tabs ---------- */
.th-route-tabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--th-line); overflow-x: auto; }
.th-route-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 9px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--th-ink-2);
}
.th-route-tab.is-active { color: var(--th-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--th-advant); }
.th-route-tab:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; border-radius: 2px; }
.th-route-tab__count { font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-ink-2); font-weight: 400; }

/* ---------- Draft layout ---------- */
.th-two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.th-route-col { display: flex; flex-direction: column; gap: 14px; }
.th-route-card-meta { margin-left: auto; font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-ink-2); }
.th-route-required { color: var(--th-risk); font-size: 11.5px; }
.th-route-card-tag { font-family: var(--th-font-mono); font-size: 10.5px; color: var(--th-ink-2); }
.th-route-default { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.th-route-help { font-size: 12px; color: var(--th-ink-2); line-height: 1.5; }
.th-route-error { font-size: 12px; color: var(--th-risk-ink); display: inline-flex; align-items: center; gap: 6px; }
.th-route-add {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--th-radius-3);
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--th-line-2);
  background: var(--th-paper);
  color: var(--th-ink);
  cursor: pointer;
  position: relative;
}
.th-route-add:hover { border-color: var(--th-ink-4); }
.th-route-add:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-route-add:disabled { opacity: .5; cursor: not-allowed; }
.th-route-info {
  padding: 10px 16px 6px;
  font-size: 12px;
  color: var(--th-ink-2);
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.th-route-info > svg { flex: none; margin-top: 2px; color: var(--th-ink-2); }
.th-route-empty-rules { padding: 16px; font-size: 12.5px; color: var(--th-ink-2); }
.th-route-note { padding: 10px 16px; font-size: 11.5px; color: var(--th-ink-2); line-height: 1.55; }

/* ---------- team picker (default and each row) ---------- */
.th-route-teamwrap { position: relative; display: inline-block; max-width: 100%; }
.th-route-teamwrap.is-default { align-self: flex-start; }
.th-route-teampick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--th-radius-3);
  background: var(--th-paper);
  border: 1px solid var(--th-line-2);
  color: var(--th-ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.th-route-teampick.is-default { padding: 7px 12px 7px 10px; font-size: 13px; min-width: min(320px, 100%); }
.th-route-teampick.is-row { padding: 5px 10px 5px 8px; font-size: 12.5px; width: 100%; }
.th-route-teampick.is-invalid { border-color: var(--th-risk); }
.th-route-teampick:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-route-teampick:disabled { cursor: not-allowed; opacity: .5; }
.th-route-teampick__icon {
  width: 22px;
  height: 22px;
  border-radius: var(--th-radius-3);
  display: grid;
  place-items: center;
  background: var(--th-paper-2);
  border: 1px solid var(--th-line);
  color: var(--th-ink-2);
  flex: none;
}
.th-route-teampick > svg { color: var(--th-ink-2); flex: none; }
.th-route-teampick__name { flex: 1; font-weight: 600; white-space: nowrap; }
.th-route-teampick.is-row .th-route-teampick__name { overflow: hidden; text-overflow: ellipsis; }
/* The default chooser keeps the canon's one line but never grows past its card. */
.th-route-teampick.is-default { max-width: 100%; }
.th-route-teampick.is-default .th-route-teampick__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.th-route-listbox {
  position: absolute;
  top: calc(100% + 4px);
  z-index: 40;
  background: var(--th-paper-sunk);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-5);
  box-shadow: 0 8px 24px oklch(20% 0.01 255 / 0.13);
  padding: 4px;
}
.th-route-listbox.is-default { left: 0; min-width: 320px; }
.th-route-listbox.is-row { right: 0; min-width: 300px; }
.th-route-listbox__search { margin: 4px 4px 6px; }
.th-route-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--th-radius-3);
  font: inherit;
  font-size: 12.5px;
  color: var(--th-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.th-route-option:hover { background: var(--th-paper-2); }
.th-route-option:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; }
.th-route-option:disabled { opacity: .55; cursor: not-allowed; }
.th-route-option__mark { font-family: var(--th-font-mono); width: 14px; color: var(--th-advant-deep); }
.th-route-option__name { flex: 1; }
.th-route-option__note { font-size: 11px; color: var(--th-ink-2); }
.th-route-option__more { justify-content: center; color: var(--th-ink-2); }
.th-route-listbox__state { padding: 8px 10px; font-size: 12px; color: var(--th-ink-2); }

/* ---------- rule picker (handoff th-rule-picker) ---------- */
.th-rule-picker {
  margin: 10px 16px 4px;
  background: var(--th-paper);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-5);
  box-shadow: 0 8px 24px oklch(20% 0.01 255 / 0.10);
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  container-name: th-picker;
}
.th-rule-picker__head { padding: 10px 12px 8px; border-bottom: 1px solid var(--th-line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.th-rule-picker__meta { font-size: 11.5px; color: var(--th-ink-2); white-space: nowrap; }
.th-rule-picker__scope {
  padding: 6px 12px 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--th-ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.th-rule-picker__scope-note { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--th-ink-2); }
.th-rule-picker__results { padding: 4px; }
.th-rule-picker__foot {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--th-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--th-ink-2);
  flex-wrap: wrap;
}
.th-rule-picker__pager { display: inline-flex; align-items: center; gap: 4px; }
.th-rule-picker__page { font-family: var(--th-font-mono); font-size: 11px; padding: 0 4px; }
.th-rule-picker__step {
  padding: 2px 8px;
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-3);
  background: var(--th-paper-sunk);
  font: inherit;
  font-size: 11.5px;
  color: var(--th-ink-2);
  cursor: pointer;
}
.th-rule-picker__step:disabled { opacity: .45; cursor: default; }
.th-rule-picker__step:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-rule-picker__close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--th-radius-3);
  color: var(--th-ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.th-rule-picker__close:hover { background: var(--th-paper-2); color: var(--th-ink); }
.th-rule-picker__close:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-rule-picker__none { padding: 22px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.th-rule-picker__none-title { font-size: 13px; font-weight: 600; color: var(--th-ink); }
.th-rule-picker__none-body { font-size: 12px; color: var(--th-ink-2); max-width: 360px; line-height: 1.45; }
.th-rule-picker__clear {
  margin-top: 4px;
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-3);
  background: var(--th-paper-sunk);
  color: var(--th-ink);
  cursor: pointer;
  white-space: nowrap;
}
.th-rule-picker__state { padding: 14px 12px; font-size: 12px; color: var(--th-ink-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.th-route-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--th-paper-sunk);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-3);
  padding: 5px 10px;
  flex: 1 1 240px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--th-ink-2);
}
.th-route-search:focus-within { border-color: var(--th-advant); }
.th-route-search > svg { color: var(--th-ink-2); flex: none; }
.th-route-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 12.5px; color: var(--th-ink); }
.th-route-search input::placeholder { color: var(--th-ink-2); opacity: 1; }
.th-rule-opt {
  display: grid;
  grid-template-columns: 16px minmax(120px, 1fr) minmax(0, auto);
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: var(--th-radius-3);
  font: inherit;
  font-size: 12.5px;
  color: var(--th-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.th-rule-opt:hover { background: var(--th-paper-2); }
.th-rule-opt:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; }
.th-rule-opt[disabled] { opacity: .55; cursor: default; }
.th-rule-opt > svg { color: var(--th-rule); flex: none; margin-top: 2px; }
.th-rule-opt__text { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; min-width: 0; }
.th-rule-opt__name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-rule-opt__ref { font: 11px var(--th-font-mono); color: var(--th-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-rule-opt__cond {
  font-size: 11.5px;
  color: var(--th-ink-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.th-rule-note { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; min-width: 0; max-width: 200px; overflow-wrap: anywhere; }
.th-rule-note__sub { font-size: 11px; color: var(--th-ink-2); line-height: 1.35; }
@container th-picker (max-width: 560px) {
  .th-rule-opt { grid-template-columns: 16px minmax(0, 1fr); }
  .th-rule-note { grid-column: 2; align-items: flex-start; text-align: left; max-width: none; }
}

/* ---------- ordered specialist rules (handoff th-rule-row, th-drop, th-rule-menu, th-moveto) ---------- */
.th-rule-list { position: relative; container-type: inline-size; container-name: th-rulelist; }
.th-rule-row {
  display: grid;
  grid-template-columns: 28px 22px minmax(0, 1.3fr) 24px minmax(0, 1fr) auto 32px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px 10px 8px;
  border-bottom: 1px solid var(--th-line-soft);
  position: relative;
}
.th-rule-row.is-dragging { opacity: .45; background: var(--th-paper-2); outline: 2px dashed var(--th-line-2); outline-offset: -2px; }
.th-rule-row.is-moved { box-shadow: inset 3px 0 0 var(--th-advant); } /* the row that just moved; focus is on its move control */
.th-rule-row.is-invalid { background: var(--th-risk-soft); }
.th-rule-pos {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font: 600 12px var(--th-font-mono);
  color: var(--th-ink);
  background: var(--th-paper-2);
  border: 1px solid var(--th-line);
}
.th-rule-handle {
  width: 22px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  color: var(--th-ink-2);
  cursor: grab;
  border-radius: var(--th-radius-3);
  touch-action: none;
}
.th-rule-handle:hover { background: var(--th-paper-2); color: var(--th-ink); }
.is-dragging .th-rule-handle { cursor: grabbing; color: var(--th-advant-deep); }
.th-rule-main { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.th-rule-main > svg { color: var(--th-rule); flex: none; margin-top: 2px; }
.th-rule-main__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.th-rule-main__name { font-size: 13px; color: var(--th-ink); font-weight: 500; }
.th-rule-main__ref { font-family: var(--th-font-mono); font-size: 11px; color: var(--th-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-rule-main__cond {
  font-size: 11.5px;
  color: var(--th-ink-2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.th-rule-arrow { color: var(--th-ink-2); font-size: 12px; text-align: center; }
.th-rule-team { position: relative; display: inline-block; min-width: 0; }
.th-rule-move { position: relative; display: inline-block; } /* one always-visible "Move…" button per row; aria-label "Move <rule>" */
.th-rule-move__btn {
  height: 32px;
  padding: 0 10px 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-3);
  background: var(--th-paper-sunk);
  color: var(--th-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.th-rule-move__btn:hover { background: var(--th-paper-2); }
.th-rule-move__btn[aria-expanded="true"] { border-color: var(--th-advant); }
.th-rule-move__btn:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-rule-move__btn.is-single { opacity: .6; }
.th-rule-move__btn:disabled { opacity: .5; cursor: not-allowed; }
.th-rule-move__btn > svg { color: var(--th-ink-2); }
.th-rule-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 220px;
  background: var(--th-paper-sunk);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-5);
  box-shadow: 0 8px 24px oklch(20% 0.01 255 / 0.12);
  padding: 4px;
}
.th-rule-menu__head { padding: 6px 10px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--th-ink-2); }
.th-rule-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--th-radius-3);
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--th-ink);
  cursor: pointer;
  text-align: left;
}
.th-rule-menu__item:hover { background: var(--th-paper-2); }
.th-rule-menu__item:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; }
.th-rule-menu__item[aria-disabled="true"] { opacity: .45; cursor: not-allowed; } /* Move up at position 1, Move down at position N - shown, not hidden, still reachable */
.th-rule-menu__item > svg { color: var(--th-ink-2); }
.th-rule-menu__item--sep { border-top: 1px solid var(--th-line-soft); margin-top: 2px; }
.th-rule-menu__label { flex: 1; }
.th-rule-menu__note { font-size: 11px; color: var(--th-ink-2); }
.th-drop { position: absolute; left: 8px; right: 12px; height: 0; border-top: 3px dashed var(--th-advant); z-index: 2; }
.th-drop.is-before { top: -2px; }
.th-drop.is-after { bottom: -2px; }
.th-drop.is-end { top: -2px; }
.th-drop::before {
  content: '';
  position: absolute;
  left: -6px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--th-advant);
  border: 2px solid var(--th-paper-sunk);
}
.th-drop__label { position: absolute; right: -2px; top: -9px; font: 600 10px/1.5 var(--th-font-mono); color: var(--th-advant-fg); background: var(--th-advant); border-radius: 2px; padding: 0 5px; } /* "→ position 2": the indicator never depends on colour alone */
.th-route-dropend { height: 14px; position: relative; }
.th-moveto {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  width: 250px;
  background: var(--th-paper-sunk);
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-5);
  box-shadow: 0 8px 24px oklch(20% 0.01 255 / 0.12);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.th-moveto__label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--th-ink-2); }
.th-moveto__range { font-weight: 400; color: var(--th-ink-2); }
.th-moveto__input { font-family: var(--th-font-mono); width: 100%; padding: 6px 10px; }
.th-moveto__hint { font-size: 11px; color: var(--th-ink-2); line-height: 1.4; }
.th-moveto__actions { display: flex; justify-content: flex-end; gap: 6px; }
.th-moveto__btn {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--th-line-2);
  border-radius: var(--th-radius-3);
  background: var(--th-paper-sunk);
  color: var(--th-ink);
  cursor: pointer;
}
.th-moveto__btn.is-primary { font-weight: 500; border-color: var(--th-advant-deep); background: var(--th-advant-deep); color: var(--th-advant-fg); }
.th-moveto__btn:disabled { opacity: .5; cursor: not-allowed; }
.th-moveto__btn:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-rule-remove {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--th-radius-3);
  color: var(--th-ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.th-rule-remove:hover { background: var(--th-risk-soft); color: var(--th-risk-ink); }
.th-rule-remove:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-rule-remove:disabled { opacity: .5; cursor: not-allowed; }
.th-rule-row[draggable="false"] .th-rule-handle { opacity: .5; cursor: default; }
.th-rule-msg { grid-column: 1 / -1; min-width: 0; font-size: 12px; display: flex; align-items: flex-start; gap: 6px; line-height: 1.45; color: var(--th-ink-2); }
.th-rule-msg.is-error { color: var(--th-risk-ink); }
.th-rule-msg > svg { flex: none; margin-top: 2px; }
@container th-rulelist (max-width: 760px) {
  .th-rule-row {
    grid-template-columns: 28px 22px minmax(0, 1fr) 32px;
    grid-template-areas: "pos handle main remove" "pos handle team team" "pos handle move move" "msg msg msg msg";
    row-gap: 8px;
    align-items: start;
  }
  .th-rule-row > .th-rule-pos { grid-area: pos; }
  .th-rule-row > .th-rule-handle { grid-area: handle; }
  .th-rule-row > .th-rule-main { grid-area: main; }
  .th-rule-row > .th-rule-arrow { display: none; }
  .th-rule-row > .th-rule-team { grid-area: team; }
  .th-rule-row > .th-rule-move { grid-area: move; justify-content: flex-start; }
  .th-rule-row > .th-rule-remove { grid-area: remove; }
  .th-rule-row > .th-rule-msg { grid-area: msg; min-width: 0; }
}

/* ---------- how one submission routes ---------- */
.th-route-outcome {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--th-line-soft);
  font-size: 12.5px;
  align-items: baseline;
}
.th-route-outcome__text { color: var(--th-ink-2); line-height: 1.5; }
.cc-pill.th-route-pill-advant { background: var(--th-advant-soft); color: var(--th-advant-deep); } /* the canon's "info" tone */

/* ---------- validation ---------- */
.th-route-valhead { padding: 10px 14px; border-bottom: 1px solid var(--th-line); display: flex; align-items: center; gap: 8px; }
.th-route-valhead__title { font-weight: 600; font-size: 12.5px; color: var(--th-ink); }
.th-route-check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 9px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--th-line-soft);
  font-size: 12.5px;
  align-items: start;
}
.th-route-check__icon { display: inline-flex; margin-top: 1px; }
.th-route-check__icon.is-ok { color: var(--th-ok-ink); }
.th-route-check__icon.is-fail { color: var(--th-risk-ink); }
.th-route-check__icon.is-pending { color: var(--th-ink-2); }
.th-route-check__text { display: flex; flex-direction: column; gap: 1px; }
.th-route-check__label { color: var(--th-ink); }
.th-route-check__sub { font-size: 11.5px; color: var(--th-ink-2); line-height: 1.45; }
.th-route-valfoot { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.th-route-publish {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--th-radius-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--th-advant-deep);
  background: var(--th-advant-deep);
  color: var(--th-advant-fg);
  cursor: pointer;
}
.th-route-publish:disabled { opacity: .5; cursor: not-allowed; }
.th-route-publish:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-route-discard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--th-radius-3);
  font: inherit;
  font-size: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--th-ink-2);
  cursor: pointer;
}
.th-route-discard:disabled { opacity: .5; cursor: default; }
.th-route-discard:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-route-valnote { font-size: 11.5px; color: var(--th-ink-2); line-height: 1.5; }
.th-route-valfail { padding: 10px 14px; font-size: 12px; color: var(--th-ink-2); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border-bottom: 1px solid var(--th-line-soft); }

/* ---------- versions ---------- */
.th-ver-wrap { container-type: inline-size; container-name: th-ver; }
.th-ver-grid { grid-template-columns: 300px minmax(0, 1fr); }
@container th-ver (max-width: 860px) { .th-ver-grid { grid-template-columns: minmax(0, 1fr); } }
.th-route-verhead { padding: 10px 14px; border-bottom: 1px solid var(--th-line); font-weight: 600; font-size: 12.5px; color: var(--th-ink); }
.th-route-verhead__tag { font-family: var(--th-font-mono); font-size: 10.5px; font-weight: 400; color: var(--th-ink-2); }
.th-route-ver {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--th-line-soft);
  background: transparent;
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.th-route-ver:hover { background: var(--th-paper-2); }
.th-route-ver[aria-pressed="true"] { background: var(--th-advant-soft); }
.th-route-ver:focus-visible { outline: 2px solid var(--th-advant); outline-offset: -2px; }
.th-route-ver__number { font-family: var(--th-font-mono); font-size: 13px; font-weight: 600; color: var(--th-ink); width: 30px; }
.th-route-ver__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.th-route-ver__line { font-size: 12.5px; color: var(--th-ink); }
.th-route-ver__meta { font-family: var(--th-font-mono); font-size: 11px; color: var(--th-ink-2); }
.th-route-ver-note { padding: 10px 14px; font-size: 11.5px; color: var(--th-ink-2); line-height: 1.5; }
.th-route-ver-more { margin: 8px 14px 10px; }
.th-route-cmphead { padding: 10px 16px; border-bottom: 1px solid var(--th-line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-route-cmp {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--th-line-soft);
  font-size: 12.5px;
  align-items: start;
}
.th-route-cmp__label { color: var(--th-ink-2); }
.th-route-cmp__a { color: var(--th-ink-2); }
.th-route-cmp__b { color: var(--th-ink); }
/* A team or rule name can be one long token (a fixture team's name carries a 32-digit id): it wraps
   inside its own column instead of widening the page at narrow widths. */
.th-route-cmp__a,
.th-route-cmp__b,
.th-route-ver__line { overflow-wrap: anywhere; }
.th-route-cmp__foot {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding: 6px 16px 10px;
  font-family: var(--th-font-mono);
  font-size: 10.5px;
  color: var(--th-ink-2);
}
.th-route-diff-struck { text-decoration: line-through; text-decoration-color: var(--th-ink-4); }
.th-route-diff-strong { font-weight: 600; }
.th-route-diff-added { color: var(--th-ok-ink); font-weight: 600; }
.th-route-diff-mono { font-family: var(--th-font-mono); font-size: 11.5px; }
.th-route-state { padding: 14px 16px; font-size: 12.5px; color: var(--th-ink-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- publish dialog (the routing canon's modal: 600px, 8px radius, a darker scrim) ---------- */
.th-route-scrim { background: oklch(20% 0.01 255 / 0.45); padding: 12px; }
.th-route-modal { width: 600px; max-height: calc(100vh - 24px); border-radius: 8px; box-shadow: 0 24px 60px oklch(20% 0.01 255 / 0.3); font-size: 13.5px; }
.th-route-modal .th-modal__body { font-size: 13px; color: var(--th-ink-2); line-height: 1.55; }
.th-route-pubdiff { border: 1px solid var(--th-line); border-radius: var(--th-radius-5); background: var(--th-paper); }
.th-route-pubdiff__row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--th-line-soft);
  font-size: 12.5px;
}
.th-route-pubdiff__foot {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 6px 12px 8px;
  font-family: var(--th-font-mono);
  font-size: 10.5px;
  color: var(--th-ink-2);
}
.th-route-pubnotes { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.th-route-pubnote { display: flex; gap: 8px; }
.th-route-pubnote > svg { flex: none; margin-top: 2px; color: var(--th-ink-2); }
.th-route-pubnote.is-ok > svg { color: var(--th-ok-ink); }
.th-route-pubintent { font-family: var(--th-font-mono); font-size: 11px; color: var(--th-ink-2); }
.th-route-pubbusy { padding: 28px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--th-ink-2); text-align: center; }
.th-route-spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--th-line-2);
  border-top-color: var(--th-advant);
  animation: th-route-spin 0.9s linear infinite;
}
@keyframes th-route-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .th-route-spin { animation: none; } }
.th-route-pubdone { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--th-ink-2); line-height: 1.55; }
.th-route-pubdone__title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--th-ok-ink); }
.th-route-pubdone__title.is-risk { color: var(--th-risk-ink); }

/* ---------- narrow widths: the routing canon's own 720px overrides, driven by the page's width ---------- */
@container th-route (max-width: 720px) {
  .th-two-col { grid-template-columns: minmax(0, 1fr); }
  .th-route-page .cc-page-head { flex-direction: column; align-items: stretch; }
  .th-rule-picker { margin: 10px 8px 4px; }
  .th-rule-opt { grid-template-columns: 16px minmax(0, 1fr); }
  .th-rule-note { grid-column: 2; align-items: flex-start; text-align: left; max-width: none; }
}
@media (max-width: 720px) {
  .th-route-modal { width: calc(100vw - 24px); max-width: calc(100vw - 24px); border-radius: 8px; }
}

/* ---------- forced colours ----------
   Box shadows and backgrounds are dropped in forced-colours mode, which would erase the moved-row
   marker, the active tab and the insertion dot. Each keeps a border or a system colour instead, so
   position text, shape and focus still identify the change without relying on colour (plan TO-12). */
@media (forced-colors: active) {
  .th-rule-row.is-moved { box-shadow: none; border-left: 3px solid Highlight; }
  .th-route-tab.is-active { box-shadow: none; border-bottom: 2px solid Highlight; }
  .th-drop { border-top-color: Highlight; }
  .th-drop::before { forced-color-adjust: none; background: Highlight; border-color: Canvas; }
  .th-drop__label { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
