/* ChainProof dashboard. Kept deliberately plain: system fonts, a dark grey
   page, ordinary blue links, and green/red only for check results. */

:root {
  /* Charcoal with a teal accent. Green/red stay reserved for check results. */
  --bg: #0d1013;
  --box: #151a1f;
  --box-2: #1b2128;
  --text: #e6ebef;
  --text-2: #b0bac3;
  --muted: #84909b;
  --line: #262e36;
  --link: #5cc8bd;
  --accent: #1f9e8f;
  --accent-hover: #26b3a2;
  --ok: #4bbf73;
  --ok-bg: rgba(75, 191, 115, 0.15);
  --bad: #f2645a;
  --bad-bg: rgba(242, 100, 90, 0.15);
  --pending: #252c34;
  --entry: #6cb6ff;
  --exit: #e0a849;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: dark;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--link); }
a:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.88em; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.good { color: var(--ok); }
.bad { color: var(--bad); }

.page { max-width: 1120px; margin: 0 auto; padding: 20px 24px 48px; }

/* Header */
.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 0 14px; border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.05rem; text-decoration: none; }
.wordmark img { border-radius: 5px; }
.site-header nav { display: flex; align-items: center; gap: 20px; font-size: 0.93rem; flex-wrap: wrap; }
.site-header nav a { color: var(--text-2); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.site-header nav .nav-btn { color: var(--link); border: 1px solid var(--accent); border-radius: 6px; padding: 6px 12px; }
.site-header nav .nav-btn:hover { background: rgba(31, 158, 143, 0.12); color: var(--link); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; align-items: start; padding: 36px 0 12px; }
.hero h1 { margin: 0; font-size: 2.3rem; font-weight: 700; line-height: 1.15; }
.hero p { color: var(--text-2); }
.hero p.good { color: var(--ok); } .hero p.bad { color: var(--bad); } .hero p.muted { color: var(--muted); }
.ledger-card { background: var(--box); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 8px; padding: 14px 16px; }
.ledger-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.9rem; font-weight: 600; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 5px 0 10px; vertical-align: -1px; }
.key:first-child { margin-left: 0; }
.key-ok { background: var(--ok); } .key-bad { background: var(--bad); } .key-wait { background: var(--pending); border: 1px solid var(--line); }
.mini-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.88rem; }
.mini-facts dt { color: var(--muted); font-size: 0.8rem; }
.mini-facts dd { margin: 0; }

/* Intro */
.intro { padding: 36px 0 8px; max-width: 44rem; }
.intro h1 { margin: 0; font-size: 2.1rem; font-weight: 700; line-height: 1.2; }
.subtitle { margin: 6px 0 20px; font-size: 1.15rem; color: var(--text-2); }
.intro p { color: var(--text-2); }

/* Blocks */
.block { padding: 28px 0 4px; border-top: 1px solid var(--line); margin-top: 28px; }
.hero + .block { border-top: 0; }
.block h2 { margin: 0 0 8px; font-size: 1.35rem; font-weight: 600; }
.block > p { margin: 0 0 14px; max-width: 46rem; }
.box { background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: 18px; min-width: 0; }
.box + .box { margin-top: 12px; }
.table-box { padding: 4px 16px; }
.table-scroll { overflow-x: auto; }

