/* Theme-resistant UI + table overrides + PDF scaffold + cooldown badge */
.kb-compounder-root, .kb-compounder-root * { box-sizing:border-box; }
.kb-compounder-root { --kb-bg:#0b1625; --kb-bg-2:#0f1d30; --kb-text:#eef3ff; --kb-muted:#b7c2d9; --kb-border:#22324d; --kb-grid:#2a3a57; --kb-accent:#4da3ff; color:var(--kb-text)!important; font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji"!important; }
.kb-compounder-root .kb-app{ background:var(--kb-bg)!important; border:1px solid var(--kb-border)!important; border-radius:16px!important; padding:18px 18px 10px!important; box-shadow:0 6px 20px rgba(0,0,0,.25)!important; }
.kb-compounder-root h2{ font-size:1.5rem!important; margin:0 0 8px!important; color:var(--kb-text)!important; background:transparent!important; }
.kb-compounder-root .desc{ color:var(--kb-muted)!important; margin-bottom:8px!important; }
.kb-compounder-root .card{ background:var(--kb-bg-2)!important; border:1px solid var(--kb-border)!important; border-radius:12px!important; padding:12px!important; overflow:hidden; }
.kb-compounder-root .grid{ display:grid!important; gap:12px!important; }
@media(min-width:820px){ .kb-compounder-root .grid.cols-2{ grid-template-columns:1fr 1fr!important; } }
.kb-compounder-root label{ display:block!important; font-size:.9rem!important; color:var(--kb-muted)!important; margin-bottom:6px!important; }
.kb-compounder-root input,.kb-compounder-root select{ width:100%!important; background:#0b1625!important; color:var(--kb-text)!important; border:1px solid var(--kb-border)!important; border-radius:10px!important; padding:10px 12px!important; outline:none!important; }
.kb-compounder-root .btn{ background:#1b2a44!important; color:var(--kb-text)!important; border:1px solid var(--kb-border)!important; padding:10px 14px!important; border-radius:10px!important; cursor:pointer; }
.kb-compounder-root .btn.primary{ background:var(--kb-accent)!important; color:#061325!important; border-color:transparent!important; }
.kb-compounder-root .btn[disabled]{ opacity:.6; cursor:not-allowed; }

/* KPI */
.kb-compounder-root .kpi{ display:flex!important; flex-wrap:wrap!important; gap:10px!important; }
.kb-compounder-root .kpi .tile{ flex:1 1 180px!important; min-width:180px!important; display:flex!important; flex-direction:column!important; align-items:flex-start!important; }
.kb-compounder-root .kpi .tile>.muted{ white-space:normal!important; overflow:visible!important; text-overflow:clip!important; font-size:.8rem!important; line-height:1.2; }
.kb-compounder-root .kpi .tile>div:not(.muted){ white-space:nowrap!important; overflow:visible!important; text-overflow:unset!important; }

/* Table overrides */
.kb-compounder-root table{ width:100%!important; border-collapse:separate!important; border-spacing:0!important; background:var(--kb-bg-2)!important; border:1px solid var(--kb-border)!important; border-radius:12px!important; }
.kb-compounder-root thead th{ position:sticky; top:0; background:#10243d!important; color:var(--kb-text)!important; }
.kb-compounder-root th,.kb-compounder-root td{ padding:10px!important; border-bottom:1px solid var(--kb-border)!important; text-align:right!important; color:var(--kb-text)!important; }
.kb-compounder-root th:first-child,.kb-compounder-root td:first-child{ text-align:left!important; }
.kb-compounder-root tbody tr, .kb-compounder-root tbody tr td{ background:var(--kb-bg-2)!important; }
.kb-compounder-root table tbody tr:nth-child(odd), .kb-compounder-root table tbody tr:nth-child(even){ background:var(--kb-bg-2)!important; }

/* Cooldown hint */
.kb-compounder-root .kb-cooldown{ font-size:.85rem; color:var(--kb-muted); margin-left:8px; }

/* PDF scaffold (on-page, hidden but measurable) */
.kb-compounder-root .kb-pdf-root{ position:absolute; left:0; top:0; width:794px; background:#fff; color:#111; opacity:0; pointer-events:none; }
.kb-compounder-root .kb-pdf-brand{ display:flex; align-items:center; gap:10px; border-bottom:1px solid #e5e7eb; padding-bottom:8px; margin-bottom:10px; }
.kb-compounder-root .kb-pdf-brand img{ width:130px; height:auto; max-height:40px; border-radius:6px; }
.kb-compounder-root .kb-pdf-muted{ color:#4b5563; font-size:12px; }
.kb-compounder-root .kb-pdf-kpi{ display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin:10px 0; }
.kb-compounder-root .kb-pdf-kpi .tile{ background:#f8fafc; border:1px solid #e5e7eb; border-radius:8px; padding:8px; }
.kb-compounder-root .kb-pdf-kpi .label{ color:#6b7280; font-size:11px; }
.kb-compounder-root .kb-pdf-kpi .value{ font-weight:600; }
.kb-compounder-root .kb-pdf-table{ width:100%; border-collapse:collapse; }
.kb-compounder-root .kb-pdf-table th,.kb-compounder-root .kb-pdf-table td{ border:1px solid #e5e7eb; padding:6px 8px; text-align:right; font-size:12px; }
.kb-compounder-root .kb-pdf-table th:first-child,.kb-compounder-root .kb-pdf-table td:first-child{ text-align:left; }
.kb-compounder-root .kb-pdf-chart{ margin:8px 0; }

/* Hide legacy export UI if cached */
#kb-export-pdf, .kb-cooldown { display:none !important; }
