/* ETH On Chain dashboard. Uses the --rk-* tokens from site.css; all classes are prefixed db-. */
body.db { margin: 0; background: var(--rk-bg); color: var(--rk-ink); font-family: var(--rk-font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.db *, .db *::before, .db *::after { box-sizing: border-box; }
.db button, .db input, .db select { font: inherit; color: inherit; }
.db a { color: inherit; text-decoration: none; }
.db h1, .db h2, .db h3, .db p { margin: 0; }
.db table { border-collapse: collapse; width: 100%; }
.db img { display: block; }

.db-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

/* ---------- Sidebar ---------- */
.db-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 16px; border-right: 1px solid var(--rk-line); }
.db-side .rk-brand { padding: 0 10px; }
.db-nav { display: flex; flex-direction: column; gap: 2px; }
.db-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--rk-muted); font-weight: 500; transition: background-color 0.15s ease, color 0.15s ease, transform 0.18s ease; }
.db-nav a svg { width: 19px; height: 19px; flex: none; }
.db-nav a:hover { background: var(--rk-soft); color: var(--rk-ink); transform: translateX(2px); }
.db-nav a[aria-current="page"] { background: var(--rk-soft); color: var(--rk-ink); box-shadow: inset 2px 0 0 var(--rk-primary); }
.db-nav small { margin: 14px 12px 4px; color: var(--rk-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.db-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--rk-line); border-radius: 12px; min-width: 0; }
.db-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--rk-primary); color: var(--rk-on-primary); font-weight: 600; }
.db-user b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-user span { display: block; font-size: 0.8125rem; color: var(--rk-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Top bar + main ---------- */
.db-body { min-width: 0; display: flex; flex-direction: column; }
.db-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 68px; padding: 0 clamp(16px, 3vw, 32px); background: var(--rk-header-bg); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--rk-line); }
.db-top h1 { font-size: 1.125rem; font-weight: 500; letter-spacing: -0.015em; }
.db-top .db-grow { flex: 1; }
.db-badge { padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 500; background: color-mix(in srgb, #e0a100 18%, transparent); color: #e0a100; border: 1px solid color-mix(in srgb, #e0a100 40%, transparent); }
.db-main { width: 100%; max-width: 1180px; padding: clamp(18px, 3vw, 32px); display: grid; gap: 20px; }
.db-loading, .db-empty { padding: 48px 12px; text-align: center; color: var(--rk-muted); }

/* ---------- Buttons ---------- */
.db-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--rk-line); background: var(--rk-soft); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.18s ease, box-shadow 0.18s ease; }
.db-btn:hover { border-color: var(--rk-muted); transform: translateY(-1px); box-shadow: var(--rk-lift, 0 6px 16px rgba(0,0,0,.15)); }
.db-btn:active { transform: none; box-shadow: none; }
.db-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.db-btn-primary { background: var(--rk-primary); border-color: transparent; color: var(--rk-on-primary); }
.db-btn-primary:hover { background: var(--rk-primary-hover); border-color: transparent; }
.db-btn-sm { height: 32px; padding: 0 12px; font-size: 0.875rem; border-radius: 8px; }
.db-btn-ghost { background: transparent; }
.db-btn-danger { color: var(--rk-neg); }

