/* Grid bots sandbox — Bloomberg 4px, B/W/gray, green up / red down */
body.bots-page .wrap {
  max-width: 1280px;
}

.bots-hero {
  padding: 20px 0 14px;
  border-bottom: 1px solid #000;
}

.bots-kicker {
  font-family: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 800;
  color: #000;
  margin: 0 0 8px;
}

.bots-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3.2vw, 34px);
  letter-spacing: -0.03em;
  font-weight: 800;
  color: #000;
}

.bots-lead {
  margin: 0;
  max-width: 48rem;
  font-size: 14px;
  line-height: 1.55;
  color: #111;
}

.bot-console {
  display: grid;
  grid-template-columns: minmax(280px, 400px) 1fr;
  gap: 16px;
  padding: 16px 0 8px;
  align-items: start;
}

.bot-panel,
.bot-stats {
  border: 1px solid #000;
  background: #fff;
  border-radius: 4px;
  padding: 12px;
}

.bot-panel h2,
.bot-stats h2,
.bot-presets h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.bot-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.bot-field label,
.bot-field > span {
  font-size: 12px;
  font-weight: 700;
  color: #111;
}

.bot-field input,
.bot-field select,
.bot-ai-lab textarea {
  height: 34px;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
  color: #000;
  box-sizing: border-box;
  width: 100%;
}

.bot-band-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bot-compact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bot-range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.bot-range-row input[type="range"] {
  width: 100%;
  accent-color: #000;
}

.bot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.bot-lev,
.bot-days,
.bot-mode,
.bot-ai-chip {
  border: 1px solid #000;
  background: #fff;
  color: #000;
  border-radius: 4px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.bot-lev.is-on,
.bot-days.is-on,
.bot-mode.is-on {
  background: #000;
  color: #fff;
}

.bot-ai-lab {
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  padding: 10px;
  margin: 4px 0 10px;
  background: #fafafa;
}

.bot-ai-lab-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.bot-ai-lab textarea {
  height: auto;
  min-height: 56px;
  padding: 8px 10px;
  resize: vertical;
  color: #111;
}

.bot-ai-lab textarea::placeholder {
  color: #9a9a9a;
}

.bot-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.bot-ai-chip {
  background: #fff;
  color: #555;
  border-color: #ccc;
  font-weight: 600;
}

.bot-ai-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.bot-ai-go {
  flex: 1 1 auto;
  min-width: 140px;
  background: #fff !important;
  color: #000 !important;
}

.bot-ai-quota {
  font-size: 11px;
  color: #666;
}

.bot-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.bot-btn {
  border: 1px solid #000;
  border-radius: 4px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  background: #000;
  color: #fff;
}

.bot-btn.ghost {
  background: #fff;
  color: #000;
}

.bot-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: #555;
}

.bot-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.bot-kpi {
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  padding: 8px 10px;
  min-width: 0;
}

.bot-kpi-lab {
  font-size: 11px;
  color: #666;
  font-weight: 700;
}

.bot-kpi-val {
  font-family: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 800;
  color: #000;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  transition: none;
}

.bot-kpi-val.data-updated-up {
  animation: greenFlash 0.45s ease-out;
}

.bot-kpi-val.data-updated-down {
  animation: redFlash 0.45s ease-out;
}

