/*
  MX Console — Pure-Matrix Trading & Alert Client
  Design system derived from tasteskill 2.5.1 (warm-black-gold fintech palette,
  Host Grotesk + JetBrains Mono, sharp fintech radius scale, 1px oklab hairlines,
  tabular numerals, cubic-bezier(.2,.8,.2,1) motion, zero decorative emoji clutter).
*/

:root,
html[data-theme="dark"] {
  --bg: #0c0a08;
  --surface: #13110e;
  --card: #181512;
  --card-hover: #1d1915;
  --keycap: #211d18;
  --keycap-hover: #29241e;
  --ink: #f4f1ea;
  --text-2: #cfc9be;
  --muted: #8e867b;
  --accent: #c9a45a;
  --accent-ink: #120f0a;
  --buy-dot: #4bc28a;
  --sell-dot: #df6963;
  --warn-dot: #d89b40;
  --line: color-mix(in oklab, var(--ink) 10%, transparent);
  --line-2: color-mix(in oklab, var(--ink) 16%, transparent);
  --line-strong: color-mix(in oklab, var(--ink) 26%, transparent);
  --top-hi: rgba(255, 255, 255, 0.045);
  --shadow-card: inset 0 1px 0 var(--top-hi), 0 1px 2px rgba(0, 0, 0, 0.36);
  --shadow-float: inset 0 1px 0 var(--top-hi), 0 12px 32px -8px rgba(0, 0, 0, 0.62);
}

html[data-theme="light"] {
  --bg: #f4f3ef;
  --surface: #eceae3;
  --card: #ffffff;
  --card-hover: #faf9f6;
  --keycap: #f5f4f0;
  --keycap-hover: #eae8e0;
  --ink: #151310;
  --text-2: #2f2c27;
  --muted: #6d675e;
  --accent: #8f6820;
  --accent-ink: #ffffff;
  --buy-dot: #17824f;
  --sell-dot: #be3933;
  --warn-dot: #a36512;
  --line: color-mix(in oklab, var(--ink) 10%, transparent);
  --line-2: color-mix(in oklab, var(--ink) 16%, transparent);
  --line-strong: color-mix(in oklab, var(--ink) 28%, transparent);
  --top-hi: rgba(255, 255, 255, 0.8);
  --shadow-card: 0 1px 2px rgba(20, 18, 14, 0.05);
  --shadow-float: 0 12px 28px -8px rgba(20, 18, 14, 0.14);
}

:root {
  --font-sans: "Host Grotesk", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-btn: 5px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --m-in: 150ms;
  --m-out: 120ms;
  --m-press: 90ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1, "cv11" 1;
  overflow: hidden;
}

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

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

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

.tnum {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- Auth Gate */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  padding: 32px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark svg {
  width: 14px;
  height: 14px;
}

.brand-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.auth-sub {
  margin: 8px 0 24px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.input {
  height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-btn);
  font-size: 14px;
  transition: border-color 140ms var(--ease);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-err {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--sell-dot) 12%, var(--card));
  border: 1px solid color-mix(in oklab, var(--sell-dot) 32%, transparent);
  color: var(--ink);
  font-size: 13px;
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition:
    transform var(--m-in) var(--ease),
    background-color var(--m-in) var(--ease),
    border-color var(--m-in) var(--ease),
    color var(--m-in) var(--ease);
}

.btn--primary {
  background: var(--ink);
  color: var(--bg);
}

.btn--secondary {
  background: var(--keycap);
  border-color: var(--line-2);
  color: var(--ink);
}

.btn--accent {
  background: color-mix(in oklab, var(--accent) 16%, var(--keycap));
  border-color: color-mix(in oklab, var(--accent) 38%, transparent);
  color: var(--ink);
}

.btn--full {
  width: 100%;
}

@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover {
    transform: translateY(-1px);
  }
  .btn--primary:not(:disabled):hover {
    background: color-mix(in oklab, var(--ink) 88%, var(--accent));
  }
  .btn--secondary:not(:disabled):hover {
    background: var(--keycap-hover);
    border-color: var(--line-strong);
  }
  .btn--accent:not(:disabled):hover {
    background: color-mix(in oklab, var(--accent) 24%, var(--keycap));
  }
}

.btn:not(:disabled):active {
  transform: translateY(1px) scale(0.985);
  transition-duration: var(--m-press);
}

.btn:disabled {
  opacity: 0.48;
  cursor: default;
}

/* ---------------------------------------------------------------- Workspace Layout */
.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 348px;
  background: var(--bg);
}

