/* ═══════════════════════════════════════════════════════
   Drawdown Analysis — dd- (sidebar), ddm- (modal)
   ═══════════════════════════════════════════════════════ */

/* ── Sidebar card (matches statistics sidebar layout) ── */
.dd-glass-wrap { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.dd-header { padding: 8px 0 0; flex-shrink: 0; }
.dd-header-top { display: flex; justify-content: space-between; align-items: center; }
.dd-title {
  font-family: var(--font-ui); font-size: 1.1rem; font-weight: 600;
  letter-spacing: -.01em; color: var(--text-bright);
}
.dd-title span { color: var(--blue); }
.dd-header .sn-dash-open-btn { margin: 10px 0 8px; }
.dd-header .sn-dash-open-btn + .sn-dash-open-btn { margin-top: 0; }

.dd-empty { padding: 24px 12px; text-align: center; color: var(--text-muted); font-size: .82rem; }

/* ── Sidebar action box (KPIs) — compact wrapper, no border-bottom in sidebar ── */
.dd-sidebar-action-box { padding: 12px 10px; border-bottom: none; border-radius: var(--radius-md); background: var(--hover-subtle); border: 1px solid var(--surface-raised); }

/* ── AI insights sections inside .st-ai-content (matches statistics compact padding) ── */
.st-ai-content .ddm-ins-section { padding: 14px 14px 16px; }

/* ── Modal overlay ── */
.ddm-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  z-index: 200; display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(var(--overlay-blur));
}
.ddm-overlay.open { display: flex; animation: optFadeIn .2s ease; }

.ddm-panel {
  width: 100vw; max-width: 100vw;
  height: 100vh; max-height: 100vh;
  background: var(--panel);
  border: none; border-radius: 0;
  display: flex; flex-direction: row;
  box-shadow: var(--overlay-shadow);
  overflow: hidden;
  animation: optSlideIn .2s ease;
  font-family: var(--font-ui);
}

/* ── Left nav ── */
.ddm-left-nav {
  width: 64px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 4px;
  background: var(--surface-veil);
  border-right: 1px solid var(--border);
}
.ddm-nav-btn {
  padding: 10px 2px; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text-muted);
  font-family: var(--font-ui); font-size: .7rem; font-weight: 700;
  cursor: pointer; transition: all var(--ease);
  white-space: nowrap; text-align: center;
  letter-spacing: .02em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  overflow: hidden;
}
.ddm-nav-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; flex-shrink: 0; }
.ddm-nav-btn:hover { color: var(--text); background: var(--divider-soft); }
.ddm-nav-btn.active { background: var(--red-dim); color: var(--red); }

/* ── Right content ── */
.ddm-right-content { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.ddm-header { padding: 0; border-bottom: 1px solid var(--border); flex-shrink: 0; background: linear-gradient(180deg, var(--surface-veil) 0%, transparent 100%); }
.ddm-header-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px 0; gap: 16px; }
.ddm-header h3 {
  font-family: var(--font-ui); font-size: 1.2rem; font-weight: 700;
  color: var(--text-bright); white-space: nowrap; margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.ddm-header h3::before {
  content: ''; display: inline-block; width: 3px; height: 18px;
  background: var(--red); border-radius: 2px;
}

/* ── Controls bar — centered below title ── */
.ddm-controls-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; padding: 10px 24px 12px;
}
.ddm-ctrl-group {
  display: flex; align-items: center; gap: 8px;
}
.ddm-ctrl-label {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.ddm-ctrl-sep {
  width: 1px; height: 20px; background: var(--border); flex-shrink: 0;
}

/* Year slider */
.ddm-year-slider {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 4px; border-radius: 2px;
  background: var(--surface-border-hi); outline: none; cursor: pointer;
}
.ddm-year-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-bright); border: 2px solid var(--panel);
  box-shadow: 0 0 4px rgba(0,0,0,.4); cursor: pointer;
}
.ddm-year-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-bright); border: 2px solid var(--panel);
  box-shadow: 0 0 4px rgba(0,0,0,.4); cursor: pointer;
}

.ddm-nav-th { display: flex; gap: 3px; }
.ddm-nav-th .ddm-th-btn {
  padding: 4px 10px; border: none; border-radius: var(--radius-sm);
  background: var(--surface-raised); color: var(--text-muted);
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all var(--ease); text-align: center;
}
.ddm-nav-th .ddm-th-btn:hover { color: var(--text); background: var(--surface-border); }
.ddm-nav-th .ddm-th-btn.active { background: var(--pill-active-bg); color: var(--pill-active-color); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* ── Main two-column ── */
.ddm-main { flex: 1; display: flex; overflow: hidden; }
.ddm-metric-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border); min-width: 0; }
.ddm-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.ddm-body::-webkit-scrollbar { width: 5px; }
.ddm-body::-webkit-scrollbar-track { background: transparent; }
.ddm-body::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 3px; }

