:root {
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-xl: 0 28px 80px rgba(7, 15, 26, 0.18);
  --shadow-md: 0 12px 34px rgba(7, 15, 26, 0.12);
  --font-ui: "Manrope", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

body[data-theme="dark"] {
  --bg: #07121e;
  --bg-soft: #0d1a29;
  --panel: rgba(12, 26, 40, 0.88);
  --panel-strong: rgba(9, 20, 31, 0.94);
  --panel-soft: rgba(18, 33, 47, 0.82);
  --card-bg: rgba(17, 33, 49, 0.82);
  --card-bg-soft: rgba(17, 33, 49, 0.72);
  --field-bg: rgba(14, 26, 39, 0.92);
  --field-bg-soft: rgba(18, 33, 47, 0.92);
  --ghost-bg: rgba(24, 41, 58, 0.9);
  --accordion-bg: rgba(17, 33, 49, 0.74);
  --border: rgba(144, 197, 255, 0.12);
  --ink: #f2f7ff;
  --muted: #9ab1cb;
  --accent: #14c6b7;
  --accent-2: #2d7cff;
  --accent-soft: rgba(20, 198, 183, 0.12);
  --warning: #ffb35c;
  --danger: #ff7a7a;
  --log-bg: rgba(5, 12, 20, 0.96);
}

body[data-theme="medium"] {
  --bg: #13202d;
  --bg-soft: #1a2a39;
  --panel: rgba(20, 35, 49, 0.84);
  --panel-strong: rgba(26, 43, 59, 0.94);
  --panel-soft: rgba(34, 53, 70, 0.8);
  --card-bg: rgba(38, 58, 76, 0.8);
  --card-bg-soft: rgba(38, 58, 76, 0.72);
  --field-bg: rgba(24, 41, 57, 0.94);
  --field-bg-soft: rgba(34, 53, 70, 0.9);
  --ghost-bg: rgba(54, 75, 95, 0.84);
  --accordion-bg: rgba(40, 60, 78, 0.78);
  --border: rgba(144, 197, 255, 0.14);
  --ink: #eef5ff;
  --muted: #afc1d7;
  --accent: #0aa6a0;
  --accent-2: #2467f4;
  --accent-soft: rgba(10, 166, 160, 0.1);
  --warning: #cc7a1d;
  --danger: #cf455d;
  --log-bg: rgba(8, 17, 27, 0.95);
}

body[data-theme="light"] {
  --bg: #e7edf3;
  --bg-soft: #dde6ef;
  --panel: rgba(235, 242, 248, 0.96);
  --panel-strong: rgba(228, 237, 245, 0.98);
  --panel-soft: rgba(222, 233, 243, 0.92);
  --card-bg: rgba(232, 240, 246, 0.88);
  --card-bg-soft: rgba(225, 235, 243, 0.92);
  --field-bg: rgba(236, 243, 248, 0.96);
  --field-bg-soft: rgba(226, 235, 244, 0.96);
  --ghost-bg: rgba(214, 226, 238, 0.96);
  --accordion-bg: rgba(231, 239, 246, 0.96);
  --border: rgba(43, 78, 111, 0.16);
  --ink: #112538;
  --muted: #42586f;
  --accent: #0a9b92;
  --accent-2: #2c62ee;
  --accent-soft: rgba(10, 155, 146, 0.1);
  --warning: #cc7a1d;
  --danger: #cb405b;
  --log-bg: rgba(10, 18, 28, 0.96);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 310px;
  background:
    radial-gradient(circle at top left, rgba(45, 124, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(20, 198, 183, 0.13), transparent 24%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  color: var(--ink);
  font-family: var(--font-ui);
}

body[data-page="dashboard"] .device-wifi-fields,
body[data-page="dashboard"] #saveConnectivityButton {
  display: none;
}

body[data-log-dock="collapsed"] {
  padding-bottom: 108px;
}

.backdrop {
  position: fixed;
  inset: auto;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.55;
  z-index: 0;
  animation: ambientFloat 18s ease-in-out infinite;
}

.backdrop--left {
  left: -120px;
  top: -80px;
  width: 360px;
  height: 360px;
  background: rgba(36, 103, 244, 0.25);
}

.backdrop--right {
  right: -120px;
  bottom: -120px;
  width: 420px;
  height: 420px;
  background: rgba(10, 166, 160, 0.2);
  animation-delay: -9s;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1540px, calc(100vw - 28px));
  margin: 18px auto 24px;
}

.hero,
.surface,
.log-dock {
  backdrop-filter: blur(18px);
}

.hero,
.surface {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}

body[data-theme="dark"] .hero,
body[data-theme="dark"] .surface {
  box-shadow:
    0 28px 90px rgba(1, 8, 18, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.hero {
  --hero-stream-height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.82fr) minmax(320px, 460px);
  align-items: stretch;
  gap: 22px;
  border-radius: 32px;
  padding: 24px;
  margin-bottom: 18px;
}

.hero--compact {
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
}

.hero__copy h1,
.section-head h2,
.section-head h3,
.panel h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero__copy h1 {
  max-width: 11ch;
  font-size: clamp(2.35rem, 3.8vw, 4.8rem);
  line-height: 0.95;
}

.lead {
  margin: 16px 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.62;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__chips,
.button-row,
.toolbar,
.stats,
.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-stack {
  display: grid;
  gap: 8px;
}

.status-row,
.section-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-chip,
.badge,
.profile-chip,
.token-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.83rem;
  font-weight: 700;
  border: 1px solid transparent;
  gap: 8px;
}

.badge::before,
.route-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(154, 177, 203, 0.95);
  box-shadow: 0 0 0 4px rgba(154, 177, 203, 0.12);
}

.badge--ok,
.badge--connected {
  background: rgba(10, 155, 146, 0.16);
  border-color: rgba(10, 155, 146, 0.26);
}

.badge--ok::before,
.badge--connected::before {
  background: rgba(20, 198, 183, 0.95);
  box-shadow: 0 0 0 4px rgba(20, 198, 183, 0.14);
}

.badge--warn {
  background: rgba(204, 122, 29, 0.16);
  border-color: rgba(204, 122, 29, 0.22);
}

.badge--warn::before {
  background: rgba(255, 179, 92, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 179, 92, 0.15);
}

.badge--danger {
  background: rgba(203, 64, 91, 0.16);
  border-color: rgba(203, 64, 91, 0.22);
}

.badge--danger::before {
  background: rgba(255, 122, 122, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 122, 122, 0.15);
}

.badge--idle {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.field--toggle {
  align-content: center;
}

.field--toggle input {
  width: 20px;
  height: 20px;
  justify-self: start;
}

.section-tags {
  align-self: center;
}

.route-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.route-badge--usb::before {
  background: rgba(45, 124, 255, 0.96);
  box-shadow: 0 0 0 4px rgba(45, 124, 255, 0.12);
}

.route-badge--lora::before {
  background: rgba(20, 198, 183, 0.96);
  box-shadow: 0 0 0 4px rgba(20, 198, 183, 0.12);
}

.route-badge--indexer::before {
  background: rgba(255, 179, 92, 0.96);
  box-shadow: 0 0 0 4px rgba(255, 179, 92, 0.12);
}

.hero__controls {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 0;
  padding: 18px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel-soft));
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

body[data-page="setup"] .hero__copy h1 {
  max-width: 7.8ch;
}

body[data-page="setup"] .hero__controls {
  gap: 18px;
}

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

.setup-card {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 100%;
}

.setup-readout {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--field-bg-soft), var(--field-bg));
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

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

