:root {
  --bg: #edf3f9;
  --bg-accent: radial-gradient(circle at top left, rgba(19, 93, 175, 0.18), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.1), transparent 24rem),
    linear-gradient(180deg, #f8fbff 0%, #edf3f9 100%);
  --panel: rgba(255, 255, 255, 0.84);
  --panel-solid: #ffffff;
  --panel-muted: #f3f7fb;
  --panel-strong: #eaf1f8;
  --text: #102035;
  --text-soft: #617184;
  --line: rgba(15, 32, 53, 0.09);
  --shadow: 0 18px 48px rgba(13, 26, 43, 0.1);
  --blue: #2270d2;
  --teal: #0f8b8d;
  --amber: #d88918;
  --green: #14804a;
  --red: #c84f4f;
  --slate: #6b788b;
  --dark: #1f3348;
  color-scheme: light;
}

body[data-theme="dark"] {
  --bg: #09131e;
  --bg-accent: radial-gradient(circle at top left, rgba(58, 104, 169, 0.26), transparent 26rem),
    radial-gradient(circle at bottom right, rgba(14, 165, 164, 0.14), transparent 24rem),
    linear-gradient(180deg, #0c1724 0%, #09131e 100%);
  --panel: rgba(12, 23, 36, 0.88);
  --panel-solid: #122131;
  --panel-muted: #102032;
  --panel-strong: #16283b;
  --text: #e7eef7;
  --text-soft: #a6b6c9;
  --line: rgba(231, 238, 247, 0.08);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-accent);
  color: var(--text);
  font-family: "Segoe UI", "Aptos", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  padding: 24px;
  overflow-x: clip;
}

.hero-panel,
.toolbar-panel,
.panel,
.graph-panel,
.detail-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border-radius: 30px;
  align-items: center;
}

.hero-copy {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(34, 112, 210, 0.18), rgba(15, 139, 141, 0.18));
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 700;
}

.hero-panel h1,
.panel-head h2 {
  margin: 0;
  font-size: clamp(1.7rem, 2.3vw, 2.7rem);
  letter-spacing: -0.05em;
}

.hero-meta {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 18px;
}

.status-pill,
.badge,
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.82rem;
}

.status-pill {
  background: rgba(107, 120, 139, 0.12);
  color: var(--text);
}

.status-pill.live {
  background: rgba(20, 128, 74, 0.14);
  color: var(--green);
}

.status-pill.fallback {
  background: rgba(216, 137, 24, 0.14);
  color: #9d6509;
}

.meta-block {
  display: grid;
  gap: 4px;
}

.meta-label {
  color: var(--text-soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toolbar-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: minmax(250px, 1.8fr) repeat(2, minmax(160px, 0.85fr)) auto;
  gap: 14px;
  align-items: end;
}

.toolbar-search,
.toolbar-filters {
  display: grid;
  gap: 8px;
}

.toolbar-panel label {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.toolbar-panel input,
.toolbar-panel select,
.theme-btn,
.secondary-btn {
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  border-radius: 14px;
  min-height: 46px;
  padding: 0 14px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.upload-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.08), transparent 70%), var(--panel-solid);
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-progress-head strong {
  font-size: 0.95rem;
}

.upload-progress-head span,
.upload-progress p {
  color: var(--text-soft);
}

.upload-progress p {
  margin: 0;
  font-size: 0.84rem;
}

.upload-progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #36a3ff 55%, var(--teal));
  transition: width 0.18s ease;
}

.secondary-btn,
.theme-btn {
  cursor: pointer;
  font-weight: 700;
}

.secondary-btn:hover,
.theme-btn:hover,
.route-rail-card:hover,
.user-pill:hover,
.action-pill:hover,
.interactive-row:hover {
  border-color: rgba(34, 112, 210, 0.32);
}

.theme-btn {
  width: 46px;
  padding: 0;
}

.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 0 14px;
  min-height: 46px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
}

.toggle input {
  accent-color: var(--blue);
}

.stats-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
}

.stat-card {
  border-radius: 22px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--text-soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.65rem;
  letter-spacing: -0.05em;
}

.warning-strip {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(216, 137, 24, 0.28);
  background: rgba(216, 137, 24, 0.12);
  color: #8f5c06;
}

body[data-theme="dark"] .warning-strip {
  color: #f1cb84;
}

.workspace-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.92fr) minmax(300px, 0.68fr);
  gap: 18px;
  align-items: start;
}

.graph-panel,
.detail-panel,
.queues-panel,
.mobile-routes {
  border-radius: 28px;
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 14px;
}

.panel-head.compact {
  margin-bottom: 10px;
}

.panel-head p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.legend-item {
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
}

.legend-item.inbound {
  box-shadow: inset 0 0 0 1px rgba(34, 112, 210, 0.08);
}

