/* Vecta Signals – web app nhẹ (không framework). Màu theo nhận diện thương hiệu. */
:root {
  --bg: #070B19;
  --card: #0F172A;
  --card2: #131C33;
  --line: #1E293B;
  --gold: #EAB308;
  --cyan: #06B6D4;
  --green: #22C55E;
  --red: #EF4444;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 60px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
a { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Màn khởi động ---------- */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.boot img { width: 88px; height: 88px; border-radius: 22px; }
.boot b { letter-spacing: 4px; font-size: 18px; }
.boot b span, .brand span { color: var(--gold); font-weight: 300; }

/* ---------- Khung chính ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
  min-height: calc(var(--safe-top) + 54px);
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.iconbtn { flex: none; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; display: grid; place-items: center; color: var(--text); cursor: pointer; }
.iconbtn:active { background: var(--line); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pages { flex: 1; position: relative; min-height: 0; }
.page {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 24px);
}
.page.sub { padding-bottom: calc(var(--safe-bottom) + 24px); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex;
  height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.nav button {
  flex: 1; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; font-size: 11px; cursor: pointer; position: relative;
}
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--gold); }
.nav button.on::before { content: ""; position: absolute; top: 6px; width: 46px; height: 28px; border-radius: 14px; background: rgba(234,179,8,.14); z-index: -1; }
.nav .dot { position: absolute; top: 8px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---------- Thành phần ---------- */
.section { margin: 20px 16px 8px; font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.note { margin: 0 16px 10px; font-size: 11px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin: 0 16px 10px; overflow: hidden; }
.card.pad { padding: 14px; }
.tap { cursor: pointer; }
.tap:active { background: var(--card2); }
.row { display: flex; align-items: center; gap: 8px; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.b-gold { color: var(--gold); background: rgba(234,179,8,.14); }
.b-green { color: var(--green); background: rgba(34,197,94,.14); }
.b-muted { color: var(--muted); background: rgba(148,163,184,.14); }
.b-buy { color: #000; background: var(--green); }
.b-sell { color: #000; background: var(--red); }

.sym-name { font-size: 16px; font-weight: 700; }
.sym-sub { font-size: 12px; color: var(--muted); }
.locked { opacity: .38; }
.stat-up { color: var(--green); }
.stat-down { color: var(--red); }
.chev { width: 20px; height: 20px; color: var(--muted); flex: none; }

/* Thẻ tín hiệu */
.sig { border-left: 3px solid var(--green); padding: 14px; }
.sig.sell { border-left-color: var(--red); }
.sig .kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.sig .kv3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.kv-k { font-size: 11px; color: var(--muted); }
.kv-v { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv-v.big { font-size: 17px; }
.c-red { color: var(--red); }
.c-green { color: var(--green); }
.c-gold { color: var(--gold); }
.sig-time { margin-top: 10px; font-size: 11px; color: var(--muted); }
.sig-sym { margin-top: 10px; font-weight: 700; }

/* Bộ lọc */
.seg { display: flex; margin: 10px 16px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 4px; font-size: 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--gold); color: #000; font-weight: 600; }

/* Khung thông báo / trạng thái */
.banner { margin: 10px 16px 0; padding: 14px; border-radius: 12px; border: 1px solid rgba(234,179,8,.4); background: rgba(234,179,8,.08); display: flex; gap: 12px; line-height: 1.45; }
.banner svg { flex: none; width: 22px; height: 22px; color: var(--gold); }
.push { margin: 8px 16px 4px; padding: 14px; border-radius: 12px; background: var(--card); border: 1px solid rgba(6,182,212,.45); }
.push.ok { border-color: var(--line); }
.push .ico { flex: none; width: 24px; height: 24px; color: var(--cyan); }
.push.ok .ico { color: var(--green); }
.push .t { font-weight: 700; }
.push .d { margin-top: 4px; color: var(--muted); font-size: 13px; white-space: pre-line; }
.push .acts { margin-top: 10px; text-align: right; }
.push .msg { margin-top: 8px; font-size: 13px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

.empty { text-align: center; padding: 48px 32px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; }
.empty .t { margin-top: 12px; color: var(--text); font-weight: 600; font-size: 16px; }
.empty .d { margin-top: 6px; }
.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }

/* Nút */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 0 16px; height: 48px; font-weight: 700; font-size: 15px; background: var(--gold); color: #000; cursor: pointer; }
.btn.block { width: 100%; }
.btn.sm { height: 38px; font-size: 14px; padding: 0 14px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn.link { background: none; color: var(--gold); font-weight: 500; height: 40px; }
.btn.link.muted { color: var(--muted); }
.btn:disabled { opacity: .55; }
.btn:active:not(:disabled) { filter: brightness(.9); }

/* Danh sách cài đặt */
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--line); }
.item svg.i { width: 22px; height: 22px; flex: none; color: var(--muted); }
.item .v { font-weight: 600; text-align: right; }
.item.danger, .item.danger svg.i { color: var(--red); }
.kvrow { display: flex; gap: 12px; padding: 12px 16px; }
.kvrow + .kvrow { border-top: 1px solid var(--line); }
.kvrow .k { width: 110px; flex: none; color: var(--muted); }
.kvrow .v { flex: 1; text-align: right; font-weight: 600; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: rgba(234,179,8,.15); color: var(--gold); display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }

/* Công tắc */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 30px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #CBD5E1; transition: transform .2s; }
.switch input:checked + span { background: rgba(234,179,8,.5); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--gold); }
.switch input:disabled + span { opacity: .5; }

/* Biểu mẫu */
.auth { position: fixed; inset: 0; overflow-y: auto; padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px); }
.auth .wrap { max-width: 420px; margin: 0 auto; }
.logo { text-align: center; margin: 24px 0 28px; }
.logo img { width: 88px; height: 88px; border-radius: 22px; }
.brand { font-size: 26px; letter-spacing: 3px; font-weight: 800; margin-top: 16px; }
.slogan { color: var(--muted); font-size: 11px; letter-spacing: 1.2px; margin-top: 6px; }
.field { position: relative; margin-bottom: 12px; }
.field input {
  width: 100%; height: 54px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  font-size: 16px; outline: none;
}
.field input:focus { border-color: var(--gold); }
.field.icon input { padding-left: 46px; }
.field.icon > svg { position: absolute; left: 14px; top: 16px; width: 22px; height: 22px; color: var(--muted); pointer-events: none; }
.field .eye { position: absolute; right: 6px; top: 8px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 2px; }
.err { color: var(--red); margin: 8px 0; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.disclaimer { color: var(--muted); font-size: 11px; text-align: center; margin-top: 24px; line-height: 1.5; }
.boxed { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.center { text-align: center; }

/* Giới thiệu */
.refcode { font-size: 28px; font-weight: 800; letter-spacing: 4px; color: var(--gold); margin: 8px 0 12px; user-select: all; -webkit-user-select: all; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 16px 16px; }
.stats2 .card { margin: 0; padding: 16px; }
.stats2 .v { font-size: 20px; font-weight: 700; margin-top: 6px; }

/* Hộp thoại */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal .box { width: 100%; max-width: 420px; max-height: 85vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Thông báo nổi */
#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px); z-index: 30;
  background: #1E293B; color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 14px;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }
