@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-500.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-600.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --canvas: #e8ecea;
  --surface: #f8faf8;
  --surface-strong: #ffffff;
  --ink: #122522;
  --ink-soft: #243935;
  --muted: #5d6d69;
  --line: #c5cfcc;
  --line-strong: #9eaeaa;
  --route: #087a72;
  --route-soft: #d9ece8;
  --signal: #d44c35;
  --signal-soft: #f4ddd7;
  --amber: #9b6800;
  --amber-soft: #f3e8c8;
  --shadow: 0 18px 50px rgba(18, 37, 34, 0.09);
  --radius: 6px;
  --font-sans: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(18, 37, 34, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 37, 34, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

svg {
  display: block;
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

:focus-visible {
  outline: 3px solid rgba(8, 122, 114, 0.3);
  outline-offset: 2px;
}

/* Authentication */

.auth-shell {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
  background: var(--surface);
}

.auth-signal {
  position: relative;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 4vw, 64px);
  background:
    linear-gradient(rgba(248, 250, 248, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 250, 248, 0.07) 1px, transparent 1px),
    var(--ink);
  background-size: 54px 54px;
  color: var(--surface);
}

.auth-signal::after {
  position: absolute;
  right: -110px;
  bottom: -110px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(248, 250, 248, 0.15);
  border-radius: 50%;
  box-shadow:
    0 0 0 54px rgba(248, 250, 248, 0.025),
    0 0 0 108px rgba(248, 250, 248, 0.018);
  content: "";
}

.auth-brand,
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: var(--route);
}

.auth-signal .brand-mark {
  color: #70d8cd;
}

.auth-signal-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding: 8vh 0 6vh;
}

.auth-signal-copy .lede {
  max-width: 34ch;
  margin: 0 0 26px;
  color: #a9bfba;
  font-size: 16px;
}

.auth-signal-copy h1 {
  margin: 0;
  color: #eaf2ef;
  font-size: clamp(46px, 6.2vw, 104px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.88;
}

.auth-signal-copy h1 span {
  color: #70d8cd;
}

.signal-board {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: 720px;
  grid-template-columns: minmax(120px, 1fr) 1.4fr minmax(120px, 1fr);
  align-items: center;
  border-top: 1px solid rgba(248, 250, 248, 0.28);
  border-bottom: 1px solid rgba(248, 250, 248, 0.28);
}

.signal-node {
  padding: 20px 0;
}

.signal-node-end {
  text-align: right;
}

.signal-label {
  display: block;
  margin-bottom: 2px;
  color: #829a95;
  font-size: 12px;
}

.signal-node strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.signal-path {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 78px;
}

.signal-path span {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: #70d8cd;
  transform-origin: left;
  animation: draw-route 900ms cubic-bezier(0.65, 0, 0.35, 1) both;
}

.signal-path span::before,
.signal-path span::after {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #70d8cd;
  content: "";
  transform: translateY(-50%);
}

.signal-path span::before {
  left: -4px;
}

.signal-path span::after {
  right: -4px;
}

.signal-path b {
  position: relative;
  z-index: 1;
  padding: 4px 10px;
  background: var(--ink);
  color: #b9cbc7;
  font-size: 11px;
  font-weight: 400;
}

.auth-form-side {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(28px, 6vw, 88px);
}

.auth-form {
  display: grid;
  width: min(100%, 440px);
  gap: 26px;
}

.auth-mobile-mark {
  display: none;
  color: var(--route);
}

.auth-form h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.auth-form p {
  max-width: 44ch;
  margin: 0;
  color: var(--muted);
}

.auth-form code {
  color: var(--ink);
  font-size: 0.9em;
}

/* Shared controls */

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 13px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--route);
  background: var(--route);
  color: #fff;
}

.button-primary:hover {
  border-color: #05675f;
  background: #05675f;
}

