/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --orange: #E8751A;
    --orange-light: #FFF3E8;
    --orange-dark: #c45e0d;
    --grey-bg: #f5f5f5;
    --grey-border: #d0d0d0;
    --text: #222;
    --text-muted: #666;
    --white: #fff;
    --radius: 8px;
}

html { font-size: 16px; }
body { font-family: 'Segoe UI', Arial, sans-serif; color: var(--text); background: var(--grey-bg); }

/* ── Site Header ──────────────────────────────────────────────────────── */
.site-header {
    background: var(--orange);
    color: white;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-brand { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.04em; }
.header-nav a { color: white; text-decoration: none; margin-left: 1.5rem; font-size: 0.95rem; opacity: 0.9; }
.header-nav a:hover { opacity: 1; text-decoration: underline; }

/* ── Timer Bar ────────────────────────────────────────────────────────── */
.timer-bar {
    background: #333;
    color: white;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.timer-label { opacity: 0.8; }
.timer-display { font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.timer-bar.timer-urgent { background: #c0392b; }
.timer-bar.timer-urgent .timer-display { animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0.5; } }
.timer-instructions-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}
.timer-instructions-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Instructions Modal ──────────────────────────────────────────────── */
.instructions-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.instructions-modal-dialog {
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}
.instructions-modal-dialog .section-name {
    display: inline-block;
    background: var(--orange);
    color: white;
    padding: 0.25rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}
.instructions-modal-dialog h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }
.instructions-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.instructions-modal-close:hover { color: #333; }

/* ── Page Layout ──────────────────────────────────────────────────────── */
.page-content {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.page-content.full-width { max-width: 100%; }

/* ── Card ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.card-sm { padding: 1.25rem 1.5rem; }

/* ── Headings ─────────────────────────────────────────────────────────── */
h1 { font-size: 2rem; color: var(--orange); margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; color: var(--orange); margin-bottom: 1rem; }
h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 0.75rem; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.95rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], textarea, select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(232,117,26,0.15);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary { background: #555; color: white; }
.btn-secondary:hover { background: #333; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--orange);
    color: var(--orange);
}
.btn-outline:hover { background: var(--orange); color: white; }
.btn-lg { padding: 0.85rem 2.5rem; font-size: 1.15rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-danger { background: #c0392b; color: white; }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 0.3rem 0.85rem; font-size: 0.85rem; }

/* ── Icon Buttons (table row actions) ───────────────────────────────── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    color: inherit;
    text-decoration: none;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon-view { color: var(--orange); border: 1.5px solid var(--orange); }
.btn-icon-view:hover { background: var(--orange); color: var(--white); }
.btn-icon-muted { color: var(--text-muted); }
.btn-icon-muted:hover { background: var(--grey-bg); color: var(--text); }
.btn-icon-danger { color: #c0392b; }
.btn-icon-danger:hover { background: #fde8e8; color: #8b2020; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.alert-error { background: #fde8e8; border: 1px solid #e08080; color: #8b2020; }
.alert-success { background: #e8f5e9; border: 1px solid #80c880; color: #1b5e20; }
.alert-info { background: var(--orange-light); border: 1px solid #f0b070; color: #7a3a00; }

/* ── Tables ───────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { background: var(--orange); color: white; padding: 0.65rem 0.75rem; text-align: left; font-weight: 600; }
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #eee; }
tr:hover td { background: var(--orange-light); }

/* ── Status Badges ────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-pending { background: #eee; color: #555; }
.badge-progress { background: #fff3cd; color: #856404; }
.badge-done { background: #d4edda; color: #155724; }

/* ── Section Cover (instructions screen) ─────────────────────────────── */
.section-cover {
    text-align: center;
    padding: 3rem 2rem;
}
.section-cover .section-name {
    display: inline-block;
    background: var(--orange);
    color: white;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
}
.section-cover h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.section-cover .timer-info {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}
.section-cover .instructions {
    max-width: 700px;
    margin: 0 auto 2.5rem;
    text-align: left;
    background: var(--orange-light);
    border-left: 4px solid var(--orange);
    padding: 1.25rem 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    line-height: 1.7;
}
.instructions .example-box {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #f5f0ff;
    border-radius: 8px;
    border-left: 3px solid #7c5cbf;
}
.instructions .example-box p { margin: 0.3rem 0; }
.instructions .example-box .example-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #7c5cbf;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.instructions .example-box .example-series {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.instructions .example-box .example-answer {
    color: #5a3d8a;
    font-weight: 600;
}
.instructions .tip-box {
    margin: 1rem 0;
    padding: 0.6rem 1rem;
    background: #e8f4f8;
    border-radius: 8px;
    font-size: 0.93rem;
}
.instructions .tip-box p { margin: 0.3rem 0; }

/* ── RA question image ────────────────────────────────────────────────── */
.ra-question { margin-bottom: 2.5rem; }
.ra-question img {
    width: 100%;
    max-width: 720px;
    display: block;
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.ra-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.ra-option {
    flex: 1;
    min-width: 80px;
    max-width: 130px;
    padding: 0.6rem 1rem;
    border: 2px solid var(--grey-border);
    border-radius: var(--radius);
    background: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}
.ra-option:hover { border-color: var(--orange); color: var(--orange); }
.ra-option.selected { background: var(--orange); color: white; border-color: var(--orange); }
.ra-option input { display: none; }

/* ── RV question ──────────────────────────────────────────────────────── */
.rv-question {
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: white;
}
.rv-question-number {
    display: inline-block;
    background: var(--orange);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 0.5rem;
}
.rv-stem {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.5;
}
.rv-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}
.rv-option label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--grey-border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.95rem;
    transition: all 0.15s;
}
.rv-option label:hover { border-color: var(--orange); background: var(--orange-light); }
.rv-option input[type="radio"]:checked + label,
.rv-option label:has(input[type="radio"]:checked) {
    border-color: var(--orange);
    background: var(--orange-light);
    font-weight: 600;
}
.rv-option input[type="radio"] { accent-color: var(--orange); width: 16px; height: 16px; }

/* ── RN question ──────────────────────────────────────────────────────── */
.rn-question {
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    background: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.rn-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 42px;
    background: var(--grey-bg);
    border: 1px solid var(--grey-border);
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 0 0.75rem;
}
.rn-blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 42px;
}
.rn-blank input {
    width: 64px;
    height: 42px;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 600;
    border: 2px solid var(--grey-border);
    border-radius: 6px;
    background: #fffaf5;
}
.rn-blank input:focus { border-color: var(--orange); }
.rn-sep { font-size: 1.1rem; color: var(--text-muted); }
.rn-q-number {
    font-weight: 700;
    color: var(--orange);
    min-width: 30px;
    font-size: 1rem;
}

/* ── RP question ──────────────────────────────────────────────────────── */
.rp-question {
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: white;
}
.rp-problem-text {
    font-size: 0.97rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--text);
}
.rp-answer-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

/* ── Stop page ────────────────────────────────────────────────────────── */
.stop-page {
    text-align: center;
    padding: 3rem 1rem;
}
.stop-page h2 { color: #333; font-size: 1.6rem; margin-bottom: 1rem; }
.stop-page p { color: var(--text-muted); margin-bottom: 2rem; font-size: 1.05rem; }

/* ── Done page ────────────────────────────────────────────────────────── */
.done-page { text-align: center; padding: 3rem 1rem; }
.done-page .checkmark { font-size: 4rem; color: var(--orange); margin-bottom: 1rem; }
.done-page h1 { color: #333; }

/* ── Admin PIN display ────────────────────────────────────────────────── */
.pin-display {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--orange);
    font-variant-numeric: tabular-nums;
    background: var(--orange-light);
    border: 2px solid var(--orange);
    border-radius: var(--radius);
    padding: 0.75rem 2rem;
    display: inline-block;
    margin: 1rem 0;
}

/* ── Login page ───────────────────────────────────────────────────────── */
.login-wrap {
    max-width: 420px;
    margin: 4rem auto;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo h1 { font-size: 2.5rem; margin-bottom: 0; }
.login-logo p { color: var(--text-muted); font-size: 1rem; margin-top: 0.25rem; }

/* ── Link-style Button ────────────────────────────────────────────────── */
.btn-link { background: none; border: none; color: var(--orange); cursor: pointer; text-decoration: underline; font-size: 0.95rem; padding: 0; }
.btn-link:hover { color: var(--orange-dark); }

/* ── Utilities ────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.nowrap { white-space: nowrap; }

/* ── Responsive Guard ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .card { padding: 1rem; }
    table { font-size: 0.85rem; }
    th, td { padding: 0.5rem 0.5rem; }
}

/* ── Client Search Dropdown ── */
.search-container { position: relative; }
.search-results {
    position: absolute;
    z-index: 50;
    width: 100%;
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    background: var(--white);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.search-result-item {
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-size: 0.92rem;
}
.search-result-item:hover { background: var(--orange-light); }

/* ── Client Interactions ── */
.interaction-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--grey-border);
}
.interaction-item:last-child { border-bottom: none; }
.interaction-item p { margin-top: 0.3rem; white-space: pre-wrap; }

/* ── Release Notes ── */
.release-note {
    background: var(--white);
    border-left: 4px solid var(--orange);
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.release-note h2 { margin-bottom: 0.5rem; }
.release-note p { color: var(--text-muted); margin-bottom: 0.75rem; }
.release-note ul { padding-left: 1.25rem; }
.release-note li { margin-bottom: 0.4rem; line-height: 1.5; }

/* ── Help guides (Pages/Admin/Ajuda) ── */
.help-link { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.5rem; color: var(--orange); font-weight: 600; text-decoration: none; white-space: nowrap; }
.help-link:hover { color: var(--orange-dark); text-decoration: underline; }
.help-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.1rem; height: 1.1rem; border-radius: 50%;
    background: var(--orange); color: var(--white); font-size: 0.75rem; font-weight: 700;
}
.guide-card { display: block; color: inherit; text-decoration: none; border-left: 4px solid var(--orange); transition: box-shadow 0.15s; }
.guide-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.14); }
.guide-card h2 { margin-bottom: 0.4rem; }
.guide-card p { margin-bottom: 0.6rem; }
.guide-start { color: var(--orange); font-weight: 600; font-size: 0.9rem; }
a.qf-progress-step { text-decoration: none; }
a.qf-progress-step:hover { box-shadow: 0 0 0 2px var(--orange); }
.guide-step-count { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.3rem; }
.guide-text { line-height: 1.65; margin-bottom: 1.25rem; }
.guide-text p + p { margin-top: 0.6rem; }
.guide-note { background: var(--orange-light); border-left: 3px solid var(--orange); padding: 0.6rem 0.9rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.95rem; }
.guide-shot { display: block; width: 100%; height: auto; border: 1px solid var(--grey-border); border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ── Credentials Footer ── */
.credentials-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Questionnaire inputs (Pages/Shared/_QuestionInput) ── */
.q { padding: 1rem 0; border-bottom: 1px solid #eee; }
.q:last-child { border-bottom: none; }
.q-title { font-weight: 600; margin-bottom: 0.6rem; line-height: 1.45; }
.q-num { color: var(--orange); margin-right: 0.2rem; }
.q-hint { font-weight: 400; color: var(--text-muted); font-size: 0.88rem; }
.q-error { background: #fff3f3; box-shadow: -4px 0 0 #e08080; padding-left: 0.75rem; padding-right: 0.75rem; border-radius: 4px; }
.q-error > .q-title { color: #8b2020; }

.q-options { display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.q-options-inline { display: flex; flex-wrap: wrap; }
.q-options-stack { grid-template-columns: 1fr; }
.q-option {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.55rem 0.8rem; margin: 0;
    border: 1px solid var(--grey-border); border-radius: 6px;
    font-weight: 400; font-size: 0.95rem; line-height: 1.35;
    cursor: pointer; background: var(--white);
    transition: border-color 0.15s, background 0.15s;
}
.q-option:hover { border-color: var(--orange); }
.q-option:has(input:checked) { border-color: var(--orange); background: var(--orange-light); font-weight: 600; }
.q-option:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.q-option input, .q-cell input { accent-color: var(--orange); width: 18px; height: 18px; margin-top: 0.05rem; flex-shrink: 0; }
.q-consent { border-width: 2px; }
.q-other { margin-top: 0.5rem; }
.q-other[hidden] { display: none; }

/* Grids: table layout on wide screens, stacked rows with labelled pills on phones */
.q-grid { --q-cell-w: 6.5rem; }
.q-grid-dual { --q-cell-w: 6.5rem; }
.q-grid-check { --q-cell-w: 9rem; }
.q-grid-head, .q-grid-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) calc(var(--q-cols) * var(--q-cell-w));
    align-items: center;
    gap: 0.5rem;
}
.q-grid-head { position: sticky; top: 0; z-index: 2; background: var(--white); padding: 0.4rem 0; border-bottom: 2px solid var(--orange); font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.q-grid-cells { display: grid; grid-template-columns: repeat(var(--q-cols), 1fr); text-align: center; }
.q-grid-group-title { color: var(--orange); }
.q-grid-row { padding: 0.35rem 0; border-bottom: 1px solid #f0f0f0; }
.q-grid-row:hover { background: #fafafa; }
.q-grid-label { font-size: 0.95rem; }
.q-row-hint { display: block; font-size: 0.8rem; color: var(--text-muted); }
.q-cell-group { display: contents; }
.q-cell { display: flex; justify-content: center; align-items: center; margin: 0; padding: 0.35rem 0; cursor: pointer; font-weight: 400; }
.q-cell span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.q-clear {
    margin-left: 0.4rem; padding: 0.05rem 0.45rem; border: 1px solid var(--grey-border); border-radius: 4px;
    background: var(--white); color: var(--text-muted); font-size: 0.75rem; cursor: pointer;
}
.q-clear:hover { border-color: var(--orange); color: var(--orange); }
.q-grid-row:not(:has(input:checked)) .q-clear { display: none; }
/* ColumnGrid (e.g. the parents' profession): long lists as two tables side by side */
.q-grid-pick { --q-cell-w: 4rem; }
.q-grid-halves { display: grid; grid-template-columns: 1fr; gap: 0 2rem; }
@media (min-width: 900px) { .q-grid-halves { grid-template-columns: 1fr 1fr; } }
.q-other-columns { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.q-other-columns label { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-weight: 600; }
.q-other-columns input { width: auto; min-width: 14rem; }

@media (max-width: 767px) {
    .q-grid-head { display: none; }
    .q-grid-row { grid-template-columns: 1fr; padding: 0.7rem 0; }
    .q-grid-label { font-weight: 600; }
    .q-grid-cells { display: flex; flex-wrap: wrap; gap: 0.4rem; text-align: left; }
    .q-cell-group { display: flex; flex-wrap: wrap; gap: 0.4rem; width: 100%; }
    .q-cell {
        padding: 0.45rem 0.75rem; gap: 0.4rem;
        border: 1px solid var(--grey-border); border-radius: 999px; font-size: 0.9rem;
    }
    .q-cell span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .q-cell:has(input:checked) { border-color: var(--orange); background: var(--orange-light); font-weight: 600; }
    .q-options { grid-template-columns: 1fr; }
    /* Long Mãe/Pai lists: the two pills on the same line as the profession */
    .q-grid-pick .q-grid-row { grid-template-columns: minmax(0, 1fr) auto; padding: 0.4rem 0; }
    .q-grid-pick .q-grid-label { font-weight: 400; }
    .q-grid-pick .q-grid-cells { flex-wrap: nowrap; }
}

/* ── Student questionnaire form (Pages/Test/Questionario) ── */
.qf-wrap { max-width: 860px; margin: 0 auto; }
.qf-intro h1 { font-size: 1.6rem; }
.qf-intro p { line-height: 1.6; margin-top: 0.6rem; }
.qf-subtitle { color: var(--orange); font-weight: 600; }
.qf-confidential { font-size: 0.85rem; background: #eef3f8; padding: 0.5rem 0.75rem; border-radius: 4px; }
.qf-section h2 { margin-bottom: 0.25rem; }
.qf-signature { margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; text-align: right; }
.qf-progress { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-bottom: 1rem; }
.qf-progress-step {
    width: 2.2rem; height: 2.2rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.9rem; background: #e9ecef; color: #666;
}
.qf-progress-step.active { background: var(--orange); color: #fff; }
.qf-progress-step.done { background: #f3b98a; color: #fff; }
.qf-nav { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0 3rem; }
.qf-nav [hidden], .q-step[hidden], #qf-intro[hidden] { display: none; }

/* ── Questionnaire answers (Pages/Shared/_QuestionAnswer) ── */
.qa { padding: 0.75rem 0; border-bottom: 1px solid #eee; break-inside: avoid; }
.qa:last-child { border-bottom: none; }
.qa-question { font-weight: 600; margin-bottom: 0.35rem; }
.qa-answer { padding-left: 0.75rem; white-space: pre-wrap; }
.qa-list { padding-left: 2rem; }
.qa-table { width: auto; min-width: 50%; font-size: 0.9rem; }
.qa-table th { background: var(--orange-light); color: var(--text); padding: 0.35rem 0.6rem; }
.qa-table td { padding: 0.3rem 0.6rem; }

@media print {
    .site-header, .credentials-footer, .no-print { display: none !important; }
    body { background: #fff; }
    .page-content { margin: 0; max-width: 100%; }
    .card { box-shadow: none; padding: 0.5rem 0; }
}

/* ── Student access ── */
.student-code { font-family: Consolas, 'Courier New', monospace; font-size: 1.15rem; letter-spacing: 0.12em; }
.access-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.access-slip { border: 1px dashed #999; border-radius: 6px; padding: 0.9rem 1rem; background: var(--white); break-inside: avoid; }
.access-slip p { margin: 0.2rem 0; }
.turma-progress { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.9rem; }
.turma-progress li { display: flex; align-items: center; gap: 0.4rem; }
.turma-students { padding-left: 1.25rem; margin-top: 0.5rem; }
.turma-students li { margin: 0.25rem 0; }
.turma-session { margin-left: 0.5rem; font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
@media print {
    .access-sheet { grid-template-columns: repeat(2, 1fr); }
}

/* ── Session Result Visualization ── */

/* Holland RIASEC scores table */
.holland-scores-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.95rem;
}
.holland-scores-table th,
.holland-scores-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
}
.holland-scores-table th {
    background: #fdf5e6;
    font-weight: 700;
    color: #8b6914;
}
.holland-scores-table td:first-child {
    text-align: left;
    font-weight: 500;
}
.holland-total-row td {
    border-top: 2px solid #c2851e;
    background: #fdf5e6;
}

/* Holland top areas */
.holland-top-area {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}
.holland-top-area:last-child { border-bottom: none; }
.holland-top-letter {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #c2851e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Sociability score circle */
.sociability-score-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: #1a7a8a;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
}

/* Answer grid for IPPR / BFP compact display */
.answer-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px;
    background: var(--grey-border);
    border: 1px solid var(--grey-border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.85rem;
}
.answer-grid-header {
    background: var(--grey-bg);
    padding: 0.3rem 0.4rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
}
.answer-grid-cell {
    background: #fff;
    padding: 0.25rem 0.4rem;
    text-align: center;
    display: flex;
    justify-content: space-between;
}
.answer-grid-cell .q-num {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.answer-grid-cell .q-val {
    font-weight: 600;
}

/* Legend bar */
.legend-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: var(--grey-bg);
    border-radius: 4px;
    color: var(--text);
}
.legend-item .legend-key {
    font-weight: 700;
    color: var(--orange);
}

/* Result answer table */
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.result-table th,
.result-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.result-table th {
    background: var(--grey-bg);
    font-weight: 600;
    color: var(--text);
}
.result-table tbody tr:hover { background: #fafafa; }
.result-table .empty { color: var(--text-muted); }
