.issue-routing-form {
  width: 100%;
  min-width: 0;
  gap: 1rem;
}

.issue-routing-form [hidden] {
  display: none !important;
}

.issue-routing-template {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

:root {
  --routing-ok: #34d399;
  --routing-ok-soft: rgba(52, 211, 153, 0.12);
  --routing-warn: #fbbf24;
  --routing-warn-soft: rgba(251, 191, 36, 0.12);
  --routing-bad: #f87171;
  --routing-bad-soft: rgba(248, 113, 113, 0.12);
  --routing-muted: var(--color-muted, #b8c7e6);
  --routing-line: rgba(103, 232, 249, 0.18);
}

/* Form steps */
.routing-step,
.routing-step.flat-form-panel {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--routing-line);
}

.routing-step-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.routing-step-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.routing-step-number {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--hud-glass-border, rgba(103, 232, 249, 0.46));
  border-radius: 50%;
  color: var(--hud-cyan-strong, #8ff8ff);
  font-size: 0.85rem;
}

.routing-step-fields {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.routing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.75rem;
  min-width: 0;
}

.routing-field {
  display: grid;
  align-content: start;
  gap: 0.3rem;
  min-width: 0;
}

.routing-field-wide {
  grid-column: 1 / -1;
}

.routing-field small,
.routing-rule small,
.routing-checks small,
.routing-table small,
.routing-summary small {
  display: block;
  color: var(--routing-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.routing-field small.routing-resolved {
  color: var(--routing-ok);
}

.routing-mode-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.75rem;
}

.routing-mode-card {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--routing-line);
  border-radius: 10px;
  cursor: pointer;
}

.routing-mode-card:has(input:checked) {
  border-color: var(--hud-glass-border, rgba(103, 232, 249, 0.46));
  background: rgba(34, 211, 238, 0.07);
}

.routing-mode-card input {
  margin-top: 0.2rem;
}

.routing-mode-card strong {
  display: block;
}

.routing-mode-card small {
  display: block;
  margin-top: 0.25rem;
  color: var(--routing-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.routing-mode-fields {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.routing-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.routing-form-footer .cockpit-note {
  flex: 1 1 18rem;
  margin: 0;
}

.routing-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.routing-inline-actions form {
  margin: 0;
}

/* Flow strip */
.routing-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: routing-flow;
}

.routing-flow li {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--routing-line);
  border-radius: 10px;
  background: rgba(2, 16, 32, 0.34);
  counter-increment: routing-flow;
}

.routing-flow strong::before {
  content: counter(routing-flow) " ";
  color: var(--hud-cyan-strong, #8ff8ff);
}

.routing-flow span {
  color: var(--routing-muted);
  font-size: 0.8rem;
}

/* Rule cards */
.routing-rule-list {
  display: grid;
  gap: 0.75rem;
}

.routing-rule {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--routing-line);
  border-radius: 10px;
}

.routing-rule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.routing-rule-title {
  min-width: 0;
}

.routing-rule-title .eyebrow {
  margin: 0 0 0.2rem;
}

.routing-rule-title h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.routing-sentence {
  margin: 0;
  line-height: 1.6;
}

.routing-sentence b {
  color: var(--hud-cyan-strong, #8ff8ff);
  font-weight: 600;
}

.routing-blockers {
  margin: 0;
  color: var(--routing-bad);
  font-size: 0.85rem;
}

.routing-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.2rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.routing-chip-on {
  color: var(--routing-ok);
  background: var(--routing-ok-soft);
}

.routing-chip-off {
  color: var(--routing-muted);
  background: rgba(148, 163, 184, 0.08);
}

.routing-chip-blocked {
  color: var(--routing-bad);
  background: var(--routing-bad-soft);
}

.routing-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.86rem;
}

.routing-checks li {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  gap: 0.4rem;
  min-width: 0;
}

.routing-check-mark {
  font-weight: 700;
}

.routing-check-ok { color: var(--routing-ok); }
.routing-check-warn { color: var(--routing-warn); }
.routing-check-bad { color: var(--routing-bad); }

.routing-empty {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
}

.routing-empty p {
  margin: 0;
}

/* Task check */
.routing-check-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.routing-check-form .routing-field {
  flex: 1 1 12rem;
}

.routing-check-form.flat-form-panel {
  overflow: visible;
}

.routing-check-verdict {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0.75rem;
  border-left: 3px solid;
  border-radius: 8px;
}

.routing-check-verdict p {
  margin: 0;
}

.routing-check-verdict.is-ok {
  border-color: var(--routing-ok);
  background: var(--routing-ok-soft);
}

.routing-check-verdict.is-bad {
  border-color: var(--routing-bad);
  background: var(--routing-bad-soft);
}

/* Tables */
.routing-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.routing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.routing-table th,
.routing-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--routing-line);
  text-align: left;
  vertical-align: top;
}

.routing-table th {
  color: var(--routing-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.routing-table tr:last-child td {
  border-bottom: 0;
}

.routing-time,
.routing-number {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Overview summary */
.routing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
}

.routing-summary > div {
  display: grid;
  align-content: start;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--routing-line);
  border-radius: 10px;
}

.routing-url {
  overflow-wrap: anywhere;
  font-size: 0.8rem;
}

/* Period switch */
.routing-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.routing-request {
  min-width: 16rem;
}
