:root {
  --bg: #0f1216; --panel: #161b22; --line: #262d36; --text: #e6e9ee; --muted: #8b95a3;
  --accent: #4f8cff; --good: #2fbf71; --bad: #f0524f; --warn: #e5a53b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 16px 0; }
.brand { font-weight: 700; font-size: 18px; }
.brand .sub { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 6px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-top: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.pill { background: var(--line); border-radius: 9px; padding: 0 7px; font-size: 12px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; }
.searchbar input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font-size: 15px; outline: none; padding: 6px 0; }
.mag { opacity: .7; }
button.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
button.secondary, button.small { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button.small { padding: 4px 10px; font-size: 13px; }
button.small.on { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
.row-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; }
label { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
select, input[type=number] { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; }
.status { color: var(--muted); padding: 8px 0; }
.status.error { color: var(--bad); }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: 24px; text-align: center; color: var(--muted); }
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--bg); }
table.data td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.data tr:hover td { background: #141920; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pair b { font-size: 14px; }
.pair a { color: var(--muted); font-size: 12px; text-decoration: none; margin-left: 6px; }
.pair a:hover { color: var(--accent); }
.up { color: var(--good); } .down { color: var(--bad); }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-right: 4px; background: var(--line); color: var(--muted); }
.tag.bad { background: rgba(240,82,79,.15); color: var(--bad); }
.tag.warn { background: rgba(229,165,59,.15); color: var(--warn); }
.tag.good { background: rgba(47,191,113,.15); color: var(--good); }
tr.alerting td { background: rgba(240,82,79,.10) !important; }
.hidden { display: none !important; }
h3 { margin: 20px 0 8px; font-size: 15px; }
.log { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.log li { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log .t { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ilgrid { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px; }
@media (max-width: 760px) { .ilgrid { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h3 { margin-top: 0; }
#ilForm label { display: flex; justify-content: space-between; margin-bottom: 10px; }
#ilForm input, #ilForm select { width: 150px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 14px; }
.kv .big { font-size: 20px; font-weight: 700; }
.verdict { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 13px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; }
svg text { fill: var(--muted); font-size: 11px; }
.seg { display: inline-flex; gap: 4px; }
.risk { border: 0; border-radius: 6px; padding: 3px 8px; font-weight: 600; font-size: 12px; cursor: pointer; }
.risk.l0 { background: rgba(47,191,113,.15); color: var(--good); }
.risk.l1 { background: rgba(229,165,59,.15); color: var(--warn); }
.risk.l2 { background: rgba(240,82,79,.15); color: var(--bad); }
.risk.l3 { background: var(--bad); color: #fff; }
tr.breakdown td { background: var(--panel); white-space: normal; }
.bd { display: grid; grid-template-columns: 180px 60px 1fr; gap: 4px 12px; font-size: 12px; }
.bd .bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; }
.bd .bar i { display: block; height: 100%; background: var(--warn); border-radius: 3px; }
details.method { margin-top: 16px; }
details.method summary { cursor: pointer; font-weight: 600; }
details.method li { margin: 6px 0; font-size: 13px; }
.toprow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lang { display: inline-flex; gap: 4px; }
.chartbox { position: relative; height: 320px; }
.chartbox.tall { height: 420px; }
.chartbox.small { height: 150px; }
.histgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 900px; }
@media (max-width: 760px) { .histgrid { grid-template-columns: 1fr; } .chartbox.tall { height: 340px; } }
tr.breakdown h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.mb { margin-bottom: 8px; }
.log.mini { max-height: 160px; max-width: 520px; }
.log.mini li { padding: 5px 10px; }
.card h3 + .hint { margin-top: -4px; }
.walletform .wf-row { display: flex; gap: 8px; flex-wrap: wrap; }
.walletform input[type=text] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
#wAddr { flex: 1 1 320px; min-width: 0; font-family: ui-monospace, Menlo, monospace; }
#wLabel { flex: 0 1 180px; min-width: 0; }
.chainpick { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.chainpick label { color: var(--text); }
.wallet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.wallet code { color: var(--muted); font-size: 12px; }
.wallet .grow { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.rangebar { position: relative; width: 150px; height: 8px; background: var(--line); border-radius: 4px; margin: 4px 0; }
.rangebar i { position: absolute; top: -3px; width: 3px; height: 14px; border-radius: 2px; background: var(--text); }
.rangebar b { position: absolute; top: 0; height: 8px; border-radius: 4px; background: rgba(79,140,255,.45); }
.warnbox { background: rgba(229,165,59,.1); border: 1px solid rgba(229,165,59,.35); color: var(--text); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.errbox { background: rgba(240,82,79,.08); border: 1px solid rgba(240,82,79,.3); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
#pfAlerts input[type=password] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 260px; max-width: 100%; }
.gate { position: fixed; inset: 0; z-index: 50; background: rgba(8,10,13,.86); display: flex; align-items: center; justify-content: center; padding: 16px; }
.gatebox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 760px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.gatehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.gatehead h2 { margin: 0; font-size: 18px; }
.gatebody { padding: 4px 18px 8px; overflow-y: auto; font-size: 13.5px; line-height: 1.55; }
.gatebody h4 { margin: 14px 0 4px; font-size: 14px; }
.gatebody p, .gatebody li { color: var(--text); }
.gatebody .ver { color: var(--muted); font-size: 12px; }
.gatefoot { border-top: 1px solid var(--line); padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.gatefoot .chk { color: var(--text); font-size: 13.5px; align-items: flex-start; gap: 8px; }
.gatefoot .chk input { margin-top: 3px; }
.gatefoot button { align-self: flex-start; }
.gatefoot button:disabled { opacity: .45; cursor: not-allowed; }
.foot a { color: var(--muted); }
body.gated { overflow: hidden; }
