:root {
  color-scheme: light;
  --ink: #15171a;
  --muted: #68707c;
  --line: #d9dde3;
  --panel: #ffffff;
  --soft: #f4f6f8;
  --field: #fbfcfd;
  --brand: #126c6f;
  --brand-ink: #083d40;
  --accent: #c5542d;
  --focus: #2e7dd1;
  --ok: #237a48;
  --danger: #b53632;
  --shadow: 0 18px 45px rgba(22, 29, 37, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 246, 248, 0.96)),
    repeating-linear-gradient(
      90deg,
      rgba(18, 108, 111, 0.08) 0,
      rgba(18, 108, 111, 0.08) 1px,
      transparent 1px,
      transparent 72px
    );
  color: var(--ink);
}

body[data-environment="development"]::before {
  content: "DEV";
  position: fixed;
  z-index: 10000;
  right: 14px;
  bottom: 14px;
  padding: 7px 11px;
  border-radius: 999px;
  background: #7b2cbf;
  color: #fff;
  box-shadow: 0 6px 18px rgba(58, 20, 92, .28);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.splash {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 42px;
  align-items: center;
  padding: 44px clamp(22px, 6vw, 82px);
}

.splash-title {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 7.25rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.splash-title p {
  margin: 24px 0 0;
  max-width: 620px;
  color: #404852;
  font-size: 1.1rem;
  line-height: 1.6;
}

.splash-panel,
.panel,
.rack-card,
.channel-table,
.library-card,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.splash-panel {
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.project-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 22px;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.project-button {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid transparent;
  border-radius: 6px;
}

.project-button:hover,
.project-button:focus {
  border-color: var(--brand);
  outline: none;
}

.project-rename-button {
  align-self: stretch;
}

.project-name {
  font-weight: 800;
}

.project-meta,
.small-copy {
  color: var(--muted);
  font-size: 0.88rem;
}

.new-project-form,
.import-project-form {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.import-project-form {
  margin-top: 16px;
}

.toolbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.project-title {
  margin: 0;
  font-size: 1rem;
}

.save-state {
  color: var(--muted);
  font-size: 0.84rem;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 22px 0;
  overflow-x: auto;
  background: #fff;
}

.tab {
  padding: 11px 14px;
  color: #3d4651;
  background: transparent;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--brand-ink);
  border-color: var(--accent);
  font-weight: 800;
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

.panel {
  padding: 22px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  color: #333a43;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid #cfd5dc;
  border-radius: 6px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(46, 125, 209, 0.28);
  border-color: var(--focus);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar-actions {
  margin-left: auto;
}

.toolbar-nav {
  margin-left: auto;
}

.toolbar-actions + .toolbar-nav {
  margin-left: 0;
}

.live-presence-stack {
  display: flex;
  align-items: center;
  padding-left: 8px;
}

.live-presence-avatar,
.live-presence-count {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-size: .68rem;
  font-weight: 700;
}

.live-presence-count { background: var(--ink); }

.history-workspace { display: grid; gap: 18px; }
.history-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 18px; }
.history-list { display: grid; gap: 8px; margin-top: 12px; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.history-row small { display: block; margin-top: 3px; color: var(--muted); }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  color: #fff;
  background: var(--brand);
  border-radius: 6px;
  font-weight: 800;
}

.button.secondary {
  color: var(--brand-ink);
  background: #e8f2f2;
}

.toolbar .button.active:disabled {
  color: #fff;
  background: var(--brand);
  opacity: 1;
}

.button.warning {
  color: #fff;
  background: var(--danger);
}

.compact-button {
  justify-self: start;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  color: #3c4652;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
}

.icon-button.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.icon-button.connect {
  color: var(--brand-ink);
  background: #e8f2f2;
}

.icon-button.connect.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.icon-button.mini {
  width: 24px;
  height: 24px;
  min-height: 24px;
  font-size: 0.72rem;
}

.system-map {
  position: relative;
}

.connection-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.connection-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
}

.connection-canvas marker path {
  fill: var(--accent);
}

.connection-label {
  fill: var(--brand-ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 5px;
  text-anchor: middle;
  font-size: 0.78rem;
  font-weight: 900;
}

.config-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.system-column {
  min-width: 0;
}

.rack-list {
  display: grid;
  gap: 14px;
}

.add-system-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.rack-card {
  padding: 16px;
  box-shadow: none;
}

.system-node-card {
  position: relative;
  z-index: 2;
  min-height: 250px;
}

.system-node-card.connecting {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(197, 84, 45, 0.16);
}

.connection-controls {
  display: grid;
  gap: 8px;
}

.endpoint-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.endpoint-status {
  color: var(--brand-ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.endpoint-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.endpoint-status-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.endpoint-port-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.endpoint-port {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.endpoint-port strong,
.endpoint-port .small-copy {
  display: block;
}

.rack-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.rack-card-head strong {
  display: block;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.surface-channel-assignment {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding: 11px 12px;
  border: 1px solid #c9d8d2;
  border-radius: 7px;
  background: #f4faf7;
}

.surface-channel-assignment.has-error {
  border-color: #d9a15c;
  background: #fff8ec;
}

.surface-channel-assignment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.surface-channel-assignment-head strong,
.surface-channel-assignment-head small {
  display: block;
}

.surface-channel-assignment-head small,
.surface-channel-assignment p {
  color: var(--muted);
  font-size: .74rem;
}

.surface-channel-assignment label {
  color: var(--brand-ink);
  font-size: .76rem;
  font-weight: 800;
}

.surface-channel-assignment input {
  min-width: 0;
}

.surface-channel-assignment p {
  margin: 0;
}

.surface-channel-assignment.has-error p {
  color: #8a541d;
  font-weight: 700;
}

.secondary-surface-card-note {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #c9b98b;
  border-radius: 7px;
  background: #fffaf0;
  color: #67531c;
  font-size: .76rem;
}

.secondary-surface-card-note span {
  color: var(--muted);
}

.nested-card-selector {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding: 9px;
  border-left: 3px solid var(--brand);
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--brand) 7%, transparent);
}

.nested-card-selector label {
  color: var(--muted);
  font-size: 0.78rem;
}

.channel-table {
  overflow: hidden;
  box-shadow: none;
}

.patch-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.subtab {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}

.subtab.active {
  background: var(--brand-ink);
  border-color: var(--brand-ink);
  color: #ffffff;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #3a414b;
  background: #eef2f4;
  font-size: 0.8rem;
  text-transform: uppercase;
}

td.channel-number {
  width: 70px;
  color: var(--brand-ink);
  font-weight: 900;
}

.compact-input {
  min-height: 36px;
}

.patch-mixer-select {
  min-width: 240px;
}

.io-inventory-table table {
  min-width: 760px;
}

.patch-block-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
}

.patch-block-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(320px, 380px);
  gap: 14px;
  align-items: start;
  width: max-content;
  min-width: 100%;
}

.mixer-channel-grid {
  grid-auto-columns: minmax(380px, 460px);
}

.patch-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  --patch-tint: #eef2f4;
  --patch-tint-strong: #dfe7eb;
}

.patch-block-title {
  min-height: 36px;
  padding: 9px 11px;
  background: var(--patch-tint-strong);
  color: var(--brand-ink);
  font-weight: 900;
  font-size: 0.92rem;
}

.patch-block-subtitle {
  padding: 7px 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.patch-tone-0 {
  --patch-tint: #f3f7fb;
  --patch-tint-strong: #dfeaf5;
}

.patch-tone-1 {
  --patch-tint: #f4f8f1;
  --patch-tint-strong: #e2eed9;
}

.patch-tone-2 {
  --patch-tint: #fbf5ef;
  --patch-tint-strong: #f1e2d2;
}

.patch-tone-3 {
  --patch-tint: #f7f3fb;
  --patch-tint-strong: #e8def3;
}

.patch-tone-4 {
  --patch-tint: #f1f8f8;
  --patch-tint-strong: #d9eeee;
}

.patch-tone-5 {
  --patch-tint: #faf5f6;
  --patch-tint-strong: #efdfe4;
}

.patch-mini-table {
  min-width: 0;
  table-layout: auto;
}

.patch-mini-table th,
.patch-mini-table td {
  padding: 5px;
  font-size: 0.82rem;
}

.patch-mini-table th:first-child,
.patch-mini-table td:first-child {
  width: auto;
  max-width: none;
  text-align: center;
  white-space: nowrap;
}

.patch-mini-table th:nth-child(3),
.patch-mini-table td:nth-child(3) {
  width: auto;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.patch-mini-table th:nth-child(4),
.patch-mini-table td:nth-child(4) {
  width: auto;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.patch-mini-table .compact-input {
  min-height: 30px;
  font-size: 0.82rem;
  padding: 5px 7px;
}

.channel-move-cell {
  padding: 2px !important;
}

.channel-selection-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin: 10px 0;
}

.keyboard-hint {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 0.68rem;
  line-height: 1.3;
  opacity: 0.65;
}

.channel-move-handle {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: none;
  min-height: 28px;
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: grab;
  touch-action: none;
}

.patch-picker-value {
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.io-row-selected td {
  background: color-mix(in srgb, var(--brand) 13%, transparent);
}

.io-row-selected .channel-move-handle {
  background: var(--brand);
  color: #ffffff;
}

.io-row-selected .channel-grip {
  color: #ffffff;
  opacity: 0.8;
}

.io-row-drop-target td {
  border-top: 3px solid var(--brand);
}

.channel-move-handle:active {
  cursor: grabbing;
}

.channel-grip {
  display: inline-block;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: -3px;
  opacity: 0.45;
}

.channel-move-handle:hover,
.channel-move-handle:focus-visible {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.mixer-channel-selected td {
  background: color-mix(in srgb, var(--brand) 13%, transparent);
}

.mixer-channel-selected .channel-move-handle {
  background: var(--brand);
  color: #ffffff;
}

.mixer-channel-selected .channel-grip {
  color: #ffffff;
  opacity: 0.8;
}

.mixer-channel-drop-target td {
  border-top: 3px solid var(--brand);
}

.patch-picker-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 4px;
  align-items: stretch;
}

.patch-fill-cell {
  position: relative;
}

.patch-fill-cell:has(.double-patch-info) {
  padding-right: 29px;
}

.double-patch-info {
  position: absolute;
  top: 50%;
  right: 5px;
  z-index: 5;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 1px solid color-mix(in srgb, var(--brand) 65%, transparent);
  border-radius: 50%;
  background: var(--panel);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: help;
}

.double-patch-info::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 6px 8px;
  border-radius: 6px;
  background: #20312c;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(20, 37, 32, 0.24);
  content: attr(data-tooltip);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  opacity: 0;
  overflow-wrap: anywhere;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 45ms ease, transform 45ms ease;
  visibility: hidden;
}

.double-patch-info:hover::after,
.double-patch-info:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.patch-fill-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 2;
  width: 11px;
  height: 11px;
  padding: 0;
  border: 0;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: ns-resize;
  touch-action: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.patch-fill-handle:hover,
.patch-fill-handle:focus-visible,
.config-fill-handle:hover,
.config-fill-handle:focus-visible {
  transform: scale(1.2);
  box-shadow: none;
}

.config-fill-cell {
  position: relative;
}

.config-fill-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 3;
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: ns-resize;
  opacity: 0.3;
  touch-action: none;
  transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.config-fill-cell:hover .config-fill-handle,
.config-fill-cell:focus-within .config-fill-handle {
  opacity: 1;
}

.patch-fill-target td {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}

.patch-fill-target.patch-fill-replace td {
  background: color-mix(in srgb, #d99129 18%, transparent);
  box-shadow: inset 3px 0 0 #d99129;
}

.patch-fill-target.patch-fill-remove td {
  background: rgba(181, 71, 58, 0.16);
  box-shadow: inset 3px 0 0 #b5473a;
}

.config-fill-target td {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  box-shadow: inset 3px 0 0 var(--brand);
}

.config-fill-target.config-fill-replace td {
  background: color-mix(in srgb, #d99129 18%, transparent);
  box-shadow: inset 3px 0 0 #d99129;
}

.config-fill-target.config-fill-remove td {
  background: rgba(181, 71, 58, 0.16);
  box-shadow: inset 3px 0 0 #b5473a;
}

.patch-picker-control:has(.patch-picker-value:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.patch-picker-value,
.patch-picker-clear {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.78rem;
}

.patch-picker-value {
  overflow: hidden;
  padding: 5px 7px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patch-picker-value.empty {
  color: var(--muted);
}

.patch-picker-clear {
  padding: 0;
  color: var(--muted);
  font-weight: 900;
}

.patch-picker-value:hover,
.patch-picker-value:focus,
.patch-picker-clear:hover,
.patch-picker-clear:focus {
  border-color: var(--brand-ink);
  outline: none;
}

.picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(27, 35, 43, 0.34);
  overflow: hidden;
  overscroll-behavior: contain;
}

.picker-panel {
  width: min(860px, calc(100vw - 32px));
  height: min(680px, calc(100dvh - 32px));
  min-height: min(520px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
  overscroll-behavior: contain;
}

.picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.picker-head h3,
.picker-head p {
  margin: 0;
}

.picker-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.picker-list {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  padding-right: 4px;
}

.picker-group {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.picker-group-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: #eef2f4;
  color: var(--brand-ink);
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.picker-group-title::-webkit-details-marker {
  display: none;
}

.picker-group-title::before {
  content: "+";
  width: 18px;
  color: var(--brand-ink);
  font-weight: 900;
}

.picker-group[open] > .picker-group-title::before {
  content: "-";
}

.picker-group-title > span {
  min-width: 0;
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.picker-group-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-group-title small {
  color: var(--muted);
  font-weight: 800;
}

.picker-option {
  width: 100%;
  display: grid;
  grid-template-columns: calc(6ch + 10px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.picker-option:hover,
.picker-option:focus {
  background: var(--soft);
  outline: none;
}

.picker-option-channel {
  color: var(--brand-ink);
  font-weight: 900;
  text-align: center;
}

.picker-option strong,
.picker-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-option small {
  margin-top: 2px;
  color: var(--muted);
}

.patch-source-row td {
  background: var(--patch-tint);
  color: var(--brand-ink);
  font-weight: 900;
  letter-spacing: 0;
  font-size: 0.74rem;
}

.patch-source-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: inherit;
}

.patch-source-title {
  display: block;
  text-transform: uppercase;
}

.patch-source-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 500;
  text-transform: none;
  text-align: left;
  white-space: pre-line;
}

.io-name-input,
.io-mic-input {
  min-width: 0;
}

.route-source-label {
  color: var(--brand-ink);
  font-weight: 800;
  margin-bottom: 4px;
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(520px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.library-grid > .panel,
.system-builder,
.system-builder .field,
.system-builder .grid-2,
.system-builder .grid-3,
.system-builder input,
.system-builder select,
.system-builder textarea {
  min-width: 0;
}

.system-builder input,
.system-builder select,
.system-builder textarea {
  width: 100%;
}

.requirements-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.requirements-grid > .panel,
.requirements-list,
.requirements-card,
.requirements-section,
.requirements-rack,
.requirements-summary-grid {
  min-width: 0;
}

.requirements-list,
.requirements-card,
.requirements-section,
.requirements-rack,
.requirements-summary-grid {
  display: grid;
  gap: 12px;
}

.requirements-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.requirements-card.compact {
  gap: 10px;
}

.requirements-card h3 {
  margin: 0;
  color: var(--brand-ink);
}

.requirements-rack {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.requirements-list-compact {
  margin: 0;
  padding-left: 18px;
  color: #2f3944;
}

.requirements-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.requirements-table th,
.requirements-table td {
  padding: 7px 8px;
  overflow-wrap: anywhere;
}

.requirements-card .small-copy,
.requirements-list-compact,
.requirements-rack strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.requirements-table th:last-child,
.requirements-table td:last-child {
  width: 64px;
  text-align: right;
}

.library-card {
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-instructions {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 800;
}

.notice.success {
  color: #123f28;
  background: #dff3e8;
  border: 1px solid #a7d9bd;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 15px 18px;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(16, 24, 32, 0.18);
  font-weight: 900;
  line-height: 1.4;
  animation: toast-lifecycle 7.2s ease both;
}

@keyframes toast-lifecycle {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  5%, 88% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

.tour-intercept {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(19, 43, 36, 0.72);
  backdrop-filter: blur(3px);
}

.tour-focus-ring {
  position: fixed;
  z-index: 101;
  border: 3px solid #f0b34b;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(19, 43, 36, 0.7), 0 0 0 5px rgba(240, 179, 75, 0.22);
  pointer-events: none;
  transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease;
}

.tour-card {
  position: fixed;
  z-index: 102;
  width: min(390px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
  border-radius: 13px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(13, 39, 31, 0.28);
}

.tour-splash-card {
  top: 50%;
  left: 50%;
  width: min(570px, calc(100vw - 20px));
  transform: translate(-50%, -50%);
}

.tour-scene {
  min-height: 145px;
  margin: 8px 0 16px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.tour-welcome-scene,
.tour-finish-scene {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-weight: 800;
}

.tour-welcome-scene img,
.tour-finish-scene img { width: 72px; height: 72px; }

.tour-system-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tour-system-scene div { padding: 15px 12px; border:1px solid var(--line); border-radius:8px; background:var(--panel); font-size:.78rem; font-weight:700; }
.tour-system-scene i { width:36px; height:3px; background:linear-gradient(90deg,var(--brand),#f0b34b,var(--brand)); background-size:200%; animation:tour-route 1.7s infinite linear; }

.tour-card-scene { display:grid; gap:7px; align-content:center; }
.tour-card-scene label { color:var(--muted); font-size:.72rem; }
.tour-card-scene div { display:flex; justify-content:space-between; padding:8px 10px; border:1px solid var(--line); border-radius:6px; background:var(--panel); font-size:.78rem; }
.tour-card-scene span { color:var(--brand); font-size:.68rem; font-weight:800; }
.tour-card-scene small { color:var(--muted); }

.tour-table-scene { display:grid; grid-template-columns:55px 1fr 1.4fr; gap:1px; padding:1px; background:var(--line); }
.tour-table-scene > * { padding:8px; background:var(--panel); font-size:.74rem; }
.tour-table-scene b { color:var(--muted); font-size:.68rem; text-transform:uppercase; }
.tour-table-scene .animated-source { animation:tour-source-select 2.5s infinite; }
@keyframes tour-source-select { 0%,25% { color:transparent; } 45%,100% { color:var(--brand); background:#dff3e8; } }

.tour-requirements-scene { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; align-items:center; }
.tour-requirements-scene div { display:grid; place-items:center; padding:15px 6px; border-radius:8px; background:var(--panel); }
.tour-requirements-scene strong { color:var(--brand); font-size:1.5rem; }
.tour-requirements-scene span { color:var(--muted); font-size:.72rem; }

.tour-card h2 {
  margin: 3px 0 8px;
  font-size: 1.15rem;
}

.tour-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tour-card-head,
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-progress {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tour-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
}

.tour-actions {
  margin-top: 16px;
}

.tour-dismiss-choice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 15px;
  color: var(--ink);
  font-size: 0.84rem;
}

.tour-demo {
  position: relative;
  margin-top: 14px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
}

.tour-demo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0;
  padding: 7px 9px;
  border-radius: 5px;
  background: var(--panel);
  font-size: 0.76rem;
}

.tour-demo-row strong { font-size: 0.68rem; text-transform: uppercase; }
.tour-demo-add { animation: tour-add 4.8s infinite; }
.tour-demo-replace { animation: tour-replace 4.8s 1.1s infinite; }
.tour-demo-remove { animation: tour-remove 4.8s 2.2s infinite; }
.tour-demo-cursor { position: absolute; right: 8px; top: 4px; color: var(--brand); font-size: 1.25rem; animation: tour-cursor 4.8s infinite ease-in-out; }

@keyframes tour-add { 8%,26% { background:#dff3e8; box-shadow:inset 3px 0 #28735a; } }
@keyframes tour-replace { 8%,26% { background:#faecd5; box-shadow:inset 3px 0 #d99129; } }
@keyframes tour-remove { 8%,26% { background:#f4dfdc; box-shadow:inset 3px 0 #b5473a; } }
@keyframes tour-cursor { 0% { transform:translateY(0); } 70% { transform:translateY(78px); } 100% { transform:translateY(0); } }

.tour-move-demo { display: grid; gap: 5px; }
.tour-move-row { padding: 7px 9px; border-radius: 5px; background:var(--panel); font-size:.76rem; }
.tour-move-row.moving { background:#dff3e8; box-shadow:inset 3px 0 var(--brand); animation:tour-move-row 2.6s infinite ease-in-out; }
@keyframes tour-move-row { 0%,20% { transform:translateY(0); } 55%,80% { transform:translateY(37px); } 100% { transform:translateY(0); } }

.tour-route-demo { display:flex; align-items:center; justify-content:center; gap:7px; color:var(--ink); font-size:.76rem; }
.tour-route-demo i { width:52px; height:3px; overflow:hidden; border-radius:2px; background:linear-gradient(90deg, var(--brand) 0 35%, #f0b34b 45% 55%, var(--line) 65%); background-size:200% 100%; animation:tour-route 1.7s infinite linear; }
.tour-route-demo b { padding:5px 8px; border-radius:5px; background:#dff3e8; color:var(--brand); }
@keyframes tour-route { to { background-position:-200% 0; } }

.toast.success {
  color: #123f28;
  background: #dff3e8;
  border: 1px solid #8dccaa;
}

.system-builder {
  display: grid;
  gap: 14px;
}

.io-builder {
  display: grid;
  gap: 8px;
}

.io-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.io-row-list {
  display: grid;
  gap: 8px;
}

.io-row {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) minmax(76px, .45fr) 38px;
  gap: 8px;
  align-items: center;
}

.io-row > * {
  min-width: 0;
  width: 100%;
}

.channel-move-cell[style*="--channel-color"] {
  background: color-mix(in srgb, var(--channel-color) 28%, var(--panel));
  box-shadow: inset 5px 0 var(--channel-color);
}

.io-color-panel {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 18px;
  width: min(620px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: auto 52px 1fr 42px;
  gap: 14px;
  align-items: center;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(13, 39, 31, .24);
  transform: translateX(-50%);
}
.io-color-panel > div:first-child { display:grid; gap:2px; }
.io-color-panel > div:first-child span, .io-used-colors small { color:var(--muted); font-size:.68rem; }
.io-color-panel input[type="color"] { width:52px; height:36px; padding:2px; border:1px solid var(--line); border-radius:7px; background:var(--soft); cursor:pointer; }
.io-range-editor { grid-column:1 / -1; display:grid; grid-template-columns:minmax(180px,1fr) auto 38px; align-items:end; gap:8px; padding-top:8px; border-top:1px solid var(--line); }
.io-range-editor label { display:grid; gap:3px; }
.io-range-editor label > span { color:var(--muted); font-size:.68rem; }
.channel-number.io-range-member { position:relative; }
.channel-number.io-range-member::after { position:absolute; left:3px; top:0; bottom:0; width:6px; border-left:2px solid var(--brand); content:""; pointer-events:none; }
.channel-number.io-range-start::after { top:5px; border-top:2px solid var(--brand); }
.channel-number.io-range-end::after { bottom:5px; border-bottom:2px solid var(--brand); }
.channel-number.io-range-start.io-range-end::after { top:5px; bottom:5px; }
.io-used-colors { display:flex; gap:7px; align-items:center; overflow-x:auto; }
.io-used-colors button { flex:0 0 28px; width:28px; height:28px; border:2px solid #fff; border-radius:50%; background:var(--swatch); box-shadow:0 0 0 1px var(--line); }
.io-color-remove { width:38px; height:38px; border:1px solid #e3c5c1; border-radius:7px; background:#fff2f0; color:#9a382e; font-size:1rem; }

.mixer-paste-progress {
  position: fixed;
  z-index: 79;
  left: 50%;
  bottom: 18px;
  width: min(520px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, .8fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(13, 39, 31, .24);
  transform: translateX(-50%);
}
.mixer-paste-progress > div { display:grid; gap:3px; }
.mixer-paste-progress span { color:var(--muted); font-size:.72rem; }
.mixer-paste-progress progress { width:100%; accent-color:var(--brand); }

@media (max-width: 620px) {
  .io-color-panel { grid-template-columns:1fr 48px 40px; }
  .io-color-panel > div:first-child { grid-column:1 / -1; }
}

.library-path,
.schema-sample {
  overflow-x: auto;
  padding: 12px;
  color: #23303b;
  background: #eef2f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.schema-sample {
  margin: 16px 0 0;
  line-height: 1.45;
  white-space: pre;
}

.library-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.catalog-group-summary,
.catalog-manufacturer-summary {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
}

.catalog-group-summary::-webkit-details-marker,
.catalog-manufacturer-summary::-webkit-details-marker {
  display: none;
}

.catalog-group-summary::before,
.catalog-manufacturer-summary::before {
  content: "+";
  color: var(--brand-ink);
  font-weight: 900;
  text-align: center;
}

.catalog-type-group[open] > .catalog-group-summary::before,
.catalog-manufacturer-group[open] > .catalog-manufacturer-summary::before {
  content: "−";
}

.catalog-group-summary > span,
.catalog-manufacturer-summary > span {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.catalog-group-summary small,
.catalog-manufacturer-summary small {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.catalog-type-group[open] > .catalog-group-summary {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.catalog-manufacturer-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.catalog-manufacturer-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.catalog-series-list {
  display: grid;
  gap: 7px;
  padding: 8px;
}

.catalog-series-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.catalog-series-summary {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}

.catalog-series-summary::-webkit-details-marker { display:none; }
.catalog-series-summary::before { content:"+"; color:var(--brand-ink); font-weight:900; text-align:center; }
.catalog-series-group[open] > .catalog-series-summary::before { content:"−"; }
.catalog-series-summary > span { min-width:0; display:flex; justify-content:space-between; align-items:center; gap:10px; }
.catalog-series-summary small { color:var(--muted); font-size:.7rem; font-weight:700; }
.catalog-series-group[open] > .catalog-series-summary { border-bottom:1px solid var(--line); background:#f8fafb; }
.catalog-series-group > .library-list { padding:8px; }

.catalog-manufacturer-summary {
  padding: 10px 12px;
  background: var(--soft);
}

.catalog-manufacturer-group[open] > .catalog-manufacturer-summary {
  border-bottom: 1px solid var(--line);
}

.catalog-manufacturer-group > .library-list {
  padding: 9px;
}

.library-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.library-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.library-actions .icon-button {
  width: 34px;
  height: 34px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  color: #2f3a44;
  background: #e7ecef;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  box-shadow: none;
}

@media (max-width: 1100px) {
  .history-grid { grid-template-columns: 1fr; }
  .splash,
  .config-layout,
  .add-system-row,
  .library-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions,
  .toolbar-nav {
    margin-left: 0;
  }

  .toolbar-nav {
    align-self: flex-end;
  }

  .workspace {
    padding: 16px;
  }
}

@media (max-width: 700px) {
  .io-row {
    grid-template-columns: minmax(0, 1fr) minmax(90px, .45fr) 38px;
  }

  .io-row > select {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .splash {
    padding: 24px 16px;
  }

  .splash-panel,
  .panel {
    padding: 16px;
  }

  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .button-row > * {
    width: 100%;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(16, 31, 47, 0.58);
  backdrop-filter: blur(5px);
}

.export-dialog {
  position: fixed;
  z-index: 121;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  padding: 26px;
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(10, 27, 43, 0.28);
}

.export-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.export-dialog h2 { margin: 3px 0 10px; }
.export-dialog .eyebrow { margin: 0; }

.export-format-grid {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

.export-format-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  cursor: pointer;
}

.export-format-card input { margin-top: 3px; accent-color: var(--accent); }
.export-format-card span { display: grid; gap: 3px; }
.export-format-card small { color: var(--muted); line-height: 1.35; }

.dante-network-control {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid #b7d9e8;
  border-radius: 7px;
  background: #eef8fc;
}

.dante-network-toggle { display: flex; align-items: center; gap: 8px; color: #24536a; font-size: .75rem; font-weight: 800; }
.dante-network-toggle input { accent-color: #247b9b; }
.dante-network-name { width: 100%; padding: 7px 8px; border: 1px solid #9dc8d9; border-radius: 5px; background: #fff; font-size: .75rem; }

.automatic-route-dialog {
  position: fixed;
  z-index: 121;
  top: 50%;
  left: 50%;
  width: min(640px, calc(100vw - 28px));
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  padding: 24px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(10, 27, 43, .3);
}

.automatic-route-dialog h2 { margin: 3px 0 8px; }
.automatic-route-options { display: grid; gap: 10px; margin-top: 18px; }
.automatic-route-options > button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--ink); text-align: left; }
.automatic-route-options > button:hover { border-color: var(--brand); background: #eef8f4; }
.automatic-route-options span { display: grid; gap: 4px; }.automatic-route-options small { color: var(--muted); }.automatic-route-options > button > b { flex: 0 0 auto; color: var(--brand); font-size: .75rem; }
.automatic-route-paste-actions { display: grid; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.automatic-route-paste-actions p { margin: 0 0 2px; }
.automatic-route-paste-actions button { width: 100%; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 9px; background: var(--brand); color: white; font-weight: 700; }
.automatic-route-paste-actions button:hover { filter: brightness(.94); }

.route-inspector-dialog {
  position: fixed;
  z-index: 121;
  top: 50%;
  left: 50%;
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  padding: 24px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(10, 27, 43, .3);
}
.route-inspector-dialog h2 { margin: 3px 0 8px; }
.route-inspector-status { display: flex; align-items: center; gap: 8px; margin: 12px 0 16px; font-size: .78rem; font-weight: 800; }
.route-inspector-status span { width: 9px; height: 9px; border-radius: 50%; background: #c74a4a; box-shadow: 0 0 0 4px rgba(199, 74, 74, .12); }
.route-inspector-status.is-valid { color: #17694d; }
.route-inspector-status.is-valid span { background: #26966d; box-shadow: 0 0 0 4px rgba(38, 150, 109, .13); }
.route-inspector-status.is-info { color: #67531c; }
.route-inspector-status.is-info span { background: #d39b28; box-shadow: 0 0 0 4px rgba(211, 155, 40, .14); }
.route-inspector-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.route-inspector-summary > div { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.route-inspector-summary dt { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.route-inspector-summary dd { margin: 5px 0 0; font-size: .82rem; font-weight: 750; overflow-wrap: anywhere; }
.route-inspector-summary small { display: block; margin-top: 3px; color: var(--muted); font-weight: 600; }
.route-inspector-path { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.route-inspector-hop { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; }
.route-hop-index { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 900; }
.route-inspector-hop > div { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 9px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.route-inspector-hop strong { font-size: .76rem; overflow-wrap: anywhere; }
.route-inspector-hop strong:last-child { text-align: right; }
.route-inspector-hop div > span { color: var(--brand); font-size: .66rem; font-weight: 850; text-align: center; }
.route-inspector-hop div > span::before { content: "→ "; }
.route-inspector-issues { margin-top: 16px; padding: 12px 14px; border: 1px solid #e2b6b6; border-radius: 10px; background: #fff3f3; color: #863636; font-size: .78rem; }
.route-inspector-issues ul { margin: 7px 0 0; padding-left: 18px; }
.route-inspector-information { margin-top: 16px; padding: 12px 14px; border: 1px solid #ead9a9; border-radius: 10px; background: #fff9e9; color: #67531c; font-size: .78rem; }
.route-inspector-information ul { margin: 7px 0 0; padding-left: 18px; }
.route-repair-options { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border: 1px solid #d8c184; border-radius: 12px; background: #fffaf0; }
.route-repair-options > div:first-child p { margin: 4px 0 0; color: var(--muted); font-size: .72rem; }
.route-repair-path { background: #fff; }
.route-repair-picker-option { cursor: pointer; }
.route-repair-picker-option:hover .picker-option-channel { color: var(--brand); }
.channel-move-cell.route-repair-highlight { position: relative; background: #fff5df; outline: 2px dashed #e58a22; outline-offset: -3px; }
.channel-move-cell.route-repair-highlight::after { content: "repair"; position: absolute; top: 2px; right: 3px; color: #b45f08; font-size: .44rem; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; pointer-events: none; }
.route-inspector-hint { margin: 16px 0 0; color: var(--muted); font-size: .7rem; text-align: right; }

@media (max-width: 620px) {
  .route-inspector-summary { grid-template-columns: 1fr; }
  .route-inspector-hop > div { grid-template-columns: 1fr; }
  .route-inspector-hop strong:last-child { text-align: left; }
  .route-inspector-hop div > span { text-align: left; }
  .route-inspector-hop div > span::before { content: "↓ "; }
}

/* Larger, self-contained product tour */
.tour-splash-card {
  width: min(920px, calc(100vw - 32px));
  padding: 24px 26px;
  border-radius: 18px;
}

.tour-splash-card .tour-scene {
  min-height: 330px;
  margin: 12px 0 20px;
  padding: 22px;
  border-radius: 13px;
}

.tour-splash-card h2 { font-size: 1.35rem; }
.tour-step-copy { max-width: 780px; }
.tour-step-copy h2 { margin-bottom: 7px; }
.tour-step-copy p { margin: 0; font-size: .94rem; }
.tour-mini-heading { margin-bottom: 10px; color: var(--brand-ink); font-size: .72rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }

.tour-intro-scene { display: grid; place-content: center; gap: 42px; }
.tour-intro-brand { display: flex; align-items: center; justify-content: center; gap: 20px; }
.tour-intro-brand img { width: 92px; height: 92px; }
.tour-intro-brand div { display: grid; gap: 5px; }
.tour-intro-brand strong { color: var(--brand-ink); font-size: 1.55rem; }
.tour-intro-brand span { color: var(--muted); }
.tour-feature-strip { display: flex; align-items: center; justify-content: center; gap: 11px; }
.tour-feature-strip span { padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: .78rem; font-weight: 800; }
.tour-feature-strip span.active { color: #17533f; background: #dff3e8; border-color: #8dccaa; }
.tour-feature-strip i { width: 35px; height: 3px; background: linear-gradient(90deg, var(--brand), #f0b34b, var(--brand)); background-size: 200%; animation: tour-route 1.7s infinite linear; }

.tour-workspace-scene { display: grid; grid-template-rows: auto 1fr; gap: 16px; background: #edf1f3; }
.tour-fake-toolbar { display: flex; gap: 24px; padding: 10px 15px; border-radius: 8px; background: var(--panel); color: var(--muted); font-size: .76rem; }
.tour-fake-toolbar b { color: var(--brand); border-bottom: 2px solid var(--brand); }
.tour-system-layout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; }
.tour-device-picker { display: grid; align-content: start; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.tour-device-picker label { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.tour-device-picker div { display: grid; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; font-size: .72rem; }
.tour-device-picker button { padding: 5px; border-radius: 5px; background: var(--brand); color: #fff; font-size: .68rem; }
.tour-topology { display: flex; align-items: center; justify-content: center; }
.tour-topology article { min-width: 125px; display: grid; gap: 5px; padding: 18px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); box-shadow: 0 8px 18px rgba(20,39,54,.07); text-align: center; }
.tour-topology article b { color: var(--brand-ink); }
.tour-topology article small { color: var(--muted); }
.tour-connect-button { width: 34px; height: 34px; margin: 0 5px; border: 2px solid #f0b34b; border-radius: 50%; background: #fff8e8; color: #ad7116; animation: tour-connect-pulse 2s infinite; }
@keyframes tour-connect-pulse { 50% { box-shadow: 0 0 0 7px rgba(240,179,75,.18); } }

.tour-device-scene { display: grid; grid-template-columns: .9fr 1.1fr; gap: 20px; align-items: stretch; }
.tour-device-summary, .tour-card-config { display: grid; align-content: start; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.tour-device-summary > strong { color: var(--brand-ink); font-size: 1.15rem; }
.tour-device-summary > span, .tour-card-config small { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.tour-device-summary > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.tour-device-summary label { display: grid; gap: 5px; color: var(--muted); font-size: .7rem; }
.tour-device-summary input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--soft); }
.tour-card-config > div:first-child { display: flex; justify-content: space-between; }
.tour-compatible-pill { padding: 4px 7px; border-radius: 99px; color: #17533f; background: #dff3e8; font-size: .65rem; font-weight: 800; }
.tour-fake-select { display: flex; justify-content: space-between; padding: 10px; border: 2px solid var(--brand); border-radius: 7px; font-size: .8rem; }
.tour-card-connection { display: flex; justify-content: space-between; margin-top: 10px; padding: 13px; border-radius: 7px; background: var(--soft); font-size: .72rem; }

.tour-auto-patch-scene { display: grid; grid-template-columns: .9fr 1.1fr; gap: 20px; }
.tour-channel-picker, .tour-route-created { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.tour-channel-line { display: grid; grid-template-columns: 55px 1fr 1.5fr; gap: 5px; align-items: center; padding: 9px; background: var(--soft); font-size: .73rem; }
.tour-channel-line button { padding: 8px; border: 2px solid var(--brand); border-radius: 6px; background: var(--panel); color: var(--brand); text-align: left; }
.tour-picker-menu { display: grid; margin: 7px 0 0 115px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; font-size: .7rem; }
.tour-picker-menu > * { padding: 7px 9px; border-bottom: 1px solid var(--line); }
.tour-picker-menu strong { background: var(--soft); }
.tour-picker-menu .selected { color: #17533f; background: #dff3e8; font-weight: 800; }
.tour-route-chain { display: flex; align-items: center; justify-content: center; margin: 25px 0; }
.tour-route-chain span { max-width: 120px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); font-size: .68rem; text-align: center; }
.tour-route-chain i { flex: 1; min-width: 15px; height: 3px; background: linear-gradient(90deg,var(--brand),#f0b34b,var(--brand)); background-size: 200%; animation: tour-route 1.7s infinite linear; }
.tour-route-created p { padding: 11px; border-radius: 7px; color: var(--muted); background: #fff8e8; font-size: .72rem; }
.tour-route-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tour-route-choice > div { position: relative; display: grid; gap: 4px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); font-size: .68rem; }
.tour-route-choice span { color: var(--muted); }.tour-route-choice .available { border-color: #8dccaa; background: #dff3e8; }.tour-route-choice b { position: absolute; right: 7px; bottom: 7px; color: var(--brand); font-size: .62rem; }
.automatic-route-paste-checkbox { display:flex; align-items:center; gap:7px; margin-top:10px; color:var(--muted); font-size:.74rem; }
.automatic-route-paste-checkbox input { width:15px; height:15px; }

.tour-drag-scene { position: relative; display: grid; grid-template-columns: 1fr 180px; gap: 20px; align-items: center; }
.tour-drag-table { display: grid; grid-template-columns: 55px 1fr 1.5fr; gap: 1px; padding: 1px; background: var(--line); }
.tour-drag-table > * { min-height: 44px; display: flex; align-items: center; padding: 9px; background: var(--panel); font-size: .75rem; }
.tour-drag-table b { min-height: auto; color: var(--muted); font-size: .68rem; }
.tour-drag-table .tour-demo-add, .tour-drag-table .tour-demo-replace, .tour-drag-table .tour-demo-remove { animation-duration: 5.2s; animation-iteration-count: infinite; }
.tour-drag-key { display: grid; gap: 10px; }
.tour-drag-key span { padding: 10px; border-radius: 7px; font-size: .72rem; font-weight: 800; }
.tour-drag-key .add { background: #dff3e8; color: #17533f; }.tour-drag-key .replace { background: #faecd5; color: #8b5710; }.tour-drag-key .remove { background: #f4dfdc; color: #8a3026; }
.tour-drag-scene .tour-demo-cursor { right: 205px; top: 55px; animation-duration: 5.2s; }

.tour-multi-move-scene { display: grid; grid-template-columns: 1fr 130px 1fr; gap: 18px; align-items: center; }
.tour-move-list, .tour-move-result { display: grid; gap: 5px; }
.tour-move-list div, .tour-move-result div { padding: 9px 11px; border-radius: 6px; background: var(--panel); font-size: .76rem; }
.tour-move-list .selected, .tour-move-result .selected { color: #17533f; background: #dff3e8; box-shadow: inset 3px 0 var(--brand); }
.tour-move-list .selected { animation: tour-selected-shift 3s infinite ease-in-out; }
.tour-move-arrow { display: grid; place-items: center; gap: 4px; color: var(--muted); font-size: .7rem; text-align: center; }
.tour-move-arrow b { color: var(--brand); font-size: 2.2rem; }
.tour-move-result small { margin-top: 8px; color: var(--muted); text-align: center; }
@keyframes tour-selected-shift { 0%,25% { transform: translateX(0); } 55%,80% { transform: translateX(8px); } }

.tour-inventory-scene { display: grid; grid-template-columns: 1.2fr 45px 1fr; gap: 12px; align-items: center; }
.tour-input-row { display: grid; grid-template-columns: 45px 1fr 1fr 1.2fr; gap: 1px; background: var(--line); }
.tour-input-row > * { padding: 8px; background: var(--panel); font-size: .7rem; }
.tour-input-row.head > * { color: var(--muted); background: var(--soft); }
.tour-input-row .entered { animation: tour-entry-highlight 3s infinite; }
.tour-inventory-arrow { color: var(--brand); font-size: 2rem; text-align: center; }
.tour-count-card { display: grid; margin-bottom: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.tour-count-card strong { margin-bottom: 5px; color: var(--brand-ink); font-size: .75rem; }
.tour-count-card span { display: flex; justify-content: space-between; padding: 3px; color: var(--muted); font-size: .7rem; }
.tour-count-card b { color: var(--brand); }
@keyframes tour-entry-highlight { 30%,65% { background: #dff3e8; color: #17533f; } }

.tour-full-requirements-scene { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; }
.tour-requirement-devices article { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: .76rem; }
.tour-requirement-devices article span { color: var(--muted); }
.tour-requirement-totals > div:not(.tour-mini-heading) { display: grid; margin-bottom: 9px; padding: 12px; border-radius: 8px; background: var(--panel); }
.tour-requirement-totals strong { margin-bottom: 6px; color: var(--brand-ink); }
.tour-requirement-totals span { display: flex; justify-content: space-between; padding: 4px; color: var(--muted); font-size: .72rem; }
.tour-requirement-totals b { color: var(--brand); }

.tour-export-scene { display: grid; place-items: center; }
.tour-export-dialog { width: min(620px, 100%); display: grid; align-content: center; gap: 9px; }
.tour-export-title { display: grid; gap: 3px; margin-bottom: 5px; }.tour-export-title span { color: var(--brand); font-size: .7rem; font-weight: 900; text-transform: uppercase; }.tour-export-title strong { color: var(--brand-ink); font-size: 1.15rem; }
.tour-export-dialog label { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.tour-export-dialog label i { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; font-size: .68rem; font-style: normal; }.tour-export-dialog label i.checked { color: #fff; background: var(--brand); border-color: var(--brand); }
.tour-export-dialog label span { display: grid; gap: 2px; }.tour-export-dialog label small { color: var(--muted); }.tour-export-dialog button { justify-self: end; padding: 9px 14px; border-radius: 6px; background: var(--brand); color: #fff; }

/* Tour replicas use the same visual language as the working screens. */
.tour-finish-group { display:flex; align-items:center; gap:12px; }
.tour-finish-group .tour-dismiss-choice { margin:0; align-items:center; color:var(--muted); font-size:.72rem; white-space:nowrap; }
.tour-finish-group .tour-dismiss-choice input { width:14px; height:14px; margin:0; }
.tour-config-columns { position:relative; display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.tour-config-panel { padding:14px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.tour-config-panel h3 { margin:0 0 10px; color:var(--brand-ink); font-size:.9rem; }
.tour-add-row { display:grid; grid-template-columns:1fr auto; gap:7px; align-items:center; margin-bottom:10px; }
.tour-add-row span, .tour-add-row b { padding:7px 8px; border:1px solid var(--line); border-radius:5px; background:#fff; font-size:.63rem; }
.tour-add-row b { border-color:var(--brand); background:var(--brand); color:#fff; }
.tour-system-card { position:relative; min-height:180px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#fff; box-shadow:0 5px 14px rgba(20,39,54,.06); }
.tour-system-card header { display:flex; justify-content:space-between; gap:8px; margin-bottom:10px; }
.tour-system-card header div { display:grid; gap:2px; }.tour-system-card header strong { color:var(--brand-ink); font-size:.8rem; }.tour-system-card header small { color:var(--muted); font-size:.6rem; }
.tour-system-card header > span { color:var(--muted); }
.tour-field-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.tour-field-grid label, .tour-io-card-field { display:grid; gap:4px; color:var(--muted); font-size:.6rem; }
.tour-field-grid i, .tour-io-card-field > i { padding:7px; border:1px solid var(--line); border-radius:5px; background:#fff; color:var(--ink); font-size:.68rem; font-style:normal; }
.tour-endpoint { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:10px; padding:8px; border:1px solid var(--line); border-radius:6px; background:var(--soft); }
.tour-endpoint span { display:grid; gap:2px; }.tour-endpoint b { font-size:.65rem; }.tour-endpoint small { color:var(--muted); font-size:.58rem; }.tour-endpoint button { width:26px; height:26px; border:1px solid var(--accent); border-radius:5px; background:#fff; color:var(--accent); }
.tour-connection-animation { position:absolute; inset:0; z-index:3; width:100%; height:100%; pointer-events:none; overflow:visible; }
.tour-connection-animation path { fill:none; stroke:var(--accent); stroke-width:3; stroke-dasharray:8 7; animation:tour-draw-connection 3.2s infinite; }
.tour-connection-animation circle { fill:var(--accent); opacity:0; animation:tour-show-connection 3.2s infinite; }.tour-connection-animation text { fill:var(--brand-ink); paint-order:stroke; stroke:#fff; stroke-width:5px; font-size:12px; font-weight:800; text-anchor:middle; opacity:0; animation:tour-show-connection 3.2s infinite; }
.tour-connect-origin { animation:tour-connect-origin 3.2s infinite; }.tour-connect-target { animation:tour-connect-target 3.2s infinite; }
@keyframes tour-draw-connection { 0%,25% { stroke-dashoffset:100; opacity:0; } 45%,85% { stroke-dashoffset:0; opacity:1; } 100% { opacity:0; } }
@keyframes tour-show-connection { 0%,42% { opacity:0; } 52%,88% { opacity:1; } 100% { opacity:0; } }
@keyframes tour-connect-origin { 15%,30% { color:#fff; background:var(--accent); box-shadow:0 0 0 4px rgba(197,84,45,.18); } }
@keyframes tour-connect-target { 35%,50% { color:#fff; background:var(--accent); box-shadow:0 0 0 4px rgba(197,84,45,.18); } }
.tour-card-replica { grid-template-rows:auto 1fr; }.tour-card-replica > .tour-system-card { width:min(680px,100%); min-height:245px; margin:auto; }
.tour-slot-grid { display:grid; grid-template-columns:.7fr 1.3fr; gap:10px; margin-top:10px; }
.tour-io-card-field em { display:grid; gap:5px; margin-top:4px; padding:8px; border:1px solid #b7d9e8; border-radius:6px; background:#eef8fc; color:#24536a; font-style:normal; }
.tour-io-card-field em b { font-size:.64rem; }.tour-io-card-field em span { display:flex; gap:8px; align-items:center; padding:6px; border:1px solid #9dc8d9; border-radius:4px; background:#fff; color:var(--ink); }.tour-io-card-field em strong { color:var(--muted); font-size:.56rem; text-transform:uppercase; }
.tour-patch-replica { background:#edf1f3; }
.tour-patch-tabs { display:flex; gap:6px; margin-bottom:10px; }.tour-patch-tabs > * { padding:7px 9px; border:1px solid var(--line); border-radius:5px; background:#fff; color:var(--muted); font-size:.62rem; }.tour-patch-tabs b { border-color:var(--brand-ink); background:var(--brand-ink); color:#fff; }
.tour-auto-grid { position:relative; display:grid; grid-template-columns:1fr 1.08fr; gap:14px; }
.tour-auto-patch-scene.tour-patch-replica { display:block; }
.tour-app-table, .tour-route-tables { position:relative; overflow:hidden; border:1px solid var(--line); border-radius:7px; background:#fff; }
.tour-table-title { padding:9px; color:var(--brand-ink); font-size:.7rem; font-weight:900; }
.tour-table-row { display:grid; grid-template-columns:42px 1fr 1.55fr; gap:1px; background:var(--line); }.tour-table-row > * { min-width:0; padding:8px; background:#fff; font-size:.65rem; }.tour-table-row.head > * { color:#3a414b; background:#eef2f4; font-size:.58rem; text-transform:uppercase; }
.tour-source-choice { border:1px solid var(--line); border-radius:5px; background:#fff; color:var(--muted); text-align:left; animation:tour-source-pick 5.5s infinite; }
.tour-auto-name { animation:tour-auto-name 5.5s infinite; }.tour-auto-patch-scene .tour-picker-menu { position:absolute; z-index:4; top:88px; right:8px; width:190px; margin:0; background:#fff; animation:tour-picker-cycle 5.5s infinite; }
.tour-route-tables { padding:10px; }.tour-route-tables .tour-table-row { margin-bottom:7px; }.tour-route-appears, .tour-route-status { animation:tour-route-appear 5.5s infinite; }.tour-route-appears.delayed { animation-delay:.18s; }.tour-route-status { padding:8px!important; border-radius:5px; background:#fff8e8; font-size:.62rem!important; }
.tour-route-popup { position:absolute; z-index:8; top:50%; left:50%; display:grid; gap:6px; width:min(390px,calc(100% - 24px)); padding:13px; border-radius:10px; background:#fff; box-shadow:0 12px 38px rgba(10,27,43,.28); opacity:0; transform:translate(-50%,-46%) scale(.97); animation:tour-route-popup 5.5s infinite; }
.tour-route-popup > small { color:var(--brand); font-size:.56rem; font-weight:900; letter-spacing:.06em; text-transform:uppercase; }.tour-route-popup > strong { color:var(--brand-ink); font-size:.86rem; }.tour-route-popup > p { color:var(--muted); font-size:.6rem; }
.tour-route-popup > button { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px; border:1px solid var(--line); border-radius:6px; background:var(--soft); color:var(--ink); text-align:left; }.tour-route-popup > button span { display:grid; gap:2px; }.tour-route-popup > button b { font-size:.62rem; }.tour-route-popup > button i { color:var(--muted); font-size:.56rem; font-style:normal; }.tour-route-popup > button em { color:var(--brand); font-size:.58rem; font-style:normal; font-weight:900; }.tour-route-popup > button.chosen { animation:tour-route-choice-click 5.5s infinite; }
@keyframes tour-source-pick { 0%,15% { border-color:var(--line); color:var(--muted); } 24%,42% { border-color:var(--brand); box-shadow:0 0 0 2px rgba(42,143,108,.15); } 50%,100% { color:var(--brand-ink); background:#eef8f4; } }
@keyframes tour-picker-cycle { 0%,18%,100% { opacity:0; transform:translateY(-4px); } 24%,42% { opacity:1; transform:none; } 48%,95% { opacity:0; } }
@keyframes tour-route-popup { 0%,40%,72%,100% { opacity:0; pointer-events:none; transform:translate(-50%,-46%) scale(.97); } 46%,67% { opacity:1; transform:translate(-50%,-50%) scale(1); } }
@keyframes tour-route-choice-click { 58%,66% { border-color:var(--brand); background:#dff3e8; box-shadow:0 0 0 2px rgba(42,143,108,.18); } }
@keyframes tour-route-appear { 0%,68% { opacity:0; transform:translateY(5px); } 76%,94% { opacity:1; transform:none; } 100% { opacity:0; } }
@keyframes tour-auto-name { 0%,45% { color:transparent; } 55%,100% { color:inherit; } }
.tour-inventory-scene .tour-patch-replica { padding:10px; border-radius:8px; }.tour-inventory-scene .tour-patch-tabs { flex-wrap:nowrap; }.tour-inventory-scene .tour-patch-tabs > * { padding:6px; font-size:.54rem; }
.tour-count-card span b { margin-left:auto; min-width:24px; text-align:right; }
.tour-drag-table { position:relative; }
.tour-patch-control { position:relative; display:grid!important; grid-template-columns:minmax(0,1fr) 22px; gap:4px; align-items:center; padding:5px!important; }
.tour-patch-control button { min-width:0; overflow:hidden; padding:6px; border:1px solid var(--line); border-radius:5px; background:#fff; color:var(--brand-ink); font-size:.64rem; text-align:left; text-overflow:ellipsis; white-space:nowrap; }
.tour-patch-control i { display:grid; place-items:center; width:21px; height:21px; border-radius:4px; background:var(--soft); color:var(--muted); font-size:.75rem; font-style:normal; }
.tour-patch-control > b { position:absolute; right:1px; bottom:1px; width:8px; height:8px; border-right:2px solid var(--brand); border-bottom:2px solid var(--brand); }
.tour-drag-scene .tour-demo-cursor { right:198px; top:112px; animation-name:tour-table-cursor; }
@keyframes tour-table-cursor { 0%,10% { transform:translate(0,0); } 72%,88% { transform:translate(0,132px); } 100% { transform:translate(0,0); } }
.tour-requirement-panel { padding:14px; border:1px solid var(--line); border-radius:8px; background:#fff; }.tour-requirement-panel header { margin-bottom:10px; }.tour-requirement-panel h3,.tour-requirement-panel h4 { margin:0; color:var(--brand-ink); }.tour-requirement-panel header small,.tour-requirement-panel article > small { color:var(--muted); font-size:.62rem; }.tour-requirement-panel article { display:grid; gap:7px; padding:12px; border:1px solid var(--line); border-radius:7px; }.tour-requirement-panel article strong { margin-top:3px; font-size:.68rem; }.tour-requirement-panel article ul { margin:0; padding-left:18px; font-size:.65rem; }.tour-requirement-panel article div { display:grid; gap:2px; padding:8px; border:1px solid var(--line); border-radius:5px; background:var(--soft); font-size:.68rem; }

@media (max-width: 720px) {
  .tour-splash-card { width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 16px; }
  .tour-splash-card .tour-scene { min-height: 360px; padding: 14px; }
  .tour-system-layout, .tour-device-scene, .tour-auto-patch-scene, .tour-full-requirements-scene { grid-template-columns: 1fr; }
  .tour-device-picker { display: none; }
  .tour-topology article { min-width: 82px; padding: 12px 6px; }
  .tour-picker-menu { margin-left: 0; }
  .tour-drag-scene { grid-template-columns: 1fr; }.tour-drag-key { grid-template-columns: repeat(3,1fr); }.tour-drag-scene .tour-demo-cursor { right: 14px; }
  .tour-multi-move-scene { grid-template-columns: 1fr 55px 1fr; gap: 7px; }
  .tour-inventory-scene { grid-template-columns: 1fr; }.tour-inventory-arrow { transform: rotate(90deg); }
  .tour-feature-strip { flex-wrap: wrap; }.tour-feature-strip i { width: 20px; }
  .tour-config-columns, .tour-auto-grid, .tour-slot-grid { grid-template-columns:1fr; }
  .tour-config-panel:first-child { display:none; }
  .tour-connection-animation { display:none; }
  .tour-card-replica > .tour-system-card { min-height:0; }
  .tour-finish-group { gap:7px; }.tour-finish-group .tour-dismiss-choice { max-width:112px; white-space:normal; }
}

/* Authentication and profile */
.auth-splash { grid-template-columns:minmax(0,1fr) minmax(420px,560px); }
.auth-intro { display:grid; align-content:center; }
.auth-logo { width:72px; height:72px; margin-bottom:28px; }
.auth-intro h1 { max-width:840px; font-size:clamp(3rem,7vw,6.5rem); }
.auth-feature-list { display:grid; gap:10px; margin-top:36px; color:var(--brand-ink); font-weight:750; }
.auth-feature-list span { display:flex; align-items:center; gap:12px; }
.auth-feature-list i { display:grid; place-items:center; width:30px; height:30px; border:1px solid rgba(18,108,111,.3); border-radius:50%; color:var(--brand); font-size:.64rem; font-style:normal; }
.auth-panel { width:100%; max-height:calc(100vh - 64px); overflow:auto; }
.auth-panel-header { align-items:flex-start; margin-bottom:24px; }
.auth-panel-header h2 { margin:0 0 6px; font-size:1.75rem; }
.auth-panel-header p { margin:0; color:var(--muted); line-height:1.5; }
.auth-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; margin-bottom:28px; padding:4px; border-radius:10px; background:var(--soft); }
.auth-tab { padding:10px 14px; border-radius:7px; background:transparent; color:var(--muted); font-weight:800; }
.auth-tab.active { background:var(--panel); color:var(--brand-ink); box-shadow:0 2px 8px rgba(22,29,37,.09); }
.auth-form { display:grid; gap:16px; }
.auth-form label { display:grid; gap:7px; color:var(--brand-ink); font-size:.78rem; font-weight:800; }
.auth-form input { min-width:0; width:100%; padding:12px 13px; border:1px solid var(--line); border-radius:8px; background:var(--field); color:var(--ink); outline:none; font-weight:500; }
.auth-form input:focus { border-color:var(--focus); box-shadow:0 0 0 3px rgba(46,125,209,.13); }
.auth-form label small { color:var(--muted); font-weight:500; }
.auth-submit { width:100%; margin-top:4px; padding:13px 18px; }
.auth-form-row { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.auth-form .auth-check { display:flex; grid-template-columns:none; flex-direction:row; align-items:center; gap:8px; color:var(--muted); font-weight:600; }
.auth-check input { width:16px; height:16px; padding:0; }
.auth-link { padding:0; background:none; color:var(--brand); font-size:.78rem; font-weight:800; text-decoration:underline; text-underline-offset:3px; }
.auth-back-link { justify-self:start; margin-top:4px; }
.auth-notice { margin:0 0 18px; padding:11px 13px; border:1px solid var(--line); border-radius:8px; font-size:.8rem; line-height:1.45; }
.auth-notice.error { border-color:#e7b8b5; background:#fff1f0; color:#8e2925; }
.auth-notice.success { border-color:#add7bf; background:#effaf4; color:#176037; }
.auth-notice.muted { margin:0; background:var(--soft); color:var(--muted); }
.auth-dev-note { margin:0; color:var(--muted); font-size:.72rem; line-height:1.5; }
.auth-loading { min-height:300px; display:grid; place-items:center; align-content:center; gap:16px; color:var(--muted); }
.auth-spinner { width:34px; height:34px; border:3px solid var(--line); border-top-color:var(--brand); border-radius:50%; animation:auth-spin .8s linear infinite; }
@keyframes auth-spin { to { transform:rotate(360deg); } }
.profile-sections { display:grid; gap:18px; }
.profile-section { padding:18px; border:1px solid var(--line); border-radius:10px; background:var(--soft); }
.profile-section h3 { margin:0 0 4px; color:var(--brand-ink); }
.profile-section > div > p { margin:0; color:var(--muted); font-size:.76rem; line-height:1.45; }
.profile-section .button { justify-self:start; }
.auth-signout { margin-top:20px; }
.auth-account-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:20px; }
.auth-account-actions .auth-signout { margin-top:0; }
.admin-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; margin-bottom:16px; }
.admin-search input, .admin-user select { min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--field); color:var(--ink); }
.admin-user-list { display:grid; gap:10px; }
.admin-user { display:grid; grid-template-columns:minmax(180px,1fr) auto 130px 150px; gap:14px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:10px; background:var(--soft); }
.admin-user.disabled { opacity:.7; }
.admin-user-main { display:grid; gap:3px; min-width:0; }
.admin-user-main span, .admin-user-main small { overflow:hidden; color:var(--muted); text-overflow:ellipsis; white-space:nowrap; }
.admin-user-status { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:.72rem; }
.admin-user > label { display:grid; gap:5px; color:var(--muted); font-size:.68rem; font-weight:750; }
.admin-user-actions { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:8px; }
.admin-user-actions .button { padding:7px 10px; font-size:.7rem; }
.status-badge { padding:4px 7px; border-radius:999px; background:#f4e7d6; color:#83531d; font-size:.65rem; font-weight:800; }
.status-badge.success { background:#e3f4e9; color:#176037; }
.admin-shell { min-height:100vh; }
.admin-workspace { width:100%; max-width:none; }
.admin-workspace > .panel { max-width:none; }
.admin-tabs { padding-inline:clamp(16px, 3vw, 42px); }
.team-panel { display:grid; gap:20px; }
.team-owner-card { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--soft); }
.team-owner-card > div { display:grid; gap:4px; }
.team-owner-card small { color:var(--muted); }
.team-owner-actions { display:flex; align-items:center; gap:10px; }
.project-invitations { display:grid; gap:8px; margin:16px 0; padding:14px; border:1px solid var(--brand); border-radius:10px; background:var(--soft); }
.project-invitation-row, .team-member-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.project-invitation-row:last-child, .team-member-row:last-child { border-bottom:0; }
.project-invitation-row small, .team-member-row small { display:block; margin-top:3px; color:var(--muted); }
.team-invite-form { display:grid; grid-template-columns:minmax(220px, 1fr) 150px auto; align-items:end; gap:12px; margin-top:18px; padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--soft); }
.team-invite-form label { display:grid; gap:6px; }
.team-member-list { margin-top:20px; }
.viewer-banner { margin-bottom:14px; padding:10px 14px; border:1px solid var(--brand); border-radius:9px; background:var(--soft); color:var(--brand); font-weight:700; }
.team-coming-soon { display:grid; grid-template-columns:minmax(0, 1fr) auto; gap:12px 16px; align-items:end; max-width:720px; padding:18px; border:1px dashed var(--line); border-radius:10px; }
.team-coming-soon h3, .team-coming-soon p, .team-coming-soon small { grid-column:1 / -1; margin:0; }
.team-coming-soon p, .team-coming-soon small { color:var(--muted); }
.team-coming-soon label { display:grid; gap:6px; }
.team-coming-soon input { padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--field); }
.profile-shell { min-height:100vh; }
.profile-workspace { display:grid; grid-template-columns:minmax(300px, .82fr) minmax(340px, 1fr); gap:20px; align-items:start; width:100%; max-width:1180px; margin:0 auto; }
.profile-card { min-width:0; padding:22px; }
.profile-card .profile-sections { gap:14px; }
.profile-card .profile-section { gap:11px; padding-top:14px; }
.profile-card .auth-form input { padding:9px 11px; }
.team-account-card { display:grid; gap:18px; }
.team-account-card .panel-header { align-items:flex-start; }
.team-empty-state { padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--soft); }
.team-empty-state h3, .team-empty-state p { margin:0; }
.team-empty-state p { margin-top:6px; color:var(--muted); line-height:1.5; }
.team-create-preview { opacity:.72; }
.team-create-preview small { color:var(--muted); }
.account-team-card { display:grid; gap:14px; padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--soft); }
.account-team-card .panel-header h3, .account-team-card .panel-header p, .account-team-card h4 { margin:0; }
.account-team-card .panel-header p, .account-team-card h4 { color:var(--muted); }
.team-management-actions { justify-content:flex-end; }

@media (max-width: 980px) {
  .auth-splash { grid-template-columns:1fr; align-items:start; }
  .auth-intro { display:none; }
  .auth-panel { max-width:620px; max-height:none; margin:28px auto; }
}

@media (max-width: 620px) {
  .team-coming-soon { grid-template-columns:1fr; }
  .team-coming-soon .button { width:100%; }
}

@media (max-width: 560px) {
  .auth-splash { padding:12px; }
  .auth-panel { margin:0; padding:22px 18px; border-radius:14px; }
  .auth-name-grid { grid-template-columns:1fr; }
  .auth-form-row { align-items:flex-start; flex-direction:column; }
  .auth-panel-header { display:grid; gap:14px; }
  .admin-search, .admin-user { grid-template-columns:1fr; }
  .admin-user-actions { grid-column:1; }
  .profile-workspace { grid-template-columns:1fr; max-width:680px; }
}
