/* Dashboard v2 — chart-first control room */
.dash2 {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 58px);
  background: var(--bg);
}

.dash2-topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0d131c, #0a0e14);
}
.dash2-topbar .meta { font-size: 12px; color: var(--text-dim); }
.dash2-topbar .meta b { color: var(--text); }
.dash2-topbar .spacer { flex: 1; }

.dash2-kpis {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px;
  background: var(--border); border-bottom: 1px solid var(--border);
}
.dash2-kpi { background: var(--panel); padding: 12px 16px; position: relative; overflow: hidden; }
.dash2-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--border-2); }
.dash2-kpi.gold::before { background: var(--gold); }
.dash2-kpi.green::before { background: var(--green); }
.dash2-kpi.red::before { background: var(--red); }
.dash2-kpi .k { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .8px; font-weight: 800; }
.dash2-kpi .v { font-size: 19px; font-weight: 800; font-family: var(--mono); margin-top: 3px; font-variant-numeric: tabular-nums; }
.dash2-kpi .v.gold { color: var(--gold-bright); }
.dash2-kpi .v.green { color: var(--green); }
.dash2-kpi .v.red { color: var(--red); }
.dash2-kpi .s { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; font-family: var(--mono); }
.dash2-kpi .s.green { color: var(--green); }
.dash2-kpi .s.red { color: #e88; }

.dash2-main { display: grid; grid-template-columns: 1.55fr 1fr; gap: 10px; padding: 10px 12px; }
.dash2-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.dash2-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.dash2-card-head h3 { font-size: 12.5px; font-weight: 800; letter-spacing: .3px; }
.dash2-card-head h3 em { font-style: normal; color: var(--gold-bright); }

#dashChart { width: 100%; height: 430px; }
.dash2-px { display: flex; align-items: baseline; gap: 8px; }
.dash2-px .v { font-size: 16px; font-weight: 900; font-family: var(--mono); color: #fff; }
.dash2-px .v.up { color: var(--green); }
.dash2-px .v.down { color: var(--red); }
.dash2-px .chg { font-size: 11px; font-weight: 700; font-family: var(--mono); }
.dash2-px .chg.up { color: var(--green); }
.dash2-px .chg.down { color: var(--red); }
.dash2-tf { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 6px; border: 1px solid transparent; color: var(--text-faint); cursor: pointer; background: transparent; letter-spacing: .3px; }
.dash2-tf:hover { color: var(--text-dim); }
.dash2-tf.on { color: var(--gold-bright); background: rgba(212,168,67,.1); border-color: rgba(212,168,67,.3); }
.dash2-chart-legend {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 8px 14px; border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--text-faint);
}
.dash2-chart-legend .sw { display: inline-flex; align-items: center; gap: 5px; }
.dash2-chart-legend .sw i { width: 13px; height: 7px; border-radius: 3px; }
.dash2-chart-legend .sw.z-sell i { background: rgba(224,82,82,.35); border: 1px solid rgba(224,82,82,.7); }
.dash2-chart-legend .sw.z-buy i { background: rgba(47,191,113,.3); border: 1px solid rgba(47,191,113,.6); }
.dash2-chart-legend .sw.l-tp i { height: 0; border-top: 2px dashed var(--green); border-radius: 0; width: 14px; }
.dash2-chart-legend .sw.l-inv i { height: 0; border-top: 2px dashed #9aa7b8; border-radius: 0; width: 14px; }

.dash2-chip { font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 99px; letter-spacing: .5px; }
.dash2-chip.live { background: rgba(47,191,113,.12); color: var(--green); border: 1px solid rgba(47,191,113,.3); }
.dash2-chip.wait { background: rgba(154,167,184,.1); color: var(--text-dim); border: 1px solid var(--border-2); }
.dash2-chip.gold { background: rgba(212,168,67,.12); color: var(--gold-bright); border: 1px solid rgba(212,168,67,.3); }

/* paths */
.dash2-paths { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.dash2-path {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); position: relative; overflow: hidden;
}
.dash2-path.active { border-color: rgba(240,201,106,.5); background: linear-gradient(90deg, rgba(212,168,67,.08), var(--panel-2) 55%); }
.dash2-path.active::after {
  content: "กำลังเดินแผนนี้"; position: absolute; right: 10px; top: -9px; font-size: 8.5px;
  font-weight: 800; color: #14100a; background: var(--gold-bright); padding: 2px 7px; border-radius: 99px;
}
.dash2-side {
  width: 44px; height: 44px; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 900; font-size: 13px;
}
.dash2-side small { font-size: 8px; font-weight: 700; opacity: .8; }
.dash2-side.sell { background: rgba(224,82,82,.12); color: var(--red); border: 1px solid rgba(224,82,82,.35); }
.dash2-side.buy { background: rgba(47,191,113,.12); color: var(--green); border: 1px solid rgba(47,191,113,.35); }
.dash2-path .zone-rng { font-size: 14px; font-weight: 800; font-family: var(--mono); }
.dash2-path .thesis { font-size: 10.5px; color: var(--text-dim); margin-top: 2px; line-height: 1.45; }
.dash2-path .levels { display: flex; gap: 10px; margin-top: 5px; font-size: 9.5px; font-family: var(--mono); color: var(--text-faint); flex-wrap: wrap; }
.dash2-path .levels b { color: var(--text-dim); }
.dash2-path .metrics { text-align: right; }
.dash2-path .metrics .prob { font-size: 15px; font-weight: 800; font-family: var(--mono); color: var(--gold-bright); }
.dash2-path .metrics .ev { font-size: 10px; font-family: var(--mono); color: var(--text-faint); margin-top: 2px; }
.dash2-path .metrics .ev.good { color: var(--green); }
.dash2-probbar { width: 74px; height: 4px; border-radius: 99px; background: var(--border); margin-top: 5px; margin-left: auto; overflow: hidden; }
.dash2-probbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }

/* plan log */
.dash2-planlog { padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.dash2-plan {
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  padding: 10px 12px; position: relative;
}
.dash2-plan.current { border-color: rgba(240,201,106,.5); background: linear-gradient(90deg, rgba(212,168,67,.07), var(--panel-2) 55%); }
.dash2-plan.won { border-color: rgba(47,191,113,.35); }
.dash2-plan.lost { border-color: rgba(224,82,82,.35); }
.dash2-plan .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash2-plan .when { font-size: 10px; font-family: var(--mono); color: var(--text-faint); }
.dash2-plan .what { font-size: 12px; font-weight: 800; }
.dash2-plan .what.sell { color: #f0a8a8; }
.dash2-plan .what.buy { color: #8fd9b3; }
.dash2-plan .res { margin-left: auto; font-size: 9.5px; font-weight: 800; padding: 2px 8px; border-radius: 5px; }
.dash2-plan .res.open { background: rgba(240,201,106,.14); color: var(--gold-bright); }
.dash2-plan .res.win { background: rgba(47,191,113,.14); color: var(--green); }
.dash2-plan .res.loss { background: rgba(224,82,82,.14); color: var(--red); }
.dash2-plan .res.other { background: rgba(154,167,184,.1); color: var(--text-dim); }
.dash2-plan .nums { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px; font-size: 10px; font-family: var(--mono); }
.dash2-plan .nums .n .k { color: var(--text-faint); font-size: 9px; display: block; }
.dash2-plan .nums .n .v { color: var(--text); font-weight: 700; }
.dash2-plan .nums .n .v.tp { color: var(--green); }
.dash2-plan .nums .n .v.sl { color: var(--red); }
.dash2-plan .why { font-size: 10.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.5; }
.dash2-plan .why.blocked { color: #f0b4b0; }
.dash2-plan .res.blocked { color: #f0b4b0; }

/* bottom grid */
.dash2-bottom { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; padding: 0 12px 10px; }

/* decisions feed */
.dash2-feed { padding: 6px 10px; }
.dash2-feed-row {
  display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: start;
  padding: 8px 6px; border-bottom: 1px solid var(--border);
}
.dash2-feed-row:last-child { border-bottom: none; }
.dash2-feed-row .t { font-size: 10px; font-family: var(--mono); color: var(--text-faint); padding-top: 2px; white-space: nowrap; }
.dash2-dec { font-size: 9px; font-weight: 800; padding: 3px 7px; border-radius: 5px; letter-spacing: .4px; white-space: nowrap; }
.dash2-dec.ENTER { background: rgba(47,191,113,.12); color: var(--green); }
.dash2-dec.MANAGE { background: rgba(74,158,255,.12); color: var(--blue, #4a9eff); }
.dash2-dec.WAIT { background: rgba(154,167,184,.1); color: var(--text-dim); }
.dash2-dec.REPLAN { background: rgba(212,168,67,.14); color: var(--gold-bright); }
.dash2-dec.EXIT { background: rgba(224,82,82,.12); color: var(--red); }
.dash2-dec.ERROR_BLOCKED { background: rgba(224,82,82,.16); color: var(--red); }
.dash2-feed-row .why { font-size: 11px; color: var(--text-dim); line-height: 1.5; }

/* position */
.dash2-pos { padding: 12px 14px; }
.dash2-pos-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash2-pos-head .sym { font-weight: 800; font-size: 14px; }
.dash2-pos-head .dir { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 5px; }
.dash2-pos-head .dir.sell { background: rgba(224,82,82,.12); color: var(--red); }
.dash2-pos-head .dir.buy { background: rgba(47,191,113,.12); color: var(--green); }
.dash2-pos-lots { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.dash2-pnl { margin-left: auto; text-align: right; }
.dash2-pnl .v { font-size: 20px; font-weight: 800; font-family: var(--mono); text-shadow: 0 0 16px rgba(47,191,113,.25); }
.dash2-pnl .v.profit { color: var(--green); }
.dash2-pnl .v.loss { color: var(--red); }
.dash2-pnl .k { font-size: 9px; color: var(--text-faint); font-weight: 700; }
.dash2-pos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.dash2-pos-cell { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.dash2-pos-cell .k { font-size: 9px; color: var(--text-faint); font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.dash2-pos-cell .v { font-size: 12.5px; font-weight: 700; font-family: var(--mono); margin-top: 3px; }
.dash2-pos-cell .v.tp { color: var(--green); }
.dash2-pos-cell .v.sl { color: var(--red); }
.dash2-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 12px; }

/* timeline */
.dash2-tl { padding: 10px 14px; }
.dash2-tl-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.dash2-tl-row:last-child { border-bottom: none; }
.dash2-tl-row .t { font-size: 9.5px; font-family: var(--mono); color: var(--text-faint); min-width: 40px; padding-top: 2px; }
.dash2-tl-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.dash2-tl-dot.g { background: var(--green); }
.dash2-tl-dot.r { background: var(--red); }
.dash2-tl-dot.y { background: var(--gold); }
.dash2-tl-dot.b { background: #4a9eff; }
.dash2-tl-row .what { font-size: 11px; color: var(--text-dim); line-height: 1.45; }
.dash2-tl-row .what b { color: var(--text); font-family: var(--mono); }

@media (max-width: 1100px) {
  .dash2-main { grid-template-columns: 1fr; }
  .dash2-bottom { grid-template-columns: 1fr; }
  .dash2-kpis { grid-template-columns: repeat(2, 1fr); }
}
