/* [scaffold:fw=nis2] generated by scripts/scaffold-framework.js, then hand-edited
   for a white-background / green-text palette per explicit product requirement.
   The scaffolder's renderCss() hardcodes a dark-navy page background
   (--bg-1: #0b1220) for every framework unconditionally — this file overrides
   the generated root palette and every rgba(255,255,255,..) dark-page tint
   with a light equivalent, mirroring cis-assessment.css's own hand-conversion
   (same light --bg:#f4f6f8/--card:#fff pattern already used by
   dora-assessment.css / crma-assessment.css / iso27001-assessment.css /
   ai-governance-assessment.css / soc-assessment.css / cis-assessment.css). */
:root {
    --nis2-primary:   #16a34a;
    --nis2-secondary: #15803d;
    --bg-1: #ffffff;
    --bg-2: #f4f6f8;
    --text-1: #1c2a38;
    --text-2: #5a6a7a;
    --border: #dde3ea;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-1);
    color: var(--text-1);
    line-height: 1.5;
}

.assessment-container { max-width: 900px; margin: 0 auto; padding: 24px 20px 80px; }

.assessment-container.has-sidebar {
    max-width: none;
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 40px);
    padding: 0;
    align-items: start;
}
.assessment-main { padding: 24px 20px 80px; }