/* ---------- Cards ---------- */
.db-card { background: var(--rk-soft); border: 1px solid var(--rk-line); border-radius: 16px; padding: 20px; min-width: 0; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.db-card:hover { border-color: color-mix(in srgb, var(--rk-muted) 45%, var(--rk-line)); }
.db-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.db-card-head h2 { font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; }
.db-link { color: var(--rk-primary); font-size: 0.875rem; font-weight: 500; }
.db-link:hover { text-decoration: underline; }
.db-grid-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.db-grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.db-grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.db-stat > span { display: block; color: var(--rk-muted); font-size: 0.8125rem; }
.db-stat > strong { display: block; margin-top: 6px; font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 500; letter-spacing: -0.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.db-stat > small:not(.rk-up):not(.rk-down) { color: var(--rk-muted); }
.db-stat > small { display: block; margin-top: 4px; font-size: 0.8125rem; font-weight: 500; }

/* ---------- Tables ---------- */
.db-tablewrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.db-table th { text-align: left; font-size: 0.75rem; font-weight: 500; color: var(--rk-muted); padding: 8px 10px; white-space: nowrap; }
.db-table td { padding: 12px 10px; border-top: 1px solid var(--rk-line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.db-table .r { text-align: right; }
.db-table tbody tr { transition: background-color 0.15s ease; }
.db-table tbody tr:hover { background: color-mix(in srgb, var(--rk-line) 45%, transparent); }
.db-table th button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font-size: inherit; font-weight: inherit; }
.db-table th button:hover { color: var(--rk-ink); }
.db-coin { display: flex; align-items: center; gap: 10px; }
.db-coin img, .db-coin i { width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--rk-line); }
.db-coin b { font-weight: 500; display: block; line-height: 1.2; }
.db-coin span { display: block; font-size: 0.75rem; color: var(--rk-muted); line-height: 1.2; }
.db-actions { display: flex; gap: 6px; justify-content: flex-end; }
.db-pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 500; background: var(--rk-line); text-transform: capitalize; }
.db-pill.buy, .db-pill.deposit { color: var(--rk-pos); background: color-mix(in srgb, var(--rk-pos) 14%, transparent); }
.db-pill.withdraw { color: #f5a524; background: color-mix(in srgb, #f5a524 14%, transparent); }
.db-pill.sell { color: var(--rk-neg); background: color-mix(in srgb, var(--rk-neg) 14%, transparent); }
.db-star { background: none; border: 0; cursor: pointer; color: var(--rk-muted); padding: 4px; border-radius: 6px; transition: color 0.15s, transform 0.18s ease; }
.db-star:hover { color: var(--rk-neg); transform: scale(1.12); }

/* ---------- Charts ---------- */
.db-chart { position: relative; height: 240px; }
.db-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.db-tip { position: absolute; top: 0; transform: translateX(-50%); padding: 6px 10px; border-radius: 8px; background: var(--rk-bg); border: 1px solid var(--rk-line); box-shadow: var(--rk-shadow); font-size: 0.8125rem; white-space: nowrap; pointer-events: none; }
.db-tip b { display: block; font-weight: 500; }
.db-tip span { color: var(--rk-muted); }
.db-donut { display: grid; grid-template-columns: 140px 1fr; gap: 18px; align-items: center; }
.db-donut svg { width: 140px; height: 140px; transform: rotate(-90deg); }
.db-donut circle { transition: stroke-width 0.2s ease; }
.db-donut circle:hover { stroke-width: 6; }
.db-legend { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 0.875rem; }
.db-legend li { display: flex; align-items: center; gap: 8px; }
.db-legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.db-legend span { margin-left: auto; color: var(--rk-muted); font-variant-numeric: tabular-nums; }

/* ---------- Toolbar, forms ---------- */
.db-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.db-seg { display: inline-flex; padding: 3px; border: 1px solid var(--rk-line); border-radius: 10px; background: var(--rk-bg); }
.db-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--rk-muted); font-weight: 500; font-size: 0.875rem; cursor: pointer; transition: color 0.15s, background-color 0.15s; }
.db-seg button:hover { color: var(--rk-ink); }
.db-seg button[aria-pressed="true"] { background: var(--rk-soft); color: var(--rk-ink); }
.db-field { display: grid; gap: 6px; }
.db-field label { font-size: 0.8125rem; color: var(--rk-muted); }
.db-input { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--rk-line); background: var(--rk-bg); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.db-input:focus { outline: none; border-color: var(--rk-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rk-primary) 25%, transparent); }
.db-input:disabled { opacity: 0.6; }
.db-form { display: grid; gap: 14px; max-width: 440px; }
.db-msg { min-height: 1.2em; font-size: 0.875rem; }
.db-msg.err { color: var(--rk-neg); }
.db-msg.ok { color: var(--rk-pos); }
.db-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--rk-muted); font-size: 0.875rem; }

