/* ==========================================================================
   Nova Trade — Design System
   Premium dark theme for a serious trading platform (not a crypto casino).
   ========================================================================== */

:root {
  --bg: #0a0e14;
  --bg-elevated: #0d121a;
  --surface: #121821;
  --surface-hover: #161d29;
  --border: #212a38;
  --border-strong: #2b3646;

  --text-primary: #e7edf5;
  --text-secondary: #9aa9bd;
  --text-muted: #66748a;

  --accent: #3b82f6;
  --accent-hover: #2f6fdb;
  --accent-soft: rgba(59, 130, 246, 0.12);

  --paper: #3b82f6;
  --paper-soft: rgba(59, 130, 246, 0.14);
  --live: #ef4444;
  --live-soft: rgba(239, 68, 68, 0.14);

  --positive: #22c55e;
  --positive-soft: rgba(34, 197, 94, 0.14);
  --negative: #ef4444;
  --negative-soft: rgba(239, 68, 68, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --neutral-soft: rgba(154, 169, 189, 0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);

  --sidebar-width: 232px;
  --topbar-height: 64px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4 { margin: 0 0 4px 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0; }

.muted { color: var(--text-secondary); }
.text-sm { font-size: 12.5px; }
.mono { font-family: var(--font-mono); }

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  flex-shrink: 0;
}

.sidebar-brand .name { font-weight: 700; font-size: 15px; }
.sidebar-brand .sub { font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }

.sidebar-nav { padding: 12px; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.9; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--text-secondary);
  flex-shrink: 0;
}
.sidebar-user .who { min-width: 0; }
.sidebar-user .who .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who .role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.btn-logout {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-logout:hover { background: var(--surface-hover); color: var(--text-primary); }

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.menu-toggle {
  display: none;
  background: transparent; border: none; color: var(--text-primary);
  cursor: pointer; padding: 6px;
}

.content {
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ---------- Connection indicator ---------- */

.conn-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.conn-indicator.online .conn-dot { background: var(--positive); box-shadow: 0 0 0 3px var(--positive-soft); }
.conn-indicator.online { color: var(--positive); border-color: rgba(34,197,94,0.3); }
.conn-indicator.offline .conn-dot { background: var(--negative); }
.conn-indicator.offline { color: var(--negative); border-color: rgba(239,68,68,0.3); }

/* ---------- Cards / grid ---------- */

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

.stat-label {
  font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px; font-weight: 600;
}
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px 0; }
.section-title:first-child { margin-top: 0; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-paper { background: var(--paper-soft); color: var(--paper); }
.badge-live { background: var(--live-soft); color: var(--live); }
.badge-positive { background: var(--positive-soft); color: var(--positive); }
.badge-negative { background: var(--negative-soft); color: var(--negative); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-secondary); }
.badge-running { background: var(--positive-soft); color: var(--positive); }
.badge-paused { background: var(--warning-soft); color: var(--warning); }
.badge-stopped { background: var(--neutral-soft); color: var(--text-secondary); }
.badge-error { background: var(--negative-soft); color: var(--negative); }

.pnl-positive { color: var(--positive); font-weight: 600; }
.pnl-negative { color: var(--negative); font-weight: 600; }
.pnl-neutral { color: var(--text-secondary); font-weight: 600; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }

.btn-long { background: var(--positive); color: #06210f; }
.btn-long:hover:not(:disabled) { filter: brightness(1.08); }

.btn-short { background: var(--negative); color: #2a0808; }
.btn-short:hover:not(:disabled) { filter: brightness(1.08); }

.btn-danger { background: transparent; color: var(--negative); border-color: rgba(239,68,68,0.4); }
.btn-danger:hover:not(:disabled) { background: var(--negative-soft); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-secondary .spinner, .btn-ghost .spinner { border-color: var(--border-strong); border-top-color: var(--text-primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em;
}
.field input, .field select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
}
.field-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.radio-option {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 14px;
}
.radio-option input[type="radio"] { margin: 0; }
.radio-option:has(input:checked) { border-color: var(--accent); }
.readonly-field { opacity: 0.8; cursor: not-allowed; background: var(--bg-elevated, rgba(255,255,255,0.03)); }

.side-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.side-toggle button {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elevated);
  color: var(--text-secondary); font-weight: 700; font-size: 13px; cursor: pointer;
  letter-spacing: 0.03em;
}
.side-toggle button.selected.long { background: var(--positive-soft); border-color: var(--positive); color: var(--positive); }
.side-toggle button.selected.short { background: var(--negative-soft); border-color: var(--negative); color: var(--negative); }

/* ---------- Tables ---------- */

.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
  padding: 10px 14px; background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 26px; margin-bottom: 10px; opacity: 0.6; }

/* ---------- Alerts / banners ---------- */

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.alert-danger { background: var(--negative-soft); color: var(--negative); border-color: rgba(239,68,68,0.3); }
.alert-info { background: var(--accent-soft); color: var(--accent); border-color: rgba(59,130,246,0.3); }
.alert-success { background: var(--positive-soft); color: var(--positive); border-color: rgba(34,197,94,0.3); }

.mode-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  margin-bottom: 18px;
}
.mode-banner.paper { background: var(--paper-soft); color: var(--paper); border: 1px solid rgba(59,130,246,0.3); }
.mode-banner.live { background: var(--live-soft); color: var(--live); border: 1px solid rgba(239,68,68,0.35); }

/* ---------- Toasts ---------- */

.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.toast {
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card); font-size: 13px;
  animation: toast-in 0.18s ease;
}
.toast.success { border-left: 3px solid var(--positive); }
.toast.error { border-left: 3px solid var(--negative); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }





.bot-status-message{
    display:flex;
    align-items:center;
    gap:10px;
    padding:12px 16px;
    background:#1b2233;
    border-radius:12px;
    color:#fff;
    font-size:14px;
    margin-top:16px;
}

.bot-thinking{
    display:flex;
    gap:4px;
}

.bot-thinking span{
    width:8px;
    height:8px;
    border-radius:50%;
    background:#4ade80;
    animation:botThinking 1.2s infinite;
}

.bot-thinking span:nth-child(2){
    animation-delay:.2s;
}

.bot-thinking span:nth-child(3){
    animation-delay:.4s;
}

@keyframes botThinking{
    0%,80%,100%{
        transform:scale(.5);
        opacity:.3;
    }
    40%{
        transform:scale(1);
        opacity:1;
    }
}
/* ---------- Modal (confirmation) ---------- */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 7, 12, 0.72);
  display: flex;  justify-content: center; z-index: 90;
  padding: 20px;overflow-y: scroll;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 22px; max-width: 450px; width: 100%;
  box-shadow: var(--shadow-card);height: 100%;
}
.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Login page ---------- */

.auth-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, rgba(59,130,246,0.08), transparent 55%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 30px;
  box-shadow: var(--shadow-card);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; justify-content: center; }
.auth-brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: white;
}
.auth-brand .name { font-weight: 700; font-size: 18px; }
.auth-title { text-align: center; margin-bottom: 22px; }
.auth-title h1 { font-size: 18px; }
.auth-title p { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- Bot instance / model cards ---------- */

.model-card, .instance-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; background: var(--bg-elevated); margin-bottom: 12px;
}
.instance-card .row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.instance-meta { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0; font-size: 12.5px; color: var(--text-secondary); }
.instance-meta span b { color: var(--text-primary); font-weight: 600; }
.instance-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Status list (System Status page) ---------- */

.status-list { display: flex; flex-direction: column; gap: 1px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; background: var(--surface);
}
.status-row .label { font-size: 13px; font-weight: 500; }
.status-row .desc { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Chart ---------- */

.chart-container { position: relative; width: 100%; height: 380px; }
.chart-empty {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--text-muted); font-size: 13px; flex-direction: column; gap: 8px;
}

/* ---------- Utility ---------- */

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 39;
  }
  .sidebar-overlay.open { display: block; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 14px; }
  .card { padding: 14px 16px; }
  .stat-value { font-size: 20px; }
}

/* ==========================================================================
   Bots page redesign (Section 1: header + Section 2: active bot cards).
   Additive only — nothing above this block was removed, so any other page
   still relying on .instance-card / .model-card is unaffected.
   ========================================================================== */

.bots-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.bots-page-title { font-size: 22px; font-weight: 700; margin: 0; }
.bots-page-subtitle { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0 0; }
.btn-lg { padding: 11px 20px; font-size: 14px; }

/* Registered Bot Models reference, tucked inside the Create Bot modal */
.models-reference { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; }
.models-reference summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.models-reference-list { margin-top: 10px; max-height: 220px; overflow-y: auto; }
.modal-lg { max-width: 560px; width: 100%; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-close {
  background: none; border: none; color: var(--text-secondary); font-size: 22px;
  line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }
body.modal-open { overflow: hidden; }

/* ---------- Active bot cards ---------- */

.bot-cards { display: flex; flex-direction: column; gap: 20px; }

.bot-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elevated); box-shadow: var(--shadow-card);
  padding: 20px; transition: box-shadow 0.2s ease;
}
.bot-card:hover { box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.32); }

.bot-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bot-card-title-block h3 { margin: 0 0 8px 0; font-size: 16px; }
.bot-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.bot-card-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bot-card-pnl { font-size: 20px; font-weight: 700; text-align: right; line-height: 1.1; }
.bot-card-pnl-label { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.bot-card-health { display: flex; gap: 6px; }

.bot-card-chart { margin-top: 16px; }
.bot-card-chart .chart-container { height: 420px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.signals-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.signal-chip {
  font-size: 11.5px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; color: var(--text-secondary); display: inline-flex; gap: 6px; align-items: center;
}
.signal-time { color: var(--text-muted); }

.info-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px;
}
.info-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.info-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.info-value { font-size: 14px; font-weight: 600; }

.bot-card-section-title { margin: 20px 0 8px 0; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

.timeline { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.timeline-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.timeline-row:last-child { border-bottom: none; }
.timeline-icon { flex: 0 0 auto; }
.timeline-time { flex: 0 0 auto; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; padding-top: 1px; }
.timeline-body { display: flex; flex-direction: column; gap: 1px; }
.timeline-title { font-weight: 600; }
.timeline-desc { color: var(--text-muted); font-size: 11.5px; }

.bot-card-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* Details toggle — purely a frontend expand/collapse, no extra request.
   Collapsed by default: chart still shows, timeline height is capped via
   .timeline's max-height above; expanding just removes that cap. */
.bot-card .timeline { max-height: 140px; }
.bot-card.bot-card-expanded .timeline { max-height: 420px; }

@media (max-width: 900px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .bots-page-header { flex-direction: column; align-items: stretch; }
  .bots-page-header .btn-lg { width: 100%; }
  .bot-card-header { flex-direction: column; }
  .bot-card-header-right { align-items: flex-start; width: 100%; }
  .bot-card-chart .chart-container { height: 280px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .bot-card-controls .btn { flex: 1 1 calc(50% - 8px); }
}