.hero__mint-stream {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  min-height: 0;
  height: var(--hero-stream-height);
  max-height: var(--hero-stream-height);
  align-self: start;
  overflow: hidden;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(20, 198, 183, 0.09), transparent 42%),
    linear-gradient(180deg, var(--panel-strong), var(--panel-soft));
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

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

.surface {
  grid-column: span 6;
  border-radius: var(--radius-xl);
  padding: 20px;
}

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

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

.section-head--compact {
  margin-bottom: 12px;
}

.surface[data-panel] > .section-head > div:first-child h2,
.surface[data-panel] > .section-head > div:first-child h3 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.surface[data-panel] > .section-head > div:first-child h2::before,
.surface[data-panel] > .section-head > div:first-child h3::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(36, 103, 244, 0.16), rgba(20, 198, 183, 0.16));
  border: 1px solid rgba(127, 172, 227, 0.18);
  color: var(--accent-2);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.surface[data-panel="overview"] > .section-head > div:first-child h2::before {
  content: "HQ";
}

.surface[data-panel="device"] > .section-head > div:first-child h2::before {
  content: "ID";
}

.surface[data-panel="radio"] > .section-head > div:first-child h2::before {
  content: "RF";
}

.surface[data-panel="portfolio"] > .section-head > div:first-child h2::before {
  content: "BAL";
}