.progress-tracker {
    position: sticky;
    top: 40px;
    height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.progress-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.progress-ring { width: 72px; height: 72px; }
.progress-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.progress-ring-fill {
    fill: none;
    stroke: var(--nis2-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 213.6;
    stroke-dashoffset: 213.6;
    transform: rotate(-90deg);
    transform-origin: 40px 40px;
    transition: stroke-dashoffset .4s ease;
}
.progress-ring-label { font-size: 1.1rem; font-weight: 700; color: var(--nis2-primary); }
.progress-ring-sub { font-size: .72rem; color: var(--text-2); text-align: center; }
.progress-sections { display: flex; flex-direction: column; gap: 2px; }
.progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
    font-size: .83rem;
}
.progress-row:hover { background: rgba(22,163,74,.06); }
.progress-row-badge {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(15,23,42,.15);
    flex-shrink: 0;
}
.progress-row-badge.complete { background: #22c55e; }
.progress-row-badge.partial  { background: #f59e0b; }
.progress-row-badge.started  { background: var(--nis2-secondary); }
.progress-row-name {
    flex: 1;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.progress-row-count { font-size: .75rem; color: var(--text-2); white-space: nowrap; flex-shrink: 0; }

.evidence-note {
    width: 100%;
    margin-top: 10px;
    background: #f8f9fb;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-1);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
    resize: vertical;
    line-height: 1.4;
}
.evidence-note::placeholder { color: var(--text-2); }
.evidence-note:focus { outline: none; border-color: var(--nis2-primary); }

.header {
    position: sticky; top: 40px; z-index: 10;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    display: flex; align-items: center; gap: 16px;
}
.header h1 { margin: 0; font-size: 20px; flex: 1; }
.header input[type="text"] {
    background: #fff; border: 1px solid var(--border);
    color: var(--text-1); padding: 8px 12px; border-radius: 6px; width: 280px;
}
.save-notice { margin-top: 6px; font-size: .72rem; color: var(--text-2); transition: color .3s; }
.save-notice.just-saved { color: rgba(39,174,96,.95); }

.control-section {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 16px 0;
    overflow: hidden;
}
.control-header {
    padding: 14px 18px;
    background: #fff;
    cursor: pointer;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--border);
}
.control-title { flex: 1; font-weight: 600; color: var(--nis2-primary); }
.control-progress { color: var(--text-2); font-size: 13px; }
.control-content { padding: 16px 18px; }

.question {
    padding: 14px 0;
    border-bottom: 1px dashed var(--border);
}
.question:last-child { border-bottom: none; }
.question-text { font-weight: 500; margin-bottom: 6px; }
.question-help { color: var(--text-2); font-size: 13px; margin-bottom: 10px; }

.options { display: grid; gap: 6px; }
.option {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}
.option:hover { background: rgba(22,163,74,.05); }
.option input[type="radio"]:checked + span { color: var(--nis2-primary); font-weight: 600; }

.save-bar {
    position: sticky; bottom: 0;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 24px;
}
.save-bar button {
    padding: 10px 18px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-1);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.save-bar .primary-btn {
    background: var(--nis2-primary);
    border-color: var(--nis2-primary);
    color: #fff;
}

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    display: none; align-items: center; justify-content: center;
    z-index: 100;
}
.modal-overlay[style*="flex"] { display: flex !important; }
.modal-panel {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    max-width: 540px;
    width: calc(100% - 40px);
}
.modal-panel h2 { margin-top: 0; color: var(--nis2-primary); }
.modal-panel button {
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--nis2-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

/* Results overlay — fixed, full-viewport takeover below the 40px nav bar,
   matching every shipped framework's results panel. Do not turn this back
   into a plain in-flow block: assessment-core.js's renderResults() only
   toggles display:block/none on this element, so without position:fixed the
   analysis output renders in normal document flow instead of the expected
   overlay. Deliberately white/light — every shipped framework's results panel
   is light-on-white regardless of the rest of that page's theme (this template
   itself is dark-themed, --bg-1 above). The four variables below are redeclared
   for this subtree only: any var(--bg-1)/var(--text-1)/var(--text-2)/var(--border)
   used by a hand-added descendant rule picks up the light palette automatically
   via CSS custom-property cascading. If you add SVG (e.g. a radar chart) or any
   other hardcoded-colour content inside #results-content, colour it for a WHITE
   background, not this file's dark --bg-1/--text-1 defaults.
   The explicit color property below is NOT redundant with the --text-1
   redeclaration above it. Redeclaring a custom property only changes what
   var(--text-1) RESOLVES TO for a rule that explicitly references it — it does
   nothing for an element with no color rule of its own that is simply
   inheriting the color property from body (body's own color:var(--text-1) rule
   computes once, using the dark root value,
   and that already-resolved value is what's inherited — not re-evaluated per
   descendant). Plain, unclassed report text (list items built by onRenderResult
   for gaps/strengths/next-steps/warnings) is exactly this shape and will
   silently inherit body's near-white text straight onto this white panel
   without the line below. This was found and fixed on NIST CSF's own results
   panel by exactly this omission — do not drop it when copying this pattern. */
.results-panel {
    position: fixed;
    inset: 40px 0 0 0;
    background: #fff;
    z-index: 500;
    overflow-y: auto;
    padding: 28px 32px;
    --bg-1: #ffffff;
    --bg-2: #f4f6f8;
    --text-1: #1c2a38;
    --text-2: #5a6a7a;
    --border: #dde3ea;
    color: var(--text-1);
}
.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.results-header h2 { flex: 1; font-size: 1.4rem; color: var(--nis2-primary); margin: 0; }
.results-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.export-btn {
    background: var(--nis2-primary);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s;
}
.export-btn:hover { background: var(--nis2-secondary); }
.close-results-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: .85rem;
    cursor: pointer;
}
.close-results-btn:hover { color: var(--text-1); border-color: var(--text-2); }

/* ── RESULTS CONTENT — score summary, section grid, issue cards ──
   §3c: mandatory, zero exceptions — see FRAMEWORK_TEMPLATE.md. These
   classes are what onRenderResult's hand-written renderer actually
   creates (results-summary/results-score-row/overall-score/overall-label/
   results-grid/principle-card family/issue-item/issue-badge). Missing
   this block was found on CMMC (built before it existed here): the
   renderer worked and the elements existed, but rendered with bare
   browser-default spacing/colour because nothing here styled them. */
.results-summary {
    background: var(--bg-1);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
}
.results-score-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.overall-score { font-size: 3rem; font-weight: 700; color: var(--nis2-primary); }
.overall-label { font-size: .85rem; color: var(--text-2); }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.principle-card {
    background: var(--bg-2);
    border-radius: 8px;
    padding: 12px 14px;
}
.principle-card-title { font-size: .8rem; font-weight: 600; color: var(--nis2-primary); margin-bottom: 6px; }
.principle-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.principle-bar-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
.principle-score-label { font-size: .75rem; color: var(--text-2); margin-top: 4px; }

.results-issues { background: var(--bg-1); border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.10); }
.issue-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .87rem; }
.issue-item:last-child { border-bottom: none; }
.issue-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    height: fit-content;
}
.badge-critical { background: #fde8e8; color: #c0392b; }
.badge-warning  { background: #fef3e2; color: #e07b00; }
.badge-good     { background: #e6f9f0; color: #27ae60; }

/* ── RADAR CHART ── assessment-core.js's buildRadarChart() wraps its SVG
   in a div classed "${cfg.key}-radar-wrapper" — one rule per framework key. */
.nis2-radar-wrapper {
    margin: 20px 0 24px;
    display: flex;
    justify-content: center;
}

.score-circle {
    width: 140px; height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--nis2-primary) 0%, var(--nis2-secondary) 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin: 16px auto;
    color: #fff;
}
.score-num { font-size: 36px; font-weight: 800; }
.score-label { font-size: 13px; font-weight: 600; }

#radar-chart { display: block; max-width: 560px; margin: 0 auto; }

.section-bar { display: grid; grid-template-columns: 200px 1fr 60px; gap: 12px; align-items: center; margin: 8px 0; }
.bar-track { background: var(--border); border-radius: 4px; height: 8px; overflow: hidden; }
.bar-fill  { height: 100%; background: var(--nis2-primary); }
.bar-value { color: var(--text-2); font-size: 13px; text-align: right; }

.results-issues { margin-top: 24px; }
.results-issues h3 { color: var(--nis2-primary); margin-top: 20px; }

.size-hidden { display: none !important; }

/* §12 — every framework supplies its own .evidence-comment styling;
   evidence-upload.css deliberately doesn't (it only styles the upload
   widget it attaches alongside), so without this the textarea renders with
   bare browser defaults. */
.evidence-comment { margin-top: 8px; margin-bottom: 6px; }
.evidence-comment label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 3px;
}
.evidence-comment textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text-1);
    font-size: .82rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color .15s;
}
.evidence-comment textarea:focus { outline: none; border-color: var(--nis2-primary); }
.evidence-comment textarea::placeholder { color: var(--text-2); opacity: .8; }
@media print { .evidence-comment textarea { border: 1px solid #ccc; background: #fff; color: #000; } }

/* ── EXECUTIVE SUMMARY (screen hidden, print visible) ──
   §3c: mandatory, zero exceptions. assessment-core.js's prepareAndPrint()
   builds this DOM generically for every core-based framework using the
   cfg.key prefix (here "nis2") — without the CSS below the elements
   exist but render unstyled/invisible: no PDF cover page, no colour, cards
   splitting across page boundaries, no confidentiality footer. */
.nis2-exec-summary { display: none; }

.nis2-exec-header {
    background: linear-gradient(135deg, var(--nis2-primary) 0%, var(--nis2-secondary) 100%);
    color: #fff;
    padding: 28px 32px;
    border-radius: 10px;
    margin-bottom: 24px;
}
.nis2-exec-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.nis2-exec-subtitle { font-size: 1.15rem; opacity: .85; margin-bottom: 2px; }
.nis2-exec-date { font-size: .82rem; opacity: .7; }

.nis2-exec-score-block {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
}
.nis2-exec-big-score { font-size: 3.2rem; font-weight: 700; }
.nis2-exec-rating { font-size: 1.1rem; font-weight: 600; }

.nis2-exec-pillars {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.nis2-exec-pillar-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    border: 1.5px solid;
}

.nis2-exec-gaps {
    background: var(--bg-1);
    border-radius: 10px;
    padding: 18px 22px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
}
.nis2-exec-gaps h3 {
    font-size: .95rem;
    color: var(--nis2-primary);
    margin-bottom: 10px;
}
.nis2-exec-gap-item {
    padding: 6px 0 6px 16px;
    border-left: 3px solid #c0392b;
    font-size: .87rem;
    color: var(--text-1);
    margin-bottom: 6px;
}

/* Print footer (hidden on screen) */
.nis2-print-footer { display: none; }

/* ── MOBILE ── */
@media (max-width: 900px) {
    .assessment-container.has-sidebar { grid-template-columns: 1fr; }
    .progress-tracker { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .results-panel { padding: 16px; }
}

/* ─────────────────────────────────────────
   Sector + org-size scoping modal & bar (§13/§17 of build plan)
   Deliberately no .n2-scope-hidden class — this never hides a question,
   unlike CIS's .ig-hidden. Mirrors .ig-modal/.ig-options/.ig-card/.ig-bar's
   shape but with a two-step panel and a plain "Change" link instead of a
   live 3-way toggle group.
   ───────────────────────────────────────── */
.n2-scope-modal { max-width: 760px; }
.n2-scope-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 20px 0;
}
.n2-scope-card {
    background: #f8f9fb;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 14px;
    cursor: pointer;
    text-align: center;
    transition: border-color .2s, box-shadow .2s;
}
.n2-scope-card:hover {
    border-color: var(--nis2-primary);
    box-shadow: 0 2px 12px rgba(22,163,74,.15);
}
.n2-scope-card-title { font-size: 1rem; font-weight: 700; color: var(--nis2-primary); margin-bottom: 4px; }
.n2-scope-card-desc { font-size: .76rem; color: var(--text-2); line-height: 1.4; }
.n2-scope-back {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}
.n2-scope-back:hover { color: var(--nis2-primary); border-color: var(--nis2-primary); }

/* Inline informational bar above the questionnaire */
.n2-scope-bar {
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.n2-scope-bar-label { font-size: .85rem; font-weight: 600; color: var(--text-1); white-space: nowrap; }
.n2-scope-bar-value { font-size: .85rem; color: var(--text-2); flex: 1; }
.n2-scope-bar-change {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 5px 14px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--nis2-primary);
    cursor: pointer;
}
.n2-scope-bar-change:hover { border-color: var(--nis2-primary); }

@media (max-width: 600px) {
    .n2-scope-options { grid-template-columns: 1fr; }
    .n2-scope-modal { max-width: 500px; }
    .n2-scope-bar { flex-direction: column; align-items: flex-start; }
}

@media print {
    /* Printing is only ever triggered from inside the results panel via
       exportPDF() -> window.print() — hide the questionnaire and chrome,
       print only the results panel, matching every shipped framework. */
    #sch-nav-bar, .header, .save-bar, .progress-tracker, #assessment-form,
    .results-actions, .results-header, .n2-scope-bar { display: none !important; }
    body { background: #fff !important; color: #000 !important; padding: 0 !important; padding-top: 0 !important; margin: 0; }
    .results-panel {
        position: static !important;
        display: block !important;
        inset: auto;
        padding: 0 !important;
        background: #fff !important;
        overflow: visible !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page { size: A4; margin: 15mm 18mm; }

    .nis2-exec-summary {
        display: block !important;
        page-break-after: always;
    }

    .results-summary, .results-issues, .nis2-radar-wrapper, .principle-card,
    .nis2-exec-gaps { page-break-inside: avoid; }

    .results-issues { page-break-before: auto; }
    .results-issues:first-of-type { page-break-before: always; }

    .results-grid { grid-template-columns: repeat(5, 1fr) !important; gap: 8px !important; }
    .principle-card { padding: 8px 10px !important; }
    .principle-card-title { font-size: .72rem !important; }
    .principle-score-label { font-size: .68rem !important; }

    .nis2-radar-wrapper svg { width: 100%; max-width: 480px; height: auto; }

    .nis2-print-footer {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0; right: 0;
        background: #ffffff;
        border-top: 2px solid var(--nis2-primary);
        padding: 5px 18mm;
        align-items: center;
    }
    .nis2-footer-col { flex: 1; font-size: 6.5pt; color: #5a6a7a; }
    .nis2-footer-left { text-align: left; font-weight: 700; color: #1c2a38; }
    .nis2-footer-right { text-align: right; }
}
