:root {
  --bg: #0f1419;
  --card: #171e26;
  --line: #263340;
  --text: #d7e0e8;
  --dim: #8296a5;
  --accent: #f2a900;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --dirty: #1f6feb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
h1 { font-size: 1.1rem; margin: 0; }
h1 span { color: var(--accent); }
h2 { font-size: 1rem; margin: 0 0 0.6rem; color: var(--accent); }
h3 { font-size: 0.85rem; margin: 0.8rem 0 0.35rem; color: var(--dim); }
.help-host { position: relative; }
.label-title {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}
.help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  font-size: 0.68rem;
  line-height: 1;
  vertical-align: middle;
}
.help-button:hover, .help-button[aria-expanded="true"] {
  background: rgba(242, 169, 0, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}
.help-popover {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  width: min(22rem, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  overflow: auto;
  overflow-wrap: break-word;
  text-align: left;
  text-transform: none;
  white-space: normal;
}
.help-popover[hidden] { display: none; }
.header-status { display: flex; align-items: center; justify-content: flex-end; gap: 0.8rem; min-width: 0; }
.poll-control { display: flex; align-items: center; gap: 0.35rem; color: var(--dim); font-size: 0.76rem; white-space: nowrap; }
.poll-control select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font: inherit;
  padding: 0.2rem 0.45rem;
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading h2 { margin-bottom: 0.6rem; }
.explorer-status { display: flex; align-items: center; gap: 0.45rem; color: var(--dim); font-size: 0.76rem; margin-bottom: 0.6rem; }
.explorer-status a, #blocks a { color: var(--accent); text-decoration: none; }
.explorer-status a:hover, #blocks a:hover { text-decoration: underline; }
.docs-link { font-size: 0.78rem; color: var(--dim); text-decoration: none; white-space: nowrap; }
.docs-link:hover { color: var(--accent); text-decoration: underline; }
.conn { font-size: 0.8rem; color: var(--dim); }
.conn.ok { color: var(--ok); }
.conn.stale { color: var(--err); }
main {
  padding: 1rem 1.2rem;
}
.dashboard-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.dashboard-tab {
  background: transparent;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  color: var(--dim);
  padding: 0.45rem 0.9rem;
}
.dashboard-tab[aria-selected="true"] {
  background: var(--card);
  color: var(--accent);
}
.dashboard-panel { display: none; }
.dashboard-panel.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
#panel-overview.active, #panel-faucet.active { grid-template-columns: 1fr; }
/* One grid cell holding a stack of cards, so a short card leaves its
   successor directly beneath it instead of in the opposite column. */
.panel-stack { display: grid; gap: 1rem; align-content: start; min-width: 0; }
@media (max-width: 1100px) { .dashboard-panel.active { grid-template-columns: 1fr; } }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 1rem;
}
.tiles { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  min-width: 7.5rem;
}
.tile .k { font-size: 0.7rem; color: var(--dim); text-transform: uppercase; }
.tile .v { font-size: 1.05rem; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.split > * { min-width: 0; }
.split > div:first-child { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
th, td { text-align: right; padding: 0.15rem 0.45rem; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: normal; }
td:first-child, th:first-child { text-align: left; }
.services .svc { display: flex; gap: 0.5rem; align-items: flex-start; margin: 4px 0; font-size: 0.76rem; overflow-wrap: anywhere; }
.services .svc .dot { flex: 0 0 auto; margin-top: 0.25rem; }
.component-control {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.component-state { color: var(--dim); font-size: 0.76rem; margin-bottom: 0.45rem; }
.component-buttons { display: flex; gap: 0.5rem; }
.component-buttons button { padding: 0.3rem 0.65rem; font-size: 0.76rem; }
#mining-resume, #spam-resume { background: var(--ok); }
.action-result { color: var(--dim); font-size: 0.72rem; min-height: 1rem; margin-top: 0.35rem; }
.action-result.err { color: var(--err); }
.snapshot-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.snapshot-rationale { margin-top: 0.8rem; padding-top: 0.7rem; border-top: 1px solid var(--line); margin-bottom: 0; }
.snapshot-rationale b { color: var(--text); }
.faucet-badge {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}
.faucet-wallets { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-bottom: 0.7rem; }
.faucet-wallets > div { border: 1px solid var(--line); border-radius: 5px; padding: 0.4rem 0.5rem; }
.faucet-wallets strong, .faucet-wallets span { display: block; }
.faucet-wallets span { color: var(--dim); font-size: 0.7rem; overflow-wrap: anywhere; }
#user-address-card a { color: var(--accent); display: block; overflow-wrap: anywhere; }
#user-address-card .hint { margin: 0.4rem 0 0; }
.faucet-form-heading { display: flex; justify-content: space-between; align-items: center; }
.faucet-form-heading h3 { margin-top: 0; }
.faucet-outputs { display: grid; gap: 0.4rem; }
.faucet-output-row {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(7rem, 0.35fr) auto;
  gap: 0.45rem;
  align-items: end;
}
.faucet-output-row label, .faucet-source { color: var(--dim); font-size: 0.72rem; }
.faucet-output-row input, .faucet-source select {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  font: inherit;
}
.faucet-source { display: block; margin: 0.65rem 0; max-width: 16rem; }
.faucet-progress, .faucet-transfer {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  padding: 0.5rem 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}
.faucet-transfer > * { margin-bottom: 0.3rem; }
.faucet-transfer-state { font-weight: 700; }
.faucet-transfer ul { margin: 0.35rem 0; padding-left: 1.2rem; }
.faucet-transfer a { color: var(--accent); }
.faucet-transfer-error { color: var(--err); }
.transfer-confirmed { border-left-color: var(--ok); }
.transfer-delivery_failed, .transfer-aborted_after_submission { border-left-color: var(--err); }
.test-key-warning {
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid var(--warn);
  border-radius: 5px;
  color: var(--warn);
  font-size: 0.76rem;
  margin-bottom: 0.7rem;
  padding: 0.45rem 0.55rem;
}
.mnemonic-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.45rem;
  align-items: center;
}
.credential-label { color: var(--dim); font-size: 0.72rem; }
.credential-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.secret-value { color: var(--dim); }
.secret-value.revealed { color: var(--text); }
.copy-status { color: var(--ok); font-size: 0.7rem; min-height: 1rem; margin-top: 0.25rem; }
.copy-status.err { color: var(--err); }
.regtest-keys-scroll { margin-top: 0.35rem; }
.regtest-keys-table { min-width: 54rem; table-layout: fixed; }
.regtest-keys-table th:nth-child(1) { width: 10rem; }
.regtest-keys-table th:nth-child(2) { width: 22rem; }
.regtest-keys-table th:nth-child(3) { width: 22rem; }
.regtest-keys-table th, .regtest-keys-table td { text-align: left; vertical-align: middle; }
.regtest-keys-table td { padding-bottom: 0.3rem; padding-top: 0.3rem; }
.regtest-keys-table td:first-child { white-space: nowrap; }
.regtest-key-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
}
.regtest-private-cell { grid-template-columns: minmax(0, 1fr) auto auto; }
.regtest-key-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mnemonic-row button, .regtest-key-cell button { min-width: 4.2rem; }
.regtest-key-links { color: var(--dim); font-size: 0.72rem; margin: 0.65rem 0 0; }
.regtest-key-links a { color: var(--accent); text-decoration: none; }
.regtest-key-links a:hover { text-decoration: underline; }
dialog {
  width: min(38rem, calc(100vw - 2rem));
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.faucet-confirm { padding: 1rem; }
.faucet-confirm p, #faucet-confirm-summary { font-size: 0.8rem; }
#faucet-confirm-summary { color: var(--accent); font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.mutation-lock {
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ok);
  font-size: 0.76rem;
  margin-bottom: 0.8rem;
  padding: 0.4rem 0.55rem;
}
.mutation-lock.busy { color: var(--warn); border-color: var(--warn); }
.action-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(9rem, 1fr));
  gap: 0.55rem 0.8rem;
  align-items: end;
}
.action-form label { color: var(--dim); font-size: 0.74rem; }
.action-form input[type="number"], .action-form select {
  display: block;
  width: 100%;
  margin-top: 0.2rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  font: inherit;
}
.action-form .check-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  color: var(--text);
}
.action-form button { min-height: 2rem; }
.reorg-card {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.65rem;
  margin-bottom: 0.7rem;
}
.reorg-card > h3 { margin-top: 0; }
.reorg-card > .action-result:not(:empty) { margin-top: 0.55rem; }
.bounded-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.7rem; }
.mini-action-form { border: 1px solid var(--line); border-radius: 5px; padding: 0.5rem; }
.mini-action-form h3 { margin-top: 0; }
.mini-action-form label { display: block; color: var(--dim); font-size: 0.72rem; margin-bottom: 0.35rem; }
.mini-action-form input, .mini-action-form select {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font: inherit;
}
.mini-action-form input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.mini-action-form .check-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}
.mini-action-form .check-field input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin: 0;
}

