/* Cấu trúc và bảng màu tham chiếu V4.1; chỉ sửa hiển thị, không can thiệp engine. */
:root{--v41-accent:#5b2c6f;--v41-line:#d9e0eb;--v41-bg:#f5f7fb;--v41-text:#162033}
body{background:var(--v41-bg);color:var(--v41-text)}
header{background:#fff!important;color:#162033!important;box-shadow:0 1px 9px #102a4308;border-bottom:1px solid var(--v41-line)}
header h1{color:var(--v41-accent);font-size:24px!important}
header .header-back,header .header-back:visited{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;text-decoration:none;border:1px solid #d9d2df;background:#f0eaf3;color:#4e2763!important;border-radius:10px;padding:10px 15px;font-size:15px;font-weight:750;min-height:42px}
header .header-back:hover{background:#e7d9ed}
header .header-back:focus-visible{outline:3px solid #b39bc7;outline-offset:2px}
header small{color:#637085!important}
.card,section.card,main>section{border:1px solid #dde3ec;border-radius:16px;box-shadow:0 6px 20px #1018280a}
button:not(.secondary):not(.danger):not([disabled]),.btn:not(.secondary){background:var(--v41-accent)}
button:hover:not(:disabled),.btn:hover{filter:brightness(.95)}
.secondary,.btn.secondary{background:#eef2f7!important;border:1px solid #d9e0eb!important;color:#27364b!important}
.tabs button.active{background:var(--v41-accent)!important;color:white!important}
#notice.is-error,.status.is-error{color:#b42318!important}
#notice.is-success,.status.is-success{color:#0f766e!important}
#status.is-error{color:#b42318!important}
.iec-dialog-overlay[hidden]{display:none!important}
.iec-dialog-overlay{position:fixed;inset:0;z-index:99999;padding:24px;display:flex;align-items:center;justify-content:center;background:#0b1528a6}
.iec-dialog{width:min(450px,100%);background:white;border-radius:16px;padding:24px;box-shadow:0 20px 65px #1422364d;border:1px solid #e6e9ef}
.iec-dialog h2{font-size:21px;margin:0 0 12px}.iec-dialog p{font-size:16px;line-height:1.55;white-space:pre-wrap}.iec-dialog-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:18px}
.iec-dialog-actions button{min-width:105px}
.state-legend{display:flex;flex-wrap:wrap;gap:8px}
.state-legend span{padding:6px 10px;border-radius:999px;font-size:13px;font-weight:700}
.state-legend .red{background:#fef3f2;color:#b42318}.state-legend .yellow{background:#fff7d6;color:#a16207}
.state-legend .blue{background:#eff6ff;color:#1d4ed8}.state-legend .green{background:#ecfdf3;color:#15803d}
.iec-student-menu{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}
.iec-student-menu button{background:#eef2f7!important;color:#27364b!important;border:1px solid #d9e0eb;border-radius:11px;min-width:130px}
.iec-student-menu button.active{background:var(--v41-accent)!important;color:#fff!important}
.iec-exam-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.iec-exam-grid a{display:flex;flex-direction:column;gap:10px;justify-content:center;min-height:150px;border-radius:14px;border:1px solid #ded5e4;background:#fbf9fc;padding:20px;text-decoration:none;color:#28334b}
.iec-exam-grid a:hover,.iec-quicklinks a:hover{border-color:#9b7bac;box-shadow:0 7px 20px #10182818}
.iec-exam-grid a strong{color:#54266a;font-size:19px}.iec-exam-grid a span{line-height:1.5}
.iec-quicklinks{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}
.iec-quicklinks a{display:block;border:1px solid #e0e8f0;border-radius:12px;padding:16px;text-decoration:none;color:#54266a;font-weight:750}
.iec-quicklinks small{display:block;color:#667085;font-weight:400;margin-top:6px}
.student-overview{padding:16px;background:#f7f8fb;border-radius:12px;border:1px solid #e3e8ef}
.iec-status-card{margin:16px 0;border:1px solid var(--v41-line);padding:16px;border-radius:12px;background:#fff}
.iec-status-card p{margin:8px 0}
.iec-phase-linked{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;border:1px solid #d5e9d7;border-radius:10px;background:#f0fcf3;padding:12px;margin-top:10px}
.iec-phase-linked strong{color:#17633d}.iec-phase-linked button{min-width:120px}
#workspace{max-width:1170px;margin-left:auto;margin-right:auto}
#loginCard[hidden],#workspace[hidden]{display:none!important}
#portalChecking{display:flex;align-items:center;gap:12px;justify-content:center;padding:25px;color:#667085}
#portalChecking[hidden]{display:none!important}
#workspace>.row{align-items:start}#workspace .grid{grid-template-columns:minmax(215px,285px) minmax(0,1fr)}
.iec-student-menu[hidden],.iec-exam-grid[hidden]{display:none!important}
.audit-label{font-weight:650}.notice-panel{padding:12px;border-left:3px solid var(--v41-accent);background:#f7f4f9;border-radius:8px}
@media(max-width:750px){.iec-exam-grid{grid-template-columns:1fr}.iec-student-menu button{flex:1;min-width:42%}#workspace .grid{grid-template-columns:1fr}header h1{font-size:21px!important}}

/* Nhóm luyện tập theo bố cục V4.1 */
.practice-mode-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:14px 0}
.practice-mode-grid button{display:flex;flex-direction:column;gap:6px;text-align:left;align-items:flex-start;min-height:78px;justify-content:center;border:1px solid var(--v41-line);background:#f7f8fb!important;color:#27364b!important}
.practice-mode-grid button.active{background:var(--v41-accent)!important;color:#fff!important}
.practice-mode-grid button small{font-weight:400;opacity:.85;color:inherit}
.visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
#practiceLock{color:#b42318;background:#fff6f6;border-color:#e8a5a5;margin:12px 0}
#practiceLock[hidden]{display:none!important}
#studentPanel{margin-top:18px}#studentPanel>.state-legend{margin:0 0 10px}#studentPanel .student-view[hidden]{display:none!important}
@media(max-width:720px){.practice-mode-grid{grid-template-columns:1fr}}

/* Hoàn thiện độ tương phản và nhãn phiên dùng chung. */
#tabs button:not(.active){background:#eef2f7!important;color:#27364b!important}
#tabs button.active{background:var(--v41-accent)!important;color:#fff!important}
body.hosted>header::after{content:'IEC V5.1 · Phiên đăng nhập chung'!important;color:#72617d!important;font-size:12px}
body.hosted>header a.header-back{color:#4e2763!important}

html.v51-embedded .header-back{display:none!important}html.v51-embedded body>header{display:none!important}html.v51-embedded main{margin:6px auto;padding:4px 15px;}

/* Hai tầng lựa chọn học đúng cấu trúc V4.1, giữ nguyên lõi TTS V5.1. */
.v41-practice-navigation{margin:18px 0;padding:18px;border:1px solid #d9e0eb;border-radius:14px;background:#fff}
.v41-practice-navigation h3{font-size:20px;margin:0 0 8px}
.practice-breadcrumb{color:#5b2c6f;font-weight:700;padding:10px 0}
.practice-level{display:grid;gap:10px;margin:9px 0}
.practice-level-parent,.practice-level-child{grid-template-columns:repeat(2,minmax(0,1fr))}
.practice-level button{min-height:55px;padding:12px 15px;border:1px solid #d9e0eb;background:#eef2f7!important;color:#27364b!important;font-weight:750}
.practice-level button.active{background:#5b2c6f!important;color:#fff!important}
.practice-free-note{padding:10px;border-radius:9px;background:#f7f9fc;color:#667085;font-size:13px}
.practice-level[hidden]{display:none!important}
@media(max-width:600px){.practice-level-parent,.practice-level-child{grid-template-columns:1fr}}
