/* Reusable components. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--text); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 6px; }
.btn.lg { padding: 13px 22px; font-size: 15.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.buy { background: var(--up); border-color: var(--up); color: #04231a; }
.btn.sell { background: var(--down); border-color: var(--down); color: #2a0610; }
.btn.icon { padding: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.flat { background: transparent; }
.card h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.005em; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 13.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--faint); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 88px; }
.input-group { position: relative; }
.input-group .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); font-weight: 600; pointer-events: none; }
.input-group .input { padding-right: 62px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { padding: 5px 10px; border-radius: 5px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.quick button:hover { border-color: var(--accent); color: var(--text); }

.seg { display: inline-flex; padding: 3px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--line); gap: 2px; }
.seg button { padding: 6px 13px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raised); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.seg.buysell button.on[data-side="buy"] { background: var(--up); color: #04231a; box-shadow: none; }
.seg.buysell button.on[data-side="sell"] { background: var(--down); color: #2a0610; box-shadow: none; }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 0; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ely { background: var(--ely); } .dot.hl { background: var(--hl); } .dot.sol { background: var(--sol); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-strong); color: var(--muted); background: transparent; }
.chip.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.chip.bad { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.chip.wn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.chip.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: var(--gold-soft); }

.av { width: 40px; height: 40px; border-radius: 8px; flex: none; object-fit: cover; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #0b1b20; }
.av.sm { width: 30px; height: 30px; border-radius: 6px; font-size: 11px; }
.av.lg { width: 60px; height: 60px; border-radius: 16px; font-size: 20px; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th { text-align: right; padding: 12px 16px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--text); }
.tbl th.sorted { color: var(--mint); }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: var(--accent-soft); }
.coin { display: flex; align-items: center; gap: 12px; min-width: 0; }
.coin b { display: block; font-weight: 650; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.coin small { color: var(--muted); font-size: 12.5px; }

.stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }

.splitbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--bg-2); }
.splitbar i { display: block; height: 100%; }
.chbar { display: inline-flex; width: 64px; height: 6px; border-radius: 99px; overflow: hidden; background: var(--bg-2); vertical-align: middle; }
.chbar i { display: block; height: 100%; }
.meter { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 99px; }

.notice { display: flex; gap: 12px; padding: 13px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--raised); font-size: 14px; color: var(--muted); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); color: var(--text); }
.notice.bad { border-color: color-mix(in srgb, var(--down) 50%, transparent); background: color-mix(in srgb, var(--down) 9%, transparent); color: var(--text); }
.notice.ok { border-color: color-mix(in srgb, var(--up) 45%, transparent); background: color-mix(in srgb, var(--up) 8%, transparent); color: var(--text); }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--surface), var(--raised), var(--surface)); background-size: 200% 100%; animation: sk 1.3s linear infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 90; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 14px; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: color-mix(in srgb, var(--up) 60%, transparent); } .toast.bad { border-color: color-mix(in srgb, var(--down) 60%, transparent); }
@media (max-width: 860px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

.modal { position: fixed; inset: 0; z-index: 80; background: rgba(2, 10, 12, 0.66); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal .box { width: min(440px, 100%); max-height: 88vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); font-weight: 600; margin-top: 8px; text-align: left; }
.opt:hover { border-color: var(--accent); }

.palette { position: fixed; inset: 0; z-index: 85; background: rgba(2, 10, 12, 0.6); backdrop-filter: blur(4px); display: grid; align-items: start; justify-items: center; padding: 12vh 16px 0; }
.palette .box { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.palette input { width: 100%; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; outline: none; font-size: 16px; }
.palette .res { max-height: 50vh; overflow: auto; padding: 6px; }
.palette .res a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 7px; }
.palette .res a:hover, .palette .res a.on { background: var(--accent-soft); }

.demo-banner { background: var(--gold-soft); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); text-align: center; padding: 7px 16px; font-size: 13px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 8px; border: 1px solid var(--line-strong); margin-bottom: 14px; cursor: pointer; }
.check-row input { margin-top: 4px; accent-color: var(--sol); }
.check-row b { font-weight: 600; }
