/* ── Analytics Modal ─────────────────────────────────────────── */
#analyticsModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  backdrop-filter: blur(4px);
}

#analyticsModal .am-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92%;
  max-width: 1100px;
  max-height: 88vh;
  background: #111827;
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

/* Header */
.am-header {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(34,197,94,0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.am-header h3 {
  margin: 0;
  color: #22c55e;
  font-size: 15px;
  font-weight: 700;
}
.am-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.am-close:hover { color: #94a3b8; }

/* Inner tabs */
.am-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(34,197,94,0.15);
  flex-shrink: 0;
  padding: 0 16px;
}
.am-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.am-tab:hover { color: #94a3b8; }
.am-tab.active { color: #22c55e; border-bottom-color: #22c55e; }

/* Filters */
.am-filters {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(34,197,94,0.1);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.am-filters label { color: #64748b; font-size: 11px; font-weight: 600; }
.am-filters select {
  padding: 4px 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 5px;
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
}

/* Body */
.am-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
}

/* Summary cards */
.am-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.am-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.am-card .am-card-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 4px;
}
.am-card .am-card-lbl {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.am-card.green  .am-card-val { color: #22c55e; }
.am-card.amber  .am-card-val { color: #f59e0b; }
.am-card.red    .am-card-val { color: #ef4444; }
.am-card.blue   .am-card-val { color: #60a5fa; }
.am-card.muted  .am-card-val { color: #94a3b8; }

/* Section heading */
.am-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 18px 0 10px;
}

/* Breakdown table */
.am-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  color: #e5e7eb;
}
.am-breakdown thead tr {
  border-bottom: 2px solid rgba(34,197,94,0.25);
  background: rgba(34,197,94,0.07);
}
.am-breakdown th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
}
.am-breakdown th.r { text-align: right; }
.am-breakdown td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.am-breakdown td.r { text-align: right; }
.am-breakdown tbody tr:hover { background: rgba(255,255,255,0.03); }
.am-breakdown .lbl { color: #94a3b8; }

/* Bar */
.am-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 120px;
}
.am-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.am-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.am-bar-fill.green { background: #22c55e; }
.am-bar-fill.amber { background: #f59e0b; }
.am-bar-fill.red   { background: #ef4444; }
.am-bar-fill.muted { background: #475569; }
.am-bar-pct {
  font-size: 10px;
  color: #94a3b8;
  min-width: 32px;
  text-align: right;
}

/* Sized PnL column — slightly dimmed to signal it's secondary */
.am-col-sized { color: #94a3b8 !important; font-style: italic; }
.am-col-sized span { font-style: normal; }

/* Loading / empty */
.am-loading {
  text-align: center;
  color: #64748b;
  padding: 40px;
  font-size: 13px;
}
