/* ══════════════════════════════════════════════════════════════════════
   DEMO PAGE — Dark Theme
   Background (#0A0A08) + Gold (#E8C547) + Light text (#F0EDE6)
   ══════════════════════════════════════════════════════════════════════ */

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

:root {
    --bg: #0A0A08;
    --bg-raised: #111110;
    --bg-surface: #161614;
    --bg-hover: #1c1c1a;
    --gold: #E8C547;
    --gold-dim: #b8993e;
    --gold-light: #f0d76a;
    --text: #F0EDE6;
    --text-secondary: #B0ADA6;
    --text-muted: #706E68;
    --text-faint: #4A4945;
    --border: rgba(112,110,104,0.12);
    --border-strong: rgba(112,110,104,0.25);
    --success: #3D9970;
    --danger: #c44040;
    --warning: #c8860a;
    --radius: 4px;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-secondary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── TOP NAV ─────────────────────────────────────────────────────────── */
.demo-topnav {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    gap: 1.5rem;
}

.demo-topnav-brand {
    color: var(--gold);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.demo-topnav-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    flex: 1;
}

.demo-topnav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
}

.demo-topnav-link:hover { color: var(--text-secondary); }

/* ── PRODUCT SELECTOR ────────────────────────────────────────────────── */
.product-selector {
    background: var(--bg);
    padding: 2.5rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.product-selector-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.ps-headline {
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.ps-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

.product-cards {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}

.product-card {
    flex: 0 0 auto;
    min-width: 200px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.product-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.product-card.active {
    background: rgba(232,197,71,0.06);
    border-color: var(--gold);
}

.pc-product {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.pc-state {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-right: 0.35rem;
}

.pc-state-ga { background: rgba(200,106,26,0.15); color: #e8984a; }
.pc-state-mn { background: rgba(74,80,168,0.15); color: #8a8ee0; }
.pc-state-or { background: rgba(23,138,122,0.15); color: #4dc4b2; }
.pc-state-mi { background: rgba(148,100,60,0.15); color: #c8a070; }
.pc-state-sd { background: rgba(100,140,80,0.15); color: #a0c880; }
.pc-state-az { background: rgba(180,80,60,0.15); color: #e0a090; }
.pc-state-mo { background: rgba(120,100,160,0.15); color: #b8a0e0; }

.pc-detail {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

.pc-filing {
    color: var(--text-faint);
    font-size: 0.6rem;
    font-family: monospace;
    margin-top: 0.4rem;
}

.pc-badge-live {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(61,153,112,0.15);
    color: #6cc890;
    margin-left: 0.35rem;
}

/* ── WORKSPACE (4-pane) ──────────────────────────────────────────────── */
.workspace {
    padding: 0;
    background: var(--bg);
    min-height: calc(100vh - 200px);
}

.workspace-inner {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.8fr 1fr;
    max-width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}

/* ── PANE COMMON ─────────────────────────────────────────────────────── */
.pane {
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--bg);
}

.pane:last-child { border-right: none; }

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.pane-header h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
}

.pane-badge {
    font-size: 0.6rem;
    font-family: monospace;
    color: var(--text-muted);
    background: var(--bg-raised);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.pane-status {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.pane-desc {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.pane-status.processing { color: var(--gold); }
.pane-status.complete { color: var(--success); }
.pane-status.error { color: var(--danger); }

/* ── EXECUTION TYPE TAGS ────────────────────────────────────────────── */
.exec-tag {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    flex-shrink: 0;
    line-height: 1;
}

.exec-ai {
    background: rgba(232,197,71,0.1);
    color: var(--gold-dim);
}

.exec-code {
    background: rgba(176,173,166,0.08);
    color: var(--text-muted);
}

.exec-hybrid {
    background: rgba(61,153,112,0.1);
    color: var(--success);
}

/* ── PRODUCTION READINESS SUMMARY ───────────────────────────────────── */
.build-production {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(61,153,112,0.04);
    border: 1px solid rgba(61,153,112,0.15);
    border-radius: var(--radius);
}

.build-production-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--success);
    margin-bottom: 0.4rem;
}

.build-production-text {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.3rem;
}

.build-production-items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.35rem;
}

.build-production-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-muted);
    padding: 0.15rem 0;
    border-bottom: 1px solid var(--border);
}

.build-production-item:last-child { border-bottom: none; }

.build-production-item span:last-child {
    font-weight: 600;
    color: var(--text-secondary);
}

.build-production-status {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--success);
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(61,153,112,0.15);
}

/* ── ACT BUTTONS ─────────────────────────────────────────────────────── */
.btn-act {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--gold);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, opacity 0.15s;
    margin-top: 0.75rem;
}

.btn-act:hover:not(:disabled) { background: var(--gold-light); }
.btn-act:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-act.loading {
    position: relative;
    color: transparent;
}
.btn-act.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--bg);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── STATUS LINE ─────────────────────────────────────────────────────── */
.source-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.7rem;
    color: var(--gold);
    font-weight: 500;
}

.status-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────── */
.pane-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ── BUILD ENGINE PANE ────────────────────────────────────────────────── */
.pane-build {
    background: var(--bg-raised);
}

.build-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.build-step {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.build-step.pending { border-color: var(--text-faint); opacity: 0.5; }
.build-step.processing { border-color: var(--gold); opacity: 1; background: rgba(232,197,71,0.04); }
.build-step.success { border-color: var(--success); opacity: 1; }

.bs-num {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-surface);
    color: var(--text-muted);
}

.build-step.success .bs-num { background: rgba(61,153,112,0.1); color: var(--success); }
.build-step.processing .bs-num { background: rgba(232,197,71,0.1); color: var(--gold); }

.bs-label {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.bs-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.build-step.success .bs-badge { background: rgba(61,153,112,0.1); color: var(--success); }
.build-step.processing .bs-badge { background: rgba(232,197,71,0.1); color: var(--gold); }

/* Build step detail */
.bs-detail {
    width: 100%;
    padding: 0.3rem 0 0.3rem 2.4rem;
    display: none;
}

.build-step.expanded .bs-detail { display: block; }

.bs-narrative {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.bs-reasoning {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.5;
    border-left: 2px solid var(--border-strong);
    padding-left: 0.5rem;
    margin-top: 0.2rem;
}

/* ── LEFT PANE: Source Filing ────────────────────────────────────────── */
.pane-source {
    background: var(--bg-raised);
}

.source-meta {
    margin-bottom: 0.5rem;
}

.source-meta-item {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.source-meta-label {
    color: var(--text-muted);
    font-weight: 500;
}

.source-meta-value {
    font-weight: 600;
    text-align: right;
    color: var(--text-secondary);
}

.source-docs-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    margin-top: 0.75rem;
}

.source-doc {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.75rem;
    border: 1px solid transparent;
}

.source-doc:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.source-doc-icon {
    font-size: 0.7rem;
    color: var(--danger);
    flex-shrink: 0;
    width: 14px;
}

.source-doc-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.source-doc-type {
    font-size: 0.6rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.source-doc-group {
    margin-bottom: 0.75rem;
}

.source-doc.loading-in {
    animation: docSlideIn 0.35s ease forwards;
}

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

/* ── CENTER PANE: Application ────────────────────────────────────────── */
.pane-app {
    background: var(--bg);
    position: relative;
    border-right: 1px solid var(--border);
}

.df-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-raised);
}

.df-section.revealing {
    animation: sectionReveal 0.4s ease forwards;
}

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

.df-section legend {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gold);
    padding: 0 0.35rem;
}

.df-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.df-row:last-child { margin-bottom: 0; }

.df-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.df-field input,
.df-field select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 0.8rem;
    background: var(--bg-surface);
    color: var(--text);
    font-family: inherit;
}

.df-field input:focus,
.df-field select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(232,197,71,0.12);
}

.df-field input[readonly] {
    background: var(--bg);
    color: var(--text-muted);
}

.df-check label {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.df-check input[type="checkbox"] {
    width: auto;
    accent-color: var(--gold);
}

/* Health questions */
.df-hq {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.df-hq:last-child { border-bottom: none; }

.df-hq input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
    accent-color: var(--gold);
}

.df-hq-text { flex: 1; color: var(--text-secondary); }

.df-hq-lookback {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Biometric health questions */
.df-hq-biometric {
    flex-direction: column;
    gap: 0.35rem;
}

.df-hq-inputs {
    display: flex;
    gap: 0.75rem;
}

.df-hq-input-group label {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.df-hq-height {
    display: flex;
    gap: 0.25rem;
}

.df-hq-num {
    width: 48px;
    padding: 0.25rem 0.35rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    font-family: inherit;
    background: var(--bg-surface);
    color: var(--text);
}

.df-hq-weight {
    width: 60px;
}

/* Medications */
.df-med-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px 24px;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    align-items: end;
}

.df-med-row input {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    background: var(--bg-surface);
    color: var(--text);
}

.df-med-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

.df-med-remove:hover { color: var(--danger); }

.df-add-med {
    background: none;
    border: 1px dashed var(--border-strong);
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.df-add-med:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* GI Documentation */
.df-gi-docs {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(232,197,71,0.04);
    border: 1px solid rgba(232,197,71,0.12);
    border-radius: 4px;
}

.gi-docs-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gold-dim);
    margin-bottom: 0.35rem;
}

.gi-docs-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.35rem 0;
}

.gi-docs-list li {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 0.15rem 0 0.15rem 0.75rem;
    position: relative;
}

.gi-docs-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold-dim);
}