.surface[data-panel="tokens"] > .section-head > div:first-child h2::before {
  content: "TOK";
}

.surface[data-panel="operations"] > .section-head > div:first-child h2::before {
  content: "TX";
}

.surface[data-panel="profiles"] > .section-head > div:first-child h2::before {
  content: "LOOP";
}

.surface[data-panel="onboarding"] > .section-head > div:first-child h2::before {
  content: "GO";
}

.surface[data-panel="education"] > .section-head > div:first-child h2::before {
  content: "EDU";
}

.surface[data-panel="advanced"] > .section-head > div:first-child h2::before {
  content: "CFG";
}

.overview-grid,
.operations-grid,
.profile-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-strong), var(--panel-soft));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.panel--soft {
  background: linear-gradient(180deg, var(--card-bg), var(--panel-soft));
}

.panel--strong {
  background: linear-gradient(180deg, rgba(36, 103, 244, 0.08), rgba(10, 166, 160, 0.05));
}

.field,
.guide-card {
  display: grid;
  gap: 8px;
}

.field span,
.helper {
  color: var(--muted);
}

.helper {
  margin: 0;
  line-height: 1.55;
}

.mint-matrix {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(120, 166, 214, 0.24);
  background: linear-gradient(180deg, rgba(4, 15, 25, 0.95), rgba(7, 21, 36, 0.96));
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(20, 198, 183, 0.08);
}

.mint-matrix::-webkit-scrollbar {
  width: 9px;
}

.mint-matrix::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(120, 166, 214, 0.42);
}

.mint-matrix__item {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 166, 214, 0.2);
  background: rgba(18, 37, 56, 0.62);
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.mint-matrix__item + .mint-matrix__item {
  margin-top: 8px;
}

.mint-matrix__item:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 198, 183, 0.45);
  background: rgba(15, 45, 62, 0.72);
}

