/* ── Risk Scenarios Panel ─────────────────────────────────────────────────── */

.rs-panel {
    background: #111827;
    border-radius: 12px;
    border: 1px solid #1f2d45;
    margin-top: 28px;
    overflow: hidden;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Panel header ────────────────────────────────────────────────────────── */

.rs-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 28px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1a2744 100%);
    border-bottom: 1px solid #1f2d45;
}

.rs-panel-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.rs-panel-subtitle {
    font-size: .82rem;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 520px;
}

/* ── Phronesis button ────────────────────────────────────────────────────── */

.rs-phronesis-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(0,168,150,.18), rgba(0,212,170,.12));
    border: 1px solid rgba(0,212,170,.35);
    color: #00d4aa;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .25s;
    white-space: nowrap;
}

.rs-phronesis-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0,168,150,.3), rgba(0,212,170,.22));
    border-color: rgba(0,212,170,.6);
    box-shadow: 0 0 14px rgba(0,212,170,.18);
    transform: translateY(-1px);
}

.rs-phronesis-btn:disabled {
    opacity: .65;
    cursor: default;
    transform: none;
}

/* ── Summary row (band count chips) ─────────────────────────────────────── */

.rs-summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 28px;
    background: #0f172a;
    border-bottom: 1px solid #1f2d45;
}

.rs-summary-chip {
    font-size: .75rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Caveat ──────────────────────────────────────────────────────────────── */

.rs-caveat {
    font-size: .73rem;
    color: #64748b;
    padding: 8px 28px 12px;
    background: #0f172a;
    border-bottom: 1px solid #1f2d45;
    line-height: 1.5;
}

/* ── Cards grid ──────────────────────────────────────────────────────────── */

.rs-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Individual card ─────────────────────────────────────────────────────── */

.rs-card {
    border-bottom: 1px solid #1f2d45;
    transition: background .2s;
}

.rs-card:last-child { border-bottom: none; }

.rs-card-header {
    padding: 18px 28px 14px;
    cursor: default;
}

.rs-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 8px 0 4px;
    line-height: 1.3;
}

.rs-card-tagline {
    font-size: .82rem;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0;
}

/* ── Band badges ─────────────────────────────────────────────────────────── */

.rs-band-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-right: 8px;
}

.rs-prevalence-badge {
    display: inline-block;
    font-size: .7rem;
    color: #64748b;
    background: rgba(255,255,255,.05);
    border: 1px solid #334155;
    padding: 3px 10px;
    border-radius: 4px;
}

