/* SkTrade Pure Data Dashboard — Theme_4
   BG #000000 · text off-white · neon #deff9a · no charts */

:root {
  --bg: #000000;
  --panel: #0a0a0a;
  --panel-2: #111111;
  --border: rgba(222, 255, 154, 0.14);
  --border-strong: rgba(222, 255, 154, 0.35);
  --text: #f4f4f0;
  --muted: #9a9a92;
  --neon: #deff9a;
  --neon-dim: rgba(222, 255, 154, 0.12);
  --danger: #ff6b6b;
  --buy: #deff9a;
  --sell: #ff6b6b;
  --wait: #f0d78c;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100%;
}
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.neon { color: var(--neon) !important; }

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.topbar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--neon);
  color: #000;
  font-weight: 800;
}
.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand .muted { margin: 2px 0 0; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
}
.chip .label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.chip strong { color: var(--text); }
.live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--neon);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.live i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 10px var(--neon);
  animation: pulse 1.4s infinite;
}
.chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
}
.chip.err .dot {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}
.disclaimer {
  margin-top: 12px;
  border: 1px solid rgba(240, 215, 140, 0.2);
  background: rgba(240, 215, 140, 0.06);
  color: #e8d9a8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #0d1208 0%, #000 100%);
  padding: 20px;
  margin-bottom: 14px;
}
.hero.buy {
  border-color: rgba(222, 255, 154, 0.45);
  background: linear-gradient(180deg, #101808 0%, #000 100%);
}
.hero.sell {
  border-color: rgba(255, 107, 107, 0.4);
  background: linear-gradient(180deg, #180808 0%, #000 100%);
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--neon);
  font-weight: 700;
}
.hero h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.hero-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 720px;
  word-break: break-word;
}
.hero-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}
.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  min-width: 140px;
}
.side-pill {
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--neon-dim);
  color: var(--neon);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  white-space: nowrap;
}
.side-pill.buy {
  background: rgba(222, 255, 154, 0.18);
  color: var(--neon);
  border-color: rgba(222, 255, 154, 0.5);
}
.side-pill.sell {
  background: rgba(255, 107, 107, 0.15);
  color: var(--sell);
  border-color: rgba(255, 107, 107, 0.45);
}
.conf-block { text-align: right; }
.conf-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.conf-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--neon);
  line-height: 1.1;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  margin-bottom: 14px;
}
.panel h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.panel-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.badge-neon {
  border: 1px solid var(--border-strong);
  color: var(--neon);
  background: var(--neon-dim);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 5px 10px;
}

.intel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 720px) {
  .intel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .intel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.data-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 14px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.data-card.highlight {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, #12180c 0%, #0a0a0a 100%);
  box-shadow: 0 0 24px rgba(222, 255, 154, 0.06);
}
.data-card .k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.data-card .v {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  word-break: break-word;
}
.data-card.highlight .v {
  color: var(--neon);
  font-size: 26px;
}
.data-card .d {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tag {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}
.tag.buy {
  color: var(--neon);
  border-color: rgba(222,255,154,0.35);
  background: var(--neon-dim);
}
.tag.sell {
  color: var(--sell);
  border-color: rgba(255,107,107,0.35);
  background: rgba(255,107,107,0.1);
}

.cols-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 14px;
}
@media (min-width: 900px) {
  .cols-2 { grid-template-columns: 1fr 1fr; }
}

.target-box {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #050505;
  padding: 12px;
}
.target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.target-row:last-of-type { border-bottom: 0; }
.target-row span { color: var(--muted); }
.target-row strong { font-size: 18px; }
.rr-badge {
  margin-top: 10px;
  display: inline-flex;
  border-radius: 999px;
  background: var(--neon);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 12px;
}

.wait-box {
  margin-top: 14px;
  border: 1px dashed rgba(240, 215, 140, 0.35);
  background: rgba(240, 215, 140, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.wait-box.hidden { display: none; }
.wait-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--wait);
  letter-spacing: 0.04em;
}
.wait-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.pos-line {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #050505;
}
.pos-title { font-weight: 700; font-size: 13px; }
.pos-pnl {
  font-size: 18px;
  font-weight: 800;
  color: var(--wait);
}
.pos-pnl.buy { color: var(--neon); }
.pos-pnl.sell { color: var(--sell); }

.worker-url {
  display: block;
  margin: 10px 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--neon);
  word-break: break-all;
}
.rules {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.rules b { color: var(--text); }
.btn {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--neon);
  color: #000;
  font-weight: 800;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.log-box { margin-top: 16px; }
.log-box h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#logList {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #050505;
}
#logList li {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
#logList li:first-child { color: var(--text); }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 11px;
}

.err-banner {
  margin-bottom: 12px;
  border: 1px solid rgba(255,107,107,0.4);
  background: rgba(255,107,107,0.1);
  color: #ffc9c9;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
}

/* ===== Live TradingView chart panel ===== */
.chart-panel {
  padding: 0;
  overflow: hidden;
}
.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.chart-title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.chart-title-block strong { font-size: 15px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 8px;
}
.badge.sky {
  color: var(--neon);
  border-color: var(--border-strong);
  background: var(--neon-dim);
}
.price-block { text-align: right; }
.big-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--neon);
  line-height: 1.1;
}
.chart-stage {
  position: relative;
  width: 100%;
  min-height: 420px;
  background: #000;
  border-bottom: 1px solid var(--border);
}
.tv-host {
  width: 100%;
  height: 460px;
  min-height: 420px;
}
.tv-host iframe {
  width: 100% !important;
  height: 100% !important;
}
.chart-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  background: #000;
  z-index: 2;
  padding: 20px;
  text-align: center;
}
.levels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #050505;
}
.lvl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}
.lvl b { color: var(--text); font-weight: 800; }
.lvl.entry b { color: #7dd3fc; }
.lvl.tp b { color: var(--neon); }
.lvl.sl b { color: var(--sell); }
.lvl.trend b { color: var(--wait); }
.chart-pos {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #050505;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