.mint-matrix__op {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mint-matrix__witness {
  display: block;
  color: rgba(20, 198, 183, 0.93);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mint-matrix__time {
  display: block;
  color: rgba(171, 189, 210, 0.82);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mint-matrix__empty {
  padding: 16px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
}

.field textarea {
  min-height: 136px;
  resize: vertical;
  font-family: var(--font-mono);
}

.field-inline {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.field-inline > input {
  flex: 1 1 auto;
}

.field-inline > .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.field--checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field-bg-soft);
}

.field--checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.field--mini {
  min-width: 120px;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

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

.button--primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: white;
  box-shadow: 0 14px 28px rgba(27, 88, 212, 0.28);
}

.button--secondary {
  background: linear-gradient(135deg, var(--accent), #0f7de3);
  color: white;
}

.button--ghost {
  background: var(--ghost-bg);
  color: var(--ink);
  border-color: var(--border);
}

.button--tiny {
  padding: 9px 14px;
  font-size: 0.82rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.stat,
.metric,
.guide-card,
.token-card,
.timeline-card,
.known-device {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.stat__label,
.metric__label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.callout {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg-soft);
}

.callout--neutral {
  background: var(--card-bg-soft);
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}

.callout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.52;
}

.callout--ok {
  border-color: rgba(10, 155, 146, 0.32);
  background: rgba(10, 155, 146, 0.1);
}

.callout--warn {
  border-color: rgba(204, 122, 29, 0.35);
  background: rgba(204, 122, 29, 0.1);
}

.callout--danger {
  border-color: rgba(203, 64, 91, 0.35);
  background: rgba(203, 64, 91, 0.1);
}

.quick-steps__list {
  margin: 10px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.quick-steps__list li {
  color: var(--ink);
  line-height: 1.5;
}

.field-grid,
.library-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.surface[data-panel="portfolio"] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.portfolio-stack {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  align-content: stretch;
}

.portfolio-panel {
  display: grid;
  gap: 12px;
  min-height: 0;
  align-content: start;
}

.portfolio-panel h3 {
  margin: 0;
}

.portfolio-panel--history {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.token-grid,
.card-list,
.guide-grid,
.timeline {
  display: grid;
  gap: 12px;
}

#portfolioList.token-grid {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
}

#recentTransactionsList.timeline {
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
}

#portfolioList.token-grid::-webkit-scrollbar,
#recentTransactionsList.timeline::-webkit-scrollbar {
  width: 10px;
}

#portfolioList.token-grid::-webkit-scrollbar-thumb,
#recentTransactionsList.timeline::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(120, 166, 214, 0.4);
}

.token-grid,
.card-list,
.guide-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.token-card,
.profile-card,
.timeline-card,
.known-device {
  display: grid;
  gap: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.profile-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.profile-card--active {
  border-color: rgba(10, 155, 146, 0.26);
  box-shadow: inset 0 0 0 1px rgba(10, 155, 146, 0.08);
}

.profile-card__meta,
.token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.token-card__head,
.timeline-card__head,
.known-device__head,
.log-entry__head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.token-card h3,
.timeline-card h3,
.known-device h3 {
  margin: 0;
}

.token-meta,
.known-device__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.known-device--active {
  border-color: rgba(10, 155, 146, 0.28);
  box-shadow: inset 0 0 0 1px rgba(10, 155, 146, 0.08);
}

.known-device--peer {
  border-color: rgba(120, 166, 214, 0.32);
  box-shadow: inset 0 0 0 1px rgba(120, 166, 214, 0.08);
}

.chat-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(156, 190, 226, 0.14);
  display: grid;
  gap: 12px;
}

.chat-peer-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-peer-summary .hero-chip--public {
  background: rgba(120, 166, 214, 0.16);
  border-color: rgba(120, 166, 214, 0.28);
}

.chat-panel .button[aria-pressed="true"] {
  border-color: rgba(120, 166, 214, 0.32);
  box-shadow: inset 0 0 0 1px rgba(120, 166, 214, 0.16);
}

.chat-thread {
  min-height: 320px;
  max-height: min(56vh, 620px);
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(156, 190, 226, 0.16);
  background: rgba(4, 10, 21, 0.56);
  display: grid;
  align-content: start;
  gap: 10px;
}

.chat-thread::-webkit-scrollbar {
  width: 10px;
}

.chat-thread::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(120, 166, 214, 0.34);
}

.chat-message {
  max-width: min(88%, 560px);
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(156, 190, 226, 0.12);
  background: rgba(16, 28, 45, 0.92);
  display: grid;
  gap: 6px;
}

.chat-message--outgoing {
  margin-left: auto;
  background: rgba(10, 155, 146, 0.12);
  border-color: rgba(10, 155, 146, 0.24);
}

.chat-message--incoming {
  margin-right: auto;
}

.chat-message__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--muted);
}

