/* =====================================================================
   Genexus Alpha Ecosystem — hệ giao diện dark, mobile-first
   (đợt thiết kế lại 2026-11-15; chỉ đổi vỏ, không đổi hành vi).

   TOKEN ĐÃ CHỐT (tự đặt, không lấy file/font/ảnh của app tham khảo):
     Nền trang ............ --bg         #000000 (đen thuần)
     Thẻ .................. --surface    #141716  (xám rất tối, ngả lục nhẹ)
     Thẻ lồng / input ..... --surface-2  #1c201f
     Header/thanh dưới .... --chrome     #0f1211
     Viền mảnh ............ --line       #262b2a
     Chữ chính / phụ ...... --text #f3f5f4 · --muted #9aa4a1 · --faint #6b7572
     Accent (teal) ........ --accent #2dd4bf · --accent-strong #14b8a6
                            --accent-ink #04201c (chữ trên nền accent)
                            --accent-soft rgba(45,212,191,.12)
     Tăng / mua ........... --up   #22c55e  (soft rgba(34,197,94,.14))
     Giảm / bán ........... --down #f65656  (soft rgba(246,86,86,.14))
     Cảnh báo (disclaimer)  --warn #f5b84a  (soft rgba(245,184,74,.10))
     Thông tin (cổng) ..... --info #7aa2ff  (soft rgba(122,162,255,.10))
     Bo góc ............... --r-sm 10px · --r 14px · --r-lg 20px · --r-pill 999px
     Bóng mềm ............. --shadow 0 8px 28px rgba(0,0,0,.45)
     Chữ .................. system-ui (không nhúng font file)
                            tiêu đề trang 28px mobile → 44px desktop,
                            tiêu đề mục 20–22px, thân 15px, nhãn 12–13px
     Bố cục ............... mobile 1 cột + thanh tab dưới 64px;
                            ≥1024px sidebar trái 240px + nội dung ≤1100px
   ===================================================================== */

:root {
  --bg: #000000;
  --surface: #141716;
  --surface-2: #1c201f;
  --chrome: #0f1211;
  --line: #262b2a;
  --line-strong: #343a39;
  --text: #f3f5f4;
  --muted: #9aa4a1;
  --faint: #6b7572;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-ink: #04201c;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --up: #22c55e;
  --up-soft: rgba(34, 197, 94, 0.14);
  --down: #f65656;
  --down-soft: rgba(246, 86, 86, 0.14);
  --warn: #f5b84a;
  --warn-soft: rgba(245, 184, 74, 0.1);
  --info: #7aa2ff;
  --info-soft: rgba(122, 162, 255, 0.1);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --sidebar-w: 240px;
  --tabbar-h: 64px;
  --content-max: 1100px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Khung app ---------- */

.app-main {
  padding: 16px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  min-width: 0;
}

.app-main > .content {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Header mobile */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 12px 0 16px;
  background: rgba(15, 18, 17, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  margin-right: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.brand small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.topbar-auth {
  font-size: 13px;
  white-space: nowrap;
}

/* Sidebar: drawer trên mobile, cố định trên desktop */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: min(300px, 86vw);
  display: flex;
  flex-direction: column;
  background: var(--chrome);
  border-right: 1px solid var(--line);
  transform: translateX(-102%);
  transition: transform 0.22s ease;
  overflow-y: auto;
}

body.nav-open .sidebar {
  transform: none;
  box-shadow: var(--shadow);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

body.nav-open .nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.nav-group {
  padding: 6px 10px;
}

.nav-group-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: var(--r-sm);
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav-link:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--surface-2);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 16px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text);
}

.avatar-dot {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #5b7cfa 60%, #9b6bff);
}

/* Thanh tab dưới mobile */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 18, 17, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab:hover {
  text-decoration: none;
  color: var(--text);
}

.tab.active {
  color: var(--accent);
}

@media (min-width: 1024px) {
  .topbar,
  .tabbar,
  .nav-backdrop,
  .sidebar-close {
    display: none;
  }

  .sidebar {
    transform: none;
    width: var(--sidebar-w);
    box-shadow: none;
  }

  .app-main {
    margin-left: var(--sidebar-w);
    padding: 36px 40px 56px;
  }
}

/* ---------- Chữ ---------- */

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 6px 0 14px;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
}

h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 10px;
}

p {
  margin: 0 0 12px;
}

@media (min-width: 768px) {
  h1 {
    font-size: 36px;
  }

  h2 {
    font-size: 22px;
  }
}

