:root {
  color-scheme: dark;
  --bg: #080c11;
  --panel: #101720;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.17);
  --text: #eef5f7;
  --muted: #83909d;
  --cyan: #68e7dc;
  --cyan-soft: rgba(104,231,220,.1);
  --green: #80e3a3;
  --amber: #f3c56f;
  --red: #ff808b;
  --purple: #b7a4ff;
  --shadow: 0 22px 55px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: radial-gradient(circle at 8% 0%, rgba(40,113,111,.18), transparent 31%), radial-gradient(circle at 95% 5%, rgba(73,61,124,.16), transparent 34%), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
.shell { width: min(1240px, calc(100% - 34px)); margin: 0 auto; padding: 26px 0 42px; }
.card { border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(155deg, rgba(17,24,33,.97), rgba(11,17,24,.98)); box-shadow: var(--shadow); }
header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; }
.mark { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(104,231,220,.34); border-radius: 13px; color: var(--cyan); background: var(--cyan-soft); font-weight: 900; }
.brand p, .label { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .14em; }
.brand h1 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
button { min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; font-weight: 850; }
.primary { color: #061312; background: var(--cyan); }
.secondary { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,.045); }
.danger { color: #260a0c; background: var(--red); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 26px; margin-top: 20px; padding: 27px 29px; }
.hero h2 { overflow: hidden; margin: 5px 0 7px; font: 700 clamp(18px, 3vw, 28px) "SFMono-Regular", Consolas, monospace; letter-spacing: -.045em; text-overflow: ellipsis; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.hero-actions { display: flex; align-items: center; gap: 9px; }
.badge { display: inline-flex; min-height: 36px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.03); font-size: 12px; font-weight: 850; }
.badge.ok { color: var(--green); border-color: rgba(128,227,163,.24); }
.main-tabs { display: flex; gap: 8px; margin-top: 14px; padding: 6px; border: 1px solid var(--line); border-radius: 15px; background: rgba(8,13,19,.72); }
.main-tab { flex: 1; min-height: 50px; color: var(--muted); background: transparent; }
.main-tab.active { color: var(--cyan); border-color: rgba(104,231,220,.28); background: var(--cyan-soft); }
.tab-panel { margin-top: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 10px; }
.metric { padding: 18px 20px; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 30px; font-variant-numeric: tabular-nums; }
.metric.accent { border-color: rgba(104,231,220,.26); background: linear-gradient(145deg, rgba(37,78,79,.32), rgba(11,17,24,.98)); }
.metric.accent strong { color: var(--cyan); }
.records { margin-top: 10px; padding: 23px; }
.records-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.records h2, .manual-lookup h2, .modal h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.history-actions { display: flex; gap: 8px; }
.records-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.filters { display: flex; align-items: center; gap: 7px; }
.filter { min-height: 40px; color: var(--muted); border-color: var(--line); background: transparent; }
.filter.active { color: var(--cyan); border-color: rgba(104,231,220,.3); background: var(--cyan-soft); }
input { min-height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; color: var(--text); background: rgba(2,6,10,.5); font-size: 14px; }
input:focus { border-color: rgba(104,231,220,.55); box-shadow: 0 0 0 3px rgba(104,231,220,.07); }
#searchInput { width: 260px; }
.cache-status { color: var(--muted); font-size: 12px; font-weight: 700; }
.cache-status.cached { color: var(--amber); }
.cache-status.fresh { color: var(--green); }
.scan-state { margin-top: 18px; padding: 17px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
.record-list { display: grid; max-height: 680px; overflow: auto; margin-top: 12px; scrollbar-color: rgba(255,255,255,.15) transparent; }
.record { display: grid; grid-template-columns: 155px minmax(180px, .85fr) minmax(250px, 1.3fr) 150px 115px; align-items: center; gap: 16px; min-height: 92px; padding: 14px 8px; border-bottom: 1px solid var(--line); }
.record:last-child { border-bottom: 0; }
.record time, .record small { color: var(--muted); font-size: 12px; }
.record strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.record .amount { margin-bottom: 5px; color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.tx-link { display: inline-block; margin-top: 7px; color: var(--cyan); font: 12px "SFMono-Regular", Consolas, monospace; text-decoration: none; }
.tx-link:hover { text-decoration: underline; }
.state { display: inline-flex; width: fit-content; min-height: 30px; align-items: center; padding: 0 10px; border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.04); font-size: 11px; font-weight: 850; letter-spacing: .04em; }
.state.ready { color: var(--cyan); background: var(--cyan-soft); }
.state.completed { color: var(--green); background: rgba(128,227,163,.09); }
.state.waiting_vaa, .state.executor_active { color: var(--amber); background: rgba(243,197,111,.08); }
.state.blocked { color: var(--red); background: rgba(255,128,139,.08); }
.recover-button { width: 100%; min-height: 42px; padding: 0 12px; }
.failure { display: block; overflow: hidden; margin-top: 5px; color: var(--red) !important; text-overflow: ellipsis; white-space: nowrap; }
.audit-strip { display: flex; align-items: center; justify-content: space-between; gap: 26px; margin-top: 10px; padding: 18px 22px; }
.audit-strip strong { font-size: 15px; }
.audit-strip p { max-width: 720px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: right; }
footer { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 11px; }
footer a { overflow: hidden; color: var(--text); font: 12px "SFMono-Regular", Consolas, monospace; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; z-index: 30; top: 18px; left: 50%; display: none; max-width: min(680px, calc(100% - 28px)); padding: 14px 18px; border: 1px solid rgba(255,128,139,.35); border-radius: 11px; color: var(--red); background: rgba(28,11,15,.97); box-shadow: var(--shadow); font-size: 13px; transform: translateX(-50%); }
.toast.show { display: block; }
.modal { position: fixed; z-index: 20; inset: 0; display: grid; padding: 20px; place-items: center; background: rgba(0,0,0,.7); backdrop-filter: blur(8px); }
.modal-card { width: min(560px, 100%); padding: 25px; }
.modal-facts { display: grid; grid-template-columns: .65fr 1.35fr; gap: 8px; margin: 18px 0; }
.modal-facts div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.13); }
.modal-facts span { display: block; color: var(--muted); font-size: 8px; }
.modal-facts strong { display: block; overflow: hidden; margin-top: 5px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.modal p { margin: 13px 0 9px; color: var(--muted); font-size: 10px; }
.wallet-card { width: min(480px, 100%); }
.wallet-options { display: grid; gap: 8px; margin-top: 18px; }
.wallet-option { display: flex; min-height: 68px; align-items: center; gap: 13px; padding: 10px 12px; color: var(--text); border-color: var(--line); background: rgba(255,255,255,.025); text-align: left; }
.wallet-option:not(:disabled):hover { border-color: rgba(104,231,220,.36); background: var(--cyan-soft); }
.wallet-option > span:last-child { display: grid; gap: 4px; }
.wallet-option strong { font-size: 15px; }
.wallet-option small { color: var(--muted); font-size: 12px; font-weight: 650; }
.wallet-option.available small { color: var(--green); }
.wallet-logo { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 12px; color: #fff; font-size: 13px; font-weight: 950; }
.wallet-logo.okx { color: #111; background: #fff; }
.wallet-logo.rabby { background: #7084ff; }
.wallet-logo.metamask { background: #df6f38; }
.modal-close { width: 100%; margin-top: 10px; }
.modal code.phrase { display: block; padding: 11px 12px; border: 1px dashed rgba(255,128,139,.35); border-radius: 9px; color: var(--red); background: rgba(255,128,139,.04); font-size: 11px; }
.modal input { width: 100%; margin-top: 9px; }
.actions { display: flex; gap: 8px; margin-top: 12px; }
.actions button { flex: 1; }
.manual-lookup { margin-top: 10px; padding: 28px; }
.manual-lookup > p { max-width: 820px; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.manual-input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 22px; }
.tx-input { min-height: 58px; font: 15px "SFMono-Regular", Consolas, monospace; }
.manual-input-row button { min-width: 150px; }
.manual-result { max-height: none; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .record { grid-template-columns: 125px 1fr 1.2fr 115px; }
  .record .record-action { grid-column: 4; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 1240px); padding-top: 12px; }
  header, .hero, .records-head, .records-toolbar, .audit-strip { align-items: stretch; flex-direction: column; }
  .hero-actions { width: 100%; }
  .hero-actions button { flex: 1; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .filters { flex-wrap: wrap; }
  #searchInput { width: 100%; }
  .record { grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px 4px; }
  .record .route, .record .record-action { grid-column: 1 / -1; }
  .audit-strip p { text-align: left; }
  .history-actions, .manual-input-row { display: grid; grid-template-columns: 1fr; }
  .main-tabs { flex-direction: column; }
}