.legend-item.decision {
  box-shadow: inset 0 0 0 1px rgba(216, 137, 24, 0.08);
}

.legend-item.menu {
  box-shadow: inset 0 0 0 1px rgba(216, 137, 24, 0.18);
}

.legend-item.queue {
  box-shadow: inset 0 0 0 1px rgba(15, 139, 141, 0.12);
}

.legend-item.user {
  box-shadow: inset 0 0 0 1px rgba(107, 120, 139, 0.16);
}

.legend-item.final {
  box-shadow: inset 0 0 0 1px rgba(31, 51, 72, 0.08);
}

.flow-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-height: 72vh;
}

.route-rail,
.flow-stage-panel {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
}

.route-rail {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.route-rail-head,
.flow-stage-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.route-rail-head h3,
.flow-stage-head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.route-rail-head p,
.flow-stage-head p {
  margin: 6px 0 0;
  color: var(--text-soft);
}

.route-rail-list {
  display: flex;
  gap: 14px;
  padding: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
}

.site-group {
  display: grid;
  gap: 10px;
  min-width: min(360px, 100%);
  flex: 0 0 360px;
}

.site-group + .site-group {
  padding-top: 0;
  border-top: 0;
}

.site-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}

.site-group-head strong {
  font-size: 0.96rem;
}