.chat-message__route {
  font-size: 0.76rem;
  color: var(--muted);
}

.chat-message__body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  line-height: 1.55;
}

.chat-thread__empty {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(156, 190, 226, 0.16);
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
  word-break: break-all;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--accordion-bg);
}

.accordion + .accordion {
  margin-top: 10px;
}

.accordion summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
}

.accordion__body {
  padding: 0 16px 16px;
}

.education p,
.education li,
.guide-card a,
.education a {
  color: var(--muted);
  line-height: 1.62;
}

.guide-card a,
.education a {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

.guide-card a:hover,
.education a:hover {
  text-decoration: underline;
}

.education ul {
  margin: 0;
  padding-left: 18px;
}

.output {
  margin: 0;
  padding: 15px;
  min-height: 150px;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(156, 190, 226, 0.16);
  background: var(--log-bg);
  color: #eff5ff;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

body[data-theme="dark"] .output,
body[data-theme="dark"] .log-dock {
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.output--compact {
  min-height: 110px;
}

.visually-hidden {
  display: none !important;
}

.log-dock {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(151, 194, 236, 0.15);
  background: var(--log-bg);
  color: #eff5ff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  transition: transform 140ms ease, opacity 140ms ease, padding 140ms ease;
}

.log-dock__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.log-dock--collapsed {
  gap: 0;
  padding-bottom: 12px;
}

.log-dock--collapsed .log {
  display: none;
}

.log {
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.log-entry {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.log-entry__message {
  margin-top: 6px;
}

.log-entry__kind {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.log-entry pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
}

.witness-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 60;
}

.witness-modal.is-open {
  display: grid;
  place-items: center;
}

.witness-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 10, 18, 0.74);
  backdrop-filter: blur(4px);
}

.witness-modal__dialog {
  position: relative;
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 38px);
  overflow: auto;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(120, 166, 214, 0.25);
  background:
    radial-gradient(circle at top left, rgba(20, 198, 183, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(8, 21, 36, 0.98), rgba(7, 16, 28, 0.98));
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.42);
}

.witness-graph {
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid rgba(120, 166, 214, 0.22);
  background: rgba(4, 14, 24, 0.95);
  overflow: auto;
  padding: 10px;
}

.witness-graph svg {
  display: block;
  width: 100%;
  min-width: 780px;
  height: auto;
}

.signal-line {
  stroke: rgba(62, 192, 255, 0.8);
  stroke-width: 2.2;
}

.signal-node-source {
  fill: rgba(20, 198, 183, 0.15);
  stroke: rgba(20, 198, 183, 0.65);
  stroke-width: 2;
}

.signal-node-hotspot {
  fill: rgba(45, 124, 255, 0.12);
  stroke: rgba(122, 174, 255, 0.66);
  stroke-width: 1.8;
}

.signal-node-fo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  font-family: var(--font-ui);
  color: #f2f7ff;
}

.signal-node-fo--source {
  color: #e7fbf7;
}

.signal-node-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
}

.signal-node-id {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.25;
  color: rgba(212, 227, 242, 0.96);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.signal-title {
  fill: #f2f7ff;
  font-weight: 800;
  font-size: 20px;
}

.signal-subtitle {
  fill: rgba(212, 227, 242, 0.96);
  font-size: 13px;
  font-family: var(--font-mono);
}

.witness-meta-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.witness-meta-card {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 166, 214, 0.2);
  background: rgba(17, 33, 49, 0.65);
}

.witness-meta-card__name {
  font-weight: 700;
}