@media (min-width: 1280px) {
  h1 {
    font-size: 44px;
  }
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lead {
  color: var(--muted);
  font-size: 15px;
  max-width: 760px;
}

.note {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Thẻ & mục ---------- */

.page-head {
  margin: 4px 0 18px;
}

.card,
.content > section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card > :last-child,
.content > section > :last-child {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .card,
  .content > section {
    padding: 22px 24px;
  }
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.more-link {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.grid-2 {
  display: grid;
  gap: 16px;
}

.grid-2 > .card,
.grid-2 > section {
  margin: 0;
}

@media (min-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.stack-16 {
  margin-bottom: 16px;
}

/* Khối ghi chú */
.disclaimer,
.reason-note,
.pattern-note,
.gate-note,
.error {
  border-radius: var(--r);
  padding: 12px 14px;
  margin: 0 0 14px;
  font-size: 14px;
  border: 1px solid;
}

.disclaimer {
  background: var(--warn-soft);
  border-color: rgba(245, 184, 74, 0.35);
  color: #f1e3c4;
}

.disclaimer strong {
  color: var(--warn);
}

.reason-note,
.pattern-note {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: #d6dcda;
}

.reason-note strong,
.pattern-note strong {
  color: var(--text);
}

.gate-note {
  background: var(--info-soft);
  border-color: rgba(122, 162, 255, 0.35);
  color: #dbe4ff;
}

.error {
  background: var(--down-soft);
  border-color: rgba(246, 86, 86, 0.4);
  color: #ffd9d9;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: var(--r-pill);
  padding: 6px 12px;
}

.live-status::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.2);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---------- Pill / nút ---------- */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

button:hover,
.btn:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

button.ghost,
.btn.ghost,
.filter-btn,
.watchlist-remove,
#chat-new-session,
#unlink-button {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
  font-weight: 600;
}

button.ghost:hover,
.btn.ghost:hover,
.filter-btn:hover,
#chat-new-session:hover,
#unlink-button:hover {
  background: var(--surface-2);
  border-color: var(--faint);
}

.watchlist-remove {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.watchlist-remove:hover {
  color: var(--down);
  border-color: rgba(246, 86, 86, 0.5);
  background: var(--down-soft);
}

.filter-btn {
  min-height: 34px;
  padding: 0 14px;
  margin: 0 6px 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.filter-btn.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.pill-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 0 14px;
  scrollbar-width: none;
}

.pill-row::-webkit-scrollbar {
  display: none;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.pill-link .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
  vertical-align: middle;
}

.badge.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(45, 212, 191, 0.35);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(245, 184, 74, 0.4);
}

.badge.off {
  background: var(--down-soft);
  color: #ff9c9c;
  border-color: rgba(246, 86, 86, 0.35);
}

/* Hướng LONG/SHORT */
.dir {
  display: inline-flex;
  padding: 1px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.dir-long,
.dir-buy {
  background: var(--up-soft);
  color: var(--up);
}

.dir-short,
.dir-sell {
  background: var(--down-soft);
  color: var(--down);
}

.up {
  color: var(--up);
}

.down {
  color: var(--down);
}

/* ---------- Form ---------- */

label {
  display: block;
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

input[type="email"],
input[type="text"],
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input[type="email"]:focus,
input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Thanh tìm/thêm mã dạng pill */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  margin: 0 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-bar label {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-bar label svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--faint);
}

.search-bar input[type="text"] {
  margin: 0;
  padding: 8px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}

.search-bar input[type="text"]:focus {
  box-shadow: none;
}

/* ---------- Bảng ---------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--chrome);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

tbody th {
  color: var(--muted);
  font-weight: 500;
}

td.note {
  white-space: normal;
}

.kv-table td:last-child,
.kv-table th + td {
  font-weight: 600;
  color: var(--text);
}

/* ---------- Ô chỉ số ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

@media (min-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat-grid.cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.stat {
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-value.big {
  font-size: 26px;
}

/* ---------- Thẻ tín hiệu ---------- */

.signal-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .signal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .signal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.signal-card {
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}

.signal-card:hover {
  border-color: var(--line-strong);
}

.signal-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sym-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
  border: 1px solid rgba(45, 212, 191, 0.3);
}

.sym-avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.signal-sym {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.signal-when {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.signal-top > div {
  flex: 1;
  min-width: 0;
}

#rss-filters {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0 6px;
}

#rss-filters .filter-btn {
  flex: none;
}

.signal-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 0;
}

.signal-fields div {
  min-width: 0;
}

.signal-fields dt {
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.signal-fields dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.signal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.signal-foot b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Danh sách dòng (tin, cài đặt, watchlist) ---------- */

.row-list,
#rss-hub ul,
#site-hub ul,
#hot-news ul,
.seo-list,
#alert-settings-summary,
#companion-preview {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.row-list > li,
#rss-hub li,
#site-hub li,
#hot-news li,
.seo-list > li,
#alert-settings-summary li,
#companion-preview li {
  padding: 11px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.row-list > li:last-child,
#rss-hub li:last-child,
#site-hub li:last-child,
#hot-news li:last-child,
.seo-list > li:last-child,
#alert-settings-summary li:last-child,
#companion-preview li:last-child {
  border-bottom: 0;
}

#rss-hub li > a,
#site-hub li > a,
#hot-news li > a,
.seo-list li > a {
  color: var(--text);
  font-weight: 600;
}

#rss-hub li > a:hover,
#site-hub li > a:hover,
#hot-news li > a:hover,
.seo-list li > a:hover {
  color: var(--accent);
}

.rss-group,
.site-group {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px 6px;
  margin: 0 0 12px;
}

.rss-group h3,
.site-group h3 {
  font-size: 15px;
}

.seo-list.cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.seo-list.cols > li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.seo-list.cols > li:last-child {
  border-bottom: 1px solid var(--line);
}

/* Toggle cài đặt (alerts) */
.alert-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "text switch"
    "state switch";
  gap: 2px 16px;
  align-items: center;
  padding: 14px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
}

