:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #d8dee9;
  --ink: #1d2733;
  --mut: #66707f;
  --brand: #173c74;
  --accent: #2f9e8f;
  --danger: #b03a48;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
/* --- F7G: textes llargs sense desbordament --- */
p, h1, h2, h3, strong, small, span, label, .option, .tutor-bubble, .weak-item { overflow-wrap: break-word; word-break: break-word; }
pre, code { white-space: pre-wrap; word-wrap: break-word; }
/* --- F7G: focus-visible --- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .option:focus-visible, .tutor-btn:focus-visible { outline-offset: 2px; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 6px; }
.muted { color: var(--mut); font-size: 13.5px; }
.empty { color: var(--mut); font-style: italic; }
.error { color: var(--danger); font-weight: 700; }
.notice { color: var(--accent); font-weight: 600; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--brand); color: #fff; padding: 12px 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; }
.topbar .brand img { height: 26px; width: 26px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 6px; }
.topbar .nav {
  background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff;
  border-radius: 999px; padding: 7px 12px; font-size: 14px; cursor: pointer;
  min-height: 44px;
}
.topbar .nav.active { background: #fff; color: var(--brand); border-color: var(--brand); }
.topbar .user { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; }

.content { max-width: 880px; margin: 0 auto; padding: 18px 14px 34px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.feature { border-inline-start: 4px solid var(--accent); }
.eyebrow { color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  background: #eef3ff; color: var(--brand);
}
.badge.ok { background: #e6f7e9; color: #1d5b31; }
.badge.bg { background: #ffecec; color: var(--danger); }

.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-bottom: 1px solid var(--line);
  min-width: 0; flex-wrap: wrap;
}
.row:last-child { border-bottom: 0; }
.row > div:first-child { min-width: 0; flex: 1 1 160px; }
.row strong { display: block; min-width: 0; }
.row small { display: block; color: var(--mut); font-size: 12.5px; min-width: 0; }

.btn {
  min-height: 44px; padding: 10px 15px; border-radius: 9px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  max-width: 100%;
}
.btn.secondary { background: #fff; color: var(--brand); border-color: #b9c7dd; }
.btn.lime { background: #1d7f4f; color: #fff; border-color: #1d7f4f; }
.btn.danger { background: #fff; color: var(--danger); border-color: #e3b4ba; }
.btn:disabled { opacity: .55; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 600; }
.form input, .form select {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 15px; background: #fff;
}
.course-list { display: grid; gap: 10px; }
.options { display: grid; gap: 10px; }
.option {
  text-align: left; padding: 13px 14px; border-radius: 10px; font-size: 15.5px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  min-height: 44px; max-width: 100%;
}
.option b { display: inline-block; min-width: 26px; background: var(--brand); color: #fff; border-radius: 6px; text-align: center; margin-right: 10px; padding: 2px 0; }
.option.selected { border-color: var(--accent); background: #ecf9f4; }
.quizbar { margin-bottom: 12px; }
.quiznav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.feedback { border-radius: 10px; padding: 12px; margin-top: 12px; }
.feedback { background: #e6f7e9; border: 1px solid #a9d9ae; color: #1d5b31; }
.feedback.wrong { background: #ffecec; border: 1px solid #efb3b3; color: var(--danger); }

details.card summary { font-weight: 700; cursor: pointer; }
details.unit summary { font-weight: 600; cursor: pointer; margin: 8px 0; }

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .btn { width: 100%; }
  .actions, .quiznav { flex-direction: column; }
  .options .option { padding: 15px; }
}
/* --- F7G: pantalles estretes 320-375px --- */
@media (max-width: 400px) {
  .content { padding-inline: 10px; }
  .progress-grid, .results-stats { grid-template-columns: 1fr; }
  .topbar .brand { flex-wrap: wrap; min-width: 0; }
  .topbar .brand img { flex: 0 0 auto; }
  .topbar nav, .topbar .user { min-width: 0; max-width: 100%; }
  .lang-switcher select { max-width: 100%; }
  .card { padding: 14px; }
  .actions { gap: 6px; }
  .primary-card { flex-wrap: wrap; }
}
/* --- F7G: topbar/usuari sense desbordar --- */
.topbar .user { min-width: 0; max-width: 100%; flex-wrap: wrap; overflow-wrap: anywhere; }
.topbar .brand strong { overflow-wrap: anywhere; }
/* --- F7B: RTL / Logical properties --- */
[dir="rtl"] .topbar .user { margin-inline-start: auto; margin-inline-end: 0; }
[dir="rtl"] .options .option b { margin-inline-end: 0; margin-inline-start: 8px; }
[dir="rtl"] .quiznav { flex-direction: row-reverse; }

