/* Trang public - khong framework, khong build. Mau la token tren :root, co ban toi. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --line: #e3e6eb;
  --fg: #111418; --mut: #5f6b7a; --faint: #8a95a3;
  --acc: #0f766e; --acc-soft: #e6f4f2; --acc-fg: #ffffff;
  --up: #0f8a4a; --up-soft: #e7f6ee; --down: #c62828; --down-soft: #fdecec;
  --warn: #a15c07; --warn-soft: #fdf3e2;
  --radius: 10px; --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f13; --surface: #141920; --surface-2: #1b212a; --line: #252c36;
    --fg: #e7eaee; --mut: #9aa4b1; --faint: #6d7785;
    --acc: #2dd4bf; --acc-soft: #12302d; --acc-fg: #04201d;
    --up: #34d399; --up-soft: #0f2a20; --down: #f87171; --down-soft: #321717;
    --warn: #fbbf24; --warn-soft: #2f2410;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f13; --surface: #141920; --surface-2: #1b212a; --line: #252c36;
  --fg: #e7eaee; --mut: #9aa4b1; --faint: #6d7785;
  --acc: #2dd4bf; --acc-soft: #12302d; --acc-fg: #04201d;
  --up: #34d399; --up-soft: #0f2a20; --down: #f87171; --down-soft: #321717;
  --warn: #fbbf24; --warn-soft: #2f2410;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--mut); }
.faint { color: var(--faint); }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; flex: none; }
.brand svg rect { fill: var(--acc); }
.brand svg path { stroke: var(--acc-fg); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
nav { display: flex; gap: 2px; flex: 1; }
nav a { color: var(--mut); padding: 6px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
nav a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.live { font-size: 13px; color: var(--mut); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.live.on::before { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.live.off::before { background: var(--down); }

#app { flex: 1; padding-top: 28px; padding-bottom: 48px; } /* id: .wrap dat padding ngang, khong de len padding doc */
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.01em; }
.lede { color: var(--mut); margin: 0 0 20px; max-width: 62ch; }
.section { margin-top: 28px; scroll-margin-top: 72px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }

/* ---- controls ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--mut); font: inherit; font-size: 14px; padding: 5px 12px;
  border-radius: 7px; cursor: pointer; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); font-weight: 500; }
select { font: inherit; font-size: 14px; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; max-width: 100%; }
.btn { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.center { display: flex; justify-content: center; margin-top: 16px; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list > .item { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--mut); }
.note { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; color: var(--mut); font-size: 14px; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--mut); }

/* ---- signal item ---- */
.sig { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: start; }
.sig.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--acc-soft); } to { background: transparent; } }
.sig .icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--surface-2); color: var(--mut); grid-row: span 2; }
.sig .icon.new_token, .sig .icon.buy { background: var(--up-soft); color: var(--up); }
.sig .icon.below_cost, .sig .icon.reminder { background: var(--down-soft); color: var(--down); }
.sig .icon.followup { background: var(--acc-soft); color: var(--acc); }
.sig .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.sig .sym { font-weight: 650; font-size: 16px; }
.sig .who { color: var(--mut); font-size: 14px; }
.sig .when { color: var(--faint); font-size: 13px; white-space: nowrap; text-align: right; }
.sig .facts { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: 14px; color: var(--mut); grid-column: 2 / -1; }
.sig .facts b { color: var(--fg); font-weight: 550; font-variant-numeric: tabular-nums; }
.sig .facts b.up { color: var(--up); } .sig .facts b.down { color: var(--down); }
.links { display: flex; gap: 6px 16px; font-size: 13px; flex-wrap: wrap; }
.sig .links { grid-column: 2 / -1; }
.tag { display: inline-block; font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 6px; background: var(--surface-2);
  color: var(--mut); white-space: nowrap; }
