/* DASH Bridge app styles. Everything is scoped under .dbx, so the app can sit next to
   (or inside) another site without leaking styles.

   ===== THEME TOKENS: the only place colours and fonts are defined =====
   Default palette: light and dark through light-dark(); the toggle sets data-theme.
   data-palette="final-layer": dark and gold, matching the Final Layer site. */
.dbx {
  color-scheme: light dark;
  --bg: light-dark(#f6f8fb, #0b111a);
  --surface: light-dark(#ffffff, #121a26);
  --surface-2: light-dark(#f0f3f8, #182233);
  --text: light-dark(#0f1b2d, #e6edf6);
  --muted: light-dark(#5a6678, #93a1b5);
  --border: light-dark(#dde3ec, #253248);
  --accent: light-dark(#008de4, #3aa8f0);
  --accent-ink: light-dark(#ffffff, #04111d);
  --accent-soft: light-dark(#e3f2fd, #10273b);
  --ok: light-dark(#18804b, #4cc38a);
  --ok-soft: light-dark(#e4f5ec, #0f2a1e);
  --warn: light-dark(#9a5b00, #f0b44c);
  --warn-soft: light-dark(#fff4dc, #2d2210);
  --bad: light-dark(#b42318, #ff7b72);
  --bad-soft: light-dark(#fde8e6, #321615);
  --banner-bg: light-dark(#fff1c2, #3a2c05);
  --banner-ink: light-dark(#5a3b00, #ffe08a);
  --qr-bg: #ffffff;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 16px rgba(15, 27, 45, .05);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
.dbx[data-theme="light"] { color-scheme: light; }
.dbx[data-theme="dark"] { color-scheme: dark; --shadow: none; }
.dbx[data-palette="final-layer"] {
  color-scheme: dark;
  --bg: #0e0e0e;
  --surface: #161616;
  --surface-2: #1e1e1e;
  --text: #f0ece4;
  --muted: #a8a29e;
  --border: #2c2824;
  --accent: #d4a373;
  --accent-ink: #0e0e0e;
  --accent-soft: rgba(212, 163, 115, .14);
  --ok: #7fbf8e;
  --ok-soft: rgba(127, 191, 142, .12);
  --warn: #e8c9a0;
  --warn-soft: rgba(232, 201, 160, .12);
  --bad: #e07a5f;
  --bad-soft: rgba(224, 122, 95, .14);
  --banner-bg: #241c12;
  --banner-ink: #e8c9a0;
  --shadow: none;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Playfair Display", Georgia, serif;
}
/* ===== end of theme tokens ===== */

.dbx, .dbx * { box-sizing: border-box; }
.dbx {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
.dbx h1, .dbx h2 { font-family: var(--font-head); }

.dbx .wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.dbx .hidden { display: none !important; }
.dbx .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dbx .mono { font-family: var(--mono); font-size: .92em; word-break: break-all; }
.dbx .muted { color: var(--muted); }
.dbx a { color: var(--accent); }
.dbx h1 { font-size: 1.6rem; margin: 24px 0 6px; letter-spacing: -.01em; }
.dbx h2 { font-size: 1.08rem; margin: 0 0 8px; }
.dbx .lead { color: var(--muted); margin: 0 0 18px; max-width: 64ch; }

.dbx .banner { background: var(--banner-bg); color: var(--banner-ink); padding: 9px 16px; font-size: .9rem; text-align: center; }

.dbx .top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.dbx .top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 8px; }
.dbx .brand { white-space: nowrap; min-width: 0; }
.dbx .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 650; }
.dbx .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.dbx .pill { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); text-transform: uppercase; letter-spacing: .04em; }
.dbx .top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dbx .tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.dbx .tabs::-webkit-scrollbar { display: none; }
.dbx .tabs a { padding: 9px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 550; }
.dbx .tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.dbx .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0 0 14px; box-shadow: var(--shadow); min-width: 0; }
.dbx .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dbx .grid2 .card { margin: 0; }
.dbx .grid2 + .card { margin-top: 14px; }
@media (max-width: 720px) { .dbx .grid2 { grid-template-columns: 1fr; } }

.dbx .step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.dbx .step-head h2 { margin: 0; }
.dbx .num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.dbx .card.done .num { background: var(--ok-soft); color: var(--ok); }

.dbx .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.dbx .grow { flex: 1 1 240px; min-width: 0; }

.dbx .btn { appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.dbx .btn:hover { border-color: var(--accent); }
.dbx .btn:disabled { opacity: .5; cursor: not-allowed; }
.dbx .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dbx .btn-ghost { background: transparent; }
.dbx .icon-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.dbx #connect-btn { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

.dbx input { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0; }
.dbx input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dbx input.short { width: 150px; }
.dbx .field { margin-bottom: 14px; }
.dbx .field label, .dbx .calc label, .dbx .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.dbx .hint { font-size: .86rem; margin-top: 5px; color: var(--muted); min-height: 1.2em; }
.dbx .hint.ok { color: var(--ok); }
.dbx .hint.bad { color: var(--bad); }
.dbx .input-suffix { display: flex; align-items: stretch; }
.dbx .input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dbx .input-suffix span { border: 1px solid var(--border); border-left: 0; padding: 9px 12px; border-radius: 0 10px 10px 0; background: var(--surface); color: var(--muted); font-weight: 600; }
.dbx .check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 4px; font-size: .92rem; }
.dbx .check input { width: auto; margin-top: 4px; }

.dbx .addr-grid { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: start; margin-top: 8px; }
@media (max-width: 560px) { .dbx .addr-grid { grid-template-columns: 1fr; } .dbx .qr { margin: 0 auto; } }
.dbx .qr { width: 180px; height: 180px; background: var(--qr-bg); border-radius: 10px; padding: 8px; border: 1px solid var(--border); }
.dbx .qr svg, .dbx .qr img { width: 100%; height: 100%; display: block; }
.dbx .addr { font-size: 1.02rem; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); }
.dbx .addr-main { min-width: 0; }
.dbx .verify { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.dbx .verify.ok { background: var(--ok-soft); color: var(--ok); }
.dbx .verify.warn { background: var(--warn-soft); color: var(--warn); }
.dbx .verify.bad { background: var(--bad-soft); color: var(--bad); }
.dbx .checks { margin-top: 12px; }
.dbx .checks summary { cursor: pointer; font-weight: 600; }
.dbx .checks ul { list-style: none; padding: 0; margin: 8px 0 0; }
.dbx .checks li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: .88rem; }
.dbx .checks li .d { color: var(--muted); word-break: break-all; }
.dbx .mark-ok { color: var(--ok); } .mark-bad { color: var(--bad); } .mark-na { color: var(--muted); }
.dbx .facts { margin: 14px 0 0; padding-left: 18px; }
.dbx .relayers { list-style: none; padding: 0; margin: 10px 0 0; }
.dbx .relayers li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: .88rem; }
.dbx .relayers li .mono { word-break: break-all; }
.dbx .facts li { margin: 3px 0; }
.dbx .calc { margin-top: 14px; display: grid; gap: 6px; max-width: 360px; }

.dbx .alert { padding: 12px 14px; border-radius: 10px; margin: 16px 0 0; background: var(--bad-soft); color: var(--bad); }
.dbx .alert.warn { background: var(--warn-soft); color: var(--warn); }
.dbx .note { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: .9rem; margin: 10px 0; }
.dbx .note.warn { background: var(--warn-soft); color: var(--warn); }
.dbx .note:empty { display: none; }

.dbx dl.summary, .dbx dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 6px 0; }
.dbx dl.summary:empty { display: none; }
.dbx dl dt { color: var(--muted); }
.dbx dl dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.dbx dl.summary dd.big { font-weight: 700; }
@media (max-width: 480px) { .dbx dl.kv, .dbx dl.summary { grid-template-columns: 1fr; gap: 0; } .dbx dl dd { margin-bottom: 8px; } }

.dbx .timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.dbx .timeline li { position: relative; padding: 0 0 14px 28px; }
.dbx .timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.dbx .timeline li:last-child::before { display: none; }
.dbx .timeline .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); }
.dbx .timeline li.done .dot { background: var(--ok); border-color: var(--ok); }
.dbx .timeline li.now .dot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dbx .timeline li.bad .dot { background: var(--bad); border-color: var(--bad); }
.dbx .timeline .t { font-weight: 600; }
.dbx .timeline .s { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.dbx .item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.dbx .item-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; }

.dbx table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dbx th, .dbx td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dbx th { color: var(--muted); font-weight: 600; }
.dbx .table-wrap { overflow-x: auto; }
.dbx .badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.dbx .badge.ok { background: var(--ok-soft); color: var(--ok); }
.dbx .badge.warn { background: var(--warn-soft); color: var(--warn); }
.dbx .badge.bad { background: var(--bad-soft); color: var(--bad); }
.dbx .badge.info { background: var(--accent-soft); color: var(--accent); }

.dbx .health { display: flex; flex-wrap: wrap; gap: 8px; }
.dbx .health .big { font-size: 1.1rem; font-weight: 700; width: 100%; }

.dbx .prose p, .dbx .prose li { max-width: 70ch; }
.dbx .prose h2 { margin-top: 18px; }

.dbx .foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .8rem; padding-top: 18px; padding-bottom: 32px; }

.dbx .toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(30px); opacity: 0; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; transition: .2s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 10; }
.dbx .toast.show { opacity: 1; transform: translateX(-50%); }

/* Final burn confirmation (review L-7): an in-page dialog, not a browser alert. */
.dbx .modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); z-index: 20; }
.dbx .modal-box { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 520px; box-shadow: var(--shadow); }
.dbx .modal-box h2 { margin: 0 0 10px; }
.dbx .modal-dest { font-family: var(--mono); font-size: 1.15rem; font-weight: 600; word-break: break-all; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 6px 0 12px; }

@media (max-width: 480px) {
  .dbx .pill { display: none; }
  .dbx #connect-btn { max-width: 40vw; padding: 9px 10px; }
  .dbx h1 { font-size: 1.35rem; }
  .dbx .card { padding: 14px; }
}

/* The standalone page (index.html) has no inline styles (CSP style-src 'self'). This is the
   only rule outside .dbx; it applies only to pages that load this stylesheet. */
body { margin: 0; }
