/* BTick — Analytics page (Testing → Analytics).
   Performance, Drawdown and Monte Carlo views over the chart's backtest trades. */

/* Analytics is its own whole-window suite: no modal card, no backdrop, and the
   chart chrome is hidden so the whole window is about this analysis. */
.an-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: stretch; justify-content: stretch;
  padding: 0; background: var(--bg, #f6f8fb);
}
.an-shell {
  width: 100%; height: 100%; max-height: none;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg, #f6f8fb); color: var(--text, #101828);
  border: 0; border-radius: 0; box-shadow: none;
  font-size: 12px;
}
body.suite-open { overflow: hidden; }
body.suite-open .topbar,
body.suite-open .workspace { visibility: hidden; }
.an-suite { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--bg2, #eef1f6); }
.an-suite button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: var(--muted, #667085); cursor: pointer;
}
.an-suite button.on { background: var(--panel, #fff); color: var(--text, #101828); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); cursor: default; }
.an-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: var(--panel, #fff);
  border-bottom: 1px solid var(--border, #dfe3ea);
}
.an-head h2 { margin: 0; font-size: 15px; letter-spacing: 0.01em; }
.an-sub { margin: 1px 0 0; font-size: 10.5px; color: var(--muted, #667085); }
.an-views { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--bg2, #eef1f6); }
.an-views button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 6px;
  font-size: 11px; font-weight: 600; color: var(--muted, #667085); cursor: pointer;
}
.an-views button.active { background: var(--panel, #fff); color: var(--text, #101828); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.an-spacer { flex: 1 1 auto; }
.an-icon {
  width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #dfe3ea); border-radius: 6px;
  background: var(--panel, #fff); color: var(--muted, #667085); cursor: pointer; font-size: 13px;
}
.an-icon:hover { color: var(--text, #101828); border-color: var(--accent, #6366f1); }

.an-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
  padding: 9px 16px; background: var(--panel, #fff);
  border-bottom: 1px solid var(--border, #dfe3ea);
}
.an-field { display: flex; flex-direction: column; gap: 2px; }
.an-field label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #667085); }
.an-field select, .an-field input {
  height: 25px; min-width: 84px; padding: 0 6px;
  border: 1px solid var(--border, #dfe3ea); border-radius: 6px;
  background: var(--panel, #fff); color: var(--text, #101828); font-size: 11px;
}
.an-field.wide select { min-width: 118px; }
.an-field.thin input { min-width: 62px; width: 62px; }
.an-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.an-btn {
  height: 25px; padding: 0 11px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border, #dfe3ea); background: var(--panel, #fff);
  color: var(--text, #101828); font-size: 11px; font-weight: 600;
}
.an-btn.primary { background: var(--accent, #6366f1); border-color: var(--accent, #6366f1); color: #fff; }
.an-btn.ghost { color: var(--muted, #667085); }
.an-field.an-tags { flex: 1 1 100%; min-width: 100%; }
.an-chipset { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 22px; }
.an-tagpick {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border: 1px solid var(--border, #dfe3ea); border-radius: 11px; cursor: pointer;
  background: var(--panel, #fff); color: var(--text, #101828);
  font-size: 10px; font-weight: 600; line-height: 1;
}
.an-tagpick em { font-style: normal; font-size: 9px; font-weight: 500; color: var(--muted, #667085); }
.an-tagpick:hover { border-color: var(--accent, #6366f1); }
.an-tagpick.on {
  background: var(--accent-soft, rgba(99, 102, 241, 0.16));
  border-color: var(--accent, #6366f1); color: var(--accent-dark, #4338ca);
}
.an-tagpick.on em { color: inherit; opacity: 0.75; }

.an-chips { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.an-chip {
  font-size: 9.5px; padding: 2px 8px; border-radius: 9px;
  background: var(--accent-soft, rgba(99, 102, 241, 0.13)); color: var(--accent-dark, #4338ca);
}

.an-body { flex: 1 1 auto; overflow: auto; padding: 14px 16px 22px; }
.an-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.an-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.an-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
@media (max-width: 1080px) {
  .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-grid.two, .an-grid.three { grid-template-columns: minmax(0, 1fr); }
}
.an-card {
  background: var(--panel, #fff); border: 1px solid var(--border, #dfe3ea);
  border-radius: 10px; padding: 10px 12px; min-width: 0;
}
.an-span2 { grid-column: span 2; }
.an-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.an-card-head h3 { margin: 0; font-size: 11.5px; letter-spacing: 0.01em; }
.an-hint { font-size: 9.5px; color: var(--muted, #667085); }
.an-kpi label { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #667085); }
.an-kpi b { display: block; font-size: 17px; font-weight: 700; line-height: 1.35; }
.an-kpi small { display: block; font-size: 9.5px; color: var(--muted, #667085); }
.up { color: #15803d; }
.down { color: #b42318; }
.muted { color: var(--muted, #667085); }
.an-canvas { display: block; width: 100%; height: 172px; }
.an-canvas.tall { height: 230px; }
.an-canvas.short { height: 132px; }

.an-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.an-table th {
  text-align: left; font-weight: 600; color: var(--muted, #667085);
  border-bottom: 1px solid var(--border, #dfe3ea); padding: 4px 4px; white-space: nowrap;
}
.an-table td { padding: 4px 4px; border-bottom: 1px solid var(--border, #dfe3ea); }
.an-table td.num, .an-table th.num { text-align: right; }
.an-table tr:last-child td { border-bottom: 0; }

.an-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 6px; background: var(--bg2, #eef1f6); }
.an-seg button {
  border: 0; background: transparent; padding: 3px 8px; border-radius: 5px;
  font-size: 10px; font-weight: 600; color: var(--muted, #667085); cursor: pointer;
}
.an-seg button.active { background: var(--panel, #fff); color: var(--text, #101828); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.13); }

.an-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.an-cal-head { font-size: 9px; color: var(--muted, #667085); text-align: center; padding-bottom: 2px; }
.an-cal-cell {
  min-height: 44px; border-radius: 6px; padding: 3px 4px;
  border: 1px solid var(--border, #dfe3ea); background: var(--bg, #f6f8fb);
  font-size: 9.5px; line-height: 1.25; overflow: hidden;
}
.an-cal-cell.empty { background: transparent; border-color: transparent; }
.an-cal-cell b { display: block; font-size: 10px; }
.an-cal-cell .an-cal-n { font-size: 9px; color: var(--muted, #667085); }
.an-cal-year .an-cal-cell { min-height: 56px; }
.an-tag {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  background: rgba(139, 92, 246, 0.16); color: #6d28d9;
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.05em; white-space: nowrap;
}
.an-note {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg, #f6f8fb); border: 1px dashed var(--border, #dfe3ea);
  font-size: 10.5px; color: var(--muted, #667085);
}
.an-empty { padding: 40px 10px; text-align: center; color: var(--muted, #667085); font-size: 12px; }
.an-tip {
  position: fixed; z-index: 10001; pointer-events: none; display: none;
  padding: 4px 7px; border-radius: 5px; background: rgba(16, 24, 40, 0.92);
  color: #fff; font-size: 10px; white-space: nowrap;
}