/* Critical */
.rs-band-critical {
    background: rgba(192,57,43,.18);
    color: #ef4444;
    border: 1px solid rgba(192,57,43,.4);
}
.rs-card-critical .rs-card-header { border-left: 4px solid #ef4444; }

/* High */
.rs-band-high {
    background: rgba(224,123,0,.18);
    color: #f59e0b;
    border: 1px solid rgba(224,123,0,.4);
}
.rs-card-high .rs-card-header { border-left: 4px solid #f59e0b; }

/* Moderate */
.rs-band-moderate {
    background: rgba(41,128,185,.18);
    color: #60a5fa;
    border: 1px solid rgba(41,128,185,.4);
}
.rs-card-moderate .rs-card-header { border-left: 4px solid #60a5fa; }

/* Low */
.rs-band-low {
    background: rgba(127,140,141,.12);
    color: #94a3b8;
    border: 1px solid rgba(127,140,141,.25);
}
.rs-card-low .rs-card-header { border-left: 4px solid #334155; }

/* ── CE "Why this matters" callout ───────────────────────────────────────── */

.rs-ce-callout {
    margin: 0 20px 4px;
    padding: 10px 14px;
    background: rgba(2, 128, 144, 0.08);
    border-left: 3px solid #028090;
    border-radius: 0 6px 6px 0;
    font-size: .83rem;
    line-height: 1.55;
    color: #c8d8e8;
}
.rs-ce-callout-label {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #028090;
    margin-bottom: 4px;
}
.rs-ce-callout-text {
    margin: 0;
}

@media print {
    .rs-ce-callout {
        background: #f0f9fa !important;
        border-left-color: #028090 !important;
        color: #1a2332 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ── Card body ───────────────────────────────────────────────────────────── */

.rs-card-body {
    padding: 0 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rs-card-body.rs-collapsed {
    display: none;
}

/* ── Section labels ──────────────────────────────────────────────────────── */

.rs-section-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    margin-bottom: 8px;
}

/* ── Vulnerability checklist ─────────────────────────────────────────────── */

.rs-vuln-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rs-vuln-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: .82rem;
    line-height: 1.4;
}

.rs-vuln-icon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    font-size: .85rem;
    padding-top: 1px;
}

.rs-vuln-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rs-vuln-label {
    line-height: 1.4;
}

.rs-vuln-attr {
    font-size: .72rem;
    color: #6b7280;
    font-style: italic;
    line-height: 1.3;
}

.rs-vuln-present {
    color: #fca5a5;
}

.rs-vuln-absent {
    color: #4b5563;
}

.rs-icon-present { color: #f87171; }
.rs-icon-absent  { color: #22c55e; }

/* ── Loss summary ────────────────────────────────────────────────────────── */

.rs-loss-text {
    font-size: .83rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 0;
    border-left: 3px solid #1f2d45;
    padding-left: 12px;
}

/* ── Defensive controls ──────────────────────────────────────────────────── */

.rs-defs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rs-defs-list li {
    font-size: .82rem;
    color: #94a3b8;
    padding-left: 14px;
    position: relative;
    line-height: 1.4;
}

.rs-defs-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #475569;
    font-weight: 700;
}

/* ── Phronesis narrative ─────────────────────────────────────────────────── */

.rs-narrative {
    border-radius: 8px;
    background: rgba(0,212,170,.06);
    border: 1px solid rgba(0,212,170,.2);
    padding: 14px 16px;
}

.rs-narrative:empty { display: none; }

/* Header row inside the narrative block */
.rs-narrative-hdr {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
}

.rs-narrative-icon {
    font-size: 1rem;
    line-height: 1;
}

.rs-narrative-lbl {
    margin-bottom: 0;
}

.rs-narrative-new {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .08em;
    background: #00d4aa;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 2px;
}

.rs-narrative-text {
    font-size: .83rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 0 0 0 0;
}

/* Card pulse when narrative lands */
@keyframes rs-card-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0,212,170,.55); }
    50%  { box-shadow: 0 0 0 6px rgba(0,212,170,.15); }
    100% { box-shadow: 0 0 0 0 rgba(0,212,170,0); }
}

.rs-card-analysed {
    animation: rs-card-pulse 1.2s ease-out;
}

.rs-top-action {
    margin-top: 10px;
    font-size: .8rem;
    color: #00d4aa;
    background: rgba(0,212,170,.08);
    border-radius: 4px;
    padding: 6px 10px;
    line-height: 1.4;
}

.rs-top-action-label {
    font-weight: 700;
    margin-right: 4px;
}

/* ── Toggle button ───────────────────────────────────────────────────────── */

.rs-toggle-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    border-top: 1px solid #1f2d45;
    color: #475569;
    font-size: .76rem;
    font-family: inherit;
    padding: 8px 0;
    cursor: pointer;
    transition: color .2s, background .2s;
}

.rs-toggle-btn:hover {
    color: #94a3b8;
    background: rgba(255,255,255,.03);
}

/* ── Remediation tracker — scenario badges ───────────────────────────────── */

.rs-scenario-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.rs-scenario-badge {
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    background: rgba(99,102,241,.14);
    color: #818cf8;
    border: 1px solid rgba(99,102,241,.25);
    text-transform: capitalize;
    letter-spacing: .02em;
    white-space: nowrap;
}

/* ── Print rules ─────────────────────────────────────────────────────────── */

@media print {
    .rs-panel {
        background: #fff !important;
        color: #1c2233 !important;
        border: 1px solid #dde3ea;
        /* no break-inside here — panel spans many pages; cards manage their own */
    }

    .rs-panel-header {
        background: #1a2744 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .rs-panel-title  { color: #fff !important; }
    .rs-panel-subtitle { color: rgba(255,255,255,.75) !important; }

    .rs-phronesis-btn { display: none; }

    .rs-summary-chip {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .rs-card-body.rs-collapsed { display: flex !important; }
    .rs-toggle-btn { display: none; }

    .rs-card { break-inside: avoid; }

    /* Card titles: dark & bold so they read on white paper */
    .rs-card-title  { color: #111827 !important; font-weight: 700 !important; }
    .rs-card-tagline { color: #374151 !important; }
    .rs-section-label { color: #4b5563 !important; }

    /* Band badges: keep colour */
    .rs-band-badge, .rs-prevalence-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Card left-border accent colours */
    .rs-card-critical .rs-card-header,
    .rs-card-high     .rs-card-header,
    .rs-card-moderate .rs-card-header,
    .rs-card-low      .rs-card-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .rs-vuln-absent  { color: #6b7280 !important; }
    .rs-vuln-present { color: #991b1b !important; }
    .rs-loss-text    { color: #374151 !important; }
    .rs-defs-list li { color: #374151 !important; }

    /* Phronesis narrative block */
    .rs-narrative {
        background: #f0fdf4 !important;
        border-color: #86efac !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .rs-narrative-text   { color: #1f2937 !important; }
    .rs-narrative-lbl    { color: #065f46 !important; }
    .rs-narrative-icon   { color: #065f46 !important; }
    .rs-narrative-new    { display: none; }   /* badge unnecessary on paper */
    .rs-top-action {
        color: #065f46 !important;
        background: #d1fae5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .rs-top-action-label { color: #064e3b !important; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .rs-panel-header { flex-direction: column; }
    .rs-phronesis-btn { width: 100%; text-align: center; }
    .rs-card-header,
    .rs-card-body { padding-left: 16px; padding-right: 16px; }
    .rs-summary-row,
    .rs-caveat { padding-left: 16px; padding-right: 16px; }
}
