:root {
  --bg: #0f1419; --panel: #171d24; --panel2: #1e2630; --line: #2a3340;
  --text: #e6edf3; --muted: #8b98a7; --accent: #4c9aff; --win: #2fbf71; --loss: #ef5350; --warn: #f2b84b;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--loss); min-height: 1.2em; }
.win { color: var(--win); } .loss { color: var(--loss); }
button, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--loss); border: 1px solid var(--loss); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
textarea { width: 100%; min-height: 140px; resize: vertical; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; text-align: center; }
.login-card h1 { margin: 0; font-size: 22px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: rgba(15,20,25,.95); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.top nav a.active { color: var(--text); background: var(--panel2); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px 0; }
.filters select, .filters input { flex: 1 1 130px; max-width: 220px; }
main { padding: 12px 16px 40px; max-width: 1200px; margin: 0 auto; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.grid { display: grid; gap: 10px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 12px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 12px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.chart-box { position: relative; height: 260px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
tr.click { cursor: pointer; } tr.click:hover { background: var(--panel2); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; margin: 1px 2px; color: var(--text); }
.side-buy { color: var(--win); font-weight: 600; } .side-sell { color: var(--loss); font-weight: 600; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; justify-content: flex-end; }
.drawer .panel { width: min(640px, 100%); height: 100%; overflow-y: auto; background: var(--bg); border-left: 1px solid var(--line); padding: 16px; }
.drawer .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.facts { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin-bottom: 12px; }
.facts div span { display: block; color: var(--muted); font-size: 12px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.shot { position: relative; } .shot img { width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.shot button { position: absolute; top: 4px; right: 4px; padding: 2px 8px; font-size: 12px; }
.tag-suggest { margin-top: 6px; }
.tag-suggest .pill { cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 30; display: grid; place-items: center; padding: 10px; }
.lightbox img { max-width: 100%; max-height: 100%; }
.keybox { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: var(--panel2); padding: 10px; border-radius: 8px; border: 1px dashed var(--warn); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 40; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
@media (max-width: 600px) {
  .kpi .value { font-size: 19px; }
  .hide-sm { display: none; }
}
.btn { display: inline-block; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.dot-ok { background: var(--win); } .dot-bad { background: var(--warn); }
.status-dot:not(.dot-ok):not(.dot-bad) { background: var(--muted); }
.verified { margin-bottom: 12px; border-color: var(--win); }
input#vl-label, input#vl-url { width: 100%; }
