:root {
  --bg: #15171b; --panel: #1d2026; --line: #2c3038; --text: #e6e8eb; --muted: #8b93a0;
  --good: #4cc38a; --bad: #e5636a; --warn: #e2b04a; --accent: #6aa7ff;
  --dot-green: #3fbf7f; --dot-yellow: #e2b04a; --dot-red: #e5636a;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f7f9; --panel: #fff; --line: #e1e4ea; --text: #1d2128; --muted: #6b7380; --accent: #2f6fd6; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Segoe UI", "Malgun Gothic", sans-serif; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
input, select, button { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
button { cursor: pointer; } button:hover { border-color: var(--accent); }
button.ghost { background: transparent; }
.w5 { width: 5em; } .w6 { width: 6em; }
.chk { display: inline-flex; gap: 4px; align-items: center; }

.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.search { position: relative; flex: 1 1 260px; }
.search input { width: 100%; }
.qres { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; max-height: 60vh; overflow: auto; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.qres div { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.qres div:hover, .qres div.sel { background: var(--line); }
.quick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.status { font-size: 12px; }

.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 49px; z-index: 4; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 9px 12px; white-space: nowrap; }
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; }
main { padding: 10px 12px 80px; max-width: 1200px; margin: 0 auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.note button { padding: 1px 6px; font-size: 12px; }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
.grid th, .grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid th { font-weight: 600; font-size: 12px; color: var(--muted); text-align: left; background: var(--panel); }
#rankTbl thead th { position: sticky; top: 90px; z-index: 2; }
.grid th[data-sort] { cursor: pointer; } .grid th.sorted { color: var(--accent); }
.grid tbody tr.row { cursor: pointer; } .grid tbody tr.row:hover { background: rgba(127,127,127,.07); }
.grid tr.exp td { background: rgba(127,127,127,.05); }
.name { display: flex; align-items: center; gap: 8px; }
.name img { width: 32px; height: 32px; flex: none; }
.name small { color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.green { background: var(--dot-green); } .dot.yellow { background: var(--dot-yellow); } .dot.red { background: var(--dot-red); }
.c-dot { width: 22px; text-align: center; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin: 4px 0 8px; }
.detail-grid b { display: block; font-weight: 600; }
.reasons { margin: 4px 0; padding-left: 18px; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
h3 { margin: 18px 0 6px; font-size: 15px; }
.sum { margin: 10px 0; font-weight: 600; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); border-left: 1px solid var(--line); z-index: 30; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.35); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dt-row { display: flex; align-items: center; gap: 10px; }
.dt-row img { width: 44px; height: 44px; }
.ench-sw { display: inline-flex; gap: 4px; margin-top: 4px; }
.ench-sw button { min-width: 38px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-weight: 600; cursor: pointer; }
.ench-sw button:hover { border-color: var(--accent); }
.ench-sw button.on { background: var(--accent); border-color: var(--accent); color: #fff; cursor: default; }
.drawer-body { padding: 10px 14px 40px; overflow: auto; }
.drawer table.grid th { position: static; }
.age { font-size: 11px; color: var(--muted); }
.tag { font-size: 11px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.ovin { width: 7em; text-align: right; }
.chart { width: 100%; height: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin: 4px 0; }
.legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }

.settings fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.settings legend { padding: 0 6px; font-weight: 600; }
.formrow { display: flex; gap: 10px; align-items: center; }

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.card h1 { margin: 0; font-size: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.35); }

/* 모바일: 수익률·거래량 열 숨김, 탭은 아래 고정 */
@media (max-width: 700px) {
  .c-rate, .c-vol { display: none; }
  .top { position: static; }
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; top: auto; border-top: 1px solid var(--line); border-bottom: 0; justify-content: space-around; z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .grid th { top: 0; }
  .name img { width: 26px; height: 26px; }
  main { padding: 8px 6px 90px; }
  .filters label { font-size: 13px; }
}