.ddm-insight-area {
  width: 440px; min-width: 380px; max-width: 480px;
  display: flex; flex-direction: column;
  background: var(--card); flex-shrink: 0; overflow: hidden;
}

/* ── AI header ── */
.ddm-ai-header { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ddm-ai-stars { width: 18px; height: 18px; flex-shrink: 0; }
.ddm-ai-stars .ddm-star-big { fill: var(--red); transform-origin: center; transform-box: fill-box; animation: stmPulseStar 2s ease-in-out infinite; }
.ddm-ai-stars .ddm-star-small { fill: var(--amber); transform-origin: center; transform-box: fill-box; animation: stmPulseStar 2s ease-in-out infinite .5s; }
.ddm-ai-text { display: flex; align-items: center; gap: 8px; }
.ddm-ai-title {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  background: linear-gradient(135deg, var(--red), var(--amber));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  white-space: nowrap;
}
.ddm-ai-sub { font-family: var(--font-ui); font-size: .82rem; color: var(--text-muted); font-weight: 400; white-space: nowrap; }

/* ── AI Tabs (Insights / Help) — mirror stm-ai-tabs ── */
.ddm-ai-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 18px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ddm-ai-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: .04em;
  transition: var(--ease);
  margin-bottom: -1px;
}
.ddm-ai-tab:hover { color: var(--text); background: rgba(255,255,255,var(--hover-subtle)); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ddm-ai-tab.active { color: #fff; border-bottom-color: #fff; background: transparent; border-radius: 0; }

.ddm-ai-pane { display: none; flex: 1; flex-direction: column; min-height: 0; }
.ddm-ai-pane.active { display: flex; }

/* ── Help pane ── */
.ddm-help-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.ddm-help-scroll::-webkit-scrollbar { width: 5px; }
.ddm-help-scroll::-webkit-scrollbar-track { background: transparent; }
.ddm-help-scroll::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 3px; }
.ddm-help-content {
  padding: 18px;
  font-family: var(--font-ui);
  font-size: .93rem;
  line-height: 1.65;
  color: var(--text);
}
.ddm-help-content .ddm-help-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 10px;
  letter-spacing: -.005em;
}
.ddm-help-content .ddm-help-section { margin-bottom: 14px; }
.ddm-help-content .ddm-help-section:last-child { margin-bottom: 0; }
.ddm-help-content .ddm-help-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
  display: block;
}
.ddm-help-content p { margin: 0 0 10px; }
.ddm-help-content p:last-child { margin-bottom: 0; }
.ddm-help-content strong { color: var(--text-bright); }
.ddm-help-content ul {
  margin: 0 0 10px;
  padding-left: 18px;
  list-style: disc;
}
.ddm-help-content ul:last-child { margin-bottom: 0; }
.ddm-help-content ul li { margin-bottom: 4px; }
.ddm-help-content ul li:last-child { margin-bottom: 0; }
.ddm-help-content ul li::marker { color: var(--text-dim); }
.ddm-help-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-veil);
  border-left: 2px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 14px;
  font-size: .9rem;
  line-height: 1.5;
}
.ddm-help-tip-icon {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.ddm-help-tip-strong {
  background: linear-gradient(135deg, rgba(167,139,250,.12), rgba(125,211,252,.06));
  border-left-color: #a78bfa;
  border-left-width: 3px;
  padding: 12px 14px;
}
.ddm-help-tip-strong strong {
  display: inline-block;
  color: #d8b4fe;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

/* ── Chart "?" help button + title wrap ── */
.ddm-chart-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ddm-chart-title-wrap .ddm-chart-title { margin-bottom: 0; }
.ddm-chart-title-wrap-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ddm-chart-help-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  background: var(--surface-veil);
  color: var(--text-muted);
  border-radius: 50%;
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: var(--ease);
  flex-shrink: 0;
}
.ddm-chart-help-btn:hover {
  background: rgba(167,139,250,.18);
  border-color: rgba(167,139,250,.6);
  color: #d8b4fe;
}
.ddm-chart-help-btn.active {
  background: rgba(167,139,250,.28);
  border-color: rgba(167,139,250,.8);
  color: #f3e8ff;
  box-shadow: 0 0 0 3px rgba(167,139,250,.12);
}

/* ── Action box ── */
.ddm-action-box {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-veil);
}
.ddm-depth-bucket-row {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ddm-depth-bucket-row .ddm-th-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 10px;
  font-size: .82rem;
  white-space: nowrap;
}
.ddm-action-item { text-align: center; padding: 8px 4px; background: var(--surface-veil); border-radius: var(--radius-sm); }
.ddm-action-label { font-family: var(--font-ui); font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 3px; }
.ddm-action-value { font-family: var(--font-ui); font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.ddm-action-sub { font-family: var(--font-ui); font-size: .82rem; color: var(--text-muted); margin-top: 1px; }

/* ── Insight scroll ── */
.ddm-insight-scroll { flex: 1; overflow-y: auto; padding: 0; }
.ddm-insight-scroll::-webkit-scrollbar { width: 5px; }
.ddm-insight-scroll::-webkit-scrollbar-track { background: transparent; }
.ddm-insight-scroll::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 3px; }