.witness-meta-card__id {
  margin-top: 4px;
  color: rgba(213, 228, 243, 0.94);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

body[data-theme="light"] .mint-matrix__item {
  background: rgba(16, 31, 48, 0.92);
  border-color: rgba(120, 166, 214, 0.26);
}

body[data-theme="light"] .mint-matrix__item:hover {
  background: rgba(18, 41, 61, 0.96);
}

body[data-theme="light"] .mint-matrix__op {
  color: #f5faff;
}

body[data-theme="light"] .mint-matrix__witness {
  color: #87f3e8;
}

body[data-theme="light"] .mint-matrix__time {
  color: rgba(223, 234, 246, 0.9);
}

body[data-theme="light"] #recentTransactionsList.timeline {
  border-radius: var(--radius-md);
  border: 1px solid rgba(120, 166, 214, 0.2);
  background: linear-gradient(180deg, rgba(9, 19, 31, 0.86), rgba(12, 24, 38, 0.92));
  padding: 10px;
}

body[data-theme="light"] .timeline-card {
  background: linear-gradient(180deg, rgba(15, 27, 42, 0.96), rgba(19, 36, 55, 0.98));
  border-color: rgba(120, 166, 214, 0.22);
}

body[data-theme="light"] .timeline-card h3,
body[data-theme="light"] .timeline-card .badge,
body[data-theme="light"] .timeline-card .helper {
  color: #f2f8ff;
}

body[data-theme="light"] .timeline-card .hero-chip {
  background: rgba(31, 52, 76, 0.94);
  border-color: rgba(120, 166, 214, 0.22);
  color: #eef7ff;
}

body[data-theme="light"] .witness-modal__dialog,
body[data-theme="light"] .witness-modal__dialog h2,
body[data-theme="light"] .witness-modal__dialog .section-kicker,
body[data-theme="light"] #witnessModalSubtitle,
body[data-theme="light"] .witness-meta-card__name {
  color: #f4f9ff;
}

body[data-theme="light"] .signal-title {
  fill: #ffffff;
}

body[data-theme="light"] .signal-subtitle,
body[data-theme="light"] .witness-meta-card__id {
  color: rgba(233, 242, 252, 0.98);
  fill: rgba(233, 242, 252, 0.98);
}

body[data-theme="light"] .signal-node-name {
  color: #f7fbff;
}

body[data-theme="light"] .signal-node-id {
  color: rgba(226, 237, 248, 0.96);
}

body[data-theme="light"] .chat-thread {
  background: linear-gradient(180deg, rgba(11, 21, 34, 0.84), rgba(14, 27, 42, 0.92));
  border-color: rgba(120, 166, 214, 0.22);
}

body[data-theme="light"] .chat-message {
  background: rgba(18, 33, 50, 0.94);
  border-color: rgba(120, 166, 214, 0.2);
}

body[data-theme="light"] .chat-message--outgoing {
  background: linear-gradient(180deg, rgba(8, 91, 108, 0.94), rgba(12, 113, 132, 0.97));
  border-color: rgba(135, 243, 232, 0.24);
}

body[data-theme="light"] .chat-message__meta,
body[data-theme="light"] .chat-message__route,
body[data-theme="light"] .chat-thread__empty {
  color: rgba(226, 237, 249, 0.9);
}

body[data-theme="light"] .chat-message__body {
  color: #f5fbff;
}

@keyframes ambientFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, 18px, 0) scale(1.04);
  }
}

@media (max-width: 1220px) {
  .surface,
  .surface--full {
    grid-column: 1 / -1;
  }

  .hero,
  .overview-grid,
  .operations-grid,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .hero__mint-stream {
    height: auto;
    max-height: min(52vh, 620px);
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 360px;
  }

  body[data-log-dock="collapsed"] {
    padding-bottom: 90px;
  }

  .app-shell {
    width: min(100vw - 16px, 100%);
  }

  .hero,
  .surface {
    padding: 16px;
  }

  .log-dock {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  #recentTransactionsList.timeline {
    max-height: 420px;
  }

  #portfolioList.token-grid {
    max-height: 360px;
  }
}