.tag.up { background: var(--up-soft); color: var(--up); }
.tag.down { background: var(--down-soft); color: var(--down); }
.tag.acc { background: var(--acc-soft); color: var(--acc); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* ---- traders ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.trader { padding: 16px; display: flex; flex-direction: column; gap: 12px; color: inherit; }
.trader:hover { text-decoration: none; border-color: var(--acc); }
.trader .name { font-weight: 650; font-size: 16px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.trader .row3 { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 8px; }
.trader .row3 .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.trader .row3 .l { font-size: 12px; color: var(--mut); }
.dot { display: inline-flex; align-items: center; gap: 6px; color: var(--mut); font-weight: 400; }
.trader .dot { font-size: 13px; }
.profile-head .mut { font-size: 14px; }
.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.dot.on::before { background: var(--up); }

/* ---- leaderboard / scorecard ---- */
.board td:nth-child(2), .board th:nth-child(2) { text-align: left; }
.board tr.thin td { color: var(--mut); }
.board tr.thin td .up, .board tr.thin td .down { opacity: .6; }
.score .stat .v { font-size: 20px; }
.stats.score { margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.entrant { display: inline-flex; gap: 6px; align-items: baseline; flex-wrap: wrap; flex-basis: 100%; }
.sig .icon.consensus { background: var(--acc-soft); color: var(--acc); }

.sub-head { font-size: 15px; margin: 20px 0 10px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
nav a[hidden] { display: none; }

/* ---- paper trade chart ---- */
.chart-card { padding: 12px 8px 4px; }
.eq { position: relative; width: 100%; }
.eq-svg { display: block; touch-action: pan-y; }
.eq-svg:focus { outline: none; }
.eq-svg:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
.eq-line { fill: none; stroke: var(--acc); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.eq-line.thin { stroke-width: 1.5; }
.eq-area { fill: var(--acc); opacity: .08; }
.eq-zero { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 4 4; }
.eq-grid { stroke: var(--line); stroke-width: 1; }
.eq-label { fill: var(--mut); font-size: 11px; font-variant-numeric: tabular-nums; }
.eq-cross { stroke: var(--faint); stroke-width: 1; }
.eq-dot { fill: var(--acc); stroke: var(--surface); stroke-width: 2; }
.eq-tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: nowrap; box-shadow: 0 4px 14px rgb(0 0 0 / 12%); }
.spark { display: block; }
.sig .icon.paper { background: var(--acc-soft); color: var(--acc); }

/* ---- profile ---- */
.profile-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.back { font-size: 14px; display: inline-block; margin-bottom: 8px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; font-weight: 500; color: var(--mut); text-transform: uppercase; letter-spacing: .03em; background: var(--surface); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td .sub { display: block; font-size: 12px; color: var(--faint); }
td.pend { color: var(--faint); }

/* ---- consensus ---- */
.cons { padding: 16px; }
.cons-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.cons-head .sym { font-weight: 650; font-size: 17px; }
.who-list { display: flex; flex-direction: column; gap: 6px; }
.who-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) 1fr 1fr 1fr; gap: 8px; font-size: 14px; align-items: baseline; }
.who-row .h { font-weight: 550; }
.who-row > :not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.who-row.hdr { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .03em; }

.who-stack { display: flex; flex-direction: column; gap: 12px; }
.section-links { margin-top: 12px; }
.cons > p { margin: 0 0 12px; font-size: 14px; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--acc); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---- skeleton / footer ---- */
.skel { height: 72px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%; animation: skel 1.2s infinite linear; margin-bottom: 10px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.err { color: var(--down); }
.foot { border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--fg); padding: 18px 0; }
.foot p { margin: 0 0 6px; max-width: 80ch; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg);
  border: 0; font: inherit; font-size: 14px; padding: 9px 16px; border-radius: 999px; cursor: pointer; z-index: 20; box-shadow: 0 6px 20px rgb(0 0 0 / 20%); }

@media (max-width: 640px) {
  .top-in { gap: 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 6px; }
  .brand { flex: 1; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  h1 { font-size: 21px; }
  #app { padding-top: 20px; }
  .section { scroll-margin-top: 110px; } /* header 2 hang tren mobile */
  .stat .v { font-size: 19px; }
  .stats.score { grid-template-columns: 1fr 1fr; }
  .sig { grid-template-columns: auto 1fr; }
  .sig .when { grid-column: 2; text-align: left; grid-row: 2; }
  .sig .icon { grid-row: span 1; }
  .who-row { grid-template-columns: 1fr 1fr; }
  .who-row.hdr { display: none; }
  .who-row > :nth-child(3) { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .sig.fresh, .skel { animation: none; } }