/* ---------- Modal + toast ---------- */
.db-modal { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rk-line); border-radius: 18px; background: var(--rk-bg); color: var(--rk-ink); box-shadow: var(--rk-shadow); }
.db-modal::backdrop { background: rgba(5, 8, 14, 0.6); }
.db-modal[open] { animation: db-pop 0.22s ease; }
@keyframes db-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.db-modal form { display: grid; gap: 16px; padding: 22px; }
.db-modal header { display: flex; align-items: center; justify-content: space-between; }
.db-modal header h2 { font-size: 1.125rem; font-weight: 500; }
.db-x { border: 0; background: none; cursor: pointer; color: var(--rk-muted); font-size: 1.5rem; line-height: 1; padding: 0 4px; }
.db-x:hover { color: var(--rk-ink); }
.db-hint { font-size: 0.8125rem; color: var(--rk-muted); display: flex; justify-content: space-between; gap: 10px; }
.db-hint button { border: 0; background: none; color: var(--rk-primary); cursor: pointer; font-weight: 500; padding: 0; }
.db-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--rk-ink); color: var(--rk-bg); font-weight: 500; box-shadow: var(--rk-shadow); animation: db-pop 0.22s ease; }

/* ---------- Mobile tab bar ---------- */
.db-tabbar { display: none; }
@media (max-width: 1023px) {
  .db-shell { grid-template-columns: minmax(0, 1fr); }
  .db-side { display: none; }
  .db-main { padding-bottom: 96px; }
  .db-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--rk-header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--rk-line); }
  .db-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; color: var(--rk-muted); font-size: 0.6875rem; font-weight: 500; transition: color 0.15s, transform 0.18s ease; }
  .db-tabbar a:active { transform: scale(0.95); }
  .db-tabbar a svg { width: 22px; height: 22px; }
  .db-tabbar a[aria-current="page"] { color: var(--rk-primary); }
  .db-grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-grid-2, .db-grid-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .db-donut { grid-template-columns: 1fr; justify-items: center; }
  .db-top .db-btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .db-nav a:hover, .db-btn:hover { transform: none; }
  .db-modal[open], .db-toast { animation: none; }
}