.alert-toggle:last-child {
  border-bottom: 0;
}

.alert-toggle .toggle-text {
  grid-area: text;
}

.alert-toggle strong {
  color: var(--text);
}

.alert-toggle [id^="state-"] {
  grid-area: state;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

.alert-toggle input[type="checkbox"] {
  grid-area: switch;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 46px;
  height: 26px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  cursor: pointer;
  transition: background 0.15s;
}

.alert-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.alert-toggle input[type="checkbox"]:checked {
  background: var(--accent);
}

.alert-toggle input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.alert-toggle input[type="checkbox"]:checked ~ [id^="state-"] {
  color: var(--accent);
}

/* Dòng trạng thái kênh */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 0 0 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* Thanh tiến trình (credit) */
.meter {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 8px 0 12px;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

/* ---------- Trang mã ---------- */

.symbol-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 14px;
}

.symbol-head h1 {
  margin: 0;
}

.tabstrip {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabstrip::-webkit-scrollbar {
  display: none;
}

.tabstrip a {
  flex: none;
  padding: 10px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.tabstrip a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tabstrip a:hover {
  color: var(--text);
  text-decoration: none;
}

[id] {
  scroll-margin-top: 72px;
}

.chart-frame {
  padding: 8px;
  border-radius: var(--r);
  background: var(--chrome);
  border: 1px solid var(--line);
  margin: 0 0 10px;
}

.tradingview-widget-container {
  height: 420px;
  margin: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: repeating-linear-gradient(90deg, transparent 0 79px, rgba(255, 255, 255, 0.03) 79px 80px),
    repeating-linear-gradient(0deg, transparent 0 59px, rgba(255, 255, 255, 0.03) 59px 60px);
}

@media (min-width: 768px) {
  .tradingview-widget-container {
    height: 480px;
  }
}

/* ---------- Tùy chọn biểu đồ (A6: nhớ trên trình duyệt) ---------- */

.chart-prefs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 16px;
  margin: 0 0 10px;
}

.chart-prefs label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.chart-prefs select {
  display: block;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.chart-prefs select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chart-prefs .note {
  margin: 0;
}

/* ---------- Máy tính (A4) ---------- */

.calc-form select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.calc-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Backtest (C2a) ---------- */

.backtest-form .filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 16px;
}

.backtest-form select,
.backtest-form input[type="date"],
.backtest-form input[type="time"],
.backtest-form input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.backtest-form select:focus,
.backtest-form input[type="date"]:focus,
.backtest-form input[type="time"]:focus,
.backtest-form input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Scan (C1a) ---------- */

.scan-form .filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 16px;
}

.scan-form input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.scan-form input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Chat ---------- */

.chat-hero {
  text-align: center;
  padding: 10px 0 4px;
}

.chat-orb {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8ff5e6, var(--accent) 45%, #0d5c52 100%);
  box-shadow: 0 0 0 10px rgba(45, 212, 191, 0.08), 0 0 40px rgba(45, 212, 191, 0.35);
}

.composer {
  position: relative;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer label {
  margin: 0;
}

.composer textarea {
  margin: 4px 0 0;
  border: 0;
  background: transparent;
  resize: vertical;
  min-height: 84px;
  padding: 8px 6px;
}

.composer textarea:focus {
  box-shadow: none;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}

.send-btn {
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.divider-label::before,
.divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

#chat-suggestions {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 0 12px;
}

@media (min-width: 768px) {
  #chat-suggestions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.suggestion-btn {
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 500;
  text-align: left;
  white-space: normal;
}

.suggestion-btn::after {
  content: "›";
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.suggestion-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.chat-message {
  padding: 10px 14px;
  margin: 0 0 8px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.chat-role {
  font-weight: 700;
  color: var(--accent);
  margin-right: 4px;
}

.chat-session {
  padding: 12px 0 4px;
  margin: 0;
  border-top: 1px solid var(--line);
}

.chat-session:first-child {
  border-top: 0;
  padding-top: 0;
}

/* ---------- Trang đăng nhập / điều khoản ---------- */

.auth-card {
  max-width: 460px;
  margin: 12px auto 0;
}

.auth-card form button[type="submit"] {
  width: 100%;
  margin-top: 4px;
}

.terms-card {
  max-width: 820px;
}

.terms-card h2 {
  font-size: 17px;
  margin-top: 20px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---------- Skeleton khi tải ---------- */

.skeleton {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.skeleton span {
  display: block;
  height: 14px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--surface-2) 0%, #262b2a 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton span:nth-child(2) {
  width: 82%;
}

.skeleton span:nth-child(3) {
  width: 64%;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Footer ---------- */

.page-foot {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  margin: 18px 0 0;
}
