:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    font-weight: 400;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #e3e8ef;
    --primary: #2457d6;
    --primary-dark: #1943aa;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --ok: #067647;
    --ok-bg: #ecfdf3;
    --warning: #b54708;
    --warning-bg: #fffaeb;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.hidden { display: none !important; }

.shell { width: min(960px, calc(100% - 32px)); margin: 44px auto; }
.student-page .shell { width: min(1280px, calc(100% - 32px)); }
.teacher-shell { width: min(1280px, calc(100% - 32px)); margin: 36px auto 80px; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 34px rgba(16, 24, 40, .06);
    padding: 28px;
}
.narrow { width: min(560px, 100%); margin: 8vh auto 0; }
.eyebrow { color: var(--primary); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; }
h1 { margin: 6px 0 10px; line-height: 1.15; }
h2, h3 { margin-top: 0; }
.muted { color: var(--muted); }
.tiny { font-size: .78rem; }
.error { color: var(--danger); background: var(--danger-bg); border-radius: 10px; padding: 10px 12px; }

form { display: grid; gap: 16px; margin-top: 22px; }
label { display: grid; gap: 7px; font-weight: 650; }
input, textarea {
    width: 100%;
    border: 1px solid #cdd5df;
    border-radius: 11px;
    padding: 12px 13px;
    background: #fff;
    color: var(--text);
    outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 87, 214, .12); }

button {
    border: 0;
    border-radius: 11px;
    padding: 11px 16px;
    font-weight: 750;
}
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #eef2f7; color: var(--text); }
.danger { background: var(--danger); color: #fff; }
.big { padding: 14px 20px; font-size: 1.05rem; }
.notice { background: #f0f4ff; border: 1px solid #d9e2ff; border-radius: 12px; padding: 14px 16px; margin: 22px 0; }

.exam-header, .dashboard-header, .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}
.timer-box {
    min-width: 150px;
    text-align: right;
    background: #111827;
    color: white;
    border-radius: 14px;
    padding: 10px 16px;
}
.timer-box span { display: block; opacity: .72; font-size: .75rem; }
.timer-box strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }

