/* ══════════════════════════════════════════════════════════════
   TradeInsight — Premium Dark Theme
   ══════════════════════════════════════════════════════════════ */

:root {
  /* Color palette — Binance-inspired dark */
  --bg-primary: #0b0e11;
  --bg-secondary: #12161c;
  --bg-card: #1e2329;
  --bg-card-hover: #252a31;
  --bg-input: #14171c;
  --bg-glass: rgba(30, 35, 41, 0.85);

  --text-primary: #eaecef;
  --text-secondary: #848e9c;
  --text-muted: #5e6673;

  --accent: #f0b90b;       /* Binance yellow */
  --accent-hover: #fcd535;
  --accent-dim: rgba(240, 185, 11, 0.15);

  --green: #0ecb81;
  --green-dim: rgba(14, 203, 129, 0.12);
  --red: #f6465d;
  --red-dim: rgba(246, 70, 93, 0.12);
  --blue: #1e90ff;
  --blue-dim: rgba(30, 144, 255, 0.12);
  --purple: #a855f7;

  --border: #2b3139;
  --border-light: #363c45;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ══════════════════════════════════════════════════════════════
   AUTH SCREEN
   ══════════════════════════════════════════════════════════════ */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(240, 185, 11, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(30, 144, 255, 0.06) 0%, transparent 50%),
    var(--bg-primary);
  padding: 2rem;
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 20px rgba(240, 185, 11, 0.4));
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(240, 185, 11, 0.4)); }
  50% { filter: drop-shadow(0 0 35px rgba(240, 185, 11, 0.7)); }
}

.auth-logo h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.auth-logo h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.25rem;
}

.auth-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
}