/* Screen-reader only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* LTR exceptions for RTL layouts */
.dir-ltr { direction: ltr; unicode-bidi: isolate; }

/* Language selector in header */
.lang-switcher select {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer;
  margin-inline: 8px;
  min-height: 44px;
}
.lang-switcher select option { color: #1d2733; background: #fff; }

/* Responsive language selector: el target es manté >= 44px (no es redueix) */
@media (max-width: 480px) {
  .lang-switcher select { font-size: 12px; margin-inline: 4px; }
}

/* --- End F7B additions --- */

/* --- F7C: Student Home --- */
.primary-card {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--brand), #1a4a8a);
  color: #fff; border: none; border-radius: 16px; padding: 20px;
  margin-bottom: 18px;
}
.primary-card .primary-icon { font-size: 28px; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border-radius: 50%; }
.primary-card .eyebrow { color: rgba(255,255,255,.7); font-size: 13px;
  margin-bottom: 6px; }
.btn-cta {
  background: #fff; color: var(--brand); border: none;
  padding: 10px 24px; border-radius: 999px; font-weight: 700;
  font-size: 15px; cursor: pointer; display: inline-block;
}
.btn-cta:hover { background: #e8edf5; }

.home-section { margin-bottom: 18px; }
.home-section h2 { font-size: 15px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--mut); margin-bottom: 10px; }

.progress-grid { display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; text-align: center; }
.stat strong { display: block; font-size: 24px; color: var(--brand); }
.stat small { font-size: 12px; color: var(--mut); }

