:root {
  color-scheme: light;
  --bg: #fff;
  --ink: #050505;
  --muted: #5f6673;
  --soft: #f6f7f9;
  --line: #d9dde4;
  --line-strong: #aeb6c2;
  --blue: #2563eb;
  --green: #0f7a35;
  --orange: #c2410c;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 0 max(20px, calc((100vw - 1480px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 820;
  text-decoration: none;
}

.mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-weight: 850;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.98;
  max-width: 800px;
}

.summary p {
  max-width: 740px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
}

.status-pill.connected .status-dot { background: var(--green); }

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

.metric {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 850;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.8rem, 3.2vw, 3rem);
  line-height: 0.95;
  font-weight: 850;
}

.metric small {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric em {
  color: var(--muted);
  font-size: 0.94rem;
  font-style: normal;
}

.metric.warning strong { color: var(--orange); }
.metric.success strong { color: var(--green); }

.alert-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.alert-card {
  padding: 13px 14px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
}

.alert-card strong {
  display: block;
  color: #9a3412;
  font-size: 0.9rem;
}

.alert-card span {
  display: block;
  margin-top: 4px;
  color: #7c2d12;
  font-size: 0.82rem;
  line-height: 1.35;
}

.watch-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px 18px;
  align-items: start;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.watch-card > * {
  min-width: 0;
}

.watch-copy h2 {
  margin: 0;
  font-size: 1rem;
}

.watch-copy p,
.watch-message {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.watch-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.watch-form input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.84rem;
}

.watch-form input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: var(--blue);
}

.watch-form button,
.text-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.watch-form button:hover,
.text-button:hover {
  background: #eef2ff;
  border-color: #93a9e8;
}

.watch-message {
  grid-column: 2;
  min-height: 20px;
}

.watch-message.is-error { color: #b91c1c; }
.watch-message.is-ok { color: var(--green); }

.watch-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.accelerate-panel {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.accelerate-panel h3 {
  margin: 0;
  font-size: 0.98rem;
}

.accelerate-panel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.accelerate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.quote-card {
  padding: 10px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: var(--soft);
}

.quote-card span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.quote-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.quote-code {
  margin: 10px 0 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  border-radius: 8px;
  background: #0b1220;
  color: #e5edf8;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.5;
}

.quote-code code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.accelerate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
}

.watch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.watch-item code,
.full-txid {
  display: block;
  max-width: 100%;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.watch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.max-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #111827;
  cursor: pointer;
}

.max-button:hover { background: var(--soft); border-color: var(--line-strong); }
.max-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bar-chart {
  display: grid;
  grid-template-columns: repeat(9, minmax(42px, 1fr));
  gap: 10px;
  align-items: stretch;
  min-height: 250px;
  padding: 20px 16px 16px;
}

.bar-cell {
  display: flex;
  flex-direction: column;
  height: 214px;
  min-width: 0;
}

.bar-plot {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
}

.bar {
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: #111827;
}

.bar.hot { background: var(--orange); }
.bar.active { background: var(--blue); }

.bar-count,
.bar-label {
  text-align: center;
  font-size: 0.74rem;
}

.bar-count {
  margin-top: 7px;
  color: var(--ink);
  font-family: var(--mono);
}

.bar-label {
  margin-top: 5px;
  color: var(--muted);
}

.stream-list,
.event-list,
.compact-list {
  max-height: 344px;
  overflow: auto;
  padding: 8px;
}

.stream-item,
.event-item,
.compact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid #eef0f3;
}

.stream-item:last-child,
.event-item:last-child,
.compact-row:last-child { border-bottom: 0; }

.txid {
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txid-cell {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.txid-cell.is-watched .txid {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

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

.inline-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.inline-link:hover { background: var(--soft); }

.owner-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.read-only-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.accelerate-button {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: var(--green);
}

.accelerate-button:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.subline,
.event-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.tag.low { background: #fff7ed; color: var(--orange); }
.tag.high { background: #ecfdf5; color: var(--green); }

.table-wrap {
  overflow: auto;
  max-height: 380px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f3;
  text-align: left;
  font-size: 0.86rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 850;
}

td.mono {
  font-family: var(--mono);
  font-weight: 800;
}

.docs-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.docs-button:hover { background: var(--soft); }

.kv {
  margin: 0;
  padding: 8px 16px 16px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #eef0f3;
}

.kv dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.kv dd {
  margin: 0;
  max-width: 62%;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: right;
  overflow-wrap: anywhere;
}

.trend-grid,
.fee-summary {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.trend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fee-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 0; }

.trend-grid div,
.fee-summary div {
  padding: 12px;
  border: 1px solid #eef0f3;
  border-radius: var(--radius);
}

.trend-grid span,
.fee-summary span {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 850;
}

.trend-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.65rem;
  line-height: 1;
}

.trend-grid small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.fee-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.empty {
  padding: 24px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.note {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font-size: 0.94rem;
}

.note strong { color: var(--ink); }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.34);
}

.panel.is-maximized {
  position: fixed;
  inset: 22px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.panel.is-maximized .stream-list,
.panel.is-maximized .event-list,
.panel.is-maximized .compact-list,
.panel.is-maximized .table-wrap {
  max-height: none;
  flex: 1;
}

.panel.is-maximized .bar-chart {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.panel.is-maximized .bar-cell { height: auto; }
body.has-maximized { overflow: hidden; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 12px;
  }

  .navlinks {
    width: 100%;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .shell {
    width: min(100% - 24px, 1480px);
    padding-top: 16px;
  }

  .summary {
    flex-direction: column;
    gap: 14px;
  }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 116px; padding: 13px; }
  .metric strong { font-size: clamp(1.55rem, 10vw, 2.4rem); }
  .watch-card,
  .watch-form {
    grid-template-columns: 1fr;
  }
  .watch-message {
    grid-column: 1;
  }
  .watch-item {
    grid-template-columns: 1fr;
  }
  .accelerate-grid {
    grid-template-columns: 1fr;
  }
  .bar-chart { grid-template-columns: repeat(9, 50px); overflow-x: auto; }
  .panel-head { padding: 14px; }
  .panel.is-maximized { inset: 10px; }
  .trend-grid,
  .fee-summary { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .brand { font-size: 0.98rem; }
  h1 { font-size: 2rem; }
  .stream-item,
  .event-item,
  .compact-row { grid-template-columns: 1fr; }
}