.auth-form h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.referral-banner {
  background: var(--accent-dim);
  border: 1px solid rgba(240, 185, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.referral-icon { font-size: 1.1rem; }

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-error {
  margin-top: 1rem;
  padding: 0.6rem 0.8rem;
  background: var(--red-dim);
  border: 1px solid rgba(246, 70, 93, 0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.85rem;
  display: none;
}

.auth-error.visible {
  display: block;
}

/* ── Referral Banner ── */
.referral-banner {
  background: linear-gradient(135deg, var(--accent-dim), rgba(240, 185, 11, 0.08));
  border: 1px solid rgba(240, 185, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.referral-icon { font-size: 1.3rem; }

.referral-info {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.5;
}

.referral-details {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.referral-details code {
  background: rgba(240, 185, 11, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-hover);
}

.referral-link {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: var(--accent);
  color: #0b0e11;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition);
}

.referral-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(240, 185, 11, 0.3);
}

.referral-benefit {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #4ade80;
  font-weight: 500;
}


/* ── AI Strategy Builder ── */
.ai-builder-card {
  background: linear-gradient(135deg, rgba(30, 35, 41, 0.95), rgba(24, 26, 32, 0.98));
  border: 1px solid rgba(240, 185, 11, 0.35);
  box-shadow: 0 8px 32px rgba(240, 185, 11, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  margin-bottom: 1.8rem;
  overflow: hidden;
  position: relative;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ai-builder-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #f0b90b, #f3d470, #f0b90b);
}

.ai-builder-card:hover {
  border-color: rgba(240, 185, 11, 0.6);
  box-shadow: 0 12px 40px rgba(240, 185, 11, 0.15);
}

.ai-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.6rem;
  cursor: pointer;
  background: rgba(240, 185, 11, 0.02);
  transition: background 0.2s;
}

.ai-builder-header:hover {
  background: rgba(240, 185, 11, 0.06);
}

.ai-builder-header h2 {
  font-size: 1.05rem;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ai-builder-header h2::after {
  content: "HOT";
  background: linear-gradient(90deg, #f0b90b, #f3d470);
  color: #181a20;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  animation: pulse-hot 2s infinite;
}

@keyframes pulse-hot {
  0% { transform: scale(1); opacity: 0.95; box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.7); }
  70% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 0 6px rgba(240, 185, 11, 0); }
  100% { transform: scale(1); opacity: 0.95; box-shadow: 0 0 0 0 rgba(240, 185, 11, 0); }
}

.ai-builder-chevron {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform 0.3s;
}

.ai-builder-chevron.open {
  transform: rotate(180deg);
}

.ai-builder-body {
  padding: 0 1.4rem 1.4rem;
}

.ai-prompt-area {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ai-prompt-area textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.ai-prompt-area textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.ai-prompt-area textarea::placeholder {
  color: var(--text-muted);
}

/* AI Loading */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* AI Result */
.ai-result {
  margin-top: 1rem;
  animation: fadeSlide 0.3s ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ai-result-name {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
}

.ai-result-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-left: 0.5rem;
}

.ai-result-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.35rem 0.8rem !important;
  font-size: 0.78rem !important;
}

.ai-code-preview {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

.ai-code-preview code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #c9d1d9;
  white-space: pre;
}

/* My Strategies */
.my-strategies {
  margin-top: 1.2rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.my-strategies h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.my-strategies-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.my-strategy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.my-strategy-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.my-strategy-info .badge-ai {
  background: rgba(240, 185, 11, 0.15);
  color: var(--accent);
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

.my-strategy-info .name {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.my-strategy-info .desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.3rem;
}

.btn-delete-strategy {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-delete-strategy:hover {
  color: #f6465d;
  background: rgba(246, 70, 93, 0.1);
}

/* ── API Guide ── */
.api-guide {
  margin-bottom: 1.25rem;
}

.api-guide-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.api-guide-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.guide-arrow {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.guide-arrow.open {
  transform: rotate(180deg);
}

.api-guide-content {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.guide-steps {
  padding: 0.5rem 0;
}

.guide-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  transition: background var(--transition);
}

.guide-step:hover {
  background: rgba(255, 255, 255, 0.02);
}

.step-number {
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #0b0e11;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.step-content {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.5;
}

.step-content strong {
  font-size: 0.85rem;
}

.step-content p {
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.step-content code {
  background: rgba(240, 185, 11, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.78rem;
  color: var(--accent);
}

.guide-hint {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
}

.guide-warning {
  color: var(--red) !important;
  font-weight: 600;
  font-size: 0.78rem !important;
}

.guide-checklist {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0 0;
}

.guide-checklist li {
  padding: 0.15rem 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.guide-ip-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  background: rgba(240, 185, 11, 0.1);
  border: 1px solid rgba(240, 185, 11, 0.3);
  border-radius: 6px;
}

.guide-ip {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-hover);
  letter-spacing: 0.5px;
  flex: 1;
}

.guide-copy-btn {
  padding: 0.3rem 0.6rem;
  background: var(--accent);
  color: #0b0e11;
  border: none;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.guide-copy-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #e5a800);
  color: #0b0e11;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(240, 185, 11, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.btn-accent {
  background: linear-gradient(135deg, var(--green), #0ba360);
  color: white;
}
.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(14, 203, 129, 0.3);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(246, 70, 93, 0.25);
}
.btn-danger:hover {
  background: rgba(246, 70, 93, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-full { width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-icon { font-size: 1rem; }

.btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ══════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 8px rgba(240, 185, 11, 0.4));
}

.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo h1 span {
  color: var(--accent);
}

.balance-display {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.balance-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.balance-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   TAB BAR
   ══════════════════════════════════════════════════════════════ */

.tab-bar {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  padding: 0.55rem 1.2rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tab-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   SECTIONS
   ══════════════════════════════════════════════════════════════ */

.section {
  display: none;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  margin-bottom: 1rem;
}

.section-title h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════
   DASHBOARD STATS
   ══════════════════════════════════════════════════════════════ */

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ══════════════════════════════════════════════════════════════
   STRATEGIES GRID
   ══════════════════════════════════════════════════════════════ */

.strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.strategy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: default;
  transition: all var(--transition);
  position: relative;
}

.strategy-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.strategy-card .strat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.strategy-card .strat-name {
  font-size: 1rem;
  font-weight: 700;
}

.strategy-card .strat-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-both { background: var(--blue-dim); color: var(--blue); }
.badge-futures { background: var(--accent-dim); color: var(--accent); }
.badge-spot { background: var(--green-dim); color: var(--green); }

.strategy-card .strat-category {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.strategy-card .strat-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   BACKTEST
   ══════════════════════════════════════════════════════════════ */

.backtest-panel {
  max-width: 1200px;
}

.backtest-controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.backtest-controls h2 {
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.bt-data-notice {
  background: rgba(14, 203, 129, 0.08);
  border: 1px solid rgba(14, 203, 129, 0.2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bt-data-notice-icon {
  color: #0ecb81;
  font-size: 1rem;
}

.bt-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.bt-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.bt-stat .bt-stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.bt-stat .bt-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-container h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 350px;
}

/* ══════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

thead {
  background: var(--bg-secondary);
}

th {
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

td {
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

tr:hover td {
  background: var(--bg-card-hover);
}

.pnl-positive { color: var(--green); font-weight: 600; }
.pnl-negative { color: var(--red); font-weight: 600; }

/* ══════════════════════════════════════════════════════════════
   BOTS LIST
   ══════════════════════════════════════════════════════════════ */

.bots-grid, .bots-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all var(--transition);
}

.bot-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.bot-card .bot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.bot-card .bot-symbol {
  font-weight: 700;
  font-size: 1.05rem;
}

.bot-card .bot-strategy {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-running {
  background: var(--green-dim);
  color: var(--green);
  animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 203, 129, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(14, 203, 129, 0); }
}

.status-stopped {
  background: var(--red-dim);
  color: var(--red);
}

.status-starting {
  background: var(--accent-dim);
  color: var(--accent);
}

.bot-tpsl-info {
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem 0;
  flex-wrap: wrap;
}

.tpsl-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.tpsl-tp {
  background: rgba(14, 203, 129, 0.15);
  color: #0ecb81;
}

.badge-live-pnl {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: bold;
  background: rgba(58, 116, 255, 0.15);
  color: #3a74ff;
  margin-left: 0.4rem;
  vertical-align: middle;
  animation: live-pulse 1.5s infinite alternate;
}

@keyframes live-pulse {
  0% {
    opacity: 0.7;
    box-shadow: 0 0 4px rgba(58, 116, 255, 0.2);
  }
  100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(58, 116, 255, 0.5);
  }
}

.tpsl-sl {
  background: rgba(246, 70, 93, 0.15);
  color: #f6465d;
}

.bot-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.bot-stat-item {
  text-align: center;
}

.bot-stat-item .bsi-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bot-stat-item .bsi-value {
  font-size: 1rem;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════
   SYMBOL COMPARISON
   ══════════════════════════════════════════════════════════════ */

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}

.comparison-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
}

.comparison-card.selected {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: 0 0 8px rgba(240, 185, 11, 0.2);
}

.comparison-card .comp-symbol {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.comparison-card .comp-return {
  font-size: 1.4rem;
  font-weight: 800;
}

.comparison-card .comp-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

/* ══════════════════════════════════════════════════════════════
   LOADING & STATES
   ══════════════════════════════════════════════════════════════ */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.backtest-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .app-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .tab-bar {
    padding: 0.5rem 0.75rem;
  }

  .section {
    padding: 1rem;
  }

  .control-row {
    grid-template-columns: 1fr 1fr;
  }

  .bots-grid, .bots-list {
    grid-template-columns: 1fr;
  }

  .strategies-grid {
    grid-template-columns: 1fr;
  }

  .bt-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .control-row {
    grid-template-columns: 1fr;
  }

  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
  }

  .bt-stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════
   ANNOUNCEMENT BANNER
   ══════════════════════════════════════════════════════════════ */

.announcement-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(90deg, var(--accent-dim), rgba(30, 144, 255, 0.08));
  border-bottom: 1px solid rgba(240, 185, 11, 0.2);
  font-size: 0.85rem;
}

.ann-icon { font-size: 1rem; }

.ann-text {
  flex: 1;
  color: var(--text-primary);
}

.ann-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
}

.ann-close:hover { color: var(--text-primary); }

.admin-badge {
  background: var(--accent);
  color: #0b0e11;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════════════════
   COMMUNITY
   ══════════════════════════════════════════════════════════════ */

.community-panel, .requests-panel {
  max-width: 900px;
}

.community-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.category-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.cat-btn, .req-filter {
  padding: 0.45rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.cat-btn:hover, .req-filter:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.cat-btn.active, .req-filter.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Post list */
.post-list, .request-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-item, .request-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  gap: 1rem;
}

.post-item:hover, .request-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.post-item.pinned {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.post-votes, .req-votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  gap: 0.2rem;
}

.vote-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.1rem;
  transition: color var(--transition);
}

.vote-btn:hover { color: var(--accent); }

.vote-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.post-content, .req-content {
  flex: 1;
  min-width: 0;
}

.post-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  margin-right: 0.4rem;
}

.tag-results { background: var(--green-dim); color: var(--green); }
.tag-tips { background: var(--accent-dim); color: var(--accent); }
.tag-discussion { background: var(--blue-dim); color: var(--blue); }
.tag-general { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.tag-pinned { background: var(--accent); color: #0b0e11; }

.post-title-text {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.post-excerpt {
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-meta-row {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: flex;
  gap: 0.8rem;
}

/* Request status badges */
.req-status {
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
}

.status-open { background: var(--green-dim); color: var(--green); }
.status-in_progress { background: var(--accent-dim); color: var(--accent); }
.status-completed { background: var(--blue-dim); color: var(--blue); }
.status-rejected { background: var(--red-dim); color: var(--red); }

.req-type-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.admin-reply-box {
  background: var(--accent-dim);
  border: 1px solid rgba(240, 185, 11, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.admin-reply-box strong {
  color: var(--accent);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1rem;
}

.page-btn {
  padding: 0.35rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #0b0e11; border-color: var(--accent); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
}

.modal-close:hover { color: var(--text-primary); }

textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ══════════════════════════════════════════════════════════════
   POST DETAIL / COMMENTS
   ══════════════════════════════════════════════════════════════ */

.post-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.post-body {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1rem;
}

.post-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.comments-section h4 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.comment-item {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.comment-author {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.comment-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.83rem;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.comment-form textarea {
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════════════════════════════ */

.admin-panel {
  max-width: 1200px;
}

.admin-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.admin-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

/* admin stats — 5 columns */
#sec-admin .dashboard-stats {
  grid-template-columns: repeat(5, 1fr);
}

/* ══════════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ── Kelly Criterion Apply UI ── */
.bt-kelly-apply-card {
  margin: 1.5rem 0;
  padding: 1.2rem 1.5rem;
  background: rgba(240, 185, 11, 0.03);
  border: 1px dashed rgba(240, 185, 11, 0.4);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  animation: fadeSlide 0.3s ease;
}

.bt-kelly-info {
  flex: 1;
  min-width: 280px;
}

.bt-kelly-info h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--accent);
}

.bt-kelly-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 1.2rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.bt-kelly-grid strong {
  font-weight: 600;
}

/* Kelly Alert on Live Trading */
.tr-kelly-alert {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  background: rgba(14, 203, 129, 0.05);
  border: 1px solid rgba(14, 203, 129, 0.25);
  border-radius: 8px;
  color: #eaecef;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeSlide 0.2s ease;
}

.tr-kelly-alert .icon {
  font-size: 1rem;
  color: #0ecb81;
}

/* ══════════════════════════════════════════════════════════════
   Disclaimer Checkbox (Registration)
   ══════════════════════════════════════════════════════════════ */

.disclaimer-check {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  background: rgba(240, 185, 11, 0.06);
  border: 1px solid rgba(240, 185, 11, 0.2);
  border-radius: var(--radius-sm);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checkbox-text strong {
  color: var(--red);
}

/* ══════════════════════════════════════════════════════════════
   Legal Footer
   ══════════════════════════════════════════════════════════════ */

.legal-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1.2rem 1.5rem;
  text-align: center;
}

.legal-footer-inner {
  max-width: 800px;
  margin: 0 auto;
}

.legal-footer p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.legal-footer p strong {
  color: var(--text-secondary);
}

.legal-footer .legal-sub {
  margin-top: 0.4rem;
  opacity: 0.7;
  font-size: 0.68rem;
}

/* ==============================================================
   API Connect Card
   ============================================================== */

.api-connect-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  overflow: hidden;
}

.api-connect-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  background: rgba(240, 185, 11, 0.04);
  border-bottom: 1px solid var(--border);
}

.api-connect-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.api-status {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-secondary);
}

.api-status.connected {
  background: var(--green-dim);
  color: var(--green);
}

.api-connect-body {
  padding: 1.2rem;
}

.api-security-notice {
  display: flex;
  gap: 0.8rem;
  padding: 1rem;
  background: rgba(30, 144, 255, 0.05);
  border: 1px solid rgba(30, 144, 255, 0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.security-badge {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.api-security-notice strong {
  color: var(--text-primary);
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.4rem;
}

.api-security-notice ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.api-security-notice li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 0;
}

.api-btn-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.8rem;
}

/* ==============================================================
   Browser Notice
   ============================================================== */

.browser-notice {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 1rem 1.2rem;
  background: rgba(240, 185, 11, 0.06);
  border: 1px solid rgba(240, 185, 11, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 1.2rem;
}

.notice-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.browser-notice strong {
  color: var(--accent);
  font-size: 0.85rem;
}

.browser-notice p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  line-height: 1.5;
}

/* ==============================================================
   Trading Description
   ============================================================== */

.trading-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* ==============================================================
   TP/SL Optimization Results
   ============================================================== */

.optim-banner {
  background: linear-gradient(135deg, rgba(14, 203, 129, 0.06), rgba(240, 185, 11, 0.06));
  border: 1px solid rgba(14, 203, 129, 0.2);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.optim-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.optim-icon {
  font-size: 1.2rem;
}

.optim-header strong {
  color: var(--green);
  font-size: 0.9rem;
}

.optim-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.optim-best {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.optim-best-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.optim-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.optim-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.optim-details {
  margin-top: 0.5rem;
}

.optim-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.optim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.optim-table th {
  background: var(--bg-input);
  padding: 0.4rem 0.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.optim-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.optim-table .top-row {
  background: rgba(14, 203, 129, 0.08);
}

.optim-table .top-row td {
  font-weight: 600;
}
