:root {
    --ace-navy: #1F3A5F;
    --ace-teal: #1F8A8A;
    --ace-gold: #C9A227;
    --ace-ink: #1B2433;
    --ace-muted: #5B6578;
    --ace-line: #DDE3EA;
    --ace-bg: #F5F7FA;
    --ace-red: #C62828;
}

html, body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ace-ink);
    background: var(--ace-bg);
}

/* ---------- app bar ---------- */
.ace-appbar { border-bottom: 1px solid var(--ace-line); }
.ace-appbar.ace-persona { border-bottom: 2px solid var(--ace-red); }
.ace-org-logo { height: 36px; width: auto; max-width: 140px; object-fit: contain; margin: 0 10px 0 4px; }
.ace-org-name { font-weight: 600; font-size: 1.05rem; color: var(--ace-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ace-showall { margin-right: 12px; }
.ace-identity { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.ace-identity:hover { background: rgba(31, 58, 95, .06); }
.ace-identity-name { font-weight: 600; font-size: .92rem; color: var(--ace-navy); }
.ace-identity-meta { font-size: .76rem; color: var(--ace-navy); opacity: .8; }
.ace-identity-persona .ace-identity-name,
.ace-identity-persona .ace-identity-meta { color: var(--ace-red); opacity: 1; }
.ace-brand { border-left: 1px solid var(--ace-line); margin-left: 8px; padding-left: 14px; line-height: 1.05; text-align: left; }
.ace-brand-name { font-weight: 700; color: var(--ace-navy); letter-spacing: .01em; font-size: .95rem; }
.ace-brand-tag { font-size: .7rem; color: var(--ace-teal); white-space: nowrap; letter-spacing: .02em; }
.acc-brand .ace-brand { border-left: 0; margin-left: 0; padding-left: 0; }
.acc-brand .ace-brand-name { font-size: 1.35rem; }
.acc-brand .ace-brand-tag { font-size: .7rem; line-height: 1.25; }

@media (max-width: 760px) {
    .ace-brand, .ace-org-name, .ace-identity-meta { display: none; }
}

/* ---------- layout ---------- */
.ace-main { display: flex; flex-direction: column; min-height: 100vh; }
.ace-page { flex: 1; padding: 20px 24px 32px; max-width: 1500px; width: 100%; }
.ace-footer {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 24px; font-size: .78rem; color: var(--ace-muted);
    border-top: 1px solid var(--ace-line); background: #fff;
}
.ace-loading { display: grid; place-items: center; min-height: 60vh; }
.ace-drawer .mud-navmenu { padding-top: 8px; }

/* ---------- headings ---------- */
.ace-heading { margin-bottom: 16px; }
.ace-crumbs { padding: 0 0 4px 0 !important; font-size: .8rem; }
.ace-title { font-size: 1.55rem; font-weight: 700; color: var(--ace-navy); margin: 0; line-height: 1.25; }
.ace-subtitle { color: var(--ace-muted); font-size: .9rem; margin-top: 2px; }
.ace-muted { color: var(--ace-muted); }

/* ---------- cards and grids ---------- */
.ace-card-link { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.ace-card-link:hover { border-color: var(--ace-teal) !important; box-shadow: 0 2px 10px rgba(31, 58, 95, .08); }
.ace-stat-value { font-size: 1.7rem; font-weight: 700; color: var(--ace-navy); line-height: 1; }
.ace-stat-label { font-size: .82rem; color: var(--ace-muted); }
.ace-row-link { cursor: pointer; }
.ace-search { max-width: 280px; }
.ace-search-wide { max-width: 520px; }
.ace-tabs .mud-tabs-tabbar { border-bottom: 1px solid var(--ace-line); }
.ace-price { font-weight: 600; color: var(--ace-navy); font-size: .85rem; }
.ace-store-card { height: 100%; }
.ace-listing { white-space: pre-line; line-height: 1.6; }

/* ---------- full-screen record ---------- */
.ace-record { max-width: 1100px; }
.ace-record-bar {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ace-line);
}
.ace-record-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ace-teal); font-weight: 700; }

/* ---------- split view (questions) ---------- */
.ace-split { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px; align-items: start; }
.ace-split-list { position: sticky; top: 80px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; overflow: hidden; }
.ace-qlist { overflow-y: auto; flex: 1; }
.ace-qref { font-weight: 600; color: var(--ace-navy); min-width: 52px; display: inline-block; }
.ace-qtitle { font-size: .85rem; }
.ace-qheading { font-size: 1.2rem; font-weight: 700; color: var(--ace-navy); margin: 2px 0 8px; }
.ace-qplain { font-size: 1.02rem; line-height: 1.55; }
.ace-details { margin: 8px 0 12px; font-size: .88rem; }
.ace-details summary { cursor: pointer; color: var(--ace-teal); font-weight: 600; }
.ace-owners { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85rem; color: var(--ace-muted); margin-bottom: 12px; }
.ace-choices { display: flex; flex-direction: column; }
@media (max-width: 900px) {
    .ace-split { grid-template-columns: 1fr; }
    .ace-split-list { position: static; max-height: 360px; }
}

/* ---------- errors ---------- */
.ace-error { padding: 24px; border: 1px solid #F1C0C0; background: #FFF6F6; border-radius: 6px; }
.ace-error-retry { margin-top: 8px; padding: 6px 14px; border: 1px solid var(--ace-navy); background: #fff; color: var(--ace-navy); border-radius: 4px; cursor: pointer; }

/* ---------- account pages (sign-in, 2FA, password) ---------- */
.acc-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
             background: linear-gradient(160deg, #1F3A5F 0%, #24476F 55%, #1F8A8A 100%); }
.acc-card { width: 100%; max-width: 420px; background: #fff; border-radius: 10px; padding: 32px 30px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.acc-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.acc-logo { width: 46px; height: 46px; }
.acc-brand-name { font-size: 1.35rem; font-weight: 700; color: var(--ace-navy); }
.acc-brand-tag { font-size: .78rem; color: var(--ace-teal); }
.acc-title { font-size: 1.25rem; margin: 0 0 12px; color: var(--ace-ink); }
.acc-text { color: var(--ace-muted); font-size: .9rem; }
.acc-form { display: flex; flex-direction: column; gap: 14px; }
.acc-form label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--ace-ink); }
.acc-form label small { font-weight: 400; color: var(--ace-muted); }
.acc-form input { padding: 10px 12px; border: 1px solid #C5CEDA; border-radius: 6px; font-size: 1rem; font-family: inherit; }
.acc-form input:focus { outline: 2px solid var(--ace-teal); outline-offset: 0; border-color: var(--ace-teal); }
.acc-form .validation-message { color: #C62828; font-weight: 400; font-size: .8rem; }
.acc-button { margin-top: 6px; padding: 11px; border: 0; border-radius: 6px; background: var(--ace-navy); color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; }
.acc-button:hover { background: #172C48; }
.acc-error { background: #FFF2F2; border: 1px solid #F1C0C0; color: #A61B1B; padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; font-size: .9rem; }
.acc-note { background: #EEF7F7; border: 1px solid #BFE0E0; color: #155E5E; padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; font-size: .88rem; }
.acc-note code { font-size: 1.05rem; font-weight: 700; letter-spacing: .12em; }
.acc-links { display: flex; justify-content: space-between; margin-top: 14px; }
.acc-link { background: none; border: 0; padding: 0; color: var(--ace-teal); font-size: .88rem; cursor: pointer; text-decoration: none; font-family: inherit; }
.acc-link:hover { text-decoration: underline; }
.acc-version { margin-top: 16px; font-size: .75rem; color: rgba(255,255,255,.75); }

#blazor-error-ui { display: none; }

/* ---------- answer types ---------- */
.ace-qchild { padding-left: 18px; }
.ace-number { max-width: 240px; }
.ace-target { padding-top: 6px; line-height: 1.3; }
.ace-doc { padding: 12px 14px; border: 1px dashed var(--ace-line); border-radius: 6px; background: #FAFBFC; }

/* ---------- reports ---------- */
.ace-picker { min-width: 320px; }
.ace-report-table th.num, .ace-report-table td.num { text-align: right; white-space: nowrap; }
.ace-report-table td { vertical-align: top; }
.ace-status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.ace-status-met { background: #E7F4EA; color: #2E7D32; }
.ace-status-partly { background: #FFF3E0; color: #B26A00; }
.ace-status-notmet { background: #FDECEA; color: var(--ace-red); }
.ace-status-missing { background: #FFF8E1; color: #8A6D00; border: 1px dashed #E0B400; }
.ace-status-na { background: #EEF1F5; color: var(--ace-muted); }
.ace-report-row-notmet td:first-child { box-shadow: inset 4px 0 0 var(--ace-red); }
.ace-report-row-missing td:first-child { box-shadow: inset 4px 0 0 #E0B400; }
.ace-report-row-partly td:first-child { box-shadow: inset 4px 0 0 #E08A00; }
.ace-count { font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.ace-count-notmet { background: #FDECEA; color: var(--ace-red); }
.ace-count-missing { background: #FFF8E1; color: #8A6D00; }
.ace-count-partly { background: #FFF3E0; color: #B26A00; }
.ace-risk-line { color: var(--ace-red); font-size: .82rem; margin-top: 3px; display: flex; gap: 4px; align-items: flex-start; }

/* executive summary */
.ace-exec-headline { display: flex; gap: 28px; align-items: center; }
.ace-exec-score { text-align: center; min-width: 120px; }
.ace-rag { font-size: 2.6rem; font-weight: 800; line-height: 1; padding: 14px 10px; border-radius: 12px; }
.ace-rag-green { color: #2E7D32; background: #E7F4EA; }
.ace-rag-amber { color: #B26A00; background: #FFF3E0; }
.ace-rag-red { color: var(--ace-red); background: #FDECEA; }
.ace-exec-lead { font-size: 1.12rem; line-height: 1.5; margin: 4px 0 6px; color: var(--ace-ink); }
.ace-exec-card { height: 100%; }
.ace-radar { width: 100%; height: auto; max-height: 440px; }
.ace-radar-ring { fill: none; stroke: var(--ace-line); stroke-width: 1; }
.ace-radar-axis { stroke: var(--ace-line); stroke-width: 1; }
.ace-radar-scale { font-size: 10px; fill: #98A2B3; }
.ace-radar-label { font-size: 12.5px; fill: var(--ace-ink); font-weight: 600; }
.ace-radar-value { font-size: 11.5px; fill: var(--ace-teal); font-weight: 700; }
.ace-radar-shape { fill: rgba(31, 138, 138, .22); stroke: var(--ace-teal); stroke-width: 2.5; stroke-linejoin: round; }
.ace-radar-dot { fill: var(--ace-teal); stroke: #fff; stroke-width: 1.5; }
.ace-risk-group { margin-bottom: 14px; }
.ace-risk-heading { font-weight: 700; text-transform: uppercase; font-size: .75rem; letter-spacing: .06em; margin-bottom: 6px; }
.ace-risk-high .ace-risk-heading { color: var(--ace-red); }
.ace-risk-medium .ace-risk-heading { color: #B26A00; }
.ace-risk-low .ace-risk-heading { color: var(--ace-muted); }
.ace-risk { padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; background: #FAFBFC; border-left: 4px solid var(--ace-line); }
.ace-risk-high .ace-risk { border-left-color: var(--ace-red); background: #FFF7F6; }
.ace-risk-medium .ace-risk { border-left-color: #E08A00; background: #FFFBF3; }
.ace-risk-text { font-size: .95rem; line-height: 1.4; }
.ace-risk-meta { font-size: .78rem; color: var(--ace-muted); margin-top: 2px; }
@media (max-width: 760px) { .ace-exec-headline { flex-direction: column; align-items: flex-start; } }

/* print: just the report */
@media print {
    .mud-appbar, .mud-drawer, .ace-footer, .ace-noprint, .ace-picker, .mud-breadcrumbs { display: none !important; }
    .mud-main-content { padding: 0 !important; margin: 0 !important; }
    .ace-page { padding: 0; max-width: none; }
    .ace-exec-card, .mud-paper { break-inside: avoid; box-shadow: none !important; }
    body { background: #fff; }
}
.ace-inline-link { color: var(--ace-teal); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* show / hide password */
.acc-pass { position: relative; display: flex; }
.acc-pass input { flex: 1; padding-right: 44px !important; }
.acc-reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; border: 0; background: none;
              cursor: pointer; border-radius: 5px; display: grid; place-items: center; color: var(--ace-muted); }
.acc-reveal:hover, .acc-reveal:focus-visible { color: var(--ace-navy); background: rgba(31, 58, 95, .07); outline: none; }
.acc-reveal svg { width: 20px; height: 20px; fill: currentColor; }
.acc-reveal .acc-eye-off, .acc-reveal.acc-reveal-on .acc-eye { display: none; }
.acc-reveal.acc-reveal-on .acc-eye-off { display: block; }

/* sidebar: menu at the top, version at the foot (same height and line as the footer) */
.ace-drawer .mud-drawer-content { height: 100%; }
.ace-drawer-body { display: flex; flex-direction: column; height: 100%; }
.ace-drawer-body .ace-nav { flex: 1; overflow-y: auto; }
.ace-drawer-brand { padding: 12px 24px 4px; border-top: 1px solid var(--ace-line); background: #fff; text-align: center; }
.ace-drawer-brand img { width: 100%; max-width: 170px; height: auto; }
.ace-drawer-version { padding: 6px 16px 10px; font-size: .78rem; line-height: 1.43; color: var(--ace-muted); background: #fff; }
.ace-footer { line-height: 1.43; position: sticky; bottom: 0; z-index: 5; }   /* always visible, on every screen */

/* organisation tree */
.ace-tree { display: inline-flex; align-items: center; gap: 6px; }
.ace-tree-branch { color: #98A2B3; }
.ace-path { display: flex; align-items: center; gap: 6px; color: var(--ace-muted); font-size: .85rem; margin-top: -8px; }

/* ---- admin screens (6.11.2.002) ---- */
.ace-panel { height: 100%; }
.ace-facts th { font-weight: 500; color: var(--mud-palette-text-secondary); white-space: nowrap; width: 1%; padding-right: 16px !important; }
.ace-select-sm { max-width: 190px; }
.ace-text-red { color: var(--mud-palette-error); }
.ace-logo-preview { min-height: 80px; display: flex; align-items: center; justify-content: center; padding: 12px;
                    border: 1px dashed var(--mud-palette-lines-default); border-radius: 8px; background: var(--mud-palette-background-gray); }
.ace-logo-preview img { max-width: 100%; max-height: 80px; object-fit: contain; }
.ace-notes-history { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 0.875rem; line-height: 1.5;
                     margin: 0; max-height: 360px; overflow-y: auto; padding: 12px; border-radius: 8px;
                     background: var(--mud-palette-background-gray); border: 1px solid var(--mud-palette-lines-default); }

/* 6.11.11.001: playbook grids (spreadsheet style) */
.ace-view-toggle { min-width: 220px; }
.ace-sheet .mud-table-cell { white-space: nowrap; font-size: .82rem; padding: 4px 10px; vertical-align: top; }
.ace-sheet .mud-table-head .mud-table-cell { font-weight: 600; background: var(--mud-palette-background-gray); }
.ace-sheet .ace-wrap { white-space: normal; min-width: 280px; max-width: 520px; }

/* 6.11.11.002: risk register - ratings and the 5 x 5 heat map */
.ace-risk { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.ace-risk-low      { background: #d8f0e0; color: #1d5b33; }
.ace-risk-medium   { background: #fff0bf; color: #6b5200; }
.ace-risk-high     { background: #ffd3b0; color: #7a3300; }
.ace-risk-critical { background: #f6b3b3; color: #7a0f0f; }
.ace-trend-up   { color: #b3261e; font-weight: 600; }
.ace-trend-down { color: #1d7a3d; font-weight: 600; }
.ace-heat-wrap { display: flex; align-items: center; gap: 8px; max-width: 760px; }
.ace-heat-axis-y { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 600; color: var(--mud-palette-text-secondary); }
.ace-heat-axis-x { max-width: 760px; text-align: center; font-weight: 600; color: var(--mud-palette-text-secondary); padding-left: 130px; }
.ace-heat { flex: 1; display: grid; grid-template-columns: 110px repeat(5, minmax(0, 1fr)); gap: 4px; }
.ace-heat-label { font-size: .78rem; color: var(--mud-palette-text-secondary); display: flex; align-items: center; }
.ace-heat-x { justify-content: center; text-align: center; padding-top: 2px; }
.ace-heat-cell { aspect-ratio: 1.6; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: .55; }
.ace-heat-cell.has { opacity: 1; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0,0,0,.15); }
.ace-heat-cell.has:hover { box-shadow: inset 0 0 0 3px rgba(0,0,0,.35); }
.ace-heat-count { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.ace-heat-refs { font-size: .68rem; text-align: center; padding: 0 4px; }
@media (max-width: 600px) { .ace-heat { grid-template-columns: 64px repeat(5, minmax(0, 1fr)); } .ace-heat-axis-x { padding-left: 80px; } .ace-heat-refs { display: none; } }

/* 6.11.12: playbook engine v2 - outline (document view), answers, notes */
.ace-outline { overflow-y: auto; padding: 6px 0; }
.ace-outline-section { display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px; font-size: .85rem; color: var(--mud-palette-primary); border-top: 1px solid var(--ace-line); }
.ace-outline-section:first-child { border-top: 0; }
.ace-outline-section.is-excluded { opacity: .55; text-decoration: line-through; }
.ace-outline-q { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 14px; cursor: pointer; font-size: .86rem; border-left: 3px solid transparent; }
.ace-outline-q:hover { background: rgba(31,58,95,.05); }
.ace-outline-q.is-selected { background: rgba(31,138,138,.10); border-left-color: var(--mud-palette-secondary); }
.ace-outline-q.is-excluded .ace-qtitle, .ace-outline-q.is-excluded .ace-qref { opacity: .55; text-decoration: line-through; }
.ace-outline-q .ace-qtitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ace-outline .mud-switch { margin: 0; }
.ace-risk-grid { display: grid; grid-template-columns: 130px minmax(150px, 1fr) minmax(150px, 1fr) 110px; gap: 8px; align-items: center; }
@media (max-width: 700px) { .ace-risk-grid { grid-template-columns: 1fr 1fr; } }
.ace-rownotes .ace-notes-history { max-height: 220px; overflow-y: auto; }


/* page sections (SectionHeader): a chapter-style heading with a rule across the page; parts of a section (SubHeader) */
.cfg-section { margin: 36px 0 12px; }
.cfg-section:first-child, .cfg-section.cfg-first { margin-top: 8px; }
.cfg-section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 6px;
                    border-bottom: 2px solid var(--mud-palette-primary); }
.cfg-section-title { font-size: 1.25rem; font-weight: 700; color: var(--mud-palette-primary); line-height: 1.3; }
.cfg-section-actions { margin-left: 16px; /* next to the title, on the left (read left to right) */ display: flex; align-items: center; gap: 8px; }
.cfg-section-caption { margin-top: 6px; font-size: 0.8rem; color: var(--mud-palette-text-secondary); }
.cfg-subhead { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; padding-bottom: 3px;
               font-size: 0.95rem; font-weight: 600; border-bottom: 1px solid var(--mud-palette-lines-default); }
.cfg-subhead { margin-top: 22px; border-bottom-color: var(--mud-palette-gray-light, #d0d0d0); }
.cfg-subhead:first-child, .cfg-subhead.cfg-first { margin-top: 6px; }
.cfg-subhead-caption { margin: -2px 0 8px; font-size: 0.8rem; color: var(--mud-palette-text-secondary); }

/* the restructured playbook pages (copied from CFGC, 24 Nov 2026) */
.cfg-scroll-x { overflow-x: auto; }
.cfg-formula { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; background: var(--mud-palette-background-gray, #f5f5f5); padding: 2px 6px; border-radius: 4px; display: inline-block; }
/* the side menu's separators */
.ace-nav .ace-nav-divider { margin: 6px 12px; }
/* the Store sits at the foot of the side menu, above the logo */
.ace-drawer-body .ace-nav { display: flex; flex-direction: column; }
.ace-nav .ace-nav-bottom { margin-top: auto; padding-bottom: 4px; }
/* side menu as a flex column: the separators keep their size; no sideways scroll */
.ace-nav .ace-nav-divider { flex: 0 0 auto; }
.ace-drawer-body .ace-nav { overflow-x: hidden; }
.ace-drawer-body .ace-nav > * { flex: 0 0 auto; }

/* a screen's instructions (ScreenInstructions): what you are looking at, what you can do */
.cfg-instructions { background: #fff; border: 1px solid var(--ace-line); border-left: 4px solid var(--mud-palette-primary); border-radius: 6px;
                    padding: 10px 14px; margin: 0 0 16px; }
.cfg-instructions-edit { display: flex; gap: 4px; margin: -4px 0 4px -8px; }
.cfg-instructions-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 24px; font-size: .9rem; }
.cfg-instructions-label { font-weight: 600; color: var(--ace-navy); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }

/* a question's requirement: its basis, what it requires (paraphrased) and why it matters */
.cfg-requirement { background: var(--mud-palette-background-gray, #f5f7f9); border-radius: 6px; padding: 6px 10px; margin: 6px 0 8px; font-size: .88rem; }
.cfg-requirement .mud-chip { margin: 0 6px 0 0; }
.cfg-requirement-why { color: var(--mud-palette-text-secondary); margin-top: 4px; font-size: .82rem; }