.ddm-insight-content {}

/* ── Insight sections (reuses stm- pattern naming as ddm-ins-) ── */
.ddm-ins-section { padding: 16px 18px 20px; border-bottom: 1px solid var(--border); }
.ddm-ins-section:last-child { border-bottom: none; }
.ddm-ins-section-header { margin-bottom: 14px; }
.ddm-ins-title-row { display: flex; align-items: baseline; gap: 8px; }
.ddm-ins-num { font-family: var(--font-ui); font-size: 1.4rem; font-weight: 700; color: var(--text-bright); line-height: 1.15; }
.ddm-ins-title { font-family: var(--font-ui); font-size: 1.4rem; font-weight: 700; color: var(--text-bright); line-height: 1.15; }
.ddm-ins-subtitle { font-family: var(--font-ui); font-size: .82rem; font-weight: 500; color: var(--text-muted); margin-top: 4px; }
.ddm-ins-prose { font-family: var(--font-ui); font-size: .93rem; line-height: 1.65; color: var(--text); margin-bottom: 10px; }
.ddm-ins-prose:last-child { margin-bottom: 0; }
.ddm-ins-prose strong { color: var(--text-bright); }
.ddm-ins-prose .hl-red { color: var(--red); font-weight: 600; }
.ddm-ins-prose .hl-green { color: var(--green); font-weight: 600; }
.ddm-ins-prose .hl-amber { color: var(--amber); font-weight: 600; }
.ddm-ins-prose .hl-blue { color: var(--blue); font-weight: 600; }
.ddm-ins-prose .hl-white { color: var(--text-bright); font-weight: 600; }
.ddm-ins-prose .num { font-family: var(--font-ui); font-weight: 700; }

.ddm-ins-widget {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 14px;
}
.ddm-ins-widget-title {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 10px;
}

/* ── Chart containers ── */
.ddm-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.ddm-chart-wrap { position: relative; width: 100%; }
.ddm-card .ddm-chart-wrap { margin-bottom: 0; }
.ddm-chart-wrap canvas { width: 100% !important; }
.ddm-chart-title {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Drawdown table (catalog) ── */
.ddm-table-wrap {
  overflow: auto;
  max-height: 420px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ddm-table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.ddm-table-wrap::-webkit-scrollbar-track { background: transparent; }
.ddm-table-wrap::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 4px; }
.ddm-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--surface-border-strong); }
/* Stat cards — Mean/Median for the 4 dynamics metrics, ABOVE the episodes table */
.ddm-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ddm-stat-card {
  background: var(--surface-veil);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ddm-stat-card-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.ddm-stat-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.ddm-stat-card-key {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.ddm-stat-card-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
}
.ddm-stat-card-val.dd-depth { color: var(--red); }
.ddm-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-family: var(--font-ui); font-size: .82rem;
}
.ddm-table th {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 8px 10px;
  text-align: left; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.ddm-table th:hover { color: var(--text); }
.ddm-table th[title] { cursor: help; }
.ddm-table th.sort-asc::after { content: ' \25B2'; font-size: .82rem; }
.ddm-table th.sort-desc::after { content: ' \25BC'; font-size: .82rem; }
.ddm-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--hover-subtle);
  color: var(--text); white-space: nowrap;
}
.ddm-table tr:hover td { background: var(--surface-veil); }
.ddm-table .dd-depth { color: var(--red); font-weight: 600; }
.ddm-table .dd-recovered { color: var(--green); }
.ddm-table .dd-ongoing { color: var(--amber); font-weight: 600; }
.ddm-table tr.dd-row-ongoing td { background: var(--amber-dim); }
.ddm-table tr.dd-row-ongoing:hover td { background: var(--amber-dim); }