/* Buttons */
.button {
  display: inline-block; font: inherit; font-size: 0.95rem; font-weight: 500; color: var(--text);
  background: var(--box-2); border: 1px solid var(--line); border-radius: 6px; padding: 9px 16px;
  cursor: pointer; text-decoration: none;
}
.button:hover { border-color: var(--muted); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button:disabled { opacity: 0.6; cursor: not-allowed; }
.link-button { border: 0; background: none; color: var(--link); text-decoration: underline; font: inherit; font-size: 0.92rem; cursor: pointer; padding: 0; }
.link-button:hover { text-decoration: none; }

/* Verify */
.verify-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.verify-result p { margin: 0 0 4px; }
.result-line { font-weight: 600; }
.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; max-width: 420px; }
.progress-track { flex: 1; height: 6px; background: var(--box-2); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); }
.progress-text { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.ledger-grid { list-style: none; margin: 12px 0 10px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.chip {
  font-family: var(--mono); font-size: 0.8rem; text-align: center; padding: 8px 0; border-radius: 4px;
  background: var(--pending); color: var(--text-2);
}
.chip-checking { outline: 1px solid var(--muted); }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.legend-line { margin: 0; }

/* Lists */
.plain-list { margin: 0; padding-left: 1.2rem; color: var(--text-2); max-width: 46rem; }
.plain-list li { margin-bottom: 8px; }

/* Chart */
.chart svg { display: block; width: 100%; height: auto; }
.grid { stroke: var(--line); stroke-dasharray: 2 4; }
.axis { stroke: var(--muted); }
.tick { fill: var(--muted); font-size: 12px; font-family: var(--sans); }
.price-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.pt-entry { fill: var(--entry); }
.pt-exit { fill: var(--exit); }
.legend { display: flex; gap: 16px; font-size: 0.85rem; color: var(--text-2); margin-top: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot-entry { background: var(--entry); } .dot-exit { background: var(--exit); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th { text-align: left; font-weight: 600; color: var(--text-2); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
.decision-row td { white-space: nowrap; }
.role { font-size: 0.85rem; margin-right: 4px; }
.role::after { content: ":"; }
.role-entry { color: var(--entry); }
.role-exit { color: var(--exit); }
.status { font-size: 0.9rem; }
.status-pending { color: var(--muted); }
.status-good { color: var(--ok); } .status-bad { color: var(--bad); }
.rows-toggle { display: block; margin: 10px 0; }
.decisions.collapsed tr.extra { display: none; }

/* Row details */
.detail-row td { background: var(--box-2); white-space: normal; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 4px 0; }
.detail h4 { margin: 0 0 6px; font-size: 0.92rem; }
.payload { margin: 0; font-family: var(--mono); font-size: 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 10px; overflow-x: auto; }
details { margin-top: 8px; font-size: 0.88rem; }
summary { cursor: pointer; color: var(--link); }
.canonical { display: block; margin-top: 6px; word-break: break-all; font-size: 0.76rem; color: var(--text-2); }
.proof { margin: 0; font-size: 0.9rem; }
.proof dt { color: var(--muted); margin-top: 8px; }
.proof dt:first-child { margin-top: 0; }
.proof dd { margin: 0; }
.hash { word-break: break-all; font-size: 0.78rem; }

/* Tamper */
.tamper { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; }
.tamper-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tamper-form > .field { width: 100%; }
.tamper-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field-label { font-size: 0.85rem; color: var(--text-2); }
.field input, .field select {
  font: inherit; font-size: 0.93rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--link); outline-offset: 0; }
.field.changed input, .field.changed select { border-color: var(--bad); }
.field input.invalid { border-color: var(--bad); }
.tamper-out { display: flex; flex-direction: column; gap: 12px; }
.hash-row { display: flex; flex-direction: column; gap: 3px; }
.tamper-out .hash { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.verdict { margin: 0; padding: 10px 12px; border-radius: 4px; }
.verdict:empty { display: none; }
.verdict.good { background: var(--ok-bg); color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }

/* ERC-8004 */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 20px; margin: 0 0 14px; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0; }
#erc-live { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text-2); }

.snippet { margin: 0 0 8px; background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; overflow-x: auto; font-size: 0.85rem; line-height: 1.55; color: var(--text-2); max-width: 46rem; }
.scope p { color: var(--text-2); max-width: 46rem; }

.site-footer { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 760px) {
  .ledger-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .site-header nav a:not(.nav-btn) { display: none; }
  .tamper, .detail { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .page { padding: 16px 16px 40px; }
  .intro h1 { font-size: 1.8rem; }
  .tamper-fields { grid-template-columns: 1fr; }
  .tick { font-size: 26px; }
}