.button-quiet {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button-quiet:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.button-danger {
  border-color: var(--signal);
  background: var(--signal);
  color: #fff;
}

.button-danger:hover {
  border-color: #b93d29;
  background: #b93d29;
}

.button-danger-quiet {
  border-color: rgba(212, 76, 53, 0.4);
  color: var(--signal);
}

.button-danger-quiet:hover {
  background: var(--signal-soft);
}

.button-large {
  min-height: 48px;
  justify-content: space-between;
  padding-inline: 16px;
}

.button-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover {
  background: #fff;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-strong);
  color: var(--ink);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #899793;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--route);
  box-shadow: 0 0 0 3px rgba(8, 122, 114, 0.12);
  outline: none;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field > label,
.field-label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.field-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.field-error {
  margin: 0;
  color: var(--signal);
  font-size: 12px;
}

.form-error {
  min-height: 22px;
  color: var(--signal) !important;
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
}

.checkbox-field input {
  width: 17px;
  min-height: 17px;
  margin: 3px 0 0;
  accent-color: var(--route);
}

.checkbox-field span {
  display: grid;
  gap: 2px;
}

.checkbox-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.segmented {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 2px;
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 2px;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

/* Application shell */

.app-shell {
  display: grid;
  min-height: 100svh;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100svh;
  flex-direction: column;
  border-right: 1px solid rgba(248, 250, 248, 0.1);
  padding: 24px 16px 18px;
  background: var(--ink);
  color: #edf3f1;
}

.app-brand {
  min-height: 48px;
  padding: 0 8px;
}

.app-brand .brand-mark {
  width: 34px;
  height: 34px;
  color: #70d8cd;
}

.app-brand > span:last-child {
  display: grid;
  line-height: 1.2;
}

.app-brand small {
  margin-top: 3px;
  color: #8fa39f;
  font-size: 11px;
  font-weight: 400;
}

.primary-nav {
  display: grid;
  gap: 4px;
  margin-top: 44px;
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 3px;
  padding: 0 12px;
  background: transparent;
  color: #9eb1ad;
  cursor: pointer;
  text-align: left;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.nav-item::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -16px;
  width: 3px;
  background: #70d8cd;
  content: "";
  transform: scaleY(0);
  transition: transform 150ms ease;
}

.nav-item:hover {
  background: rgba(248, 250, 248, 0.055);
  color: #fff;
}

.nav-item.active {
  background: rgba(112, 216, 205, 0.12);
  color: #fff;
}

.nav-item.active::before {
  transform: scaleY(1);
}

.sidebar-foot {
  display: grid;
  gap: 14px;
  margin-top: auto;
  border-top: 1px solid rgba(248, 250, 248, 0.12);
  padding: 18px 8px 0;
}

.system-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8fa39f;
  font-size: 12px;
}

.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #70d8cd;
  box-shadow: 0 0 0 4px rgba(112, 216, 205, 0.1);
}

.sidebar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: #9eb1ad;
  cursor: pointer;
  font-size: 13px;
}

.sidebar-action:hover {
  color: #fff;
}

.workspace {
  min-width: 0;
}

.workspace-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 18px clamp(20px, 3vw, 42px);
  background: rgba(232, 236, 234, 0.92);
  backdrop-filter: blur(12px);
}

.workspace-title {
  min-width: 0;
}

.workspace-title h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.workspace-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.view-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.view-root {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 42px);
}

.view-enter {
  animation: view-enter 240ms ease-out both;
}

.view-loading {
  display: grid;
  gap: 12px;
  padding: 24px 0;
}

.view-loading span {
  display: block;
  height: 22px;
  background: rgba(18, 37, 34, 0.075);
  animation: loading-pulse 1.3s ease-in-out infinite alternate;
}

.view-loading span:nth-child(2) {
  width: 72%;
}

.view-loading span:nth-child(3) {
  width: 44%;
}

/* Shared content */

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-heading .section-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.surface {
  border: 1px solid var(--line);
  background: rgba(248, 250, 248, 0.9);
}

.protocol-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 7px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.status-pill::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-ok {
  background: var(--route-soft);
  color: #05675f;
}

.status-error {
  background: var(--signal-soft);
  color: #ae3421;
}

.status-neutral {
  background: #e4e9e7;
  color: var(--muted);
}