.site-group-head span {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.site-group-list {
  display: grid;
  gap: 10px;
}

.route-rail-card {
  border: 1px solid var(--line);
  background: var(--panel-muted);
  color: var(--text);
  border-radius: 18px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.route-rail-card.selected {
  background: linear-gradient(145deg, rgba(34, 112, 210, 0.16), rgba(15, 139, 141, 0.08));
  border-color: rgba(34, 112, 210, 0.34);
  transform: translateY(-1px);
}

.route-rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.route-rail-number {
  font-weight: 800;
  color: var(--blue);
}

.route-rail-site {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.route-rail-count {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  color: var(--text-soft);
  font-size: 0.75rem;
}

.route-rail-card strong {
  font-size: 1rem;
}

.route-rail-card small {
  color: var(--text-soft);
}

.route-rail-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-stage-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.flow-stage-viewport {
  overflow: auto;
  background:
    linear-gradient(to right, rgba(34, 112, 210, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 112, 210, 0.04) 1px, transparent 1px),
    var(--panel-muted);
  background-size: 42px 42px, 42px 42px, auto;
}

.flow-stage {
  min-height: 100%;
}

.flow-board {
  width: 100%;
  min-width: 0;
  padding: 24px;
  display: grid;
  gap: 22px;
  box-sizing: border-box;
}

.flow-graph-board {
  min-height: 100%;
  padding: 24px;
  display: grid;
  gap: 22px;
}

.graph-canvas-card {
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(34, 112, 210, 0.08), rgba(34, 112, 210, 0) 22%),
    var(--panel-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.graph-canvas-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.graph-canvas-head strong {
  display: block;
  font-size: 1.08rem;
}

.graph-canvas-head p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.graph-canvas-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.graph-canvas-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.flow-graph-canvas {
  width: 100%;
  min-height: 820px;
  background:
    linear-gradient(to right, rgba(34, 112, 210, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 112, 210, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(12, 23, 36, 0.04), rgba(12, 23, 36, 0.02)),
    var(--panel-muted);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

body[data-theme="dark"] .flow-graph-canvas {
  background:
    linear-gradient(to right, rgba(92, 165, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(92, 165, 255, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(5, 12, 19, 0.18), rgba(5, 12, 19, 0.08)),
    #102032;
  background-size: 44px 44px, 44px 44px, auto, auto;
}

.router-stage {
  display: grid;
  gap: 18px;
}

.router-stack {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.router-link {
  width: 2px;
  height: 18px;
  margin-left: 26px;
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.28), rgba(15, 139, 141, 0.22));
}

.router-hub {
  max-width: 360px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px dashed rgba(34, 112, 210, 0.34);
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.08), transparent 56%), var(--panel-solid);
  box-shadow: var(--shadow);
}

.router-hub strong {
  display: block;
  margin-top: 10px;
  font-size: 1.1rem;
}

.router-hub p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.flow-entry-card,
.scenario-card,
.schedule-card,
.flow-step-card,
.detail-card,
.technical-card,
.queue-member-grid,
.node-step-list {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.flow-entry-card {
  max-width: 340px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.flow-entry-card.flow-entry-wide {
  max-width: none;
}

.flow-entry-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.flow-entry-card p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.flow-number-cluster,
.detail-chip-cloud {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.flow-node-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.flow-node-tag.inbound {
  background: rgba(34, 112, 210, 0.14);
  color: var(--blue);
}

.flow-node-tag.decision,
.flow-node-tag.scenario,
.flow-node-tag.menu {
  background: rgba(216, 137, 24, 0.14);
  color: var(--amber);
}

.flow-node-tag.queue {
  background: rgba(15, 139, 141, 0.14);
  color: var(--teal);
}

.flow-node-tag.user {
  background: rgba(107, 120, 139, 0.16);
  color: var(--slate);
}

.flow-node-tag.final {
  background: rgba(31, 51, 72, 0.14);
  color: var(--dark);
}

.flow-branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.flow-branch-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.flow-branch-head {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: rgba(216, 137, 24, 0.06);
}

.flow-branch-head p {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.flow-branch-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.flow-scenarios {
  display: grid;
  gap: 18px;
}

.flow-scenarios.multiple {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.scenario-card {
  padding: 18px;
  box-shadow: var(--shadow);
  border-style: dashed;
}

.collapsible-head {
  list-style: none;
  cursor: pointer;
}

.collapsible-head::-webkit-details-marker {
  display: none;
}

.collapsible-head::marker {
  content: "";
}

.collapsible-head::after {
  content: "▾";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  color: var(--text-soft);
  flex: 0 0 auto;
}

.collapsible-block:not([open]) > .collapsible-head::after {
  content: "▸";
}

.collapsible-body {
  margin-top: 16px;
}

.scenario-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.scenario-head h4 {
  margin: 10px 0 0;
  font-size: 1.22rem;
}

.scenario-head p {
  margin: 0;
  color: var(--text-soft);
  max-width: 280px;
  text-align: right;
}

.schedule-lane {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.schedule-card {
  padding: 14px;
  background: var(--panel-muted);
}

.schedule-card strong {
  display: block;
  margin-bottom: 6px;
}

.schedule-card span {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.flow-lead,
.chain-zone {
  margin-top: 18px;
}

.scenario-line,
.chain-link,
.branch-connector {
  width: 2px;
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.28), rgba(15, 139, 141, 0.22));
  margin: 0 auto;
}

.scenario-line {
  height: 18px;
}

.chain-zone {
  display: grid;
  justify-items: start;
  gap: 0;
}

.chain-link {
  height: 16px;
  margin-left: 24px;
}

.branch-zone {
  margin-top: 18px;
}

.branch-connector {
  height: 18px;
}

.branch-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  min-width: 0;
}

.branch-grid::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, rgba(34, 112, 210, 0.22), rgba(15, 139, 141, 0.2));
}

.branch-grid::after {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 2px;
  height: 12px;
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.22), rgba(15, 139, 141, 0.2));
  transform: translateX(-50%);
}

.flow-step-card {
  padding: 16px;
  display: grid;
  gap: 10px;
  min-height: 150px;
}

.flow-step-card.compact {
  min-height: auto;
}

.flow-step-card strong {
  font-size: 1rem;
  line-height: 1.35;
}

.flow-step-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.45;
}

.flow-step-card.queue {
  background: linear-gradient(180deg, rgba(15, 139, 141, 0.08), transparent 56%), var(--panel-solid);
}

.flow-step-card.menu {
  background: linear-gradient(180deg, rgba(216, 137, 24, 0.09), transparent 56%), var(--panel-solid);
}

.flow-step-card.final {
  background: linear-gradient(180deg, rgba(31, 51, 72, 0.08), transparent 56%), var(--panel-solid);
}

.flow-step-card.prompt-bundle {
  gap: 14px;
}

.step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step-meta span {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--text-soft);
}

.step-audio {
  display: grid;
  gap: 8px;
}

.audio-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.step-audio audio {
  width: 100%;
  max-width: 260px;
  height: 36px;
}

.prompt-list {
  display: grid;
  gap: 10px;
}

.prompt-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.prompt-copy {
  display: grid;
  gap: 4px;
}

.prompt-copy span {
  color: var(--text-soft);
  font-size: 0.85rem;
}

.inline-audio audio {
  width: 100%;
  height: 34px;
}

.path-stage {
  display: grid;
  gap: 18px;
}

.scenario-stack {
  display: grid;
  gap: 18px;
}

.path-stage-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.path-lane-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.05), transparent 56%), var(--panel-solid);
  box-shadow: var(--shadow);
  min-width: 0;
}

.scenario-flow-card {
  display: grid;
  gap: 16px;
  border-style: solid;
  min-width: 0;
}

.scenario-flow-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.scenario-flow-head h4 {
  margin: 10px 0 0;
  font-size: 1.2rem;
}

.scenario-flow-head p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.shared-chain-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: rgba(34, 112, 210, 0.04);
}

