/* =============================================================================
   NSE High Volume Strategy - design tokens + shell
   Light, product-grade UI matching the client reference: white cards on a cool
   grey canvas, green as the semantic "system is working" colour.
   ========================================================================== */

:root {
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;

  --red-600:   #dc2626;
  --red-50:    #fef2f2;
  --amber-600: #d97706;
  --amber-50:  #fffbeb;
  --blue-700:  #1d4ed8;
  --blue-600:  #2563eb;
  --blue-50:   #eff6ff;
  --purple-700:#6d28d9;
  --purple-50: #f5f3ff;

  --ink:    #0f172a;
  --ink-2:  #334155;
  --muted:  #64748b;
  --muted-2:#94a3b8;
  --line:   #e6eaf0;
  --line-2: #f1f5f9;
  --bg:     #f4f6f9;
  --card:   #ffffff;

  --radius:   12px;
  --radius-s: 8px;
  --shadow:   0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg:0 8px 30px rgba(15, 23, 42, .10);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;

  --topbar-h: 74px;
  --sidebar-w: 104px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

.hidden { display: none !important; }
.r { text-align: right; }
.c { text-align: center; }

.num, .tbl td, .clock, .kv-val, .big-num { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- top bar */

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 22px;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--green-500), var(--green-700));
  box-shadow: 0 4px 12px rgba(22, 163, 74, .32);
  flex: none;
}
.brand-mark svg { width: 21px; height: 21px; }

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.1px;
  color: var(--muted-2);
}

.topbar-center { display: flex; align-items: center; gap: 20px; }

.market-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .6px;
  color: var(--ink-2);
  white-space: nowrap;
}
.market-status .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted-2);
}
.market-status.open .dot { background: var(--green-500); box-shadow: 0 0 0 4px var(--green-100); animation: pulse 2s infinite; }
.market-status.entry .dot { background: var(--amber-600); box-shadow: 0 0 0 4px var(--amber-50); animation: pulse 1s infinite; }
.market-status.closed .dot { background: var(--muted-2); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

.divider-v { width: 1px; height: 34px; background: var(--line); }

.clock-block { text-align: center; }
.clock { font-size: 21px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1; }
.clock-date { font-size: 11px; color: var(--muted); margin-top: 2px; }

.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 11px; }
.toggle-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }

.switch {
  position: relative;
  width: 62px; height: 27px;
  border: none; border-radius: 999px;
  background: var(--green-600);
  cursor: pointer;
  padding: 0;
  transition: background .18s ease;
}
.switch .switch-text {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  font-size: 9.5px; font-weight: 800; color: #fff; letter-spacing: .5px;
}
.switch .knob {
  position: absolute; top: 3px; right: 3px;
  width: 21px; height: 21px; border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch[aria-checked="false"] { background: var(--muted-2); }
.switch[aria-checked="false"] .switch-text { left: auto; right: 9px; }
.switch[aria-checked="false"] .knob { transform: translateX(-35px); }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--green-600); border-color: var(--green-500); background: var(--green-50); transform: rotate(-45deg); }

/* ----------------------------------------------------------------- sidebar */

.shell { display: flex; flex: 1; min-height: 0; align-items: stretch; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

.nav-item {
  position: relative;
  border: none;
  background: transparent;
  padding: 14px 6px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item:hover { color: var(--ink-2); background: var(--line-2); }
.nav-item.active { color: var(--green-700); background: var(--green-50); }
.nav-item.active::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--green-600);
}

.sidebar-foot { margin-top: auto; padding: 0 10px; display: grid; gap: 6px; }
.mode-chip, .src-chip {
  text-align: center;
  font-size: 9.5px; font-weight: 800; letter-spacing: .7px;
  padding: 6px 4px; border-radius: 7px;
}
.mode-chip { background: var(--blue-50); color: var(--blue-700); }
.src-chip  { background: var(--line-2); color: var(--muted); line-height: 1.3; }
.src-chip.live { background: var(--green-50); color: var(--green-700); }
.src-chip.sim  { background: var(--amber-50); color: var(--amber-600); }
.src-chip.down { background: var(--red-50);   color: var(--red-600); }

/* ----------------------------------------------------------------- content */

.content { flex: 1; min-width: 0; padding: 20px 22px 24px; }
.tab { display: flex; flex-direction: column; gap: 16px; }