.status-warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: rgba(18, 37, 34, 0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.data-table td {
  font-size: 13px;
}

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

.data-table tbody tr:hover {
  background: rgba(8, 122, 114, 0.035);
}

.numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.table-empty {
  border: 1px dashed var(--line);
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px dashed var(--line-strong);
  padding: 30px;
  background: rgba(248, 250, 248, 0.55);
}

.empty-state-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--route);
}

.empty-state h3 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 500;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.error-state {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid rgba(212, 76, 53, 0.35);
  padding: 24px;
  background: var(--signal-soft);
  color: #7c2517;
}

.error-state svg {
  width: 24px;
  height: 24px;
}

.error-state h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 500;
}

.error-state p {
  margin: 0;
}

/* Overview */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
  border: 1px solid var(--line);
  background: var(--surface);
}

.signal-summary {
  min-width: 0;
  padding: clamp(24px, 3vw, 42px);
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.request-total {
  margin: 10px 0 2px;
  font-family: var(--font-mono);
  font-size: clamp(50px, 8vw, 96px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
}

.request-context {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.health-ratio {
  margin-top: 42px;
}

.ratio-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.ratio-head strong {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 500;
}

.ratio-track {
  display: flex;
  height: 10px;
  overflow: hidden;
  background: var(--signal-soft);
}

.ratio-ok {
  background: var(--route);
}

.ratio-error {
  background: var(--signal);
}

.ratio-legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ratio-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  background: var(--route);
}

.legend-dot.error {
  background: var(--signal);
}

.health-ledger {
  display: grid;
  grid-template-columns: 1fr;
  border-left: 1px solid var(--line);
}

.health-row {
  display: grid;
  align-content: center;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
  padding: 20px 24px;
}

.health-row:last-child {
  border-bottom: 0;
}

.health-row .metric-label {
  margin-bottom: 5px;
}

.health-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.route-board {
  margin-top: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.route-board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 17px 20px;
}

.route-board-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.route-rows {
  padding: 7px 20px;
}

.route-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.85fr) minmax(120px, 2fr) minmax(110px, 0.85fr) 80px;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
}

.route-row:last-child {
  border-bottom: 0;
}

.route-track {
  position: relative;
  height: 1px;
  background: var(--line-strong);
}

.route-track::before,
.route-track::after {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--route);
  content: "";
  transform: translateY(-50%);
}

.route-track::before {
  left: -4px;
}

.route-track::after {
  right: -4px;
}

.route-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
}

.operation-ledger {
  display: grid;
  margin-top: 28px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.ledger-column {
  min-width: 0;
  padding: 22px 22px 12px;
}

.ledger-column + .ledger-column {
  border-left: 1px solid var(--line);
}

.ledger-column h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 500;
}

.ledger-list {
  display: grid;
}