.shared-chain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shared-chain-head span {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.branch-lane-card {
  box-shadow: none;
  background: var(--panel-solid);
}

.menu-group-card {
  background: linear-gradient(180deg, rgba(216, 137, 24, 0.07), transparent 56%), var(--panel-solid);
}

.menu-group-body {
  display: grid;
  gap: 14px;
}

.menu-group-lead {
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: var(--panel-muted);
}

.nested-branch-grid {
  margin-top: 0;
}

.nested-branch-grid::before,
.nested-branch-grid::after {
  display: none;
}

.path-lane-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.path-lane-head > div,
.scenario-flow-head > div {
  min-width: 0;
}

.path-lane-head strong,
.scenario-flow-head h4,
.route-rail-card strong {
  overflow-wrap: anywhere;
}

.path-lane-head p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.path-lane-count {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.82rem;
  white-space: nowrap;
}

.path-chain {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.path-chain-segment {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.path-step-card {
  width: 240px;
  min-height: 0;
  box-shadow: none;
}

.path-arrow-wrap {
  display: grid;
  place-items: center;
  min-width: 28px;
}

.path-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-weight: 700;
}

.flow-step-card.decision {
  background: linear-gradient(180deg, rgba(216, 137, 24, 0.12), transparent 56%), var(--panel-solid);
}

.flow-step-card.prompt {
  background: linear-gradient(180deg, rgba(34, 112, 210, 0.08), transparent 56%), var(--panel-solid);
}

.audio-caption {
  font-size: 0.8rem;
  color: var(--text-soft);
  word-break: break-word;
}

.audio-unavailable {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(216, 137, 24, 0.1);
  color: var(--amber);
  border: 1px solid rgba(216, 137, 24, 0.2);
  font-size: 0.8rem;
}

.audio-pill {
  display: grid;
  gap: 10px;
}

.audio-pill audio {
  width: 100%;
  max-width: 240px;
  height: 34px;
}

.step-user-cloud,
.user-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-pill,
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  color: var(--text);
}

.user-pill {
  cursor: pointer;
}

.user-pill span {
  font-size: 0.84rem;
  font-weight: 700;
}

.user-pill small {
  color: var(--text-soft);
}

.empty-flow {
  padding: 20px;
}

.detail-panel {
  position: sticky;
  top: 18px;
}

.detail-content {
  display: grid;
  gap: 14px;
}

.detail-card {
  padding: 16px;
}

.detail-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.detail-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  gap: 4px;
}

.detail-row span {
  color: var(--text-soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.node-step-list,
.queue-member-grid {
  padding: 12px;
}

.step-pill {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.action-pill,
.interactive-row {
  width: 100%;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.step-pill + .step-pill,
.member-row + .member-row {
  margin-top: 10px;
}

.step-pill strong,
.member-row strong {
  font-size: 0.92rem;
}

.step-pill.empty-pill {
  border-style: dashed;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.member-info {
  display: grid;
  gap: 2px;
}

.member-info span,
.muted,
.queue-name small,
.mini-note {
  color: var(--text-soft);
}

.badge {
  padding: 6px 10px;
  font-size: 0.76rem;
  border: 1px solid transparent;
}

.badge.unknown {
  color: var(--slate);
  background: rgba(107, 120, 139, 0.16);
}

.technical-card {
  margin-top: 16px;
  padding: 12px 16px;
}

.technical-card summary {
  cursor: pointer;
  font-weight: 700;
}

.technical-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-soft);
}

.queues-panel,
.mobile-routes {
  margin-top: 18px;
}

.table-tools input {
  min-width: 240px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
}

.table-scroll {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: var(--panel-solid);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-muted);
  text-align: left;
  padding: 14px 16px;
  color: var(--text-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

tbody td {
  padding: 16px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.queue-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--dark);
  color: #f5fbff;
  font-weight: 800;
}

.queue-name {
  display: grid;
  gap: 5px;
}

.mobile-routes {
  display: none;
}

.mobile-route-card {
  padding: 14px;
  border-radius: 16px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
}

.mobile-route-card + .mobile-route-card {
  margin-top: 12px;
}

.mobile-route-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.route-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.route-number-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 112, 210, 0.12);
  color: var(--blue);
  font-weight: 700;
}

@media (max-width: 1320px) {
  .toolbar-panel {
    grid-template-columns: minmax(250px, 1fr) repeat(2, minmax(160px, 1fr));
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

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

  .detail-panel {
    position: static;
  }
}

@media (max-width: 1080px) {
  .flow-shell {
    grid-template-rows: auto 1fr;
  }

  .route-rail {
    max-height: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  .hero-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-meta {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .toolbar-panel {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

}

@media (max-width: 720px) {
  .legend {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-routes {
    display: block;
  }

  .flow-stage-panel {
    display: none;
  }

  .route-rail {
    max-height: none;
  }
}