/* ── Peak type badges ── */
.ddm-peak-badge {
  display: inline-block; padding: 2px 6px; border-radius: 8px;
  font-family: var(--font-ui); font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.ddm-peak-abs { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(255,184,51,.3); }
.ddm-peak-rel { background: var(--blue-dim); color: var(--blue); border: 1px solid var(--blue-focus); }

/* ── Scatter controls ── */
.ddm-scatter-controls {
  display: flex; flex-wrap: wrap; gap: 16px 22px; align-items: flex-start;
  padding: 14px 18px; margin-bottom: 12px;
  background: var(--surface-veil); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ddm-sc-group { display: flex; flex-direction: column; gap: 6px; min-height: 52px; justify-content: flex-start; }
.ddm-sc-group--display { flex: 1 1 auto; min-width: 200px; }
.ddm-sc-label {
  font-family: var(--font-ui); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted);
  line-height: 1; height: 14px;
}
.ddm-sc-select {
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--panel, #1a1a2e); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-ui); font-size: .85rem; line-height: 1.2;
  height: 32px;
  cursor: pointer; transition: border-color var(--ease);
}
.ddm-sc-select option { background: var(--panel, #1a1a2e); color: var(--text); }
.ddm-sc-select:hover { border-color: var(--surface-border-strong); }
.ddm-sc-select:focus { outline: none; border-color: var(--blue); }
.ddm-sc-checks {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  height: 32px; align-items: center;
}
.ddm-sc-check {
  font-family: var(--font-ui); font-size: .85rem; color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  user-select: none;
}
.ddm-sc-check input { accent-color: var(--blue); width: 14px; height: 14px; margin: 0; }
.ddm-sc-check:hover { color: var(--text-bright); }

/* ── Scatter correlation ── */
.ddm-scatter-corr {
  font-family: var(--font-ui); font-size: .82rem; color: var(--text-muted);
  padding: 4px 0 8px; letter-spacing: .02em;
}

/* ── Scatter ── */
.ddm-scatter-wrap { position: relative; width: 100%; height: 450px; margin-bottom: 20px; }
.ddm-scatter-catalog { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ── Distribution toggle — identical to marketcrash stats-toggle ── */
.ddm-stats-toggle-container {
  display: flex; align-items: center; justify-content: center;
  margin: 15px 0; gap: 10px;
}
.ddm-stats-toggle-label {
  font-family: var(--font-ui); color: var(--text-muted); font-size: .82rem;
}
.ddm-stats-toggle-option {
  font-family: var(--font-ui); color: var(--text-muted); cursor: pointer; font-size: .82rem;
}
.ddm-stats-toggle-option.ddm-selected-option {
  color: var(--text-bright); font-weight: bold;
}
.ddm-toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 22px;
}
.ddm-toggle-switch input { opacity: 0; width: 0; height: 0; }
.ddm-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: var(--surface-border); transition: .4s; border-radius: 22px;
}
.ddm-toggle-slider:before {
  position: absolute; content: ""; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background-color: white;
  transition: .4s; border-radius: 50%;
}
.ddm-toggle-switch input:checked + .ddm-toggle-slider { background-color: var(--blue); }
.ddm-toggle-switch input:checked + .ddm-toggle-slider:before { transform: translateX(22px); }

/* ── Insight metrics mini grid ── */
.ddm-ins-metrics {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 2px; margin-bottom: 10px;
}
.ddm-ins-metric { padding: 5px 6px; background: var(--surface-veil); border-radius: 4px; text-align: center; }
.ddm-ins-metric-label { font-family: var(--font-ui); font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 2px; }
.ddm-ins-metric-val { font-family: var(--font-ui); font-size: .82rem; font-weight: 700; }

/* ── Summary table in insights ── */
.ddm-ins-summary { margin-top: 16px; }
.ddm-ins-summary-title {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); margin-bottom: 8px;
}
.ddm-ins-summary-tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.ddm-ins-summary-tbl td { padding: 5px 0; border-bottom: 1px solid var(--divider-soft); }
.ddm-ins-tbl-lbl { font-family: var(--font-ui); font-weight: 600; color: var(--text-muted); width: 38%; }
.ddm-ins-tbl-val { font-family: var(--font-ui); font-weight: 600; color: var(--text); text-align: right; }

/* Severity-bucket table (Duration Analysis) */
.ddm-ins-sev-tbl { width: 100%; border-collapse: collapse; font-size: .82rem; font-family: var(--font-ui); }
.ddm-ins-sev-tbl thead th {
  padding: 6px 8px; text-align: right;
  color: var(--text-muted); font-weight: 500; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--divider);
}
.ddm-ins-sev-tbl thead th:first-child { text-align: left; }
.ddm-ins-sev-tbl tbody td {
  padding: 7px 8px; border-bottom: 1px solid var(--divider-soft);
  text-align: right; font-weight: 600; color: var(--text);
}
.ddm-ins-sev-tbl tbody td:first-child {
  text-align: left; color: var(--text-muted);
}