.weak-list { display: flex; flex-direction: column; gap: 6px; }
.weak-item { display: flex; justify-content: space-between;
  align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.weak-name { font-weight: 600; font-size: 14px; }
.weak-label { font-size: 12px; color: var(--mut);
  background: #f0f2f5; padding: 3px 8px; border-radius: 6px; }

.error-card { text-align: center; padding: 30px 20px; }

[dir="rtl"] .primary-card { text-align: right; }
[dir="rtl"] .primary-icon { margin-inline: 0 0; }
[dir="rtl"] .weak-item { text-align: right; }
/* --- End F7C --- */

/* --- F7D: Learning Experience --- */
.results-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 16px 0; }
[dir="rtl"] .results-stats .stat strong { direction: ltr; display: inline-block; }
/* --- End F7D --- */

/* --- F7E: Memory Review --- */
.recall-input { margin: 16px 0; }
.recall-input textarea { width: 100%; padding: 10px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; font-family: inherit; resize: none; margin-bottom: 10px; }
.mnemonic { background: #f0f7ff; border-left: 3px solid var(--brand); }
[dir="rtl"] .mnemonic { border-left: none; border-inline-start: 3px solid var(--brand); }
/* --- End F7E --- */

/* --- F7F: Tutor UX --- */
.tutor-question-form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.tutor-question-form label { font-weight: 600; font-size: 13.5px; }
.tutor-question-form textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; resize: vertical; min-height: 60px;
}
@media (max-width: 720px) { .tutor-question-form .tutor-actions { flex-direction: column; } }

.tutor-bar { margin: 14px 0; }
.tutor-thinking { color: var(--mut); font-style: italic; font-size: 14px; }
.tutor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tutor-btn { font-size: 13px; padding: 8px 14px; background: #f0f4ff;
  border: 1px solid #d0d8e8; border-radius: 999px; cursor: pointer; color: var(--brand);
  min-height: 44px; }
.tutor-btn:hover { background: #e0e8f8; }
.tutor-response { margin: 10px 0; }
.tutor-bubble { background: #f0f4ff; border: 1px solid #d0d8e8; border-radius: 12px;
  padding: 14px; font-size: 14px; line-height: 1.5; }
.tutor-warning { color: var(--danger); font-size: 13px; margin: 8px 0; font-weight: 600; }
[dir="rtl"] .tutor-btn { margin-inline: 0; }
.tutor-question-form textarea { text-align: start; }
[dir="rtl"] .tutor-question-form { text-align: right; }
/* --- End F7F --- */

/* --- T1I-C: Mind Map --- */
.mindmap { background: #f9f5f0; border-left: 3px solid #8B6F47; padding: 14px; border-radius: 8px; margin: 12px 0; }
[dir=rtl] .mindmap { border-left: none; border-inline-start: 3px solid #8B6F47; }
.mm-tree { list-style: none; padding-inline-start: 20px; margin: 8px 0; }
.mm-tree .mm-children { margin: 2px 0; }
.mm-label { font-weight: 600; font-size: 14px; color: #3a2a1a; display: inline-block; padding: 4px 8px; border-radius: 6px; background: #fff; border: 1px solid #e0d6c8; margin: 2px 0; }
.mm-children { list-style: none; padding-inline-start: 20px; margin: 2px 0; }
.mm-label::before { content: "▸"; color: #8B6F47; margin-inline-end: 6px; font-size: 12px; }
[dir=rtl] .mm-label::before { content: "◂"; }
/* --- End T1I-C --- */

/* --- T1I-D: Flashcards --- */
.flashcard-counter { color: var(--mut); font-weight: 700; margin: 14px 0 8px; }
.flashcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 12px; }
.flashcard-front { font-size: 18px; font-weight: 700; margin: 8px 0 18px; }
.flashcard-answer { background: #f0f7ff; border-inline-start: 3px solid var(--brand); border-radius: 8px; padding: 12px; margin-top: 12px; }
.flashcard-answer p { margin: 6px 0 0; }
.flashcard-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
@media (max-width: 720px) { .flashcard-nav { flex-direction: column; } }
/* --- End T1I-D --- */

/* --- T1I-E: Error review --- */
.error-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.error-review-concept { border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.error-review-concept strong, .error-review-concept small { display: block; }
.error-review-concept small { color: var(--mut); margin-top: 4px; }
.error-review-questions { margin-top: 8px; }
@media (max-width: 720px) { .error-review-grid { grid-template-columns: 1fr; } }
/* --- End T1I-E --- */

/* --- T1I-F: Lesson tutor --- */
.tutor-lesson-history { display: flex; flex-direction: column; gap: 10px; }
.tutor-lesson-message { max-width: 88%; border-radius: 12px; padding: 12px 14px; }
.tutor-lesson-message p { margin: 5px 0 0; white-space: pre-wrap; }
.tutor-lesson-message.student { align-self: flex-end; background: #e8f1ff; border: 1px solid #c6d8f2; }
.tutor-lesson-message.assistant { align-self: flex-start; background: #f0f7f5; border: 1px solid #c8dfd8; }
.tutor-lesson-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tutor-lesson-form textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; resize: vertical; }
@media (max-width: 720px) { .tutor-lesson-message { max-width: 100%; } .tutor-lesson-suggestions { flex-direction: column; } }
/* --- End T1I-F --- */

/* --- T1K-D: Remember block --- */
.remember { background: #f7f3ff; border: 1px solid #d8c9f1; border-inline-start: 4px solid #6b46a1;
  border-radius: 12px; padding: 16px; margin: 16px 0; }
.remember h2 { color: #49306f; font-size: 19px; margin: 0 0 14px; }
.remember-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.remember-section { min-width: 0; background: #fff; border: 1px solid #e4daf4; border-radius: 9px; padding: 12px; }
.remember-section h3 { color: #49306f; font-size: 14px; margin: 0 0 8px; }
.remember-section ul, .remember-section ol { margin: 0; padding-inline-start: 20px; }
.remember-section li { margin: 5px 0; line-height: 1.4; overflow-wrap: anywhere; }
.remember-essentials, .remember-self-check { grid-column: 1 / -1; }
.remember-keywords { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 !important; list-style: none; }
.remember-keywords li { background: #eee6fb; color: #3f285f; border-radius: 999px; padding: 4px 9px; margin: 0; }
.remember-rule { background: #fff9df; border-color: #eadb91; }
.remember-rule p { margin: 0; font-weight: 650; }
[dir="rtl"] .remember { border-inline-start: 4px solid #6b46a1; }
@media (max-width: 720px) {
  .remember-grid { grid-template-columns: 1fr; }
  .remember-essentials, .remember-self-check { grid-column: auto; }
}
/* --- End T1K-D --- */

/* --- M5A: Teacher/Admin shell --- */
.staff-welcome { margin: 0 0 14px; }
.staff-welcome h1 { margin: 0 0 4px; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff;
  min-height: 92px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card strong { font-size: 26px; line-height: 1.1; }
.stat-card small { color: var(--mut); font-size: 13px; }
@media (max-width: 480px) {
  .staff-grid { grid-template-columns: 1fr; }
  .staff-welcome h1 { overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .topbar nav { max-width: 100%; }
  .topbar .nav { padding-inline: 10px; }
}
/* --- End M5A --- */

/* --- M5B: Student list + overview --- */
.student-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.student-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.student-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.student-row-main strong { font-size: 15px; overflow-wrap: anywhere; }
.student-row-main small { color: var(--mut); font-size: 13px; }
.student-row-progress { display: flex; flex-direction: column; gap: 2px; }
.student-row-progress small { color: var(--mut); font-size: 12px; white-space: nowrap; }
.student-row .btn { min-height: 44px; }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.activity-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border-bottom: none; }
.activity-list small { color: var(--mut); }
.rec-action { font-size: 17px; margin: 4px 0; }
.rec-source { font-style: italic; font-size: 12px; }
@media (max-width: 480px) {
  .student-row { align-items: stretch; }
  .student-row-progress { flex-direction: row; gap: 10px; }
}
/* --- End M5B --- */


/* --- M5C: Group/cohort overview --- */
.student-row-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.att-chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef2f7; color: #445; font-size: 11px; border: 1px solid var(--line);
}
.att-chip.att-hot { background: #fdecea; color: #a33; border-color: #ecc; }
.att-chip.att-warm { background: #fdf3e3; color: #965; border-color: #ecc9a0; }
.rec-row { display: flex; justify-content: space-between; gap: 10px; }
.rec-row strong { color: var(--ink); }
@media (max-width: 480px) {
  .rec-row { font-size: 14px; }
}
/* --- End M5C --- */

/* --- M5D: Analytics --- */
.m5d-filter { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m5d-filter label { font-size: 14px; color: var(--mut); }
.m5d-filter select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; min-height: 44px;
}
.m5d-concept { align-items: flex-start; gap: 8px; }
.m5d-concept .student-row-main { flex: 1 1 160px; }
@media (max-width: 480px) {
  .m5d-filter { align-items: stretch; flex-direction: column; }
  .m5d-filter select { width: 100%; }
}
/* --- End M5D --- */

/* --- M5E: Attention signals --- */
.sig-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.sig-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #fdf3e3; color: #965; border: 1px solid #ecc9a0; font-size: 11px;
}
.sig-badge[data-code="ACTIVE_ATTEMPT_STALLED"],
.sig-badge[data-code="MEMORY_REVIEW_OVERDUE"] { background: #fdecea; color: #a33; border-color: #ecc; }
.sig-list { margin-top: 2px; }
.sig-reason { font-size: 13px; }
.m5e-learner { align-items: flex-start; }
@media (max-width: 480px) {
  .sig-badge { font-size: 10px; }
}
/* --- End M5E --- */

/* --- M5F: Activity/attempt history --- */
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef2f7; color: #445; border: 1px solid var(--line); font-size: 11px;
}
.status-badge.st-COMPLETED { background: #e8f6ec; color: #275; border-color: #bfe7cc; }
.status-badge.st-EXPIRED { background: #fdecea; color: #a33; border-color: #ecc; }
.m5f-attempt { align-items: flex-start; }
.m5f-detail { list-style: none; }
.m5f-answer { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.m5f-answer-ok { font-weight: 600; }
.m5f-answer-ok.ans-ok { color: #275; }
.m5f-answer-ok.ans-bad { color: #a33; }
@media (max-width: 480px) {
  .m5f-answer { flex-direction: column; gap: 2px; }
}
/* --- End M5F --- */

/* --- M5G: Content and assignments --- */
.m5g-form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
.m5g-form-grid label { min-width: 0; }
.m5g-form-grid select,
.m5g-form-grid input { min-height: 44px; width: 100%; }
.m5g-form-error,
.m5g-form-actions { grid-column: 1 / -1; }
.m5g-toolbar { padding-block: 4px; }
.m5g-toolbar select { min-height: 44px; }
.m5g-status-assigned { background: #e8f6ec; color: #275; border-color: #bfe7cc; }
.m5g-status-cancelled { background: #eef2f7; color: #445; border-color: var(--line); }
.m5g-detail { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: 8px 14px; }
.m5g-detail dt { color: var(--mut); font-weight: 600; }
.m5g-detail dd { margin-inline-start: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .m5g-form-grid { grid-template-columns: 1fr; }
  .m5g-toolbar { align-items: stretch; }
  .m5g-toolbar select { width: 100%; }
  .m5g-detail { grid-template-columns: 1fr; gap: 3px; }
  .m5g-detail dd { margin-block-end: 8px; }
}
/* --- End M5G --- */

/* --- M5H: Teacher actions --- */
.m5h-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m5h-form-grid label { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.m5h-form-grid textarea { min-height: 72px; }
.m5h-form-grid select, .m5h-form-grid input, .m5h-form-grid textarea { min-height: 44px; width: 100%; }
.m5h-form-actions { grid-column: 1 / -1; }
.m5h-badge { font-weight: 700; letter-spacing: 0.04em; }
.m5h-teacher { background: #eef2f7; color: #334; border-color: #b9c6d8; }
.m5h-status-revoked { background: #f3f3f3; color: #666; border-color: #ddd; }
.m5h-status-expired { background: #fdf3e3; color: #965; border-color: #ecc9a0; }
.m5h-confirm { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 480px) {
  .m5h-form-grid { grid-template-columns: 1fr; }
}
/* --- End M5H --- */

/* --- M5I: Exports --- */
.m5i-exports { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.m5i-exports a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
@media (max-width: 480px) { .m5i-exports { flex-direction: column; align-items: stretch; } }
/* --- End M5I --- */

/* --- M5J: Audit (admin) --- */
.m5j-audit-row .m5h-teacher { letter-spacing: 0.03em; }
@media (max-width: 480px) { .m5j-audit-row .student-row-main small { overflow-wrap: anywhere; } }
/* --- End M5J --- */

/* M6A: identitat de producte — footer i organització al login */
.app-footer {
  margin: 24px auto 8px;
  max-width: 960px;
  padding: 0 16px 16px;
  text-align: center;
  color: #6b7280;
  font-size: 0.85rem;
}
.org-name {
  margin-bottom: 4px;
  font-weight: 600;
}

/* --- M7D: rich media lesson blocks --- */
.block.formula { background: #f8f9ff; border: 1px solid var(--line); border-inline-start: 4px solid var(--brand); border-radius: 10px; padding: 12px; margin: 12px 0; }
.formula-body { margin: 8px 0 0; padding: 10px; background: #fff; border: 1px solid #e4e9f2; border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; direction: ltr; text-align: start; overflow-wrap: anywhere; }
.media-image, .media-video { display: block; max-width: 100%; height: auto; border-radius: 10px; margin: 12px 0; }
.media-audio { display: block; width: 100%; max-width: 100%; margin: 12px 0; }
.media-resource { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 10px 14px; margin: 12px 0; border: 1px solid #b9c7dd; border-radius: 9px; background: #fff; color: var(--brand); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.media-unavailable { background: #f3f3f3; border: 1px solid #ddd; border-radius: 8px; padding: 10px; margin: 12px 0; }
[dir="rtl"] .media-resource { text-align: right; }
/* --- End M7D --- */

/* M7D authoring preview (M1-M7D remediation) */
.block-preview-list { margin-top: 0.75rem; padding: 0.5rem; border: 1px dashed var(--border, #ccc); border-radius: 8px; }
.block-preview { margin-top: 0.5rem; }

/* STUD-01 remediation: per-concept progress + contextual tutor */
.concept-list { display: flex; flex-direction: column; gap: 0.4rem; }
.concept-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.status-badge.concept-strong { background: #d7f5dd; color: #14532d; }
.status-badge.concept-learning { background: #fff3cd; color: #7a5b00; }
.status-badge.concept-weak { background: #ffe0e0; color: #8a1c1c; }
.status-badge.concept-unseen { background: #e5e7eb; color: #374151; }
.home-tutor { margin-top: 0.6rem; }
.status-badge.concept-insufficient_evidence { background: #e0e7ff; color: #3730a3; }
.status-badge.concept-review_due { background: #ffe8cc; color: #8a4b00; }