.tab-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tab-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.tab-head p  { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); max-width: 68ch; }
.tab-head-actions { display: flex; align-items: center; gap: 9px; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 0; }

.card-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 1.1px;
  color: var(--ink);
  margin-bottom: 14px;
}
.card-title.green  { color: var(--green-700); }
.card-title.purple { color: var(--purple-700); }
.card-sub { font-size: 11px; font-weight: 600; color: var(--muted-2); letter-spacing: .3px; }

/* ------------------------------------------------------ tab 1 : strategy */

.grid-strategy { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }

.card-logic { position: sticky; top: calc(var(--topbar-h) + 20px); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 20px 38px; }
.timeline li:last-child { padding-bottom: 4px; }
.timeline li::before {
  content: attr(data-step);
  position: absolute; left: 0; top: 0;
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--green-600); color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.timeline li:not(:last-child)::after {
  content: ""; position: absolute; left: 11px; top: 27px; bottom: 4px;
  width: 1.5px; background: var(--green-100);
}
.tl-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.tl-value { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.tl-checks { margin: 7px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.tl-checks li { padding: 0; display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.tl-checks li::before { content: none; }
.tl-checks li::after { content: none; }

.tick {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--green-100); color: var(--green-700);
  font-size: 9px; font-weight: 900;
}
.tick.off { background: var(--line-2); color: var(--muted-2); }
.tick.bad { background: var(--red-50);  color: var(--red-600); }

.status-box {
  margin-top: 14px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.status-ico { width: 30px; height: 30px; color: var(--green-600); flex: none; }
.status-ico svg { width: 30px; height: 30px; }
.status-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--green-700); }
.status-value { font-size: 17px; font-weight: 800; color: var(--green-700); margin-top: 1px; }

/* config form */

.form-stack { display: grid; gap: 14px; }

.fieldset {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px 18px;
}
.fieldset > h3 {
  margin: 0 0 3px;
  font-size: 12px; font-weight: 800; letter-spacing: .9px;
  color: var(--ink);
}
.fieldset > .fs-hint { margin: 0 0 14px; font-size: 11.5px; color: var(--muted); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 13px 16px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.field > .hint { font-size: 10.5px; color: var(--muted-2); line-height: 1.4; }

.field input[type="text"],
.field input[type="number"],
.field select {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #fff;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}
.field input:disabled, .field select:disabled { background: var(--line-2); color: var(--muted-2); cursor: not-allowed; }

.field-wide { grid-column: 1 / -1; }

.idx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 8px; }
.idx-opt {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 9px 11px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.idx-opt:hover { border-color: var(--green-500); background: var(--green-50); }
/* :has keeps the selected look in sync without a re-render on every click. */
.idx-opt.on,
.idx-opt:has(input:checked) { border-color: var(--green-500); background: var(--green-50); }
.idx-opt input { width: 16px; height: 16px; accent-color: var(--green-600); cursor: pointer; flex: none; }
.idx-opt b { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.idx-opt em { display: block; font-size: 10.5px; font-style: normal; color: var(--muted-2); margin-top: 1px; }

.field-check { flex-direction: row; align-items: flex-start; gap: 9px; }
.field-check input[type="checkbox"] { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--green-600); cursor: pointer; }
.field-check .cb-text label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.field-check .cb-text .hint { margin-top: 2px; }

/* -------------------------------------------------------- tab 2 : dashboard */

.grid-dash   { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.grid-dash-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.col-stack   { display: grid; gap: 16px; }

.signal-pill {
  font-size: 10.5px; font-weight: 800; letter-spacing: .7px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--line-2); color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.signal-pill.on   { background: var(--green-50); color: var(--green-700); box-shadow: inset 0 0 0 1px var(--green-100); }
.signal-pill.warn { background: var(--amber-50); color: var(--amber-600); }

.signal-body { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }

.sig-name { font-size: 25px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.sig-sub  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.sig-price-row { display: flex; align-items: flex-start; gap: 26px; margin-top: 14px; flex-wrap: wrap; }
.sig-price { font-size: 33px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.sig-chg   { font-size: 14px; font-weight: 700; margin-top: 6px; }
.up   { color: var(--green-600); }
.down { color: var(--red-600); }

.ohlc { display: flex; gap: 0; margin-left: auto; }
.ohlc div { padding: 0 18px; border-left: 1px solid var(--line); }
.ohlc div:first-child { border-left: none; }
.ohlc dt { font-size: 10px; font-weight: 700; letter-spacing: .8px; color: var(--muted-2); }
.ohlc dd { margin: 4px 0 0; font-size: 14.5px; font-weight: 700; }

.sig-meta {
  margin-top: 16px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-s);
  padding: 13px 16px;
  display: flex; gap: 30px; flex-wrap: wrap;
}
.sig-meta.neutral { background: var(--line-2); border-color: var(--line); }
.meta-item { display: flex; align-items: center; gap: 10px; }
.meta-ico { width: 19px; height: 19px; color: var(--green-700); flex: none; }
.sig-meta.neutral .meta-ico { color: var(--muted); }
.meta-ico svg { width: 19px; height: 19px; }
.meta-k { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.meta-v { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-top: 1px; }

.candle-panel { border-left: 1px solid var(--line); padding-left: 22px; }
.candle-title { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; margin-bottom: 8px; }
.candle-flex { display: flex; align-items: center; gap: 18px; }
.candle-svg { width: 92px; height: 170px; flex: none; }
.candle-checks { display: grid; gap: 11px; }
.candle-checks div { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); }
.ha-nums { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; font-size: 11px; color: var(--muted); }
.ha-nums b { color: var(--ink-2); font-weight: 700; }

/* tables */

.table-wrap { margin: 0 -18px -18px; }
.table-wrap.scroll-y { max-height: 420px; overflow-y: auto; }
.table-wrap.scroll-y.short { max-height: 240px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--card);
  text-align: left;
  font-size: 10px; font-weight: 800; letter-spacing: .7px;
  color: var(--muted-2);
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl thead th.r { text-align: right; }
.tbl thead th.c { text-align: center; }
.tbl tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fafcfe; }
.tbl td.sym { font-weight: 700; }
.tbl td.co  { color: var(--muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.tbl td.empty { text-align: center; color: var(--muted-2); padding: 26px 10px; font-style: italic; }
.tbl tr.hit td { background: var(--green-50) !important; }
.tbl tr.hit td.sym { color: var(--green-700); }
.tbl tr.pos-row td { background: var(--blue-50) !important; }

.rule-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
}
.rule-dot.pass { background: var(--green-500); box-shadow: 0 0 0 3px var(--green-100); }
.rule-dot.fail { background: var(--muted-2); }

/* key-value blocks */

.kv { display: grid; gap: 0; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.kv-row:last-child { border-bottom: none; }
.kv-key { font-size: 12.5px; color: var(--muted); }
.kv-val { font-size: 13px; font-weight: 700; text-align: right; }
.kv-val.mono { font-family: var(--mono); font-size: 12px; }

.badge {
  font-size: 10px; font-weight: 800; letter-spacing: .6px;
  padding: 4px 9px; border-radius: 6px;
  background: var(--line-2); color: var(--muted);
}
.badge.open   { background: var(--green-50); color: var(--green-700); }
.badge.closed { background: var(--line-2);   color: var(--muted); }
.badge.buy    { background: var(--blue-50);  color: var(--blue-700); }
.badge.sell   { background: var(--red-50);   color: var(--red-600); }
.badge.ce     { background: var(--green-50); color: var(--green-700); }
.badge.pe     { background: var(--red-50);   color: var(--red-600); }
.badge.done   { background: var(--green-50); color: var(--green-700); }
.badge.pending{ background: var(--amber-50); color: var(--amber-600); }

/* P&L */

.pnl-label { font-size: 12.5px; color: var(--muted); }
.big-num { font-size: 31px; font-weight: 800; letter-spacing: -.9px; margin-top: 3px; line-height: 1.1; }
.big-sub { font-size: 13px; font-weight: 700; margin-top: 2px; }

.pnl-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.pnl-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 12px;
}
.pnl-box .k { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.pnl-box .v { font-size: 15px; font-weight: 800; margin-top: 3px; }

/* -------------------------------------------------------- tab 3 : positions */

.statstrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 15px;
}
.stat .k { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; color: var(--muted-2); }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 4px; letter-spacing: -.4px; }

.poscard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #fff, #fcfdfe);
}
.poscard:last-child { margin-bottom: 0; }
.poscard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.poscard-title { font-size: 15px; font-weight: 800; }
.poscard-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.poscard-pnl { text-align: right; }
.poscard-pnl .v { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.poscard-pnl .p { font-size: 12px; font-weight: 700; }

.posgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px; margin-top: 14px;
  border-top: 1px solid var(--line-2); padding-top: 13px;
}
.posgrid .k { font-size: 10.5px; color: var(--muted-2); font-weight: 600; }
.posgrid .v { font-size: 13.5px; font-weight: 700; margin-top: 2px; }

.posactions { display: flex; align-items: flex-end; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.posactions .field { max-width: 118px; }

.progress-track { height: 5px; border-radius: 3px; background: var(--line-2); margin-top: 12px; overflow: hidden; position: relative; }
.progress-fill  { height: 100%; border-radius: 3px; transition: width .4s ease; }

/* --------------------------------------------------------------- log feed */

.logfeed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.logfeed li {
  display: grid; grid-template-columns: 62px 1fr;
  gap: 10px; padding: 6px 8px; border-radius: 6px;
  font-size: 12px; color: var(--ink-2); line-height: 1.45;
}
.logfeed li:nth-child(odd) { background: #fbfcfe; }
.logfeed time { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.logfeed li.success { color: var(--green-700); }
.logfeed li.warn    { color: var(--amber-600); }
.logfeed li.error   { color: var(--red-600); }

/* --------------------------------------------------------------- controls */

.btn {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--blue-700); color: #fff; box-shadow: 0 2px 8px rgba(29, 78, 216, .25); }
.btn-primary:hover:not(:disabled) { background: #1e40af; }
.btn-ghost   { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted-2); background: var(--line-2); }
.btn-danger  { background: #fff; color: var(--red-600); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: var(--red-50); }
.btn-green   { background: var(--green-600); color: #fff; }
.btn-green:hover:not(:disabled) { background: var(--green-700); }
.btn-outline { background: #fff; color: var(--purple-700); border-color: #ddd6fe; width: 100%; }
.btn-outline:hover:not(:disabled) { background: var(--purple-50); }
.btn-sm { height: 31px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }

.mode-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: #fff; }
.mode-opt {
  border: none; background: transparent;
  padding: 0 15px; height: 34px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .6px;
  color: var(--muted); cursor: pointer;
}
.mode-opt.active { background: var(--blue-700); color: #fff; }
.mode-opt.disabled { color: var(--muted-2); cursor: not-allowed; text-decoration: line-through; }

/* ---------------------------------------------------------------- footbar */

.footbar {
  flex: none;
  margin: 0 22px 18px calc(var(--sidebar-w) + 22px);
  background: var(--blue-50);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 11px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.foot-note { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-2); }
.info-ico {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--blue-600); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; font-style: italic;
  flex: none;
}
.foot-right { display: flex; align-items: center; gap: 14px; }
.foot-src { font-size: 12px; color: var(--muted); }
.foot-src b { color: var(--ink-2); }
.conn-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .6px;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
}
.conn-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.conn-pill.ok   { color: var(--green-700); border-color: var(--green-100); }
.conn-pill.ok .dot { background: var(--green-500); animation: pulse 2s infinite; }
.conn-pill.sim  { color: var(--amber-600); border-color: #fde68a; }
.conn-pill.sim .dot { background: var(--amber-600); }
.conn-pill.bad  { color: var(--red-600); border-color: #fecaca; }
.conn-pill.bad .dot { background: var(--red-600); }

/* ----------------------------------------------------------------- toasts */

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 9px; }
.toast {
  background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slidein .22s ease;
  max-width: 340px;
}
.toast.ok  { background: var(--green-700); }
.toast.bad { background: var(--red-600); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------- scrollbar */

.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-thumb { background: #dfe5ec; border-radius: 4px; }
.scroll-y::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1380px) {
  .grid-dash { grid-template-columns: 1fr 340px; }
  .signal-body { grid-template-columns: 1fr 270px; }
}
@media (max-width: 1150px) {
  .grid-strategy, .grid-dash, .grid-dash-2 { grid-template-columns: 1fr; }
  .card-logic { position: static; }
  .signal-body { grid-template-columns: 1fr; }
  .candle-panel { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; }
  .ohlc { margin-left: 0; }
}
@media (max-width: 780px) {
  .topbar { grid-template-columns: 1fr auto; row-gap: 8px; height: auto; padding: 12px 14px; position: static; }
  .topbar-center { grid-column: 1 / -1; justify-content: space-between; }
  .sidebar { position: static; height: auto; width: 76px; }
  .footbar { margin-left: 22px; }
  .content { padding: 14px; }
}