.ledger-item {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.ledger-item:first-child {
  border-top: 0;
}

.ledger-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-item-value {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.error-list {
  display: grid;
}

.error-item {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.error-item:first-child {
  border-top: 0;
}

.error-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.error-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #7c2517;
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ledger-empty {
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

/* Channels */

.channel-layout {
  display: grid;
  min-height: 680px;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
}

.channel-list-pane {
  border-right: 1px solid var(--line);
}

.channel-list-head {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.channel-list-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.channel-list {
  display: grid;
}

.channel-list-item {
  position: relative;
  display: grid;
  width: 100%;
  gap: 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px 16px 21px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.channel-list-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--route);
  content: "";
  transform: scaleY(0);
}

.channel-list-item:hover {
  background: rgba(8, 122, 114, 0.035);
}

.channel-list-item.active {
  background: var(--route-soft);
}

.channel-list-item.active::before {
  transform: scaleY(1);
}

.channel-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.channel-item-head strong {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-item-route {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.channel-item-route i {
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.channel-item-address {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-editor {
  min-width: 0;
}

.editor-head {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
}

.editor-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
}

.editor-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.form-section {
  display: grid;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 24px;
}

.form-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.form-section-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.form-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.span-full {
  grid-column: 1 / -1;
}

.route-preview {
  display: grid;
  grid-template-columns: auto minmax(30px, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: #f2f6f4;
}

.route-preview-route {
  display: flex;
  align-items: center;
  min-width: 50px;
}

.route-preview-route::before,
.route-preview-route::after {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--route);
  content: "";
}

.route-preview-route span {
  width: 100%;
  height: 1px;
  background: var(--route);
}

.editor-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line-strong);
  padding: 14px 24px;
  background: rgba(248, 250, 248, 0.96);
  backdrop-filter: blur(10px);
}

.editor-actions-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.editor-message.error {
  color: var(--signal);
}

.test-panel {
  display: grid;
  gap: 16px;
  background: rgba(18, 37, 34, 0.025);
}

.test-result {
  min-height: 56px;
  max-height: 330px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  padding: 14px;
  background: var(--ink);
  color: #c7d9d5;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Logs */

.filter-bar {
  display: grid;
  grid-template-columns: minmax(160px, 1.6fr) repeat(2, minmax(130px, 0.8fr)) auto;
  align-items: end;
  gap: 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 16px;
  background: rgba(248, 250, 248, 0.9);
}

.logs-surface {
  border: 1px solid var(--line);
  background: var(--surface);
}

.log-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.log-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.log-detail-row td {
  padding: 0;
  background: #eef2f0;
}

.log-detail {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 18px 20px;
}

.log-detail dt {
  color: var(--muted);
  font-size: 12px;
}

.log-detail dd {
  min-width: 0;
  margin: 0;
}

.log-detail pre {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  border-left: 2px solid var(--line-strong);
  padding-left: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.row-toggle {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  cursor: pointer;
}

.row-toggle svg {
  transition: transform 150ms ease;
}

.row-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Settings */

.settings-layout,
.diagnostics-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.settings-section {
  min-width: 0;
}

.settings-surface {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.settings-surface + .settings-surface {
  margin-top: 16px;
}

.settings-fields {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.transfer-actions {
  display: flex;
  gap: 9px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.inline-notice {
  border-left: 3px solid var(--amber);
  margin: 16px 0 0;
  padding: 10px 12px;
  background: var(--amber-soft);
  color: #6f4a00;
  font-size: 13px;
}

.save-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--route);
  font-size: 13px;
}

.save-message.error {
  color: var(--signal);
}

/* Diagnostics */

.diagnostic-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.diagnostic-stat {
  min-width: 0;
  padding: 20px;
}

.diagnostic-stat + .diagnostic-stat {
  border-left: 1px solid var(--line);
}

.diagnostic-stat strong {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 27px;
  font-weight: 500;
}

.diagnostic-grid {
  display: grid;
  margin-top: 28px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.diagnostic-list {
  display: grid;
  margin: 0;
}

.diagnostic-list div {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.diagnostic-list div:first-child {
  border-top: 0;
}

.diagnostic-list dt {
  color: var(--muted);
}

.diagnostic-list dd {
  min-width: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.code-panel {
  max-height: 500px;
  overflow: auto;
  margin: 0;
  border-left: 2px solid var(--ink);
  padding: 16px;
  background: rgba(248, 250, 248, 0.55);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.usage-panel {
  margin-top: 28px;
}

.usage-panel details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.usage-panel summary {
  padding: 14px 0;
  cursor: pointer;
  font-weight: 500;
}

/* Dialog + toast */

.confirm-dialog {
  width: min(92vw, 460px);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(18, 37, 34, 0.55);
  backdrop-filter: blur(3px);
}

.confirm-dialog form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
}

.dialog-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--signal-soft);
  color: var(--signal);
}

.confirm-dialog h2 {
  margin: 0 0 5px;
  font-size: 18px;
  font-weight: 500;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100vw - 44px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out both;
}

.toast-error {
  background: #7c2517;
}

.toast-leave {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

/* Motion */

@keyframes draw-route {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-pulse {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 0.95;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */

@media (max-width: 1180px) {
  .overview-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.75fr);
  }

  .operation-ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-column:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-signal {
    display: none;
  }

  .auth-form-side {
    position: relative;
  }

  .auth-form-side::before {
    position: absolute;
    inset: 0 0 auto;
    height: 45%;
    background:
      linear-gradient(rgba(18, 37, 34, 0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(18, 37, 34, 0.04) 1px, transparent 1px);
    background-size: 36px 36px;
    content: "";
    pointer-events: none;
  }

  .auth-mobile-mark {
    display: inline-grid;
  }

  .app-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    padding-inline: 10px;
  }

  .app-brand {
    padding: 0;
  }

  .app-brand > span:last-child,
  .nav-item span,
  .sidebar-foot span {
    display: none;
  }

  .primary-nav {
    width: 100%;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item::before {
    left: -10px;
  }

  .sidebar-foot {
    justify-items: center;
    padding-inline: 0;
  }

  .system-state {
    width: 38px;
    justify-content: center;
  }

  .channel-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .settings-layout,
  .diagnostics-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: block;
    width: auto;
    height: 68px;
    overflow-x: auto;
    border-top: 1px solid rgba(248, 250, 248, 0.12);
    border-right: 0;
    padding: 7px 10px;
  }

  .app-brand,
  .sidebar-foot {
    display: none;
  }

  .primary-nav {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    margin: 0;
  }

  .nav-item {
    display: grid;
    min-height: 52px;
    place-items: center;
    gap: 2px;
    padding: 4px;
    font-size: 11px;
  }

  .nav-item span {
    display: inline;
  }

  .nav-item::before {
    top: auto;
    right: 14px;
    bottom: -7px;
    left: 14px;
    width: auto;
    height: 3px;
    transform: scaleX(0);
  }

  .nav-item.active::before {
    transform: scaleX(1);
  }

  .workspace {
    padding-bottom: 68px;
  }

  .workspace-bar {
    position: static;
    min-height: 0;
    align-items: flex-start;
    padding: 18px 16px 14px;
  }

  .workspace-title h1 {
    font-size: 22px;
  }

  .workspace-title p {
    display: none;
  }

  .view-root {
    padding: 16px;
  }

  .view-actions {
    gap: 6px;
  }

  .button span.button-label-desktop {
    display: none;
  }

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

  .signal-summary {
    padding: 24px 20px;
  }

  .request-total {
    font-size: clamp(52px, 18vw, 78px);
  }

  .health-ledger {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .health-row {
    min-height: 94px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: 15px 12px;
  }

  .health-row:last-child {
    border-right: 0;
  }

  .health-value {
    font-size: 17px;
  }

  .route-board-head {
    padding: 15px;
  }

  .route-rows {
    padding: 6px 15px;
  }

  .route-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 15px 0;
  }

  .route-track {
    width: 80px;
    margin-left: 4px;
  }

  .route-count {
    text-align: left;
  }

  .operation-ledger {
    grid-template-columns: 1fr;
  }

  .ledger-column,
  .ledger-column:nth-child(3) {
    grid-column: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 18px 16px 10px;
  }

  .channel-layout {
    display: block;
  }

  .channel-list-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .channel-list {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .channel-list-item {
    width: 230px;
    flex: none;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    scroll-snap-align: start;
  }

  .channel-list-item::before {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 3px;
    transform: scaleX(0);
  }

  .channel-list-item.active::before {
    transform: scaleX(1);
  }

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

  .form-section,
  .editor-head {
    padding-inline: 16px;
  }

  .editor-head {
    align-items: flex-start;
  }

  .editor-actions {
    align-items: flex-start;
    padding-inline: 16px;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    border-bottom: 0;
    padding: 6px 14px;
  }

  .data-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
  }

  .log-detail-row {
    padding: 0;
  }

  .log-detail-row td {
    display: block;
    padding: 0;
  }

  .log-detail-row td::before {
    display: none;
  }

  .log-detail {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .diagnostic-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diagnostic-stat:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .diagnostic-stat:nth-child(4) {
    border-top: 1px solid var(--line);
  }

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

  .empty-state {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .auth-form-side {
    padding: 24px;
  }

  .workspace-bar {
    display: grid;
  }

  .view-actions {
    justify-content: flex-start;
  }

  .health-ledger {
    grid-template-columns: 1fr;
  }

  .health-row {
    min-height: 76px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .health-row:last-child {
    border-bottom: 0;
  }

  .editor-actions {
    flex-direction: column;
  }

  .editor-actions-group {
    width: 100%;
  }

  .editor-actions-group .button {
    flex: 1;
  }

  .diagnostic-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