/* Left Rail */
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 20px;
  overflow-y: auto;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 4px;
}

.rtt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
  flex: none;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.dot--ok {
  background: var(--buy-dot);
}

.dot--accent {
  background: var(--accent);
}

.dot--warn {
  background: var(--warn-dot);
}

.dot--err {
  background: var(--sell-dot);
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-label {
  padding: 0 8px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}

.nav-item:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--card);
  border-color: var(--line-2);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

.nav-item__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--accent) 22%, var(--card));
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
}

.gw-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.gw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
}

.gw-row span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-family: var(--font-mono);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rail-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tool-btn {
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.tool-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

/* ---------------------------------------------------------------- Center Stream(s) */
.stage-col {
  min-width: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.streams-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.streams-wrap.is-split {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}

.stream-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.stream-pane:last-child {
  border-right: 0;
}

.pane-head {
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  background: var(--bg);
}

.pane-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.pane-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.pane-title span {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.filter-bar {
  display: flex;
  gap: 4px;
}

.chip-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
  cursor: pointer;
}

.chip-btn:hover {
  color: var(--ink);
}

.chip-btn.is-active {
  background: var(--card);
  border-color: var(--line-2);
  color: var(--ink);
}

.timeline {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  max-width: 280px;
}

/* ---------------------------------------------------------------- Message Card & Telegram Inline Keyboard */
.msg-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-card--accent {
  border-color: color-mix(in oklab, var(--accent) 32%, var(--line));
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.msg-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--ink) 5%, var(--card));
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.tag--chain {
  color: var(--ink);
  border-color: var(--line-2);
}

.tag--ok {
  color: var(--buy-dot);
  border-color: color-mix(in oklab, var(--buy-dot) 30%, transparent);
}

.tag--warn {
  color: var(--warn-dot);
  border-color: color-mix(in oklab, var(--warn-dot) 30%, transparent);
}

.msg-token-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  flex: none;
}

/* Copyable Contract Bar */
.ca-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--line);
}

.ca-bar__addr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 7px;
  border-radius: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex: none;
}

.copy-btn:hover {
  color: var(--ink);
  background: color-mix(in oklab, var(--ink) 6%, transparent);
}

.copy-btn.is-copied {
  color: var(--buy-dot);
}

/* Structured Rows (2 levels max, never nested cards) */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.spec-cell {
  padding: 8px 10px 8px 0;
  border-right: 1px solid var(--line);
}

.spec-cell:nth-child(3n) {
  border-right: 0;
}

.spec-cell:nth-child(3n + 2),
.spec-cell:nth-child(3n + 3) {
  padding-left: 10px;
}

.spec-cell:nth-child(n + 4) {
  border-top: 1px solid var(--line);
}

.spec-k {
  font-size: 12px;
  color: var(--muted);
}

.spec-v {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-kv-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.alert-kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.alert-kv-row span:first-child {
  color: var(--muted);
  flex: none;
}

.alert-kv-row span:last-child {
  color: var(--text-2);
  text-align: right;
  word-break: break-all;
}

.tw-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tw-item {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.tw-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tw-item__handle {
  font-weight: 600;
  color: var(--ink);
}

.tw-item__handle:hover {
  text-decoration: underline;
}

.tw-item__stats {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.tw-item__mutual {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tw-item.is-expanded .tw-item__mutual {
  -webkit-line-clamp: unset;
}

.msg-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
  word-break: break-word;
}

.msg-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.msg-body a:hover {
  border-bottom-color: var(--accent);
}

.msg-body code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
}

.raw-toggle {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.raw-toggle:hover {
  color: var(--ink);
  border-bottom-color: var(--line-strong);
}

/* Telegram-Style Inline Keyboard Grid */
.ikb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.ikb-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 6px;
}

.ikb-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 35px;
  padding: 0 7px;
  border-radius: var(--r-btn);
  background: var(--keycap);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 var(--top-hi);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  transition:
    transform var(--m-in) var(--ease),
    background-color var(--m-in) var(--ease),
    border-color var(--m-in) var(--ease);
}

.streams-wrap.is-split .ikb-btn {
  font-size: 11.5px;
  padding: 0 4px;
  gap: 3.5px;
}

.ikb-btn--primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.ikb-btn--accent {
  background: color-mix(in oklab, var(--accent) 14%, var(--keycap));
  border-color: color-mix(in oklab, var(--accent) 36%, transparent);
}

.ikb-btn--buy::before,
.ikb-btn--sell::before,
.ikb-btn--danger::before,
.ikb-btn--warn::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.ikb-btn--buy::before {
  background: var(--buy-dot);
}

.ikb-btn--sell::before {
  background: color-mix(in oklab, var(--sell-dot) 72%, var(--ink));
}

.ikb-btn--danger::before {
  background: var(--sell-dot);
}

.ikb-btn--warn::before {
  background: var(--warn-dot);
}

.ikb-btn--link {
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .ikb-btn:not(:disabled):hover {
    transform: translateY(-1px);
    background: var(--keycap-hover);
    border-color: var(--line-strong);
  }
  .ikb-btn--primary:not(:disabled):hover {
    background: color-mix(in oklab, var(--ink) 88%, var(--accent));
    border-color: color-mix(in oklab, var(--ink) 88%, var(--accent));
  }
  .ikb-btn--accent:not(:disabled):hover {
    background: color-mix(in oklab, var(--accent) 22%, var(--keycap));
    border-color: var(--accent);
  }
}

.ikb-btn:not(:disabled):active {
  transform: translateY(1px) scale(0.985);
  transition-duration: var(--m-press);
}

.ikb-btn:disabled {
  opacity: 0.52;
  cursor: default;
}

.ikb-btn.is-loading::before {
  display: none;
}

.ikb-btn.is-done {
  border-color: color-mix(in oklab, var(--buy-dot) 50%, var(--line-2));
}

.spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.6px solid color-mix(in oklab, currentColor 28%, transparent);
  border-top-color: currentColor;
  animation: spin 720ms linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Inline Custom Prompt Drawer inside card */
.ikb-prompt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
}