.gi-docs-deadline {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--warning);
    padding-top: 0.25rem;
    border-top: 1px solid rgba(232,197,71,0.08);
}

/* Premium Estimate */
.df-premium {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.df-premium-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.df-premium-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
}

.df-premium-period {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.df-premium-annual {
    font-size: 0.65rem;
    color: var(--text-faint);
    margin-top: 0.15rem;
}

.df-premium-method {
    font-size: 0.55rem;
    color: var(--text-faint);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.df-premium-tag {
    display: inline-block;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    background: var(--bg);
    color: var(--text-faint);
    margin-top: 0.3rem;
}

/* Validation errors */
.df-validation-errors {
    background: rgba(196,64,64,0.06);
    border: 1px solid rgba(196,64,64,0.2);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.7rem;
    color: var(--danger);
    line-height: 1.6;
}

/* Actions */
.df-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.df-actions.revealing {
    animation: sectionReveal 0.4s ease forwards;
}

.df-submit {
    flex: 1;
    background: var(--gold);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.df-submit:hover { background: var(--gold-light); }
.df-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.df-reset {
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
}

.df-reset:hover { border-color: var(--text-secondary); }

/* ── RIGHT PANE: Agent Chain ─────────────────────────────────────────── */
.pane-chain {
    background: var(--bg-raised);
}

.chain-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.chain-step {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.chain-step.pending { border-color: var(--text-faint); opacity: 0.5; }
.chain-step.processing { border-color: var(--gold); opacity: 1; background: rgba(232,197,71,0.04); }
.chain-step.success { border-color: var(--success); opacity: 1; }
.chain-step.danger { border-color: var(--danger); opacity: 1; }
.chain-step.warning { border-color: var(--warning); opacity: 1; }
.chain-step.skipped { border-color: var(--text-faint); opacity: 0.4; }

.cs-num {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-surface);
    color: var(--text-muted);
}

.chain-step.success .cs-num { background: rgba(61,153,112,0.1); color: var(--success); }
.chain-step.danger .cs-num { background: rgba(196,64,64,0.1); color: var(--danger); }
.chain-step.warning .cs-num { background: rgba(200,134,10,0.1); color: var(--warning); }
.chain-step.processing .cs-num { background: rgba(232,197,71,0.1); color: var(--gold); }

.cs-label {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cs-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.chain-step.success .cs-badge { background: rgba(61,153,112,0.1); color: var(--success); }
.chain-step.danger .cs-badge { background: rgba(196,64,64,0.1); color: var(--danger); }
.chain-step.warning .cs-badge { background: rgba(200,134,10,0.1); color: var(--warning); }

/* Chain step detail */
.cs-detail {
    width: 100%;
    padding: 0.35rem 0 0.35rem 2.4rem;
    line-height: 1.5;
    display: none;
}

.chain-step.expanded .cs-detail { display: block; }

.cs-narrative {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.cs-reasoning {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.6;
    border-left: 2px solid var(--border-strong);
    padding-left: 0.5rem;
    margin-top: 0.25rem;
}

.cs-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.15rem 0;
    font-size: 0.65rem;
}

.cs-detail-label { color: var(--text-muted); }
.cs-detail-value { font-weight: 600; color: var(--text-secondary); }

.cs-timing {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    font-family: monospace;
}

/* Chain premium */
.chain-premium {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.chain-premium-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.chain-premium-amount {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
}

.chain-premium-period {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.chain-premium-details {
    margin-top: 0.5rem;
    font-size: 0.7rem;
}

.chain-premium-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    color: var(--text-muted);
}

/* Chain outcome */
.chain-outcome {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    text-align: center;
}

.chain-outcome.approved {
    background: rgba(61,153,112,0.06);
    border: 1px solid rgba(61,153,112,0.2);
}

.chain-outcome.declined {
    background: rgba(196,64,64,0.06);
    border: 1px solid rgba(196,64,64,0.2);
}

.chain-outcome.uw-queue {
    background: rgba(200,134,10,0.06);
    border: 1px solid rgba(200,134,10,0.2);
}

.chain-outcome-status {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.chain-outcome.approved .chain-outcome-status { color: var(--success); }
.chain-outcome.declined .chain-outcome-status { color: var(--danger); }
.chain-outcome.uw-queue .chain-outcome-status { color: var(--warning); }

.chain-outcome-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chain-details {
    margin-top: 0.75rem;
}

/* ── PDF MODAL ───────────────────────────────────────────────────────── */
.pdf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
}

.pdf-modal-content {
    position: fixed;
    top: 3%;
    left: 5%;
    right: 5%;
    bottom: 3%;
    z-index: 1001;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.pdf-modal-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.pdf-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

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

.pdf-modal-frame {
    flex: 1;
    border: none;
    border-radius: 0 0 8px 8px;
}

/* ── UAT SELF-TEST MODAL ─────────────────────────────────────────────── */
.uat-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
}

.uat-modal-content {
    position: fixed;
    top: 3%;
    left: 8%;
    right: 8%;
    bottom: 3%;
    z-index: 2001;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    overflow: hidden;
}

.uat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

.uat-modal-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gold);
}

.uat-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

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

.uat-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* UAT Confirm */
.uat-confirm {
    max-width: 520px;
    margin: 2rem auto;
    text-align: center;
}

.uat-confirm-icon { margin-bottom: 1.25rem; }
.uat-confirm-icon svg circle { stroke: var(--gold); }
.uat-confirm-icon svg path { stroke: var(--gold); }

.uat-confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.uat-confirm-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.uat-confirm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.uat-confirm-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    background: var(--bg-raised);
    color: var(--text-muted);
}

.uat-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.uat-btn-run {
    padding: 0.7rem 2rem;
    background: var(--gold);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.uat-btn-run:hover { background: var(--gold-light); }
.uat-btn-run:disabled { opacity: 0.4; cursor: not-allowed; }

.uat-btn-cancel {
    padding: 0.7rem 1.5rem;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
}

.uat-btn-cancel:hover { border-color: var(--text-secondary); }

/* UAT Execution */
.uat-execution {
    max-width: 800px;
    margin: 0 auto;
}

.uat-exec-header {
    margin-bottom: 1.5rem;
}

.uat-exec-status {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.uat-exec-progress {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.uat-test-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.uat-test-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.uat-test-card.pending { opacity: 0.4; }
.uat-test-card.running { border-color: var(--gold); opacity: 1; }
.uat-test-card.pass { border-color: var(--success); opacity: 1; }
.uat-test-card.fail { border-color: var(--danger); opacity: 1; }

.uat-test-num {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--bg-surface);
    color: var(--text-muted);
}

.uat-test-card.pass .uat-test-num { background: rgba(61,153,112,0.1); color: var(--success); }
.uat-test-card.fail .uat-test-num { background: rgba(196,64,64,0.1); color: var(--danger); }
.uat-test-card.running .uat-test-num { background: rgba(232,197,71,0.1); color: var(--gold); }

.uat-test-body { flex: 1; min-width: 0; }

.uat-test-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.uat-test-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.uat-test-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    flex-shrink: 0;
    align-self: center;
}

.uat-test-card.pass .uat-test-badge { background: rgba(61,153,112,0.1); color: var(--success); }
.uat-test-card.fail .uat-test-badge { background: rgba(196,64,64,0.1); color: var(--danger); }
.uat-test-card.running .uat-test-badge { background: rgba(232,197,71,0.1); color: var(--gold); }

.uat-test-detail {
    margin-top: 0.35rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    border-left: 2px solid var(--border-strong);
    padding-left: 0.5rem;
    line-height: 1.5;
}

.uat-test-card.fail .uat-test-detail { border-color: var(--danger); }

/* UAT Results */
.uat-results {
    max-width: 800px;
    margin: 0 auto;
}

.uat-results-summary {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}

.uat-results-summary.all-pass {
    background: rgba(61,153,112,0.06);
    border: 1px solid rgba(61,153,112,0.2);
}

.uat-results-summary.has-failures {
    background: rgba(196,64,64,0.06);
    border: 1px solid rgba(196,64,64,0.2);
}

.uat-summary-icon { margin-bottom: 0.5rem; }

.uat-summary-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.uat-results-summary.all-pass .uat-summary-title { color: var(--success); }
.uat-results-summary.has-failures .uat-summary-title { color: var(--danger); }

.uat-summary-stat {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.uat-summary-filing {
    font-size: 0.65rem;
    font-family: monospace;
    color: var(--text-faint);
}

.uat-results-cases {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.uat-results-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.uat-btn-deploy {
    padding: 0.75rem 2rem;
    background: var(--success);
    color: var(--text);
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.uat-btn-deploy:hover { background: #247a4a; }

.uat-btn-return {
    padding: 0.75rem 1.5rem;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
}

.uat-btn-return:hover { border-color: var(--text-secondary); }

/* Deploy staging */
.uat-deploy {
    text-align: center;
    padding: 2rem;
}

.uat-deploy-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.uat-deploy-steps {
    max-width: 400px;
    margin: 1.5rem auto;
    text-align: left;
}

.uat-deploy-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.uat-deploy-step.complete { color: var(--success); font-weight: 600; }
.uat-deploy-step.active { color: var(--gold); font-weight: 600; }

.uat-deploy-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
}

.uat-deploy-step.complete .uat-deploy-step-dot { background: var(--success); }
.uat-deploy-step.active .uat-deploy-step-dot { background: var(--gold); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.uat-deploy-complete {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(61,153,112,0.06);
    border: 1px solid rgba(61,153,112,0.2);
    border-radius: var(--radius);
}

.uat-deploy-complete-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.25rem;
}

.uat-deploy-complete-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ── FOOTER ──────────────────────────────────────────────────────────── */
.demo-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    text-align: center;
}

.demo-footer-quote {
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 600;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.demo-footer-meta {
    color: var(--text-muted);
    font-size: 0.65rem;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .workspace-inner {
        grid-template-columns: 1fr;
    }
    .pane {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .pane-source { max-height: 300px; }
}

@media (max-width: 700px) {
    .product-cards { flex-wrap: wrap; }
    .product-card { min-width: 160px; flex: 1; }
}

/* ── UTILITY ─────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
