/* signals.css — /signals.html (V6.18) — self-contained dark theme */
:root {
  --bg: #0a0e1a; --panel: #10162a; --panel-2: #151d36; --line: #232d4d;
  --text: #e8ecf8; --muted: #8b94b8; --accent: #c084fc; --accent-2: #8b5cf6;
  --good: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --mono: 'JetBrains Mono', monospace;
}
* { box-sizing: border-box; margin: 0; }
body {
  background: radial-gradient(1200px 500px at 80% -10%, #1b1440 0%, var(--bg) 55%);
  color: var(--text); min-height: 100vh;
  font-family: 'DM Sans', 'Noto Sans Thai', sans-serif; font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
h2 { font-size: 16px; margin-bottom: 12px; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 22px; padding: 12px 22px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: rgba(10,14,26,.92); backdrop-filter: blur(8px); z-index: 50;
}
.brand { color: var(--text); font-weight: 700; font-size: 17px; }
.brand small { color: var(--muted); font-weight: 400; }
.brand .logo { color: var(--accent); }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); }
.top-right { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 6px 12px; border-radius: 9px; cursor: pointer; font: inherit;
}
.icon-btn:hover { border-color: var(--accent); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 20px 22px 60px; display: grid; gap: 18px; }

/* ① pulse cards */
.pulse { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; display: grid; gap: 2px;
}
.card .k { color: var(--muted); font-size: 12.5px; }
.card .v { font-size: 22px; font-weight: 700; font-family: var(--mono); }
.card .s { font-size: 12px; color: var(--muted); }
.card.hi .v { color: var(--accent); }
.card.bad .v { color: var(--bad); }
.card.good .v { color: var(--good); }
.card.skel { min-height: 86px; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .45; } }
@media (max-width: 980px) { .pulse { grid-template-columns: repeat(3, 1fr); } }

.conf {
  border: 1px solid #3d3352; background: #1b1430; color: #d8c9f2;
  padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.55;
}

/* ②③ */
.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px;
}
.heat { display: grid; gap: 8px; }
.heat-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; cursor: pointer; }
.heat-row .name { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-bar { height: 12px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.heat-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.heat-row .val { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.lb-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lb-tabs button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
}
.lb-tabs button.active { color: var(--text); border-color: var(--accent); background: #221a3d; }
.lb-item {
  display: grid; grid-template-columns: 34px 40px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.lb-item:last-child { border-bottom: 0; }
.lb-item .rank { font-family: var(--mono); color: var(--muted); }
.lb-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.lb-item .t { font-size: 13px; line-height: 1.35; max-height: 36px; overflow: hidden; }
.lb-item .m { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

/* feed */
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.feed-tools { display: flex; gap: 8px; flex-wrap: wrap; }
select, input[type="number"] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 13.5px;
}
.btn {
  background: var(--accent); color: #16082a; border: 0; border-radius: 9px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  padding: 5px 11px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12.5px;
}
.chip.on { color: var(--text); border-color: var(--accent); background: #221a3d; }
.chip.warn.on { border-color: var(--bad); background: #33161c; color: #fda4af; }

.feed-list { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 64px 1.6fr 130px 96px 1.2fr 110px 86px;
  gap: 12px; align-items: center; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer;
}
.item:hover { border-color: var(--accent-2); }
.item img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--panel); }
.item .t { font-size: 13.5px; line-height: 1.4; max-height: 38px; overflow: hidden; }
.item .meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.price b { font-family: var(--mono); font-size: 15px; }
.price s { color: var(--muted); font-size: 11.5px; display: block; }
.price .disc { color: var(--good); font-size: 11.5px; font-family: var(--mono); }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.flag { font-size: 11px; padding: 2.5px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.flag.up { color: #86efac; border-color: #14532d; background: #052e16; }
.flag.down { color: #fca5a5; border-color: #7f1d1d; background: #450a0a; }
.flag.star { color: #fde68a; border-color: #78350f; background: #451a03; }
.flag.risk { color: #fda4af; border-color: #881337; background: #4c0519; }
.roi { font-family: var(--mono); font-size: 13px; }
.roi small { color: var(--muted); display: block; font-size: 11px; }
.score-wrap { display: grid; gap: 4px; }
.score { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.score-bar { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--bad), var(--warn), var(--good)); }
canvas.spark { width: 96px; height: 40px; }
@media (max-width: 1080px) {
  .item { grid-template-columns: 56px 1.4fr 110px 1fr 80px; }
  .item canvas.spark, .item .roi { display: none; }
}

.pager { display: flex; gap: 10px; justify-content: center; align-items: center; padding: 14px 0 0; }
.pager button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 7px 14px; cursor: pointer; font: inherit; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .info { color: var(--muted); font-size: 13px; font-family: var(--mono); }

/* drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(4,6,14,.66); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 96vw);
  background: var(--panel); border-left: 1px solid var(--line); z-index: 95;
  overflow-y: auto; padding: 22px;
}
.drawer h3 { font-size: 16px; line-height: 1.45; margin: 12px 0 8px; }
.drawer .head { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: start; }
.drawer .head img { width: 92px; height: 92px; border-radius: 14px; object-fit: cover; background: var(--panel-2); }
.drawer .big-score { font-family: var(--mono); font-size: 30px; font-weight: 700; }
.parts { display: grid; gap: 7px; margin-top: 8px; }
.part { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; }
.part .bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.part .bar i { display: block; height: 100%; background: var(--accent); }
.part .num { font-family: var(--mono); color: var(--muted); text-align: right; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.kv span { color: var(--muted); }
.kv b { font-family: var(--mono); font-weight: 500; }
.drawer canvas.chart { width: 100%; height: 170px; background: var(--panel-2); border-radius: 12px; }
.drawer .legend { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 14px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.sim { display: flex; flex-wrap: wrap; gap: 7px; }
.sim .s-item { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; cursor: pointer; width: calc(50% - 4px); }
.sim img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.sim .t { font-size: 11.5px; max-height: 30px; overflow: hidden; line-height: 1.3; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.close-x { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.hist { font-family: var(--mono); font-size: 11.5px; width: 100%; border-collapse: collapse; }
.hist th, .hist td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); color: var(--muted); }
.hist th { color: var(--text); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1c2542; border: 1px solid var(--accent); color: var(--text);
  padding: 10px 18px; border-radius: 12px; z-index: 120; font-size: 14px;
}
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 0 26px; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