.chain-actions-card { display: flex; flex-direction: column; gap: 0.65rem; }
.chain-action-subpane + .chain-action-subpane {
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}
.rewind-warning { color: var(--dim); font-size: 0.68rem; line-height: 1.35; margin: 0.45rem 0 0; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.scenario-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.2rem;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem;
  font: inherit;
}
.scenario-form > label { color: var(--dim); font-size: 0.74rem; }
.scenario-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; gap: 0.6rem; }
.file-label { color: var(--dim); font-size: 0.74rem; }
.file-label input { display: block; margin-top: 0.2rem; max-width: 18rem; }
.job-heading { display: flex; justify-content: space-between; align-items: center; }
.job-heading-actions { display: flex; gap: 0.45rem; }
.job-heading h3 { margin-top: 1rem; }
.job-detail {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  padding: 0.5rem 0.65rem;
  font-size: 0.76rem;
  white-space: pre-wrap;
}
.job-detail.state-succeeded { border-left-color: var(--ok); }
.job-detail.state-failed, .job-detail.state-interrupted { border-left-color: var(--err); }
.job-detail.state-aborted, .job-detail.state-abort_requested { border-left-color: var(--warn); }
.job-events {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  list-style: none;
  margin: 0.55rem 0 0;
  max-height: 13rem;
  overflow: auto;
  padding: 0.35rem 0.55rem;
}
.job-events li { display: grid; grid-template-columns: 11rem 1fr; gap: 0.55rem; font-size: 0.72rem; padding: 0.15rem 0; }
.job-checkpoints { margin-top: 0.55rem; }
.checkpoint {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 3px solid var(--dim);
  border-radius: 5px;
  margin-top: 0.35rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.72rem;
}
.checkpoint-reached { border-left-color: var(--warn); }
.checkpoint-released { border-left-color: var(--ok); }
.checkpoint-timed_out { border-left-color: var(--err); }
.checkpoint pre {
  grid-column: 1 / -1;
  max-height: 8rem;
  overflow: auto;
  margin: 0;
  color: var(--dim);
  white-space: pre-wrap;
}
.event-heading { color: var(--dim); }
.table-scroll { overflow-x: auto; }
#jobs tbody tr.selected { background: rgba(31, 111, 235, 0.12); }
.muted { color: var(--dim); }
button.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.danger { background: var(--err); color: white; }
button.small { padding: 0.15rem 0.45rem; font-size: 0.7rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }
.dot.off { background: var(--dim); }
.hint { color: var(--dim); font-size: 0.78rem; margin: 0 0 0.7rem; }
.group { margin-bottom: 0.9rem; }
.group > .gtitle {
  color: var(--dim);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  margin-bottom: 0.4rem;
}
.field {
  display: grid;
  grid-template-columns: 17rem 1fr 9rem;
  gap: 0.6rem;
  align-items: center;
  padding: 0.18rem 0;
}
.field label { font-size: 0.8rem; overflow-wrap: anywhere; }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.25rem 0.45rem;
  font: inherit;
}
.field.dirty input, .field.dirty select { border-color: var(--dirty); }
.field.invalid input, .field.invalid select { border-color: var(--err); }
.field.dirty label::after { content: " ●"; color: var(--dirty); }
.field.ignored { opacity: 0.45; }
.field.unavailable { opacity: 0.55; }
.field.unavailable .running { color: var(--err); }
.field .running { font-size: 0.72rem; color: var(--dim); overflow-wrap: anywhere; }
.field .running.differs { color: var(--warn); }
.fieldwarn { grid-column: 1 / -1; color: var(--warn); font-size: 0.74rem; padding-left: 0.2rem; }
.field.boot label { color: var(--dim); }
.field.boot .bootvalue {
  width: 100%;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 0.25rem 0.45rem;
  font: inherit;
}
.boothelp { grid-column: 1 / -1; color: var(--dim); font-size: 0.72rem; padding-left: 0.2rem; }
.field-error { grid-column: 2 / -1; color: var(--err); font-size: 0.72rem; min-height: 0.9rem; }
.applybar { display: flex; gap: 0.7rem; align-items: center; justify-content: flex-end; margin-top: 0.6rem; }
.impact { color: var(--dim); font-size: 0.78rem; margin-right: auto; }
button {
  background: var(--accent);
  color: #14100a;
  font: inherit;
  border: 0;
  border-radius: 5px;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
#reset { background: transparent; color: var(--dim); border: 1px solid var(--line); }
.result {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem;
  font-size: 0.75rem;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: auto;
}
.result.err { border-color: var(--err); }
#page-errors .pageerr {
  background: rgba(248, 81, 73, 0.08);
  border: 1px solid var(--err);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 0.78rem;
  margin-bottom: 0.7rem;
}
#page-errors .pagewarn {
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid var(--warn);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 0.78rem;
  margin-bottom: 0.7rem;
}
@media (max-width: 620px) {
  main { padding: 0.7rem; }
  .dashboard-tabs { overflow-x: auto; }
  .dashboard-tab { flex: 0 0 auto; }
  .split, .bounded-actions, .faucet-wallets { grid-template-columns: 1fr; }
  .faucet-output-row { grid-template-columns: 1fr; }
  .faucet-remove-output { justify-self: start; }
  .mnemonic-row { grid-template-columns: 1fr auto auto; }
  .mnemonic-row .credential-label { grid-column: 1 / -1; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
}