/* ---------- Buy / Sell checkout ---------- */
.db-flow { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.db-flow > .db-card:last-child { position: sticky; top: 88px; }
.db-flow-host { display: grid; gap: 20px; }
.db-steps { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.db-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 1px solid var(--rk-line); border-radius: 99px; color: var(--rk-muted); font-size: 0.875rem; font-weight: 500; }
.db-steps li button { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; }
.db-steps i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--rk-line); font-style: normal; font-size: 0.75rem; color: var(--rk-ink); transition: background-color 0.2s ease, color 0.2s ease; }
.db-steps li.now { color: var(--rk-ink); border-color: var(--rk-primary); }
.db-steps li.now i { background: var(--rk-primary); color: var(--rk-on-primary); }
.db-steps li.done { color: var(--rk-ink); }
.db-steps li.done i { background: color-mix(in srgb, var(--rk-pos) 22%, transparent); color: var(--rk-pos); }
.db-steps li.done button:hover span { text-decoration: underline; }
.db-step-in { animation: db-step 0.28s cubic-bezier(0.22, 0.61, 0.36, 1); }
@keyframes db-step { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.db-picklist { display: grid; gap: 6px; margin-top: 12px; max-height: 480px; overflow-y: auto; padding-right: 2px; }
.db-pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.18s ease; }
.db-pick:hover { background: var(--rk-bg); border-color: var(--rk-line); transform: translateX(2px); }
.db-pick:focus-visible { outline: 2px solid var(--rk-primary); outline-offset: 1px; }
.db-pick-r { text-align: right; font-variant-numeric: tabular-nums; }
.db-pick-r b { display: block; font-weight: 500; }
.db-pick-r span { font-size: 0.8125rem; }
.db-asset-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--rk-line); }
.db-asset-head .db-coin { flex: 1; min-width: 0; }
#f-amt.db-input-lg, .db-input-lg { height: 56px; font-size: 1.5rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.db-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.db-chip { height: 32px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--rk-line); background: var(--rk-bg); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: border-color 0.15s ease, transform 0.18s ease, color 0.15s; }
.db-chip:hover { border-color: var(--rk-primary); color: var(--rk-primary); transform: translateY(-1px); }
.db-est { color: var(--rk-muted); margin: 4px 0 18px; font-variant-numeric: tabular-nums; }
.db-warn { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 1.4em; margin-bottom: 14px; color: var(--rk-neg); font-size: 0.875rem; }
.db-warn:empty { display: none; }
.db-sum { display: grid; gap: 2px; }
.db-sum-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rk-line); font-size: 0.9375rem; }
.db-sum-row:first-child { border-top: 0; }
.db-sum-row span { color: var(--rk-muted); }
.db-sum-row b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.db-sum-row.strong b { font-size: 1.0625rem; }
.db-card .db-actions { margin-top: 16px; }
.db-success { display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 520px; margin: 0 auto; width: 100%; padding: 32px 24px; }
.db-success h2 { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.db-success .db-sum { width: 100%; text-align: left; margin-top: 8px; }
.db-success .db-actions { justify-content: center; flex-wrap: wrap; }
.db-chip-row { display: flex; gap: 8px; }
.db-top .db-btn { display: inline-flex; }
.db-nav .db-group { margin: 14px 12px 4px; color: var(--rk-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 1023px) {
  .db-flow { grid-template-columns: minmax(0, 1fr); }
  .db-flow > .db-card:last-child { position: static; order: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .db-step-in { animation: none; }
  .db-pick:hover, .db-chip:hover { transform: none; }
}

/* Top bar stays on one line on narrow screens */
.db-top h1, .db-badge { white-space: nowrap; }
.db-top h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .db-top { gap: 8px; padding: 0 14px; }
  .db-top h1 { font-size: 1rem; }
  .db-badge { font-size: 0.6875rem; padding: 3px 8px; }
  .db-top .db-btn-sm { padding: 0 10px; }
}

/* ---------- Deposit ---------- */
.db-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--rk-primary) 16%, transparent); color: var(--rk-primary); flex: none; }
.db-pick .db-coin { gap: 14px; }
.db-pick .db-coin span { font-size: 0.8125rem; }
.db-chev { color: var(--rk-muted); font-size: 1.5rem; line-height: 1; transition: transform 0.18s ease, color 0.15s ease; }
.db-pick:hover .db-chev { transform: translateX(3px); color: var(--rk-ink); }
@media (max-width: 640px) { .db-hide-sm { display: none !important; } }

/* Deposit / withdraw: address box and demo notice */
.db-addr { display: flex; gap: 8px; align-items: center; }
.db-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; letter-spacing: 0; }
.db-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, #f5a524 40%, transparent); background: color-mix(in srgb, #f5a524 10%, transparent); font-size: 0.8125rem; line-height: 1.45; }
.db-details { display: grid; gap: 12px; margin: 4px 0 14px; padding-top: 14px; border-top: 1px solid var(--rk-line); }
.db-details-h { margin: 0; font-size: 0.875rem; font-weight: 500; }
.db-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.db-details .db-note { margin: 0; }
.db-pill.st-pending { color: #f5a524; background: color-mix(in srgb, #f5a524 14%, transparent); }
.db-pill.st-rejected { color: var(--rk-neg); background: color-mix(in srgb, var(--rk-neg) 14%, transparent); }
.db-pill.adjustment { background: color-mix(in srgb, var(--rk-primary) 16%, transparent); color: var(--rk-primary); }
