:root {
  --bg: #f3f5f8; --panel: #fff; --panel2: #f8f9fb; --line: #e4e7ec; --text: #161a22; --muted: #6b7380;
  --accent: #f5a623; --accent-ink: #111; --up: #0a9f55; --down: #e0383e; --up-bg: rgba(10,159,85,.12); --down-bg: rgba(224,56,62,.12);
  --hdr: #12161f; --hdr-text: #e9edf3; --hdr-muted: #9aa3b2; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
:root[data-theme="dark"] {
  --bg: #0d1016; --panel: #151a23; --panel2: #1a202b; --line: #262d3a; --text: #e6eaf0; --muted: #8b94a3;
  --up: #22c271; --down: #ff5a5f; --up-bg: rgba(34,194,113,.14); --down-bg: rgba(255,90,95,.14);
  --hdr: #0a0d12; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--hdr); color: var(--hdr-text); }
.bar { display: flex; align-items: center; gap: 18px; padding: 10px 20px; max-width: 1400px; margin: 0 auto; }
.logo { font-size: 19px; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo b { color: var(--accent); }
.logo .mark { background: var(--accent); color: var(--accent-ink); width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; }
nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav a { padding: 7px 11px; border-radius: 7px; color: var(--hdr-muted); white-space: nowrap; font-weight: 500; }
nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
nav a.on { color: var(--accent-ink); background: var(--accent); }
.search { position: relative; }
.search input { width: 230px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: 7px 11px; outline: none; }
.search input:focus { border-color: var(--accent); }
.qres { position: absolute; right: 0; top: 40px; width: 380px; max-height: 420px; overflow: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.qres div { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; justify-content: space-between; }
.qres div:hover, .qres div.sel { background: var(--panel2); }
.qres small { color: var(--muted); }
.icon-btn { background: transparent; border: 1px solid rgba(255,255,255,.15); color: var(--hdr-text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; }

.ticker { display: flex; gap: 0; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.07); scrollbar-width: none; max-width: 1400px; margin: 0 auto; }
.tk { flex: 1 0 auto; min-width: 118px; padding: 8px 14px; border-right: 1px solid rgba(255,255,255,.07); cursor: pointer; }
.tk:hover { background: rgba(255,255,255,.04); }
.tk .l { font-size: 11px; color: var(--hdr-muted); letter-spacing: .04em; font-weight: 600; }
.tk .v { font-size: 15px; font-weight: 600; }
.tk .c { font-size: 12px; font-weight: 600; }

main { max-width: 1400px; margin: 0 auto; padding: 20px; min-height: 70vh; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
.sub { color: var(--muted); margin: 0 0 16px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } .search input { width: 140px; } .bar { flex-wrap: wrap; } nav { order: 3; flex-basis: 100%; } main { padding: 12px; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.card-h a.more { color: var(--muted); font-size: 13px; }
.card-h a.more:hover { color: var(--text); }

.big { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.bigc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow); position: relative; }
.bigc:hover { border-color: var(--accent); }
.bigc .l { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.bigc .v { font-size: 22px; font-weight: 650; margin: 2px 0; }
.bigc svg { position: absolute; right: 12px; bottom: 12px; }

/* tables */
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.tools input, .tools select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 200px; }
.tools input:focus, .tools select:focus { border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { white-space: nowrap; flex: 0 0 auto; border: 0; background: transparent; padding: 7px 12px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.tblwrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel2); position: sticky; top: 0; cursor: pointer; user-select: none; }
th.nosort { cursor: default; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
th .arr { color: var(--accent); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel2); }
td .code { font-weight: 650; }
td .nm { color: var(--muted); font-size: 12px; display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
td.wrap .nm { white-space: normal; max-width: 420px; min-width: 240px; }
.tools input[type="checkbox"] { min-width: 0; vertical-align: -2px; }
.tools label { display: inline-flex; align-items: center; gap: 6px; }
.up { color: var(--up); }
.down { color: var(--down); }
.pill { display: inline-block; min-width: 66px; padding: 2px 7px; border-radius: 6px; font-weight: 650; text-align: right; }
.pill.up { background: var(--up-bg); }
.pill.down { background: var(--down-bg); }
.star { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0 4px; }
.star.on { color: var(--accent); }
.flash-up { animation: fu 1.2s; }
.flash-down { animation: fd 1.2s; }
@keyframes fu { from { background: var(--up-bg); } to { background: transparent; } }
@keyframes fd { from { background: var(--down-bg); } to { background: transparent; } }
.note { color: var(--muted); font-size: 12px; padding: 10px 14px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.morebtn { display: block; width: 100%; padding: 12px; background: var(--panel2); border: 0; border-top: 1px solid var(--line); cursor: pointer; font-weight: 600; color: var(--muted); }
.morebtn:hover { color: var(--text); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* converter */
.conv { padding: 18px; display: grid; gap: 14px; grid-template-columns: 1fr auto 1fr; align-items: end; }
.conv label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.conv input, .conv select { width: 100%; font-size: 18px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
.conv .swap { height: 46px; width: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 18px; }
.conv-res { padding: 0 18px 18px; font-size: 26px; font-weight: 650; }
.conv-res small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
@media (max-width: 760px) { .conv { grid-template-columns: 1fr; } }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(5,8,12,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.dialog { background: var(--panel); border-radius: 14px; width: min(920px, 100%); max-height: 92vh; overflow: auto; position: relative; padding: 20px 22px; border: 1px solid var(--line); }
.close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 28px; color: var(--muted); cursor: pointer; }
.dh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; padding-right: 30px; }
.dh .p { font-size: 30px; font-weight: 700; }
.dh .c { font-size: 16px; font-weight: 650; }
.dmeta { color: var(--muted); margin: 2px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 14px; }
.stats div { background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.stats small { color: var(--muted); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.chartbox { position: relative; height: 340px; margin-top: 10px; }
.chartbox canvas { width: 100%; height: 100%; display: block; }
.chartbox .tip { position: absolute; pointer-events: none; background: var(--hdr); color: #fff; padding: 5px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); }
.chartbox .msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

footer { max-width: 1400px; margin: 0 auto; padding: 16px 20px 30px; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