.bot-kpi-val.is-up { color: #0f7b3a; }
.bot-kpi-val.is-down { color: #c2410c; }

.bot-kpi-val.data-updated-up {
  animation: botKpiFlashUp 0.5s ease-out;
}
.bot-kpi-val.data-updated-down {
  animation: botKpiFlashDown 0.5s ease-out;
}

@keyframes botKpiFlashUp {
  0% { background: rgba(15, 123, 58, 0.35); color: #0f7b3a; }
  100% { background: transparent; }
}
@keyframes botKpiFlashDown {
  0% { background: rgba(194, 65, 12, 0.35); color: #c2410c; }
  100% { background: transparent; }
}

.bot-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
}

.bot-chart-zoom-btn {
  border: 1px solid #000;
  background: #fff;
  color: #000;
  border-radius: 4px;
  min-width: 32px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.bot-chart-zoom-btn.ghost {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bot-chart-zoom-hint {
  flex: 1 1 160px;
  font-size: 10px;
  line-height: 1.35;
  min-width: 0;
}

.bot-chart-wrap.is-panning {
  cursor: grabbing;
}

.bot-chart-wrap.can-pan {
  cursor: grab;
}

.bot-chart-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  background: #fafafa;
}

.bot-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 260px;
  touch-action: none;
  cursor: crosshair;
}

.bot-chart-hint {
  font-size: 11px;
  margin: 6px 0 0;
  line-height: 1.4;
}

.bot-trade-tip {
  position: absolute;
  left: 8px;
  top: 8px;
  max-width: min(220px, calc(100% - 16px));
  padding: 8px 10px;
  border: 1px solid #000;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.98);
  font-size: 11px;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 8;
  pointer-events: auto;
  color: #000;
}

.bot-trade-tip[hidden] {
  display: none !important;
}

.bot-trade-tip.show {
  display: block;
}

.bot-preset-select-row {
  display: none;
  margin-bottom: 8px;
}

.bot-preset-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
}

.bot-presets-inline {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e2e2;
}

.bot-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bot-card {
  border: 1px solid #000;
  border-radius: 4px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.bot-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.bot-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #333;
}

.bot-card-meta {
  font-family: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #111;
}

.bot-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.bot-card-actions button {
  flex: 1;
  border: 1px solid #000;
  border-radius: 4px;
  min-height: 34px;
  background: #fff;
  color: #000;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}

.bot-card-actions button.solid {
  background: #000;
  color: #fff;
}

.bot-note {
  font-size: 12px;
  color: #666;
  margin: 10px 0 0;
}

.bot-deploy-bg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.bot-deploy-bg.show { display: flex; }

.bot-deploy {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 18px;
  color: #000;
}

.bot-deploy h3 { margin: 0 0 10px; font-size: 16px; }
.bot-deploy p,
.bot-deploy ol { font-size: 13px; line-height: 1.55; margin: 0 0 12px; }
.bot-deploy ol { padding-left: 18px; }
.bot-deploy label { display: block; font-size: 12px; font-weight: 700; margin: 8px 0 4px; }
.bot-deploy input {
  width: 100%;
  height: 36px;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 0 10px;
  box-sizing: border-box;
}
.bot-deploy .bot-btn { width: 100%; margin-top: 12px; }
.bot-deploy-x {
  float: right;
  border: 0;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.bot-warn { color: #c2410c; font-weight: 700; }

@media (max-width: 1100px) {
  .bot-preset-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .bots-hero {
    padding: 12px 0 10px;
  }
  .bots-lead {
    display: none;
  }
  .bots-hero h1 {
    font-size: 22px;
    margin-bottom: 0;
  }
  .bot-console {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 72px;
  }
  .bot-stats {
    order: -1;
  }
  .bot-panel {
    order: 1;
  }
  .bot-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .bot-kpi {
    padding: 6px;
  }
  .bot-kpi-val {
    font-size: 15px;
  }
  .bot-kpi-lab {
    font-size: 10px;
  }
  .bot-chart-wrap,
  .bot-chart-wrap canvas {
    height: 220px;
    max-height: 220px;
    overflow: hidden;
  }
  .bot-chart-wrap {
    touch-action: none;
    overscroll-behavior: contain;
  }
  .bot-compact-row,
  .bot-band-row {
    grid-template-columns: 1fr 1fr;
  }
  .bot-field {
    margin-bottom: 8px;
  }
  .bot-presets-inline {
    margin-top: 10px;
  }
  .bot-preset-select-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .bot-preset-grid {
    display: none;
  }
  .bot-ai-lab textarea {
    min-height: 56px;
    height: 56px;
    resize: vertical;
  }
  .bot-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #fff;
    padding: 8px 0 4px;
    border-top: 1px solid #e2e2e2;
    margin: 0 -4px;
    padding-left: 4px;
    padding-right: 4px;
  }
}

@media (max-width: 520px) {
  .bot-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bot-compact-row {
    grid-template-columns: 1fr;
  }
}