body[data-device="mobile"] {
  padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body[data-device="mobile"][data-log-dock="collapsed"] {
  padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
}

body[data-device="mobile"] .backdrop {
  filter: blur(56px);
  opacity: 0.4;
}

body[data-device="mobile"] .app-shell {
  width: min(calc(100vw - 12px), 100%);
  margin: 8px auto 16px;
}

body[data-device="mobile"] .hero,
body[data-device="mobile"] .surface {
  padding: 14px;
  border-radius: 24px;
}

body[data-device="mobile"] .hero {
  grid-template-columns: 1fr;
  gap: 14px;
}

body[data-device="mobile"] .hero--compact,
body[data-device="mobile"] .setup-config-grid {
  grid-template-columns: 1fr;
}

body[data-device="mobile"] .hero__copy h1 {
  max-width: none;
  font-size: clamp(1.85rem, 8.6vw, 2.9rem);
  line-height: 0.96;
}

body[data-device="mobile"] .lead {
  max-width: none;
  margin-top: 12px;
  font-size: 0.95rem;
  line-height: 1.55;
}

body[data-device="mobile"] .hero__controls,
body[data-device="mobile"] .hero__mint-stream,
body[data-device="mobile"] .panel {
  padding: 14px;
  border-radius: 20px;
}

body[data-device="mobile"] .setup-readout {
  min-height: 44px;
  font-size: 0.84rem;
}

body[data-device="mobile"] .layout,
body[data-device="mobile"] .overview-grid,
body[data-device="mobile"] .operations-grid,
body[data-device="mobile"] .profile-layout,
body[data-device="mobile"] .field-grid,
body[data-device="mobile"] .library-head,
body[data-device="mobile"] .token-grid,
body[data-device="mobile"] .card-list,
body[data-device="mobile"] .guide-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

body[data-device="mobile"] .surface,
body[data-device="mobile"] .surface--full {
  grid-column: 1 / -1;
}

body[data-device="mobile"] .section-head,
body[data-device="mobile"] .token-card__head,
body[data-device="mobile"] .timeline-card__head,
body[data-device="mobile"] .known-device__head {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

body[data-device="mobile"] .surface[data-panel] > .section-head > div:first-child h2::before,
body[data-device="mobile"] .surface[data-panel] > .section-head > div:first-child h3::before {
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 0.68rem;
}

body[data-device="mobile"] .hero__chips,
body[data-device="mobile"] .button-row,
body[data-device="mobile"] .toolbar,
body[data-device="mobile"] .status-row,
body[data-device="mobile"] .section-tags,
body[data-device="mobile"] .stats {
  gap: 8px;
}

body[data-device="mobile"] .stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-device="mobile"] .stat,
body[data-device="mobile"] .metric,
body[data-device="mobile"] .guide-card,
body[data-device="mobile"] .token-card,
body[data-device="mobile"] .timeline-card,
body[data-device="mobile"] .known-device,
body[data-device="mobile"] .profile-card {
  padding: 12px;
}

body[data-device="mobile"] .field-inline {
  flex-direction: column;
}

body[data-device="mobile"] .field-inline > .button,
body[data-device="mobile"] .button-row > .button,
body[data-device="mobile"] .button-row > a.button {
  width: 100%;
  justify-content: center;
}

body[data-device="mobile"] .toolbar > .field {
  min-width: 0;
}

body[data-device="mobile"] .mint-matrix {
  max-height: min(48svh, 460px);
}

body[data-device="mobile"] .chat-thread {
  min-height: 260px;
  max-height: min(48svh, 460px);
  padding: 12px;
}

body[data-device="mobile"] .chat-message {
  max-width: 100%;
}

body[data-device="mobile"] .chat-message__meta {
  flex-wrap: wrap;
}

body[data-device="mobile"] #portfolioList.token-grid {
  max-height: none;
}

body[data-device="mobile"] #recentTransactionsList.timeline {
  height: auto;
  max-height: min(50svh, 420px);
}

body[data-device="mobile"] .log-dock {
  left: 6px;
  right: 6px;
  bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  padding: 12px;
  border-radius: 20px;
}