/* ── Yearly Max Drawdown tab ── */
.ddm-yearly-hero {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.ddm-yearly-hero-item {
  text-align: center; padding: 14px 8px;
  background: var(--surface-veil); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ddm-yearly-hero-item .ddm-action-label {
  font-family: var(--font-ui); font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  margin-bottom: 4px;
}
.ddm-yearly-hero-item .ddm-action-value {
  font-family: var(--font-ui); font-size: 1.3rem; font-weight: 700; line-height: 1.2;
}
.ddm-yearly-filters {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
  padding: 10px 12px; background: var(--surface-veil);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.ddm-yearly-filters .ddm-th-btn {
  padding: 6px 14px; border: 1px solid var(--border);
  background: var(--divider-soft); color: var(--text-bright);
  font-size: .88rem;
}
.ddm-yearly-filters .ddm-th-btn:hover { background: var(--surface-border); color: var(--text-bright); }
.ddm-yearly-filters .ddm-th-btn.active {
  background: var(--pill-active-bg); color: var(--pill-active-color);
  border-color: transparent; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.ddm-yearly-custom-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════
   Crash Signal tab — ci- prefix
   ═══════════════════════════════════════════════════════ */
.ci-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.ci-ctrl-label {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
}
.ci-ctrl-sub {
  font-family: var(--font-ui); font-size: .82rem; color: var(--text-muted);
  margin-left: auto;
}
.ci-status-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px; margin-bottom: 14px;
  text-align: center;
}
.ci-status {
  font-family: var(--font-ui); font-size: 1.1rem; font-weight: 800;
  letter-spacing: .08em;
}
.ci-status-active { color: #ff4444; }
.ci-status-recent { color: #f0a030; }
.ci-status-clear { color: var(--green); }
.ci-status-invalidated { color: var(--text-dim); }
.ci-status-sub {
  font-family: var(--font-ui); font-size: .82rem;
  color: var(--text-muted); margin-top: 4px;
}
.ci-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.ci-metric {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 8px;
  text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.ci-metric-val {
  font-family: var(--font-ui); font-size: 1.1rem; font-weight: 700;
  color: var(--text-bright);
}
.ci-metric-lbl {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
}
.ci-section-title {
  font-family: var(--font-ui); font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--border);
}
.ci-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-ui); font-size: .82rem;
}
.ci-table th {
  text-align: left; padding: 6px 8px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-size: .72rem;
  border-bottom: 1px solid var(--border);
}
.ci-table td {
  padding: 5px 8px; border-bottom: 1px solid var(--hover-subtle);
  color: var(--text);
}
.ci-table-scroll {
  max-height: 340px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ci-table-scroll .ci-table th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.ci-neg { color: var(--red); font-weight: 600; }
.ci-neg-strong { color: #ff3333; font-weight: 700; }
.ci-pos { color: var(--green); font-weight: 600; }
.ci-na { color: var(--text-muted); }
.ci-horizon { font-weight: 600; color: var(--text-bright); }
.ci-row-num { color: var(--text-muted); }
.ci-date { white-space: nowrap; }
.ci-params-info {
  font-family: var(--font-ui); font-size: .72rem; color: var(--text-muted);
  padding: 8px 0; margin-top: 8px;
}

/* ── Unified insights supertitle (separates Overview / Yearly reports) ── */
.ddm-ins-supertitle {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-bright);
  padding: 18px 18px 12px;
  border-bottom: 2px solid var(--border);
  margin: 24px 0 0;
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.ddm-ins-supertitle:first-child { margin-top: 0; }
.ddm-ins-supertitle::before {
  content: '';
  display: block;
  width: 32px;
  height: 3px;
  background: var(--blue);
  position: absolute;
  bottom: -2px;
  left: 18px;
}
/* Sidebar narrower variant: tighten left/right padding when used in stats sidebar */
.st-ai-content .ddm-ins-supertitle { padding-left: 14px; padding-right: 14px; }
.st-ai-content .ddm-ins-supertitle::before { left: 14px; }