.ikb-prompt .input {
  flex: 1;
  min-width: 0;
  height: 36px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* Composer */
.composer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  background: var(--bg);
  flex: none;
}

.composer .input {
  flex: 1;
  height: 38px;
  background: var(--card);
}

/* ---------------------------------------------------------------- Right Execution Inspector */
.inspector {
  background: var(--surface);
  border-left: 1px solid var(--line);
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.insp-sec {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.insp-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.ca-lookup-row {
  display: flex;
  gap: 6px;
}

.ca-lookup-row select {
  width: 88px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line-2);
  background: var(--card);
  font-size: 12px;
}

.ca-lookup-row .input {
  flex: 1;
  min-width: 0;
  height: 36px;
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 12px;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.switch-label input {
  accent-color: var(--accent);
}

.ticket-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ticket-title-row b {
  font-size: 15px;
  font-weight: 600;
}

.chain-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.chain-tab {
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.chain-tab.is-active {
  border-color: var(--accent);
  color: var(--ink);
  background: color-mix(in oklab, var(--accent) 14%, var(--card));
}

.wallet-rows,
.fill-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.wallet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.wallet-row__meta {
  min-width: 0;
}

.wallet-row__name {
  font-weight: 500;
  color: var(--ink);
}

.wallet-row__addr {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.param-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  align-items: end;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-field span {
  font-size: 11.5px;
  color: var(--muted);
}

.param-field .input {
  height: 34px;
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.fill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.fill-row__left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.fill-row__ca {
  font-family: var(--font-mono);
  color: var(--muted);
}

/* Toast Status Pill */
.toast-bar {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: 380px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

/* Mobile Tab Bar (hidden on desktop) */
.mobile-top,
.mobile-bar {
  display: none;
}

/* ---------------------------------------------------------------- Responsive Breakpoints */
@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 196px minmax(0, 1fr) 320px;
  }
  .streams-wrap.is-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
  }
  .rail {
    display: none;
  }
  .mobile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex: none;
  }
  .stage-col {
    flex: 1;
    min-height: 0;
    height: auto;
  }
  .pane-head {
    height: 44px;
    padding: 0 14px;
  }
  .timeline {
    padding: 12px 14px;
  }
  .composer {
    padding: 10px 14px;
  }
  .inspector {
    flex: 1;
    min-height: 0;
    height: auto;
    border-left: 0;
  }
  .mobile-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    flex: none;
  }
  .mob-tab {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
  }
  .mob-tab.is-active {
    color: var(--ink);
    box-shadow: inset 0 2px 0 var(--accent);
  }
  .ikb-btn {
    height: 40px;
    font-size: 12.5px;
    padding: 0 6px;
    gap: 4px;
  }
  .ikb-row[style*="--cols: 4"],
  .ikb-row[style*="--cols:4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .input,
  .ca-lookup-row select,
  .ca-lookup-row .input,
  .param-field .input,
  .ikb-prompt .input {
    font-size: 16px;
  }
  .toast-bar {
    left: 14px;
    right: 14px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    max-width: none;
  }
}

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