/* 3.14.1 — one spacing contract for authenticated portal screens. */
@media screen {
    .app-frame.portal-workspace {
        --portal-page-inset: 24px;
        --portal-card-inset: 24px;
        --portal-section-gap: 24px;
    }
    .app-frame.portal-workspace .workspace.page-shell {
        padding: var(--portal-page-inset) var(--portal-page-inset) 40px;
    }
    .app-frame.portal-workspace .portal-contextbar.topbar { padding-inline: var(--portal-page-inset); }
    .app-frame.portal-workspace .portal-page-stack {
        display: flex;
        flex-direction: column;
        gap: var(--portal-section-gap);
        min-width: 0;
    }
    .app-frame.portal-workspace .portal-page-stack > * { min-width: 0; margin-block: 0; }
    .app-frame.portal-workspace .workspace.page-shell .card:not(.results-card):not(.results-context-note):not(.commercial-document) {
        padding: var(--portal-card-inset);
        min-width: 0;
    }
    .app-frame.portal-workspace .workspace.page-shell .results-card > .section-heading {
        padding: var(--portal-card-inset) var(--portal-card-inset) 0;
    }
    .app-frame.portal-workspace .workspace.page-shell .results-card > .pagination {
        padding: 16px var(--portal-card-inset);
    }
    .app-frame.portal-workspace .workspace.page-shell .card > .section-heading:first-child h2,
    .app-frame.portal-workspace .workspace.page-shell .card > h2:first-child,
    .app-frame.portal-workspace .workspace.page-shell .card > h3:first-child { margin-top: 0; }
    .app-frame.portal-workspace .workspace.page-shell .card:not(.results-card) > .section-heading {
        padding: 0;
    }
    .app-frame.portal-workspace .competency-workspace,
    .app-frame.portal-workspace .credit-overview-grid,
    .app-frame.portal-workspace .assessment-history-workspace,
    .app-frame.portal-workspace .assessment-explorer-workspace,
    .app-frame.portal-workspace .organization-workspace,
    .app-frame.portal-workspace .company-portal-workspace,
    .app-frame.portal-workspace .commercial-workspace,
    .app-frame.portal-workspace .credits-workspace { gap: var(--portal-section-gap); }
    .app-frame.portal-workspace .commercial-workspace { display: grid; grid-template-columns: minmax(0, 1fr); }
    .app-frame.portal-workspace :is(.commercial-workspace, .competency-workspace, .assessment-history-workspace,
        .assessment-explorer-workspace, .organization-workspace, .company-portal-workspace, .credits-workspace) > :is(.card, .page-heading, .seller-dashboard-grid) {
        margin-block: 0;
    }
    .app-frame.portal-workspace .portal-page-stack .table-scroll {
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
    }
    .app-frame.portal-workspace .portal-page-stack .table-scroll > table {
        width: 100%;
        border-collapse: collapse;
        color: var(--ink);
        font-size: .82rem;
    }
    .app-frame.portal-workspace .portal-page-stack .table-scroll > table th,
    .app-frame.portal-workspace .portal-page-stack .table-scroll > table td {
        padding: 14px 16px;
        border-bottom: 1px solid var(--line);
        text-align: left;
        vertical-align: top;
    }
    .app-frame.portal-workspace .portal-page-stack .table-scroll > table th {
        padding-block: 13px;
        font-size: .75rem;
        color: var(--muted);
        background: var(--soft);
        font-weight: 700;
    }
    .app-frame.portal-workspace .portal-page-stack .table-scroll > table tbody tr:hover { background: var(--soft); }
    .app-frame.portal-workspace .portal-page-stack .field,
    .app-frame.portal-workspace .portal-page-stack fieldset { min-width: 0; }
    .app-frame.portal-workspace .portal-page-stack fieldset:not(.mud-input-outlined-border) { border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
    .app-frame.portal-workspace .portal-page-stack textarea {
        width: 100%; max-width: 100%; box-sizing: border-box; min-height: 96px;
        padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
        font: inherit; color: var(--ink); background: var(--panel, #fff); resize: vertical;
    }
    .app-frame.portal-workspace .portal-page-stack textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
    .app-frame.portal-workspace .portal-page-stack .button-row { flex-wrap: wrap; }
    .app-frame.portal-workspace .portal-page-stack .section-heading,
    .app-frame.portal-workspace .portal-page-stack .page-heading { flex-wrap: wrap; }
    .app-frame.portal-workspace .portal-page-stack .assessment-tool-workflows p { margin-bottom: 0; }
    .app-frame.portal-workspace .workspace.page-shell .results-context-note > div { padding: var(--portal-card-inset); }
}
@media screen and (max-width: 1100px) {
    .app-frame.portal-workspace { --portal-page-inset: 16px; --portal-card-inset: 20px; }
}
@media screen and (max-width: 600px) {
    .app-frame.portal-workspace { --portal-card-inset: 16px; --portal-section-gap: 20px; }
    .app-frame.portal-workspace .credit-overview-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 3.14.2: fixed, readable Life Wheel in generation, reports and mobile. */
.wheel-domain-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-4,1rem); margin-block:1rem; }
.wheel-domain-groups section { padding:1rem; border-radius:12px; background:var(--surface-soft,#f7fafb); }
.wheel-domain-groups h3 { margin:0 0 .5rem; }
.wheel-domain-groups ul { margin:0; padding-left:1.25rem; }
.wheel-domain-groups li { margin-block:.35rem; }
.wheel-model-preview { margin-block:1rem; }
.wheel-model-preview summary { cursor:pointer; font-weight:600; }
.life-wheel-chart.life-wheel-standard { width:100%; max-width:860px; height:auto; display:block; margin-inline:auto; }
@media(max-width:640px) { .wheel-domain-groups {grid-template-columns:1fr;} }

/* Keep autocadastro checkbox and label on the same row, including narrow screens. */
.app-frame.portal-workspace .portal-page .anonymous-mode-option { display:flex; flex-direction:row; align-items:center; gap:.65rem; }
.app-frame.portal-workspace .portal-page .anonymous-mode-option > input[type="checkbox"] { flex:0 0 auto; width:1.1rem; height:1.1rem; min-width:1.1rem; padding:0; margin:0; }
.app-frame.portal-workspace .portal-page .anonymous-mode-option > span { flex:1; min-width:0; line-height:1.45; }

/* V3-015 / 3.15.3: optional configuration uses the existing model disclosure. */
.generation-options > .button { margin-block: 1rem; }
.generation-options fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.generation-actions { margin-block: 1rem; }
.generation-actions .danger-text { color: var(--danger, #b42318); }

/* Expanded sections stay in the same printable report. */
[id^="expanded-"] { scroll-margin-top: 6rem; }
@media print { #disc-expanded-inline, #disc-summary-inline { display: block; } }

/* V3-020: shared portal spacing; public WASM form has its own isolated stylesheet. */
.nps-creation-grid { grid-template-columns: minmax(0,1fr); }
.nps-configuration { display:grid; gap:16px; }
.nps-department-editor { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.nps-department-editor .mud-input-control { flex:1 1 260px; }
.nps-departments { display:flex; flex-wrap:wrap; gap:8px; }
.nps-department-tag { display:inline-flex; align-items:center; gap:8px; padding:4px 6px 4px 12px; border:1px solid #dce1eb; border-radius:24px; }
.nps-score-summary { display:flex; align-items:center; gap:24px; margin:24px 0; flex-wrap:wrap; }
.nps-score-summary strong { font-size:3rem; color:#3443bd; }
.nps-poster { max-width:780px; margin:24px auto; text-align:center; }
.nps-poster-qr { width:min(100%,320px); height:auto; display:block; margin:24px auto; image-rendering:pixelated; }
.nps-poster-url { overflow-wrap:anywhere; font-size:.86rem; }
@media print { .nps-poster { border:0; margin:0 auto; padding:12mm; box-shadow:none; break-inside:avoid; } .nps-poster-qr { width:70mm; height:70mm; } .nps-poster h1 { font-size:26pt; } }

/* V3-022: same global spacing; one ECO question per controlled MudStepper step. */
.eco-configuration, .eco-collector { display: grid; gap: var(--mdl-space-4, 1rem); min-width: 0; }
.eco-stepper-nav { max-width: 100%; }
.eco-stepper-nav .mud-step-label-content { max-width: 0; overflow: hidden; }
.eco-stepper-nav .mud-stepper-nav-connector { min-width: .5rem; }
.eco-question-prompt { font-size: 1.15rem; line-height: 1.6; }
.eco-collector .mud-radio-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.eco-review { display: grid; gap: 1rem; }
.eco-review article { border-bottom: 1px solid var(--mud-palette-lines-default); padding-block: .75rem; }
.eco-attribution { border-top: 1px solid var(--mud-palette-lines-default); margin-top: 1rem; padding-top: 1rem; font-size: .9rem; }
@media (max-width: 600px) { .eco-collector .mud-radio-group { flex-direction: column; } .eco-collector .mud-stepper-actions { flex-wrap: wrap; gap: .5rem; } }
@media print { .eco-report { box-shadow: none; } .eco-report tr { break-inside: avoid; } .eco-report .table-scroll { overflow: visible; } }

/* V3-023: use the same portal tokens for the EPJO collective flow. */
.epjo-configuration, .epjo-collector { display: grid; gap: var(--mdl-space-4, 1rem); min-width: 0; }
.epjo-stepper-nav { max-width: 100%; }
.epjo-stepper-nav .mud-step-label-content { max-width: 0; overflow: hidden; }
.epjo-stepper-nav .mud-stepper-nav-connector { min-width: .5rem; }
.epjo-question-prompt { font-size: 1.15rem; line-height: 1.6; }
.epjo-collector .mud-radio-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.epjo-review { display: grid; gap: 1rem; }
.epjo-review article { border-bottom: 1px solid var(--mud-palette-lines-default); padding-block: .75rem; }
.epjo-attribution { border-top: 1px solid var(--mud-palette-lines-default); margin-top: 1rem; padding-top: 1rem; font-size: .9rem; }
@media (max-width: 600px) { .epjo-collector .mud-radio-group { flex-direction: column; } .epjo-collector .mud-stepper-actions { flex-wrap: wrap; gap: .5rem; } }
@media print { .epjo-report { box-shadow: none; } .epjo-report tr { break-inside: avoid; } .epjo-report .table-scroll { overflow: visible; } }

/* V3-024: EAEG reuses the portal spacing and controlled stepper. */
.eaeg-configuration, .eaeg-collector { display: grid; gap: var(--mdl-space-4, 1rem); min-width: 0; }
.eaeg-stepper-nav { max-width: 100%; }
.eaeg-stepper-nav .mud-step-label-content { max-width: 0; overflow: hidden; }
.eaeg-stepper-nav .mud-stepper-nav-connector { min-width: .5rem; }
.eaeg-question-prompt { font-size: 1.15rem; line-height: 1.6; }
.eaeg-collector .mud-radio-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.eaeg-review { display: grid; gap: 1rem; }
.eaeg-review article { border-bottom: 1px solid var(--mud-palette-lines-default); padding-block: .75rem; }
.eaeg-attribution { border-top: 1px solid var(--mud-palette-lines-default); margin-top: 1rem; padding-top: 1rem; font-size: .9rem; }
@media (max-width: 600px) { .eaeg-collector .mud-radio-group { flex-direction: column; } .eaeg-collector .mud-stepper-actions { flex-wrap: wrap; gap: .5rem; } }
@media print { .eaeg-report { box-shadow: none; } .eaeg-report tr { break-inside: avoid; } .eaeg-report .table-scroll { overflow: visible; } }

/* V3-025 magnitude, no normative categories. */
.collective-intensity { display:block; width:8rem; max-width:100%; height:1rem; border:1px solid var(--mud-palette-lines-default); border-radius:.25rem; overflow:hidden; }
.collective-intensity > span { display:block; height:100%; background:var(--mud-palette-primary); }
@media print { .collective-panel { break-inside:avoid; } .collective-intensity { print-color-adjust:exact; } }

/* IBACO nominal department report tables share portal spacing. */
.ibaco-exploration-table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.ibaco-exploration-table th,.ibaco-exploration-table td{padding:12px 14px;text-align:left;border-bottom:1px solid #e2e8f0;vertical-align:top}.ibaco-exploration-table thead{background:#f6f7fc}.ibaco-exploration-table th:first-child{min-width:180px}.ibaco-exploration-table td{min-width:95px}@media print{.ibaco-exploration-table{font-size:8pt}.ibaco-exploration-table th,.ibaco-exploration-table td{padding:5px;min-width:0}.table-scroll{overflow:visible!important}}

.mdl-tool-journey{padding:16px 0;border-top:1px solid var(--mud-palette-lines-default,#e0e5ed)}
.mdl-tool-journey h3{margin:0 0 8px}.mdl-tool-journey p{max-width:80ch}

/* Shared CEP assistance, within the existing responsive form grid. */
.postal-code-field { display:flex; flex-direction:column; gap:.35rem; min-width:0; width:100%; }
.postal-code-field small { font-size:.85em; line-height:1.4; color:var(--mud-palette-text-secondary); }

.person-occupation-editor { margin-block:1rem; min-width:0; }
.cbo-suggestion { justify-content:flex-start; text-align:left; text-transform:none; white-space:normal; overflow-wrap:anywhere; }
.person-occupation-view small { display:block; }
.company-intake-table .person-occupation-editor { min-width:18rem; max-width:28rem; }