.progress-wrap { margin: 24px 0 14px; }
.progress-meta { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); margin-bottom: 7px; }
.progress-bar { height: 8px; background: #e8edf3; border-radius: 999px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--primary); transition: width .2s ease; }

.question-card { min-height: 330px; }
.question-number { color: var(--primary); font-weight: 800; margin-bottom: 12px; }
.display-question-title { font-size: 1.1rem; font-weight: 780; line-height: 1.38; margin: -2px 0 18px; overflow-wrap: anywhere; }
.preview-teacher-title { color: var(--muted); font-size: .83rem; line-height: 1.45; font-style: italic; margin: -2px 0 15px; }
.review-display-title { margin: 10px 0 0; }
.question-prompt {
    width: 100%;
    max-width: none;
    min-width: 0;
    font-size: 1.28rem;
    font-weight: 650;
    white-space: pre-wrap;
    margin-bottom: 26px;
}
.question-prompt > .htmljs-text,
.question-prompt .markdown-content {
    width: 100%;
    max-width: none;
    min-width: 0;
}
.answer-input { max-width: 460px; font-size: 1.06rem; }
.answer-textarea { min-height: 140px; resize: vertical; }
.options { display: grid; gap: 12px; }
.option {
    display: flex; grid-template-columns: auto 1fr; align-items: center;
    gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
    font-weight: 500; cursor: pointer;
}
.option:hover { background: #f8fafc; }
.option input { width: auto; margin: 0; }

.exam-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.question-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; }
.q-dot {
    width: 34px; height: 34px; padding: 0; background: #e8edf3; border-radius: 50%;
}
.q-dot.answered { background: #d1fadf; color: #05603a; }
.q-dot.current { outline: 3px solid rgba(36, 87, 214, .22); background: var(--primary); color: white; }
.submit-row { display: flex; justify-content: flex-end; margin-top: 28px; }

.warning-overlay {
    position: fixed; inset: 0; background: rgba(127, 29, 29, .94);
    display: grid; place-items: center; z-index: 99999; padding: 20px;
}
.warning-box {
    width: min(560px, 100%); background: white; border-radius: 20px; padding: 38px;
    text-align: center; box-shadow: 0 30px 90px rgba(0,0,0,.3);
}
.warning-icon { font-size: 4rem; }

.dashboard-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.pill { padding: 8px 12px; border-radius: 999px; background: #eef2f7; font-weight: 700; font-size: .84rem; }
.pill.live { background: var(--ok-bg); color: var(--ok); }
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0;
}
.stat-card {
    background: white; border: 1px solid var(--line); border-radius: 15px; padding: 18px;
}
.stat-card span { color: var(--muted); font-size: .82rem; }
.stat-card strong { display: block; font-size: 2rem; margin-top: 4px; }
.table-card { padding: 0; overflow: hidden; }
.table-head { padding: 22px 24px 10px; }
.table-head h2 { margin-bottom: 2px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; background: #fafbfc; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f8fafc; }

.status { display: inline-block; padding: 6px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-alert { background: var(--danger-bg); color: var(--danger); }
.status-offline { background: #f2f4f7; color: #475467; }
.status-submitted { background: #eef4ff; color: #3538cd; }
.status-waiting { background: var(--warning-bg); color: var(--warning); }
.alert-count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--danger-bg); color: var(--danger); font-weight: 850; }

.detail-card { margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; margin-top: 24px; }
.detail-question { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.answer-yes { color: var(--ok); font-weight: 900; }
.answer-no { color: #98a2b3; font-weight: 900; }
.event-list { max-height: 390px; overflow: auto; }
.event-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }

@media (max-width: 760px) {
    .exam-header, .dashboard-header, .detail-header { align-items: flex-start; flex-direction: column; }
    .timer-box { text-align: left; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .exam-nav { flex-wrap: wrap; }
    .question-dots { order: 3; width: 100%; }
    .dashboard-actions { width: 100%; justify-content: flex-start; }
    .dashboard-actions > * { max-width: 100%; }
}

/* V2: diàleg d'entrega, correcció i incidències agrupades */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(17, 24, 39, .72);
    backdrop-filter: blur(3px);
}
.modal-box {
    width: min(580px, 100%);
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.score-summary { margin: 22px 0 4px; }
.score-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 18px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fafbfc;
}
.score-box span { color: var(--muted); font-size: .86rem; }
.score-box strong { font-size: 1.45rem; }
.score-box small { grid-column: 1 / -1; color: var(--muted); }
.result-note {
    padding: 13px 15px;
    border-radius: 12px;
    background: #f5f7fa;
    color: var(--muted);
}
.question-small { margin: 3px 0 5px; }
.result-question {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
}
.result-question.correct { border-left: 4px solid var(--ok); }
.result-question.incorrect { border-left: 4px solid var(--danger); }
.result-question.manual { border-left: 4px solid var(--warning); }
.result-question.unanswered { border-left: 4px solid #98a2b3; }
.result-question-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.result-prompt { font-weight: 650; margin-bottom: 12px; }
.result-answer, .result-correct {
    display: grid;
    gap: 3px;
    padding: 9px 11px;
    border-radius: 10px;
    background: #f8fafc;
    margin-top: 7px;
}
.result-answer span, .result-correct span { color: var(--muted); font-size: .76rem; }
.result-answer strong, .result-correct strong { white-space: pre-wrap; overflow-wrap: anywhere; }
.grade-badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    white-space: nowrap;
}
.grade-correct { background: var(--ok-bg); color: var(--ok); }
.grade-incorrect { background: var(--danger-bg); color: var(--danger); }
.grade-manual { background: var(--warning-bg); color: var(--warning); }
.grade-unanswered { background: #f2f4f7; color: #475467; }
.incident-list { display: grid; gap: 9px; }
.incident-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.incident-item.incident-open { border-color: #fda29b; background: var(--danger-bg); }
.incident-time { text-align: right; }
.incident-time strong, .incident-time span { display: block; }
.incident-time span { color: var(--muted); font-size: .76rem; }

@media (max-width: 620px) {
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions button { width: 100%; }
    .result-question-head, .incident-item { align-items: flex-start; flex-direction: column; }
    .incident-time { text-align: left; }
}

/* --- v3: sales, exàmens i reconnexió --- */
.section-block { margin-top: 32px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading.compact { margin-bottom: 6px; }
.section-heading h2 { margin: 4px 0 0; }
.home-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 22px 0; }
.inline-form { grid-template-columns: minmax(220px, 2fr) minmax(110px, .7fr) minmax(110px, .7fr) auto; align-items: end; }
.inline-form button { height: 46px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 14px; }
.item-card { display: flex; flex-direction: column; gap: 10px; min-height: 190px; }
.item-card h3 { margin: 2px 0; }
.item-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.room-code { font-size: 2rem; font-weight: 900; letter-spacing: .12em; line-height: 1; margin-top: 6px; }
.room-open { border-top: 4px solid #067647; }
.room-closed { opacity: .78; }
.empty-card { color: var(--muted); border-style: dashed; box-shadow: none; }
.text-button { padding: 0; background: transparent; color: var(--primary); margin-bottom: 10px; }
.danger-outline { background: transparent; color: var(--danger); border: 1px solid #f3b5b0; }
.danger-outline:hover { background: var(--danger-bg); }
.button-link { display: inline-block; text-decoration: none; border-radius: 11px; padding: 11px 16px; font-weight: 750; margin-top: 10px; }
.resume-list { display: grid; gap: 10px; margin-bottom: 22px; }
.resume-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.resume-card div { display: grid; gap: 3px; }
.resume-card span { color: var(--muted); font-size: .88rem; }
.connection-pill { display: inline-block; margin-top: 5px; border-radius: 999px; padding: 4px 9px; font-size: .76rem; font-weight: 800; }
.connection-pill.connected { background: var(--ok-bg); color: var(--ok); }
.connection-pill.disconnected { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 820px) {
    .inline-form { grid-template-columns: 1fr 1fr; }
    .inline-form label:first-child { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
    .inline-form { grid-template-columns: 1fr; }
    .inline-form label:first-child { grid-column: auto; }
    .resume-card { align-items: stretch; flex-direction: column; }
    .resume-card button { width: 100%; }
}
.score-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 15px 17px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fafbfc;
}
.score-card span { color: var(--muted); font-size: .86rem; }
.graded-question {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 12px;
    background: #fff;
}
.graded-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 9px; }
.prompt-small { font-weight: 650; margin-bottom: 12px; }
.answer-box { margin-top: 4px; padding: 9px 11px; background: #f8fafc; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.correct-answer { background: #f0fdf4; }
@media (max-width: 620px) {
    .score-card, .graded-head { align-items: flex-start; flex-direction: column; }
}


/* --- v3.1: recuperació autoritzada pel professor --- */
.recovery-panel { margin-bottom: 18px; border-left: 4px solid var(--warning); }
.recovery-request-list { display: grid; gap: 10px; padding: 0 22px 22px; }
.recovery-request-item {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    border: 1px solid #fedf89; background: var(--warning-bg); border-radius: 12px; padding: 13px 14px;
}
.recovery-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 620px) {
    .recovery-request-item { align-items: stretch; flex-direction: column; }
    .recovery-actions button { flex: 1; }
}

/* --- v4: banc de preguntes i importador LaTeX --- */
.bank-counter {
    min-width: 145px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    text-align: right;
}
.bank-counter strong { display: block; font-size: 1.8rem; line-height: 1; }
.bank-counter span { color: var(--muted); font-size: .78rem; }
.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 24px;
}
.source-panel, .preview-panel { min-height: 650px; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.source-editor {
    min-height: 500px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .92rem;
    line-height: 1.48;
    tab-size: 4;
    white-space: pre;
}
.parse-status { margin-top: 12px; font-weight: 700; }
.parse-status.parse-ok { color: var(--ok); }
.parse-status.parse-bad { color: var(--danger); }
.parse-messages { display: grid; gap: 8px; margin-top: 10px; }
.parse-message { padding: 9px 11px; border-radius: 10px; }
.import-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.question-preview { display: grid; gap: 14px; }
.empty-preview {
    min-height: 260px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-align: center;
    padding: 20px;
}
.preview-question {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    background: #fff;
}
.preview-question.preview-invalid { border-color: #fda29b; background: var(--danger-bg); }
.preview-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.preview-meta > span:last-child { margin-left: auto; color: var(--muted); font-size: .82rem; }
.pill.subtle { background: #f2f4f7; color: #475467; }
.preview-prompt, .bank-prompt { font-size: 1.03rem; line-height: 1.65; }
.preview-options, .bank-options { display: grid; gap: 8px; margin: 14px 0; }
.preview-option {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfc;
}
.preview-option.correct-option { border-color: #abefc6; background: var(--ok-bg); }
.preview-answer, .bank-answer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.preview-answer span, .bank-answer span { color: var(--muted); font-size: .78rem; margin-right: 6px; }
.bank-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.bank-question-card { display: flex; flex-direction: column; gap: 10px; }
.bank-question-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.bank-question-head > div { display: flex; gap: 7px; flex-wrap: wrap; }
.bank-question-card .card-actions { margin-top: auto; }
.math-content mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    background: #f2f4f7;
    border-radius: 5px;
    padding: 1px 5px;
}

@media (max-width: 980px) {
    .editor-grid { grid-template-columns: 1fr; }
    .source-panel, .preview-panel { min-height: auto; }
}

@media (max-width: 620px) {
    .bank-counter { text-align: left; width: 100%; }
    .source-editor { min-height: 380px; }
    .bank-list { grid-template-columns: 1fr; }
}


/* --- v4.2: correcció, qualificació i exportació --- */
.monitor-actions { flex-wrap: wrap; justify-content: flex-end; }
.grade-score { font-weight: 850; color: var(--ok); font-variant-numeric: tabular-nums; }
.score-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 18px;
    align-items: center;
}
.score-card-grid > span { display: grid; gap: 2px; color: var(--muted); font-size: .82rem; }
.score-card-grid > span strong { color: var(--text); font-size: 1rem; }
.final-score { color: var(--ok) !important; font-size: 1.2rem !important; }
.pending-score { color: var(--warning) !important; }
.grading-tools { margin-top: 14px; }
.grade-editor {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: #fafbfc;
}
.grade-fields { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.points-input-row { display: flex; align-items: center; gap: 8px; }
.points-input-row input { width: 100px; }
.points-input-row span { color: var(--muted); white-space: nowrap; }
.grade-comment { min-height: 78px; resize: vertical; }
.grade-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.small-button { padding: 7px 10px; font-size: .82rem; }
@media (max-width: 900px) {
    .score-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grade-fields { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .score-card-grid { grid-template-columns: 1fr; }
    .monitor-actions { justify-content: flex-start; }
}

/* --- v5: dissenyador d'exàmens --- */
.exam-designer-callout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}
.exam-total-box {
    min-width: 128px;
    text-align: center;
    background: #111827;
    color: #fff;
    border-radius: 16px;
    padding: 12px 18px;
}
.exam-total-box span, .exam-total-box small { display: block; opacity: .7; font-size: .75rem; }
.exam-total-box strong { display: block; font-size: 2rem; line-height: 1.05; margin: 3px 0; }
.editor-config-card { margin: 22px 0; }
.exam-config-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) minmax(150px, .45fr) minmax(300px, 1fr);
    gap: 18px;
    align-items: end;
}
.toggle-label {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 11px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    background: #fafbfc;
}
.toggle-label input { width: auto; margin-top: 4px; }
.toggle-label span { display: grid; gap: 2px; }
.toggle-label small { color: var(--muted); font-weight: 400; }
.editor-selection-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
    gap: 18px;
    align-items: start;
}
.exam-bank-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, .38fr);
    gap: 10px;
    margin-bottom: 14px;
}
.exam-bank-filters select {
    width: 100%;
    border: 1px solid #cdd5df;
    border-radius: 11px;
    padding: 12px 13px;
    background: #fff;
    color: var(--text);
}
.exam-question-selector {
    display: grid;
    gap: 9px;
    max-height: 660px;
    overflow: auto;
    padding-right: 4px;
}
.exam-select-question {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 13px;
    cursor: pointer;
    background: #fff;
    font-weight: 400;
}
.exam-select-question:hover { background: #f8fafc; }
.exam-select-question.selected { border-color: #84adff; background: #f0f4ff; }
.exam-select-question > input { width: auto; margin-top: 5px; }
.exam-select-body { min-width: 0; display: grid; gap: 7px; }
.exam-select-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.exam-select-meta strong { margin-left: auto; font-size: .82rem; }
.exam-select-prompt { font-size: .9rem; color: #344054; max-height: 92px; overflow: hidden; }
.selector-empty { padding: 24px; text-align: center; }
.random-topic-list { display: grid; gap: 10px; }
.random-topic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}
.random-count-label { font-size: .76rem; color: var(--muted); gap: 4px; }
.random-count-label input { padding: 8px 9px; }
.exam-editor-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 22px 0 14px;
}
.exam-editor-summary > div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 11px;
    text-align: center;
}
.exam-editor-summary span { display: block; color: var(--muted); font-size: .72rem; }
.exam-editor-summary strong { font-size: 1.25rem; }
.full-width { width: 100%; }

@media (max-width: 980px) {
    .editor-selection-grid { grid-template-columns: 1fr; }
    .exam-config-grid { grid-template-columns: 1fr; align-items: stretch; }
}
@media (max-width: 620px) {
    .exam-designer-callout { align-items: stretch; flex-direction: column; }
    .exam-bank-filters { grid-template-columns: 1fr; }
    .random-topic-row { grid-template-columns: 1fr; }
    .exam-total-box { width: 100%; }
}


.archive-toggle { display:flex; align-items:center; gap:.55rem; margin:.5rem 0 1rem; color:var(--muted); font-weight:600; }
.archive-toggle input { width:auto; }
.archived-card { opacity:.78; border-style:dashed; }
.inline-action { margin-left:.6rem; padding:.45rem .7rem; }
.modal-overlay { position:fixed; inset:0; z-index:10000; background:rgba(15,23,42,.55); display:grid; place-items:center; padding:20px; }
.share-modal-card { width:min(520px,100%); }
.share-modal-card select { width:100%; padding:12px; border:1px solid #cdd5df; border-radius:11px; background:white; }
.account-card { margin-top:2rem; }
.admin-create-grid { display:grid; grid-template-columns:1fr 1fr auto; gap:14px; align-items:end; }
.admin-table-card { margin-top:18px; }
@media (max-width:760px){ .admin-create-grid { grid-template-columns:1fr; } }

/* v6.1 — recursos HTML/CSS/JavaScript aïllats dins dels enunciats */
.rich-prompt { display: grid; gap: 14px; }
.htmljs-text:empty { display: none; }
.htmljs-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.htmljs-frame {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 120px;
    border: 0;
    background: #fff;
}
.htmljs-missing {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--muted);
    background: #f8fafc;
    font-size: .9rem;
}
.question-prompt.rich-prompt { gap: 16px; }
@media (max-width: 620px) {
    .rich-prompt { gap: 10px; }
    .question-prompt.rich-prompt { gap: 12px; }
    .htmljs-wrap { border-radius: 8px; }
    .htmljs-frame { min-height: 80px; }
}


/* v6.2 — classificació per dificultat */
.difficulty-pill { font-weight: 700; }
.difficulty-easy { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.difficulty-medium { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.difficulty-hard { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.difficulty-unclassified { background: #f2f4f7; border-color: #d0d5dd; color: #475467; }
.difficulty-any { background: #eef4ff; border-color: #c7d7fe; color: #3538cd; }
.bank-library-filters { display:grid; grid-template-columns:minmax(220px,2fr) minmax(150px,1fr) minmax(170px,1fr); gap:10px; margin-bottom:16px; }
.bank-difficulty-editor { margin-top:12px; max-width:240px; }
.bank-difficulty-editor label { font-size:.78rem; color:var(--muted); }
.bank-difficulty-editor select { margin-top:4px; }
.exam-bank-filters { grid-template-columns:minmax(220px,2fr) minmax(150px,1fr) minmax(170px,1fr); }
.random-topic-group { border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; }
.random-topic-heading { padding:11px 13px; background:#f8fafc; border-bottom:1px solid var(--line); }
.random-topic-group .random-topic-row { padding:10px 13px; }
.random-topic-group .random-topic-row:last-child { border-bottom:0; }
@media (max-width:760px){
  .bank-library-filters, .exam-bank-filters { grid-template-columns:1fr; }
}

/* v6.3 — plantilla guiada, penalització i multiresposta */
.template-field-help {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--muted);
    font-size: .78rem;
    display: grid;
    gap: 4px;
}
.template-field-help > div { display:grid; grid-template-columns:110px 1fr; gap:10px; align-items:baseline; }
.template-field-help code { color:#667085; background:transparent; padding:0; }
.penalty-pill { background:#fff4e5; border-color:#fed7aa; color:#9a3412; font-weight:700; }
.penalty-note {
    margin: 0 0 12px;
    padding: 9px 11px;
    border-radius: 9px;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
    font-size: .9rem;
}
.option input[type="checkbox"] { accent-color: currentColor; }
@media (max-width:620px) {
    .template-field-help > div { grid-template-columns:1fr; gap:1px; }
}

/* v6.4 — edició, selecció massiva, pools manuals i permutació de preguntes */
.bank-library-filters,
.exam-bank-filters {
    grid-template-columns: minmax(220px,2fr) minmax(145px,1fr) minmax(165px,1fr) minmax(160px,1fr);
}
.bank-bulk-toolbar {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    padding:10px 12px;
    margin-bottom:12px;
    border:1px solid var(--line);
    border-radius:10px;
    background:#f8fafc;
}
.bank-question-card.bulk-selected {
    outline:2px solid #84adff;
    outline-offset:-1px;
}
.bank-select-head { display:flex; gap:12px; align-items:flex-start; flex-wrap:wrap; }
.bulk-check { display:inline-flex; gap:6px; align-items:center; font-size:.78rem; color:var(--muted); }
.bulk-check input { width:auto; margin:0; }
.tag-pill { background:#f4f3ff; border-color:#d9d6fe; color:#5925dc; }
.exam-selection-target-row {
    display:flex;
    gap:10px;
    align-items:end;
    justify-content:space-between;
    flex-wrap:wrap;
    margin-bottom:10px;
}
.exam-selection-target-row label { min-width:min(100%,280px); }
.manual-pool-list { display:grid; gap:10px; margin-bottom:16px; }
.manual-pool-empty { padding:12px; border:1px dashed var(--line); border-radius:10px; }
.manual-pool-card {
    border:1px solid var(--line);
    border-radius:12px;
    padding:12px;
    background:#fff;
}
.manual-pool-card.active-pool { border-color:#84adff; box-shadow:0 0 0 2px rgba(47,105,255,.08); }
.manual-pool-main {
    display:grid;
    grid-template-columns:minmax(170px,1fr) minmax(120px,150px) auto;
    gap:10px;
    align-items:end;
}
.manual-pool-stats { color:var(--muted); font-size:.82rem; padding-bottom:10px; }
.section-subheading { margin:16px 0 8px; color:var(--muted); font-size:.86rem; }
.exam-composition-summary {
    margin-top:14px;
    padding:11px 13px;
    border:1px solid var(--line);
    border-radius:10px;
    background:#f8fafc;
    font-size:.84rem;
}
.exam-composition-summary ul { margin:6px 0 0 18px; padding:0; }
.exam-editor-summary { grid-template-columns:repeat(4,minmax(0,1fr)); }
@media (max-width:760px) {
    .bank-library-filters, .exam-bank-filters { grid-template-columns:1fr; }
    .manual-pool-main { grid-template-columns:1fr; }
    .manual-pool-stats { padding-bottom:0; }
    .exam-editor-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* v6.5 — navegació seqüencial, resposta en blanc i temps extra */
.clear-answer-button {
    margin-top: 12px;
    width: fit-content;
}
.sequential-warning {
    border-color: #f7c873;
    background: #fff8e8;
    color: #7a4b00;
}
.sequential-nav-note {
    margin-top: 10px;
    text-align: center;
    color: #7a4b00;
    font-size: .88rem;
    font-weight: 650;
}
.q-dot:disabled {
    cursor: default;
    opacity: .65;
}
.q-dot.locked {
    background: #edf0f4;
    color: #667085;
}
.q-dot.future {
    background: #f5f7fa;
    color: #98a2b3;
}
.student-time-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    white-space: nowrap;
}
.extra-time-badge {
    display: inline-flex;
    padding: 2px 7px;
    border-radius: 999px;
    background: #ecfdf3;
    color: #027a48;
    font-size: .72rem;
    font-weight: 800;
}
button.compact {
    padding: 5px 8px;
    font-size: .78rem;
}
.extra-time-button {
    margin-top: 2px;
}
@media (max-width: 700px) {
    .student-time-cell { min-width: 92px; }
}


/* v6.5.1 — Markdown bàsic segur dins dels enunciats i opcions */
.markdown-content strong { font-weight: 850; }
.markdown-content em { font-style: italic; }
.markdown-content code {
    font-size: .92em;
    white-space: break-spaces;
}
.markdown-content .md-line { min-width: 0; }
.markdown-content .md-gap { height: .65em; }
.markdown-content ul,
.markdown-content ol {
    margin: .35em 0 .55em 1.6em;
    padding: 0;
}
.markdown-content li { margin: .18em 0; }

/* v7.0.1 · previsualització fidel de l'alumne */
.preview-professor-notice { margin-bottom: 18px; }
.preview-feedback-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    font-size: .9rem;
    cursor: pointer;
}
.preview-feedback-toggle input { width: auto; margin: 0; }
.preview-student-card { margin-bottom: 18px; }
.preview-correction {
    margin-top: 18px;
    padding: 13px 15px;
    border-radius: 12px;
    display: flex;
    gap: 10px 18px;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid var(--line);
}
.preview-correction.correct { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.preview-correction.incorrect { background: var(--danger-bg); color: var(--danger); border-color: #fda29b; }
.preview-correction.partial { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.preview-correction.manual, .preview-correction.unanswered { background: #f8fafc; color: var(--muted); }
.preview-check-button { margin-top: 12px; }
.q-dot.preview-correct-dot:not(.current) { background: #d1fadf; color: #05603a; }
.q-dot.preview-wrong-dot:not(.current) { background: #fee4e2; color: #b42318; }

/* v7.1 · Mode Assaig */
.practice-room-toggle { margin: 14px 0; }
.practice-check-button { margin-top: 12px; }
.practice-solution { margin-top: 12px; padding-top: 12px; border-top: 1px solid currentColor; display: grid; gap: 6px; }
.practice-self-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.practice-self-buttons button { flex: 1 1 150px; }
#practiceResult { margin: 18px 0; }
#retryPracticeButton { margin-bottom: 12px; }

/* v7.2 · ergonomia del dissenyador i reutilització compartida */
.exam-selector-group-title {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 7px 10px;
    margin: 0 0 6px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.automatic-blocks-panel {
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfe;
}
.automatic-blocks-panel > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
}
.automatic-blocks-panel > summary::-webkit-details-marker { display: none; }
.automatic-blocks-panel > summary span:first-child { display: grid; gap: 3px; }
.automatic-blocks-panel > summary small { color: var(--muted); font-weight: 500; }
.automatic-blocks-panel[open] > summary { border-bottom: 1px solid var(--line); }
.automatic-blocks-panel .random-topic-list { padding: 12px; }
.shared-exam-detail-card {
    width: min(1050px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
}
.shared-import-toolbar,
.shared-pools-section .section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-top: 18px;
}
.shared-exam-question-list,
.shared-exam-pool-list {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}
.shared-question-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--card);
}
.shared-question-row input { width: auto; margin-top: 3px; }
.shared-question-origin { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 5px; }
.shared-pool-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.shared-pool-card .card-actions { flex: 0 0 auto; }
@media (max-width: 760px) {
    .shared-import-toolbar,
    .shared-pools-section .section-heading,
    .shared-pool-card { align-items: stretch; flex-direction: column; }
    .shared-pool-card .card-actions { width: 100%; }
}

/* v7.3 · publicació i revisió privada de resultats */
.review-cell { display:flex; flex-direction:column; align-items:flex-start; gap:3px; min-width:82px; }
.review-published { color:var(--ok); font-size:.78rem; font-weight:800; }
.review-controls { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; align-items:center; }
.detail-review-header-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.review-page { background:#f4f6f9; }
.review-shell { width:min(980px, calc(100% - 28px)); margin:28px auto 56px; }
.review-loading { margin-top:12vh; }
.review-header { display:flex; justify-content:space-between; gap:24px; align-items:center; margin-bottom:18px; }
.review-header-actions { display:flex; gap:14px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.review-final-score { display:grid; gap:2px; min-width:120px; text-align:right; }
.review-final-score span { color:var(--muted); font-size:.8rem; }
.review-final-score strong { font-size:1.65rem; }
.review-question-list { display:grid; gap:16px; }
.review-question-card { break-inside:avoid; }
.review-question-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:14px; }
.review-points { display:grid; text-align:right; }
.review-prompt { margin-bottom:16px; }
.review-options { display:grid; gap:8px; margin:14px 0; }
.review-option { display:grid; grid-template-columns:auto 1fr auto auto; gap:9px; align-items:center; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.review-option-correct { border-color:#75e0a7; background:#ecfdf3; }
.review-option-wrong { border-color:#fda29b; background:#fff1f0; }
.review-option-selected:not(.review-option-correct):not(.review-option-wrong) { border-color:#84adff; background:#eff4ff; }
.review-option-tag { font-size:.7rem; font-weight:800; color:#175cd3; white-space:nowrap; }
.review-option-tag.correct { color:#027a48; }
.review-answer-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:14px; }
.review-correct-summary, .review-solution, .review-comment { margin-top:14px; }
.review-comment { padding:12px 14px; border-radius:10px; background:#f8fafc; border:1px solid var(--line); }
.review-comment > div:last-child { margin-top:5px; }
@media (max-width:720px) {
    .review-header { align-items:flex-start; flex-direction:column; }
    .review-header-actions { width:100%; justify-content:space-between; }
    .review-final-score { text-align:left; }
    .review-answer-grid { grid-template-columns:1fr; }
    .review-option { grid-template-columns:auto 1fr; }
    .review-option-tag { grid-column:2; }
}
@media print {
    .review-page { background:#fff; }
    .review-shell { width:100%; margin:0; }
    .review-header { box-shadow:none; border:1px solid #ddd; }
    #printReviewButton { display:none !important; }
    .review-question-card { box-shadow:none; page-break-inside:avoid; }
    .htmljs-wrap { display:none; }
}

/* v7.3.6 — enunciats fluids i justificats a examen, previsualització i targetes del banc */
.question-prompt,
.preview-prompt,
.bank-prompt {
    white-space: normal;
    text-align: justify;
    text-justify: inter-word;
}

/*
 * El renderitzador Markdown conserva cada línia del text font dins d'un
 * .md-line. Visualment, però, un salt de línia simple no ha de tallar el
 * paràgraf: les línies consecutives han de poder refluir segons l'amplada
 * real disponible. Només una línia en blanc (.md-gap) separa paràgrafs.
 */
.question-prompt .markdown-content .md-line,
.preview-prompt .markdown-content .md-line,
.bank-prompt .markdown-content .md-line {
    display: inline;
    min-width: 0;
}
.question-prompt .markdown-content .md-line::after,
.preview-prompt .markdown-content .md-line::after,
.bank-prompt .markdown-content .md-line::after {
    content: " ";
}
.question-prompt .markdown-content .md-gap,
.preview-prompt .markdown-content .md-gap,
.bank-prompt .markdown-content .md-gap {
    display: block;
}

/* El segment de text d'un enunciat sempre ocupa tota l'amplada disponible. */
.question-prompt > .htmljs-text,
.question-prompt .markdown-content,
.preview-prompt > .htmljs-text,
.preview-prompt .markdown-content,
.bank-prompt > .htmljs-text,
.bank-prompt .markdown-content {
    width: 100%;
    max-width: none;
    min-width: 0;
}

/* v7.4 — resolucions de preguntes */
.resolution-details {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
}
.resolution-details > summary {
    cursor: pointer;
    padding: 10px 13px;
    font-weight: 800;
    color: var(--ink);
    user-select: none;
}
.resolution-details > summary:hover { background: #f1f5f9; }
.resolution-content {
    padding: 2px 14px 14px;
    line-height: 1.65;
    color: var(--ink);
}
.resolution-content > :first-child { margin-top: 0; }
.resolution-content > :last-child { margin-bottom: 0; }
.preview-correction .resolution-details {
    width: 100%;
    color: var(--ink);
    background: #fff;
    border-color: rgba(15, 23, 42, .14);
}
.review-question-card .resolution-details { margin-top: 16px; }
@media print {
    .review-question-card .resolution-details > summary { display: none; }
    .review-question-card .resolution-details:not([open]) > .resolution-content { display: block; }
    .review-question-card .resolution-details { border: 1px solid #ddd; }
}

/* v7.4.3 — títols Markdown als enunciats i les resolucions.
 * Bloc real: no queden afectats per l'estil fluid dels .md-line.
 * Mides relatives perquè s'adaptin a l'enunciat, al banc i a la revisió. */
.markdown-content .md-heading {
    display: block;
    width: 100%;
    margin: .85em 0 .35em;
    line-height: 1.3;
    font-weight: 800;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}
.markdown-content .md-heading:first-child { margin-top: 0; }
.markdown-content h1.md-heading { font-size: 1.44em; }
.markdown-content h2.md-heading { font-size: 1.30em; }
.markdown-content h3.md-heading { font-size: 1.18em; }
.markdown-content h4.md-heading { font-size: 1.08em; }
.markdown-content h5.md-heading { font-size: 1em; }
.markdown-content h6.md-heading { font-size: .94em; }
/* ===============================================================
   EUDICLES 7.5 · Espai docent
   Les regles s'apliquen només a la zona docent; la pantalla d'examen
   de l'alumnat, la revisió i l'editor de resolucions no es modifiquen.
   =============================================================== */
.teacher-page {
    --bg: #fbf9f4;
    --card: #fffefd;
    --text: #112d4b;
    --muted: #5b6b7e;
    --line: #e7e6e0;
    --primary: #112d4b;
    --primary-dark: #38516c;
    --gold: #b37a28;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
.teacher-page h1, .teacher-page h2, .teacher-page h3 { letter-spacing: -.025em; }
.teacher-page .eyebrow { color: #b37a28; letter-spacing: .16em; font-size: .73rem; }
.teacher-page .card { box-shadow: 0 14px 36px rgba(17,45,75,.035); border-radius: 12px; }
.teacher-page .primary { background: #112d4b; }
.teacher-page .primary:hover { background: #38516c; }
.teacher-page .secondary { background: #f3f1eb; border: 1px solid #e7e6e0; color: #112d4b; }
.teacher-page .secondary:hover { border-color: #b37a28; background: #f6f0e6; }
.teacher-page button { border-radius: 8px; }
.teacher-page button:focus-visible, .teacher-page a:focus-visible, .teacher-page input:focus-visible,
.teacher-page select:focus-visible, .teacher-page summary:focus-visible { outline: 3px solid #b37a28; outline-offset: 2px; }
.teacher-page .notice { background: #f5efdf; border-color: #e6d6b8; }
.teacher-page .text-button { color: #8a611f; }
.teacher-page.ed-authenticated .teacher-shell {
    width: calc(100% - 250px); max-width: none; margin: 0 0 0 250px;
    padding: 37px clamp(20px, 3.5vw, 58px) 75px;
    min-width: 0;
}
.teacher-page .ed-sidebar { width: 250px; position: fixed; inset: 0 auto 0 0; z-index: 900;
    background: #112d4b; color: #fff; display: flex; flex-direction: column;
    padding: 24px 15px 21px; overflow-y: auto;
}
.teacher-page .ed-brand { text-decoration: none; color: #fff; display: flex; align-items: center;
    gap: 12px; padding: 6px 10px 22px; border-bottom: 1px solid #38516c; }
.teacher-page .ed-brand-mark { display: grid; place-items: center; width: 43px; height: 43px;
    border: 1px solid #a5844c; border-radius: 50%; flex: none; color: #d5b87e; }
.teacher-page .ed-brand-mark svg { width: 34px; height: 34px; }
.teacher-page .ed-brand strong { font: normal 22px/1.2 Georgia, serif; letter-spacing: .085em; display: block; }
.teacher-page .ed-brand small { font-size: 9px; letter-spacing: .15em; color: #b8c9d7; display: block; margin-top: 4px; }
.teacher-page .ed-nav { padding-top: 27px; display: grid; align-content: start; gap: 5px; }
.teacher-page .ed-nav-heading { color: #d5b87e; font-weight: 750; font-size: 10px;
    letter-spacing: .14em; padding: 0 11px; margin-bottom: 8px; }
.teacher-page .ed-nav-heading-separated { margin-top: 25px; padding-top: 18px; border-top: 1px solid #38516c; }
.teacher-page .ed-nav-link { background: transparent; border: 0; color: #dce6ed; font-weight: 580;
    font-size: 14px; text-align: left; padding: 11px 12px; border-radius: 8px; width: 100%;
    display: flex; align-items: center; gap: 12px; flex: none; }
.teacher-page .ed-nav-link:hover, .teacher-page .ed-nav-link.is-active { background: #31506c; color: white; }
.teacher-page .ed-nav-link.is-active { box-shadow: inset 3px 0 #d5b87e; }
.teacher-page .ed-nav-icon { color: #d9bc86; font-size: 19px; line-height: 1; display: inline-grid;
    place-items: center; width: 22px; flex: none; font-family: Georgia, serif; }
.teacher-page .ed-sidebar-bottom { margin-top: auto; padding-top: 24px; }
.teacher-page .ed-sidebar-note { border-top: 1px solid #38516c; color: #b9cad7;
    font: italic 12px/1.6 Georgia, serif; margin: 15px 10px 0; padding-top: 15px; }
.teacher-page .ed-topbar { height: 71px; position: sticky; top: 0; z-index: 850;
    margin-left: 250px; background: #fffefa; border-bottom: 1px solid #e7e6e0;
    padding: 0 clamp(20px, 3.5vw, 58px); display: flex; align-items: center;
    justify-content: space-between; gap: 14px; }
.teacher-page .ed-topbar-location { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.teacher-page .ed-topbar-location span { color: #778493; }
.teacher-page .ed-topbar-location span::after { content: '/'; margin-left: 12px; color: #c4c9c8; }
.teacher-page .ed-topbar-location strong { color: #112d4b; font-weight: 750; }
.teacher-page .ed-topbar-account { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 650; }
.teacher-page .ed-avatar { background: #f3e8d2; border: 1px solid #dfcbab; color: #8a642a;
    display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; font-weight: 800; }
.teacher-page .ed-mobile-menu { display: none; background: none; color: #112d4b; padding: 4px 8px; font-size: 26px; }
.teacher-page .ed-page-heading { margin: 0 0 27px; }
.teacher-page .ed-page-heading h1 { font: normal clamp(31px, 3.3vw, 42px)/1.18 Georgia, serif; margin: 9px 0 10px; }
.teacher-page .ed-page-heading p { font-size: 14px; max-width: 700px; margin: 0; }
.teacher-page .ed-create-banner { background: #f4ead8; border: 1px solid #e7d8bd; border-radius: 13px;
    padding: 27px 30px; margin: 24px 0; display: flex; align-items: center;
    justify-content: space-between; gap: 26px; }
.teacher-page .ed-create-banner h2 { font: normal 25px/1.25 Georgia, serif; margin: 6px 0 8px; }
.teacher-page .ed-create-banner p { margin: 0; font-size: 13px; color: #5b6b7e; }
.teacher-page .ed-create-banner #bankInfo { margin-top: 10px; font-size: 12px; }
.teacher-page .ed-create-banner button { flex: none; }
.teacher-page .ed-home-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.teacher-page .ed-home-panel { min-width: 0; padding: 24px; }
.teacher-page .ed-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.teacher-page .ed-panel-head h2 { font: normal 22px/1.22 Georgia, serif; margin: 6px 0 0; }
.teacher-page .ed-inline-link { background: none; color: #91601a; padding: 5px 1px;
    font-size: 12px; font-weight: 750; white-space: nowrap; }
.teacher-page .ed-inline-link:hover { text-decoration: underline; }
.teacher-page .ed-brief-row { display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 0; border-bottom: 1px solid #e7e6e0; }
.teacher-page .ed-brief-row:last-child { border-bottom: none; }
.teacher-page .ed-brief-row > div { min-width: 0; }
.teacher-page .ed-brief-row strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.teacher-page .ed-brief-row small { display: block; color: #5b6b7e; font-size: 12px; margin-top: 4px; }
.teacher-page .ed-empty-state { font-size: 13px; padding: 16px 0; }
.teacher-page .ed-home-tip { border: 1px dashed #d6bc86; background: #fffefa; border-radius: 10px;
    padding: 18px 22px; display: flex; justify-content: space-between; align-items: center;
    gap: 16px; margin-top: 22px; }
.teacher-page .ed-home-tip p { margin: 4px 0 0; color: #5b6b7e; font-size: 13px; }
.teacher-page .ed-filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin: 21px 0 8px; }
.teacher-page .ed-filterbar .ed-filter-search { flex: 1 1 250px; }
.teacher-page .ed-filterbar .ed-filter-select { flex: 0 1 230px; }
.teacher-page .ed-filterbar .ed-filter-select select { width: 100%; }
.teacher-page .ed-filterbar label { font-weight: 500; }
.teacher-page .ed-filterbar input, .teacher-page .ed-filterbar select { border: 1px solid #d9ddd9;
    padding: 10px 12px; border-radius: 8px; background: white; min-height: 44px; }
.teacher-page .ed-filterbar input[type="checkbox"] { min-height: 0; }
.teacher-page .ed-filterbar .archive-toggle { white-space: nowrap; font-size: 13px; }
.teacher-page .ed-sr-only { border: 0; clip: rect(0,0,0,0); clip-path: inset(50%);
    height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.teacher-page .ed-list-count { color: #778493; font-size: 12px; margin: 10px 0 12px; }
.teacher-page .ed-compact-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.teacher-page .ed-compact-list .item-card { min-height: 0; padding: 20px 23px; border-radius: 10px;
    display: grid; grid-template-columns: minmax(190px, .9fr) minmax(250px, 1.1fr); gap: 7px 22px;
    border-left: 3px solid #dfd7c9; }
.teacher-page .ed-compact-list .item-card-top { grid-column: 1; grid-row: 1 / span 2; }
.teacher-page .ed-compact-list .item-card h3 { font-size: 16px; line-height: 1.35; }
.teacher-page .ed-compact-list .item-card > p { grid-column: 2; margin: 0; font-size: 12px; }
.teacher-page .ed-compact-list .item-card > p.tiny { font-size: 11px; }
.teacher-page .ed-compact-list .item-card .card-actions { grid-column: 1 / -1; padding-top: 12px;
    border-top: 1px solid #efeee8; margin-top: 8px; }
.teacher-page .ed-compact-list .card-actions button { padding: 8px 12px; font-size: 12px; }
.teacher-page .ed-compact-list .item-card.room-open { border-left: 3px solid #236747; border-top: 1px solid #e7e6e0; }
.teacher-page .ed-compact-list .item-card.archived-card { border-left-color: #a1a8ad; }
.teacher-page #roomCards .item-card-top { grid-row: 1 / span 2; }
.teacher-page #roomCards .item-card > h3 { grid-column: 2; font-size: 16px; margin: 0; }
.teacher-page #roomCards .item-card > p { grid-column: 2; }
.teacher-page #roomCards .room-code { font: normal 27px/1.12 Georgia, serif; margin-top: 6px; }
.teacher-page .ed-compact-list .empty-card { padding: 26px; }
.teacher-page .ed-help-intro { padding: 25px 27px; margin-bottom: 19px; background: #f5eedf; }
.teacher-page .ed-help-intro h2 { font: normal 24px Georgia, serif; margin-bottom: 10px; }
.teacher-page .ed-help-intro p { font-size: 14px; color: #5b6b7e; }
.teacher-page .ed-steps { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.teacher-page .ed-steps span { padding: 8px 10px; border: 1px solid #dfccae; border-radius: 7px;
    background: #fffefa; font-size: 12px; }
.teacher-page .ed-help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px; align-items: start; }
.teacher-page .ed-help-item { padding: 19px 21px; }
.teacher-page .ed-help-item summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.teacher-page .ed-help-item p { color: #5b6b7e; font-size: 13px; line-height: 1.65; }
.teacher-page .ed-help-item button { font-size: 12px; }
@media(max-width: 1100px) {
    .teacher-page .ed-home-panels, .teacher-page .ed-help-grid { grid-template-columns: 1fr; }
    .teacher-page .ed-compact-list .item-card { grid-template-columns: 1fr; }
    .teacher-page .ed-compact-list .item-card-top,
    .teacher-page #roomCards .item-card-top { grid-column: 1; grid-row: auto; }
    .teacher-page .ed-compact-list .item-card > p,
    .teacher-page #roomCards .item-card > h3,
    .teacher-page #roomCards .item-card > p { grid-column: 1; }
}
@media(max-width: 800px) {
    .teacher-page.ed-authenticated .teacher-shell { width: 100%; margin-left: 0; padding: 23px 19px 75px; }
    .teacher-page .ed-topbar { margin-left: 0; padding: 0 20px; height: 65px; justify-content: flex-start; }
    .teacher-page .ed-topbar-account { margin-left: auto; }
    .teacher-page .ed-mobile-menu { display: block; }
    .teacher-page .ed-sidebar { transform: translateX(-105%); transition: transform .2s ease; }
    .teacher-page .ed-sidebar.ed-menu-open { transform: translateX(0); }
    .teacher-page .ed-nav-scrim:not(.hidden) { display: block; position: fixed; z-index: 880;
        inset: 0; background: rgba(7, 22, 38, .55); }
    .teacher-page .ed-create-banner { flex-direction: column; align-items: flex-start; }
}
@media(max-width: 540px) {
    .teacher-page .ed-topbar-account #edTeacherFullName { display: none; }
    .teacher-page .ed-create-banner { padding: 21px; }
    .teacher-page .ed-create-banner .primary { width: 100%; }
    .teacher-page .ed-panel-head { align-items: flex-start; flex-direction: column; }
    .teacher-page .ed-filterbar .ed-filter-select { flex: 1 1 100%; }
    .teacher-page .ed-home-tip { flex-direction: column; align-items: stretch; }
}
@media print {
    .teacher-page .ed-sidebar, .teacher-page .ed-topbar { display: none !important; }
    .teacher-page.ed-authenticated .teacher-shell { margin: 0; width: 100%; padding: 0; }
}

/* 7.5.1: enllaç a la nova entrada, només a la pantalla inicial de sala. */
/* 7.5.25: identitat de Google clara, amb canvi de nom optatiu. */
.student-page .student-identity { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 15px; border: 1px solid #d5e3db; background: #f1f7f3; border-radius: 12px; }
.student-page .student-identity-info { display: grid; gap: 5px; min-width: 0; }
.student-page .student-identity-info strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.student-page .student-identity-caption { font-weight: 650; color: #345d46; font-size: .84rem; }
.student-page .student-identity-info small { line-height: 1.45; color: #526c59; }
.student-page .student-identity-edit { flex: 0 0 auto; border: 0; background: transparent; padding: 4px; color: #164a32; text-decoration: underline; text-underline-offset: 3px; font-size: .85rem; font-weight: 650; }
.student-page .student-identity-edit:focus-visible { outline: 3px solid #b37a28; outline-offset: 3px; }
@media (max-width: 440px) { .student-page .student-identity { flex-direction: column; } }
.student-page .ea-student-return { margin: 21px 0 0; font-size: 13px; }
.student-page .ea-student-return a { color: #112d4b; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.student-page .ea-student-return a:focus-visible { outline: 3px solid #b37a28; outline-offset: 3px; }

/* Eudicles 7.5.2 · classificacions curriculars */
.ed-classifications {padding:12px 0; display:flex; flex-direction:column; gap:9px; border-top:1px solid var(--line, #e8e4df);}
.ed-class-controls {display:flex; flex-wrap:wrap; align-items:center; gap:8px;}
.ed-class-controls select {flex:1 1 165px; min-width:0; max-width:100%;}
.ed-class-chosen {display:flex; flex-wrap:wrap; gap:6px; align-items:center;}
.ed-class-remove {background:transparent; border:0; cursor:pointer; font:inherit; margin-left:5px; padding:0 3px; color:inherit;}
.ed-class-remove:hover {text-decoration:underline;}

/* Eudicles 7.5.3 · pregunta d'expressió matemàtica */
.expression-editor {width: 100%; min-width: 0; margin: .55rem 0;}
.expression-field-wrap {width: 100%; min-width: 0;}
.expression-mathfield {display: block; width:100%; min-height: 56px; padding: .65rem .8rem;
  border: 1px solid #a8b7c7; border-radius: 10px; background:#fff; color:#112d4b; font-size: 1.35rem;}
.expression-mathfield:focus-within {outline: 2px solid #b37a28; outline-offset: 2px;}
.expression-quickkeys {display:flex; flex-wrap:wrap; gap:.4rem; margin-top:.65rem;}
.expression-quickkeys button {min-width:40px; padding:.42rem .7rem;}
.expression-ascii-field {width:100%; font-size:1.12rem;}
.expression-help {font-size:.85rem; color:#55677b; margin:.55rem 0;}

/* v7.5.6 - filtres paginats i avisos de versions */
.bank-results-actions { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin:1rem 0; }
.exam-version-warning { display:flex; flex-wrap:wrap; align-items:center; gap:.6rem; margin-top:.55rem; }
.exam-version-warning .upgrade-exam-question { padding:.35rem .7rem; font-size:.85rem; }


/* v7.5.6.1 — El reproductor d'HTMLJS directe adapta l'alçada a l'amplada.
 * 16:9 del vídeo + marge per a capçalera, navegació i estat de Manim.
 * L'alçada definida al bloc de la pregunta es respecta com a mínim.
 * Sense canvis a l'index.html universal de les resolucions. */
.htmljs-direct-wrap { position: relative; }
.htmljs-direct-wrap::before {
    content: "";
    display: block;
    padding-top: calc(min(56.25%, 590.625px) + 210px);
}
.htmljs-direct-wrap > .htmljs-direct-frame {
    position: absolute;
    inset: 0;
    height: 100% !important;
}

/* 7.5.7 — Problemes compostos: enunciat comú i apartats independents. */
.compound-parts {display:grid; gap:14px; margin-top:14px;}
.compound-part {border:1px solid var(--border, #cbd5e1); border-radius:12px; padding:14px; min-width:0; background:var(--card-background, transparent);}
.compound-part-head {display:flex; justify-content:space-between; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom:10px;}
.compound-part-prompt {margin:8px 0 14px;}
.compound-part-answer {min-width:0;}
.compound-part-result {border-top:1px solid var(--border,#cbd5e1); padding:10px 0; display:grid; gap:8px;}
.compound-part-result:first-child{border-top:0;}
.compound-results{margin-top:10px;}
.compound-solution{margin-top:8px;}
.compound-options{padding:6px 0; display:grid; gap:6px;}
.compound-part .resolution-details {margin-top:12px;}

/* 7.5.7.1 — Correcció i resolucions per apartat a la vista «Veure» docent. */
.compound-part-tools,.compound-global-tools {display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;align-items:center;}
.compound-part-preview-feedback:empty {display:none;}
.compound-preview-result {border-left:3px solid var(--accent,#3474b6);background:var(--surface,#f6f8fb);border-radius:6px;padding:12px;margin-top:12px;display:grid;gap:8px;}
.compound-preview-result .compound-preview-answer {overflow-wrap:anywhere;}
.compound-preview-result .resolution-details {margin-top:6px;}
@media(max-width:600px){.compound-part-tools button,.compound-global-tools button{flex:1 1 auto;}}


/* Eudicles 7.5.10: editor d'enunciats compacte i ajuda plegable. */
.source-panel .section-heading.compact { display: block; }
.source-panel .section-heading.compact > div:first-child { margin-bottom: 8px; }
.source-panel .editor-actions { gap: 4px 5px; margin: 2px 0 10px; }
.source-panel .editor-actions button { font-size: 11.5px; line-height: 1.15; padding: 5px 8px;
    min-height: 27px; border-radius: 6px; font-weight: 500; }
.template-field-help { display: block; }
.template-field-help summary { cursor: pointer; font-weight: 650; padding: 2px 0; user-select: none; }
.template-field-help summary span { font-weight: 400; }
.template-field-help .template-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding-top: 9px; }
.template-field-help .template-fields > div { display:grid; grid-template-columns:110px 1fr;
    gap:10px; align-items:baseline; }
@media (max-width:620px) { .template-field-help .template-fields > div {grid-template-columns:1fr;gap:1px;} }
.regrade-panel { margin-bottom: 18px; }
.regrade-fields { display:grid; grid-template-columns:minmax(180px,1fr) minmax(180px,1fr) auto;
    align-items:end; gap:10px; margin:16px 0; }
.regrade-fields label { font-size:.85rem; font-weight:600; }
.regrade-fields select { margin-top:5px; width:100%; }
.regrade-table { width:100%; border-collapse:collapse; font-size:.86rem; }
.regrade-table th,.regrade-table td { padding:8px 10px; border-bottom:1px solid var(--line); text-align:left; }
.regrade-table th { background:#f8fafc; }
.regrade-preview-header { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.regrade-apply { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin:12px 0 20px; }
.regrade-apply label { flex:1; min-width:220px; }
.regrade-apply textarea { min-height:64px; width:100%; margin-top:4px; }
.regrade-history-entry { padding:10px 0; border-bottom:1px solid var(--line); display:flex;
    gap:14px; align-items:center; flex-wrap:wrap; justify-content:space-between; }
@media(max-width:740px){.regrade-fields{grid-template-columns:1fr;}}

/* 7.5.12 — importació des de fitxer i catàleg de teoria */
.ed-file-import {display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:9px 0 12px;}
.ed-file-label {display:inline-flex;align-items:center;cursor:pointer;padding:7px 10px;border-radius:6px;font-size:12px;border:1px solid #b8c4d0;}
.ed-file-import input[type=file] {position:absolute;width:1px;height:1px;opacity:0;overflow:hidden;}
.ed-file-import input[type=file]:focus-visible + .muted {outline:2px solid #225b94;outline-offset:3px;}
.ed-theory-panel {margin:20px 0;padding:18px;}
.ed-theory-panel summary {cursor:pointer;display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.ed-theory-form {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0;}
.ed-theory-form label {display:flex;flex-direction:column;gap:5px;font-size:13px;font-weight:600;min-width:0;}
.ed-theory-form input:not([type=checkbox]),.ed-theory-form textarea {width:100%;min-width:0;padding:9px;border:1px solid #cbd3dc;border-radius:6px;font:inherit;}
.ed-theory-form .ed-theory-wide {grid-column:1/-1;}
.ed-theory-form .ed-theory-check {grid-column:1/-1;display:flex;flex-direction:row;align-items:center;gap:8px;}
.ed-theory-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;}
.ed-theory-list{display:grid;gap:8px;}
.ed-theory-row {display:flex;justify-content:space-between;gap:12px;align-items:center;border-top:1px solid #dbe1e8;padding:12px 2px;}
.ed-theory-row small {display:block;color:#607387;overflow-wrap:anywhere;margin-top:3px;}
.eud-theory-links{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap;padding:10px 0;}
.eud-theory-links a{font-size:13px;color:#215e84;text-decoration:underline;text-underline-offset:3px;}
@media(max-width:650px){.ed-theory-form{grid-template-columns:1fr;}}

/* Eudicles 7.5.15: indicador dels permisos docents */
.ed-profile-pill { display:inline-flex;align-items:center;padding:.15rem .48rem;border-radius:999px;
    background:var(--accent-soft,#eef3ff);color:var(--ink,#233454);font-size:.75rem;font-weight:650;}
.ed-profile-select { min-width:7.6rem;max-width:100%; }

/* 7.5.19 — filtres sense encavalcar la columna de pools i preguntes desplegables. */
.editor-selection-grid > .card { min-width:0; }
.exam-bank-filters {
    grid-template-columns:repeat(2,minmax(0,1fr));
    min-width:0;
}
.exam-bank-filters > input, .exam-bank-filters > select { width:100%;min-width:0;max-width:100%;box-sizing:border-box; }
.exam-select-question { display:flex; flex-direction:column; gap:9px; cursor:default; min-width:0; }
.exam-select-header { display:flex; align-items:center; gap:10px; justify-content:space-between; flex-wrap:wrap; min-width:0; }
.exam-select-choice { display:flex; align-items:center; gap:10px; flex:1 1 180px; min-width:0; font-weight:650; cursor:pointer; }
.exam-select-choice input { width:auto; flex:none; margin:0; }
.exam-select-title { overflow-wrap:anywhere; min-width:0; }
.exam-select-expand { font-size:.81rem; padding:7px 10px; white-space:nowrap; }
.exam-select-meta { font-size:.78rem; }
.exam-select-full { width:100%; min-width:0; border-top:1px solid var(--line); padding:13px 3px 4px; }
.exam-select-prompt { max-height:none; overflow:visible; color:var(--text); font-size:.97rem; line-height:1.65; }
.exam-select-prompt img, .exam-select-full img { max-width:100%; height:auto; }
.exam-select-prompt iframe { max-width:100%; }
.exam-select-part { border-top:1px dashed var(--line); padding:10px 0; }
@media(max-width:760px) { .exam-bank-filters { grid-template-columns:1fr; } }

/* 7.5.20 — correcció d'apartats sense encavalcaments */
.compound-part-score {margin:8px 0 12px; padding:8px 12px;background:#f4f7f9;
  border-left:3px solid #b37a28;border-radius:5px;font-size:.87rem}
.compound-part-grade-editor {margin-top:14px;border:1px solid #d7dfe6;border-radius:7px;padding:10px 14px}
.compound-part-grade-editor summary {cursor:pointer;font-weight:650}
.compound-part-grade-fields {display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin-top:14px}
.compound-part-grade-fields label {min-width:130px;flex:1;display:flex;flex-direction:column;gap:4px}
.compound-part-grade-fields input {max-width:155px}
.compound-part-grade-fields textarea {width:100%;min-width:180px}
@media(max-width:600px){.compound-part-grade-fields>*{width:100%}}

/* Eudicles 7.5.21 — Biblioteca en format compacte amb contingut diferit. */
.bank-question-card { min-width:0; }
.bank-question-toggle { display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:10px; min-width:0; }
.bank-question-toggle h3 { flex:1 1 220px; min-width:0; margin:0; overflow-wrap:anywhere; }
.bank-question-expand { flex:0 0 auto; }
.bank-question-full { width:100%; min-width:0; padding:12px 2px 2px;
  border-top:1px solid var(--line); }
.bank-question-full .bank-prompt { max-width:100%; overflow-wrap:anywhere; }
.bank-question-full img, .bank-question-full iframe { max-width:100%; }
.bank-question-full .card-actions { margin-top:15px; }
@media (max-width:680px) { .bank-list { grid-template-columns:minmax(0,1fr); } }

/* 7.5.23 — Etiquetes del banc docent dins la targeta, també amb moltes classificacions. */
.bank-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.bank-question-card { min-width: 0; overflow-wrap: anywhere; }
.bank-question-head { min-width: 0; align-items: flex-start; }
.bank-question-head > .bank-select-head { min-width: 0; flex: 1 1 0; }
.bank-question-head .bank-select-head > div { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.bank-question-head .pill { display: inline-flex; max-width: 100%; min-width: 0;
  white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.bank-question-head > strong { flex: 0 0 auto; }
@media (max-width: 480px) {
  .bank-question-head { flex-wrap: wrap; }
  .bank-question-head > .bank-select-head { flex-basis: 100%; }
}

/* Eudicles 7.5.26 — Publicació graduada de resultats. */
.review-visibility-control { display:flex; flex-direction:column; gap:3px; font-size:12px; font-weight:600; max-width:230px; }
.review-visibility-control select { min-width:0; max-width:100%; font-size:13px; }
#reviewPrivacyMessage { margin:16px 0; padding:15px 18px; border:1px solid #dbe7df; border-radius:10px; background:#f4f9f6; }

/* Eudicles 7.5.27 — Codi visible i capçalera contextual del banc. */
.bank-visible-code { color:var(--muted, #526378); font: 700 .78em/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space:nowrap; letter-spacing: .01em; margin-right:.45em; }
.bank-all-meta { display:flex; flex-direction:column; align-items:flex-start; gap:7px;
  padding:0 0 12px; margin:0 0 12px; border-bottom:1px solid var(--line); }
.bank-all-meta-tags { display:flex; gap:5px; flex-wrap:wrap; max-width:100%; }
.bank-all-meta-tags .pill { white-space:normal; overflow-wrap:anywhere; max-width:100%; }

/* 7.5.29 — Número separat del títol i classificacions amb etiqueta llegible. */
.bank-question-head .bank-select-head {display:flex; flex-direction:column; align-items:flex-start; gap:7px;}
.bank-question-head .bank-code-row {display:flex; flex-wrap:wrap; margin-top:0;}
.bank-question-head .bank-code-row .bank-visible-code {margin:0; font-size:.84rem;}
.bank-question-head .bank-meta-row {display:flex; gap:6px; flex-wrap:wrap; min-width:0;}
.bank-meta-chip {display:inline-flex; gap:4px; align-items:baseline; max-width:100%; min-width:0;
  padding:4px 9px; border:1px solid #dce5eb; border-radius:7px;
  background:#f7f9fb; color:#3b4c5f; font-size:.79rem; line-height:1.35;
  white-space:normal; overflow-wrap:anywhere;}
.bank-meta-name {font-weight:700;color:#243b53;flex:0 0 auto;}
.bank-tags-chip {flex-wrap:wrap;}
.bank-all-meta-tags .bank-meta-chip {max-width:100%;}


/* 7.5.32 — Filtres d'etiquetes seleccionables, amb intersecció. */
.ed-tag-filter { min-width:0; position:relative; align-self:start; }
.ed-tag-filter details { position:relative; }
.ed-tag-filter summary {
    display:flex; align-items:center; justify-content:space-between; gap:.6rem;
    min-height:44px; padding:10px 13px; border:1px solid #cdd5df;
    border-radius:11px; background:#fff; color:var(--text);
    font-size:.9rem; font-weight:600; cursor:pointer; list-style:none;
    box-sizing:border-box;
}
.ed-tag-filter summary::-webkit-details-marker { display:none; }
.ed-tag-filter summary::after { content:'▾'; flex:none; color:var(--muted); }
.ed-tag-filter details[open] summary::after { content:'▴'; }
.ed-tag-filter summary:focus-visible { outline:3px solid #b0c6f0; outline-offset:2px; }
.ed-tag-filter-count { font-size:.82rem; color:var(--muted); font-weight:500; margin-left:auto; }
.ed-tag-filter-menu {
    position:absolute; z-index:50; top:calc(100% + 5px); right:0;
    min-width:min(340px,90vw); width:100%; max-width:min(420px,90vw);
    padding:12px; border:1px solid var(--line); border-radius:12px;
    background:#fff; box-shadow:0 12px 28px rgba(20,42,70,.16);
    box-sizing:border-box;
}
.ed-tag-filter-menu > p { margin:0 0 9px; line-height:1.4; }
.ed-tag-filter-options { display:flex; flex-direction:column; gap:2px; max-height:220px; overflow:auto; margin-bottom:9px; }
.ed-tag-choice { display:flex; align-items:flex-start; gap:9px; padding:7px; margin:0;
    border-radius:7px; font-size:.86rem; font-weight:500; cursor:pointer; min-width:0; }
.ed-tag-choice:hover { background:#f4f7fb; }
.ed-tag-choice input { width:17px; height:17px; flex:none; margin:1px 0 0; accent-color:#245c87; }
.ed-tag-choice span { overflow-wrap:anywhere; }
.ed-tag-unavailable { opacity:.72; }
.ed-tag-filter-actions { display:flex; flex-wrap:wrap; gap:8px; }
.ed-tag-filter-actions button { flex:1 1 120px; font-size:.82rem; padding:8px 10px; }
@media(max-width:760px) {
    .ed-tag-filter-menu { left:0; right:auto; width:100%; min-width:0; max-width:100%; }
}

/* Eudicles 7.5.33 — Google docent i vincles, contenidors acotats. */
.ed-google-teacher {margin:1rem 0;padding:1rem;border:1px solid #d9dce5;border-radius:12px;background:#f7f9fc;max-width:34rem}
.ed-google-teacher .ed-google-button {min-height:48px;margin:.8rem 0}
.ed-google-teacher .secondary {margin:.4rem 0}
.ed-password-alternative {margin-top:1rem;padding:.75rem;border-top:1px solid #ddd}
.ed-password-alternative summary {cursor:pointer;font-weight:600}
.ed-password-alternative form {margin-top:1rem}

/* 7.5.34 — selecció editorial d'activitats i inici més orientat a l'ús docent. */
.ed-home-quick-actions{display:flex;flex-wrap:wrap;gap:.65rem;justify-content:flex-end;align-items:center}
.ed-public-selection{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem;background:#f7f3e9;border:1px solid #d4c3a1;border-radius:12px;padding:.85rem 1rem;margin:1rem 0}
.ed-public-selection .card-actions{display:flex;flex-wrap:wrap;gap:.5rem}
.ed-public-selection strong{font-size:.98rem;color:#17334a}
.ed-public-selection:has(button:disabled) strong{color:#516678}
.ed-public-choose{display:inline-flex;align-items:center;gap:.45rem;background:#f8f4ec;border:1px solid #dfd1b9;border-radius:7px;padding:.4rem .65rem;cursor:pointer;font-size:.93rem}
.ed-public-choose:has(input:checked){background:#e5ecdc;border-color:#849d72}
@media(max-width:700px){.ed-home-quick-actions{justify-content:flex-start}.ed-public-selection{align-items:flex-start;flex-direction:column}.ed-public-selection .card-actions{width:100%}}

/* Eudicles 7.5.35: lletra i enunciat de compostes a la mateixa línia. */
.compound-part-statement {display:grid;grid-template-columns:max-content minmax(0,1fr);gap:10px;align-items:start;min-width:0;}
.compound-part-letter {font-weight:700;line-height:1.7;white-space:nowrap;}
.compound-part-statement .compound-part-prompt {margin:0;min-width:0;overflow-wrap:anywhere;}
.compound-part-statement .compound-part-prompt > :first-child {margin-top:0;}
.compound-part-statement .compound-part-prompt > :last-child {margin-bottom:0;}
.compound-part-meta {margin:6px 0 13px 28px;}
