:root {
    --navy-950: #101d36;
    --navy-900: #172844;
    --navy-800: #233b60;
    --blue-700: #315fcb;
    --blue-600: #3f70df;
    --blue-500: #5a85ea;
    --blue-100: #eaf0ff;
    --ink: #18243a;
    --muted: #5b6980;
    --muted-2: #66748a;
    --line: #e9edf4;
    --surface: #ffffff;
    --canvas: #f5f7fb;
    --green: #2b9b77;
    --shadow: 0 12px 32px rgba(25, 45, 82, .055);
    --radius: 17px;
    --kicker: #4f6a9c;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-md: 14px;
    --fs-base: 16px;
    --fs-lg: 16px;
    --fs-input: 16px;
    --tap: 44px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--navy-900); min-width: 0; }
.brand-mark {
    width: 39px; height: 39px; flex: 0 0 39px; display: grid; place-items: center;
    border-radius: 12px; color: #fff; background: linear-gradient(145deg, #4779e5, #315fc7);
    box-shadow: 0 6px 14px rgba(62, 109, 214, .22);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-copy { display: grid; line-height: 1.15; gap: 4px; }
.brand-copy strong { font-size: 17px; letter-spacing: -.55px; font-weight: 750; }
.brand-copy small { font-size: 10px; color: #91a0b7; letter-spacing: .25px; }

/* Teacher application shell */
.app-body { background: var(--canvas); }
.app-shell { min-height: 100vh; }
.sidebar {
    width: 258px; position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; flex-direction: column;
    padding: 26px 17px 17px; background: #fff; border-right: 1px solid #edf0f5;
}
.sidebar-brand-row { display: flex; align-items: center; justify-content: space-between; padding: 0 9px 35px; }
.sidebar-section-label { padding: 0 12px 11px; color: #a4afbf; font-size: 9px; font-weight: 750; letter-spacing: 1.25px; }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.side-nav-link {
    min-height: 43px; display: flex; align-items: center; gap: 12px; padding: 0 12px;
    border-radius: 10px; color: #66748a; font-size: 13px; font-weight: 550;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.side-nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; color: #8996aa; }
.side-nav-link:hover { background: #f5f7fc; color: var(--navy-900); }
.side-nav-link.is-active { color: #315fcb; background: #edf3ff; font-weight: 650; }
.side-nav-link.is-active svg { color: #4777df; }
.sidebar-current-subject {
    display: flex; align-items: center; gap: 8px; margin: 23px 11px 7px; min-width: 0;
    color: #354664; font-size: 11px; font-weight: 700; letter-spacing: .1px;
}
.sidebar-current-subject span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-subject-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #6d91e7; }
.side-nav-sub { min-height: 39px; margin-left: 7px; padding-left: 15px; font-size: 12px; }
.side-nav-sub svg { width: 16px; height: 16px; flex-basis: 16px; }
.sidebar-bottom { margin-top: auto; }
.admin-link { margin-top: 4px; border-top: 1px solid #f0f2f6; border-radius: 0; padding-top: 13px; }
.sidebar-version { display: flex; justify-content: space-between; align-items: center; margin: 20px 11px 0; color: #a6b0bf; font-size: 9px; letter-spacing: 1px; font-weight: 700; }
.app-main { min-height: 100vh; margin-left: 258px; display: flex; flex-direction: column; }
.topbar {
    height: 76px; flex: 0 0 76px; display: flex; justify-content: space-between; align-items: center;
    padding: 0 42px; background: rgba(255,255,255,.88); border-bottom: 1px solid #ebeff5;
}
.topbar-left, .topbar-right { display: flex; align-items: center; }
.topbar-left { gap: 14px; }
.topbar-context { display: grid; gap: 1px; }
.topbar-label { color: #a1acbc; font-size: 9px; font-weight: 650; text-transform: uppercase; letter-spacing: .85px; }
.topbar-title { color: #34435b; font-size: 12px; font-weight: 650; }
.topbar-right { gap: 21px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding-right: 18px; border-right: 1px solid #e9edf3; }
.user-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #eaf0ff; color: #426ed0; font-size: 12px; font-weight: 750; }
.user-chip-name { color: #64728a; font-size: 11px; font-weight: 600; }
.logout-button { display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 7px 0; background: transparent; color: #8692a4; font-size: 11px; transition: color .2s ease; }
.logout-button:hover { color: #c1535b; }
.logout-button svg { width: 17px; height: 17px; }
.page-content { width: 100%; max-width: 1470px; margin: 0 auto; padding: 35px 42px 42px; flex: 1; }
.app-footer { display: flex; justify-content: space-between; padding: 15px 42px 20px; color: #a4adbb; font-size: 9px; border-top: 1px solid #ebeff5; }
.icon-button {
    width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; padding: 0;
    border: 1px solid #e4e9f1; border-radius: 10px; color: #51617c; background: #fff;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.icon-button:hover { color: #315fcb; border-color: #cdd9f2; background: #fafdff; }
.mobile-menu-button, .sidebar-close-button, .sidebar-backdrop { display: none; }

/* Common page typography */
.section-kicker { display: block; margin-bottom: 10px; color: #7990bb; font-size: 9px; font-weight: 750; letter-spacing: 1.45px; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 31px; }
.page-intro h1 { margin: 0; color: #182743; font-size: clamp(25px, 3vw, 32px); font-weight: 730; letter-spacing: -1.1px; line-height: 1.22; }
.page-intro p { max-width: 650px; margin: 10px 0 0; color: #8490a3; font-size: 12px; line-height: 1.7; }
.dashboard-intro { min-height: 124px; }
.intro-side-note { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: #8995a8; font-size: 10px; white-space: nowrap; }
.intro-note-dot, .status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #45b28a; box-shadow: 0 0 0 3px #e8f6f0; }
.section-heading-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 17px; }
.section-heading-row h2 { margin: 0; color: #24334d; font-size: 16px; font-weight: 700; letter-spacing: -.35px; }
.section-heading-row p { margin: 4px 0 0; color: #98a3b3; font-size: 10px; }
.count-pill { display: inline-flex; align-items: center; padding: 6px 10px; color: #7688a8; background: #eef2f9; border-radius: 20px; font-size: 9px; font-weight: 650; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: -4px 0 18px; color: #a2adbc; font-size: 10px; }
.breadcrumbs a { color: #7184a8; transition: color .2s ease; }
.breadcrumbs a:hover { color: #315fcb; }
.breadcrumbs span:last-child { color: #62718a; }
.btn-primary, .btn-secondary, .btn-text { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 41px; padding: 0 16px; border-radius: 9px; font-size: 11px; font-weight: 650; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.btn-primary { color: #fff; background: #3f70dc; border: 1px solid #3f70dc; box-shadow: 0 5px 12px rgba(63,112,220,.13); }
.btn-primary:hover { color: #fff; background: #315fc7; border-color: #315fc7; transform: translateY(-1px); box-shadow: 0 7px 17px rgba(63,112,220,.2); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-secondary { color: #5c6c87; background: #fff; border: 1px solid #e4e9f1; }
.btn-secondary:hover { color: #315fcb; border-color: #cdd9f2; background: #fafdff; }
.btn-secondary svg { width: 15px; height: 15px; }
.btn-text { color: #5278ce; padding-inline: 5px; }
.btn-text:hover { color: #274eac; }

/* Subject cards */
.subject-grid-section { margin-top: 4px; }
.subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.subject-card {
    min-height: 205px; display: flex; flex-direction: column; padding: 20px 19px 15px;
    background: #fff; border: 1px solid #edf0f5; border-radius: 15px; box-shadow: 0 3px 12px rgba(28, 49, 84, .018);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.subject-card:hover { transform: translateY(-3px); border-color: #dbe5f8; box-shadow: 0 12px 28px rgba(27, 52, 97, .075); }
.subject-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.subject-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; }
.subject-icon svg { width: 22px; height: 22px; }
.subject-icon-1 { color: #527bd7; background: #edf2ff; }
.subject-icon-2 { color: #299b89; background: #eaf8f4; }
.subject-icon-3 { color: #9a78d2; background: #f3eefb; }
.subject-icon-4 { color: #c08743; background: #fbf3e9; }
.subject-icon-5 { color: #5d8b9c; background: #edf6f8; }
.card-arrow { width: 28px; height: 28px; display: grid; place-items: center; color: #a4b0c1; border-radius: 8px; background: #f7f8fb; transition: background .2s ease, color .2s ease; }
.card-arrow svg { width: 15px; height: 15px; }
.subject-card:hover .card-arrow { color: #fff; background: #4777df; }
.subject-card-body { padding: 19px 0 12px; }
.subject-card-body h3 { margin: 0 0 7px; color: #24334d; font-size: 14px; line-height: 1.4; font-weight: 700; letter-spacing: -.15px; }
.subject-card-body p { margin: 0; color: #8c98aa; font-size: 10px; line-height: 1.6; }
.subject-card-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid #f1f3f7; color: #99a4b3; font-size: 9px; }
.subject-card-footer .status-dot { width: 6px; height: 6px; box-shadow: 0 0 0 2px #e8f6f0; }
.dashboard-tip { display: flex; align-items: center; gap: 13px; margin-top: 24px; padding: 15px 18px; background: #f0f4fb; border: 1px solid #e8eef8; border-radius: 12px; }
.tip-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 9px; color: #6d89c7; background: #e3ebfb; }
.tip-icon svg { width: 17px; height: 17px; }
.dashboard-tip strong { display: block; color: #4c5e7b; font-size: 10px; }
.dashboard-tip p { margin: 2px 0 0; color: #8a98ad; font-size: 10px; }

/* Workspace */
.workspace-intro { align-items: center; margin-bottom: 26px; }
.change-subject { flex: 0 0 auto; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.stat-card { padding: 16px 18px 17px; background: #fff; border: 1px solid #edf0f5; border-radius: 13px; box-shadow: 0 3px 12px rgba(28,49,84,.02); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; color: #8b97a9; font-size: 10px; }
.stat-card > strong { display: block; margin: 9px 0 2px; color: #23344f; font-size: 27px; line-height: 1.15; font-weight: 720; letter-spacing: -.8px; }
.stat-card > small { color: #a0aaba; font-size: 9px; }
.stat-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-blue { color: #557eda; background: #edf2ff; }
.stat-green { color: #36a080; background: #eaf7f2; }
.stat-violet { color: #9977ce; background: #f3eefb; }
.workspace-section { margin-bottom: 31px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.action-card { min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 17px 14px; background: #fff; border: 1px solid #edf0f5; border-radius: 13px; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.action-card:hover { transform: translateY(-2px); border-color: #d8e3f7; box-shadow: 0 8px 20px rgba(30,56,101,.05); }
.action-card-primary { border-color: #dce6fb; background: linear-gradient(120deg, #fff 10%, #f8faff 100%); }
.action-icon { width: 37px; height: 37px; flex: 0 0 37px; display: grid; place-items: center; border-radius: 10px; }
.action-icon svg { width: 19px; height: 19px; }
.action-icon-primary { color: #fff; background: #4778df; }
.action-icon-blue { color: #557ed1; background: #edf2ff; }
.action-icon-green { color: #35a080; background: #eaf7f2; }
.action-card-copy { display: grid; gap: 5px; min-width: 0; padding-top: 1px; }
.action-card-copy strong { color: #34435c; font-size: 11px; font-weight: 700; }
.action-card-copy small { color: #929daf; font-size: 9px; line-height: 1.5; }
.action-card-arrow { margin-left: auto; color: #a5b0c0; align-self: center; }
.action-card-arrow svg { width: 15px; height: 15px; }
.recent-section { margin-top: 6px; }
.text-link { color: #6481bf; font-size: 10px; font-weight: 650; white-space: nowrap; }
.text-link:hover { color: #315fcb; }
.text-link span { margin-left: 3px; }

/* Tables and states */
.table-card { overflow: hidden; background: #fff; border: 1px solid #edf0f5; border-radius: 13px; box-shadow: 0 3px 12px rgba(28,49,84,.02); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 17px; background: #fafbfd; color: #98a3b2; text-align: left; font-size: 9px; font-weight: 700; white-space: nowrap; }
.data-table td { padding: 15px 17px; border-top: 1px solid #f0f2f6; color: #758198; font-size: 10px; vertical-align: middle; }
.data-table td strong { color: #33435c; font-size: 10px; font-weight: 650; }
.table-subtitle { display: block; margin-top: 3px; color: #9da7b6; font-size: 9px; }
.status-badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; font-size: 9px; font-weight: 650; white-space: nowrap; }
.status-draft { color: #8a7545; background: #fbf5e8; }
.status-published { color: #278465; background: #e9f7f1; }
.status-archived { color: #778397; background: #eff2f6; }
.table-arrow { color: #91a4c5; font-size: 17px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #fff; border: 1px dashed #dfe6f0; border-radius: 14px; }
.large-empty { min-height: 260px; padding: 35px 22px; }
.compact-empty { min-height: 114px; flex-direction: row; justify-content: flex-start; gap: 15px; padding: 18px; text-align: left; }
.compact-empty .empty-icon { margin: 0; }
.compact-empty h3 { margin-bottom: 3px; }
.compact-empty p { margin-bottom: 0; }
.compact-empty .btn-secondary { margin-left: auto; white-space: nowrap; }
.empty-icon { width: 45px; height: 45px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 13px; color: #7890bd; background: #eef3fc; }
.empty-icon svg { width: 22px; height: 22px; }
.empty-state h3 { margin: 0 0 6px; color: #36455d; font-size: 14px; font-weight: 700; }
.empty-state p { max-width: 430px; margin: 0 0 17px; color: #96a1b1; font-size: 10px; line-height: 1.7; }
.empty-state .btn-primary svg, .empty-state .btn-secondary svg { width: 15px; height: 15px; }
.list-empty { margin-top: 4px; }

/* Placeholder */
.coming-soon-card { max-width: 720px; min-height: 450px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 15px auto 0; padding: 34px 36px; text-align: center; background: #fff; border: 1px solid #edf0f5; border-radius: 18px; box-shadow: var(--shadow); }
.coming-soon-illustration { width: 110px; height: 105px; position: relative; display: grid; place-items: center; margin-bottom: 15px; }
.illustration-sheet { width: 57px; height: 72px; position: relative; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 16px 10px; background: #fff; border: 1px solid #dfe7f5; border-radius: 9px; box-shadow: 0 9px 22px rgba(53,86,143,.12); transform: rotate(-5deg); }
.illustration-sheet span { height: 4px; border-radius: 3px; background: #dce6f8; }
.illustration-sheet span:nth-child(2) { width: 75%; }
.illustration-sheet span:nth-child(3) { width: 55%; }
.illustration-sheet b { position: absolute; right: -16px; bottom: -9px; width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: #4778df; border: 3px solid white; border-radius: 50%; font-size: 19px; font-weight: 400; }
.illustration-orbit { position: absolute; width: 103px; height: 71px; border: 1px dashed #cbd9f3; border-radius: 50%; transform: rotate(-23deg); }
.coming-soon-label { margin-bottom: 8px; color: #8ba0c5; font-size: 8px; letter-spacing: 1.4px; font-weight: 750; }
.coming-soon-card h2 { margin: 0 0 9px; color: #263852; font-size: 20px; font-weight: 720; letter-spacing: -.5px; }
.coming-soon-card p { max-width: 500px; margin: 0; color: #8996a9; font-size: 11px; line-height: 1.8; }
.coming-soon-actions { display: flex; align-items: center; gap: 15px; margin-top: 23px; }

/* Public pages / login */
.public-body { min-height: 100vh; background: #f5f7fb; display: flex; flex-direction: column; }
.public-header { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(5vw, calc((100vw - 1240px) / 2)); background: #fff; border-bottom: 1px solid #e9edf4; }
.brand-public .brand-copy small { color: #9ba7b7; }
.public-header-note { padding: 7px 11px; color: #7486a6; background: #f2f5fb; border-radius: 20px; font-size: 10px; }
.public-main { flex: 1; display: flex; flex-direction: column; }
.public-footer { display: flex; align-items: center; justify-content: space-between; padding: 19px max(5vw, calc((100vw - 1240px) / 2)); color: #a3adbb; background: #fff; border-top: 1px solid #e9edf4; font-size: 9px; }
.public-footer span:first-child { color: #70819e; font-weight: 750; letter-spacing: .5px; }
.login-layout { width: min(1130px, calc(100% - 48px)); min-height: 620px; display: grid; grid-template-columns: 1fr 1fr; margin: 45px auto; overflow: hidden; background: #fff; border: 1px solid #e9edf4; border-radius: 20px; box-shadow: 0 18px 55px rgba(28,47,80,.07); }
.login-visual { min-height: 620px; position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 65px 55px 32px; color: #fff; background: linear-gradient(145deg, #172c4d 0%, #1e3a65 55%, #315a9b 100%); }
.login-visual::before { content: ""; position: absolute; width: 420px; height: 420px; right: -185px; top: -170px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 36px rgba(255,255,255,.025), 0 0 0 73px rgba(255,255,255,.018); }
.login-visual::after { content: ""; position: absolute; width: 300px; height: 300px; left: -180px; bottom: -160px; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.025), 0 0 0 60px rgba(255,255,255,.018); }
.visual-orbit { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 360px; height: 360px; right: -95px; bottom: -195px; }
.orbit-two { width: 260px; height: 260px; right: -45px; bottom: -145px; }
.visual-content, .visual-footnote { position: relative; z-index: 1; }
.visual-overline { display: inline-block; margin-bottom: 28px; color: #9db7e7; font-size: 8px; font-weight: 750; letter-spacing: 1.65px; }
.visual-content h1 { max-width: 430px; margin: 0 0 20px; color: #fff; font-size: clamp(29px, 3vw, 37px); font-weight: 730; line-height: 1.2; letter-spacing: -1.2px; }
.visual-content h1 span { color: #9ebcf5; }
.visual-content > p { max-width: 380px; margin: 0; color: #bdcbe0; font-size: 12px; line-height: 1.85; }
.visual-feature-list { display: grid; gap: 16px; margin-top: 42px; }
.visual-feature-list div { display: flex; align-items: center; gap: 11px; color: #d8e3f3; font-size: 11px; }
.visual-check { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 20px; border: 1px solid rgba(170,198,246,.4); border-radius: 50%; color: #b4d0ff; font-size: 11px; }
.visual-footnote { display: flex; align-items: center; gap: 10px; color: #91a8cc; font-size: 8px; font-weight: 700; letter-spacing: 1.5px; }
.visual-line { width: 23px; height: 1px; display: inline-block; background: #7d9fd9; }
.login-panel-wrap { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(30px, 5vw, 66px) 25px; }
.login-panel { width: 100%; max-width: 370px; margin: auto; }
.login-heading { margin-bottom: 31px; }
.login-heading .section-kicker { margin-bottom: 10px; }
.login-heading h2 { margin: 0 0 8px; color: #1c2d49; font-size: 27px; font-weight: 730; letter-spacing: -.9px; }
.login-heading p { margin: 0; color: #8c98aa; font-size: 11px; line-height: 1.7; }
.login-form { display: grid; gap: 20px; }
.field-group { display: grid; gap: 8px; }
.field-group label { margin: 0; color: #40516c; font-size: 10px; font-weight: 700; }
.input-with-icon { height: 46px; position: relative; display: flex; align-items: center; border: 1px solid #e4e9f1; border-radius: 9px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
.input-with-icon:focus-within { border-color: #87a4e9; box-shadow: 0 0 0 3px rgba(76,121,220,.09); }
.input-with-icon > svg { width: 17px; height: 17px; margin-left: 13px; color: #a0adbf; flex: 0 0 17px; }
.input-with-icon input { width: 100%; height: 100%; min-width: 0; padding: 0 12px; border: 0; outline: 0; color: #33435d; background: transparent; font-size: 11px; }
.input-with-icon input::placeholder { color: #b0bac8; }
.password-toggle { width: 37px; height: 40px; display: grid; place-items: center; flex: 0 0 37px; border: 0; background: transparent; color: #a5b0bf; }
.password-toggle svg { width: 17px; height: 17px; }
.btn-primary-wide { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 11px; margin-top: 4px; padding: 0 15px; border: 1px solid #3e6fd8; border-radius: 9px; color: #fff; background: linear-gradient(100deg, #4779e2, #3967cf); box-shadow: 0 7px 15px rgba(58,103,207,.18); font-size: 11px; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease; }
.btn-primary-wide:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 19px rgba(58,103,207,.24); }
.btn-primary-wide:disabled { cursor: not-allowed; opacity: .58; box-shadow: none; }
.btn-primary-wide span { font-size: 17px; font-weight: 400; line-height: 1; }
.form-alert { margin: -12px 0 18px; padding: 10px 12px; border: 1px solid #f3d9d9; border-radius: 8px; color: #a44e55; background: #fff6f6; font-size: 10px; }
.field-error { color: #bd5963; font-size: 9px; }
.login-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 24px; padding: 12px; border-radius: 9px; background: #f6f8fc; color: #8a97aa; font-size: 9px; line-height: 1.6; }
.note-icon { width: 16px; height: 16px; display: inline-grid; place-items: center; flex: 0 0 16px; border: 1px solid #a9b8d2; border-radius: 50%; color: #8296b8; font-size: 10px; font-weight: 700; font-style: normal; }
.login-copyright { margin-top: auto; color: #b0b9c6; text-align: center; font-size: 8px; }

/* Student invitation */
.student-page-wrap { width: min(760px, calc(100% - 36px)); margin: 38px auto 54px; }
.student-test-card { padding: 31px 37px 28px; background: #fff; border: 1px solid #e9edf4; border-radius: 18px; box-shadow: 0 16px 42px rgba(28,47,80,.06); }
.student-card-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 27px; }
.student-label { color: #8598bb; font-size: 8px; font-weight: 750; letter-spacing: 1.35px; }
.secure-label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 20px; color: #39876d; background: #edf8f3; font-size: 8px; font-weight: 650; }
.secure-label svg { width: 13px; height: 13px; }
.student-subject-line { display: flex; align-items: center; gap: 9px; color: #7083a5; font-size: 10px; font-weight: 650; }
.subject-mark { width: 25px; height: 25px; display: grid; place-items: center; color: #fff; background: #527bd7; border-radius: 7px; font-size: 8px; font-weight: 800; }
.student-test-card h1 { margin: 17px 0 8px; color: #1d2e49; font-size: clamp(23px, 4vw, 29px); line-height: 1.25; font-weight: 740; letter-spacing: -.9px; }
.student-test-description { max-width: 600px; margin: 0; color: #8996a8; font-size: 11px; line-height: 1.75; }
.test-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 25px; padding: 17px 0; border-top: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; }
.test-meta-item { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-right: 1px solid #edf0f5; }
.test-meta-item:first-child { padding-left: 0; }
.test-meta-item:last-child { border-right: 0; }
.meta-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; color: #6485d0; background: #eef3ff; border-radius: 9px; }
.meta-icon svg { width: 17px; height: 17px; }
.test-meta-item div { display: grid; gap: 1px; }
.test-meta-item strong { color: #374761; font-size: 12px; font-weight: 720; white-space: nowrap; }
.test-meta-item small { color: #9aa5b4; font-size: 8px; }
.student-divider { height: 1px; margin: 24px 0 21px; background: #edf0f5; }
.student-form-heading h2 { margin: 0 0 4px; color: #2d3e59; font-size: 14px; font-weight: 700; }
.student-form-heading p { margin: 0 0 16px; color: #929eaf; font-size: 9px; }
.student-details-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.student-details-form .field-group input { width: 100%; height: 44px; padding: 0 12px; outline: 0; border: 1px solid #e5eaf2; border-radius: 8px; background: #fafbfd; color: #6d7b92; font-size: 10px; }
.student-details-form .field-group input::placeholder { color: #b0bac8; }
.student-details-form .field-group input:disabled { opacity: 1; cursor: not-allowed; }
.student-start-button { grid-column: 1 / -1; margin-top: 4px; }
.stage-notice { display: flex; align-items: flex-start; gap: 9px; margin-top: 18px; padding: 11px 12px; color: #8896aa; background: #f6f8fc; border-radius: 8px; font-size: 9px; line-height: 1.6; }
.stage-notice .note-icon { margin-top: 1px; }
.student-support-line { margin-top: 17px; color: #a2adbc; text-align: center; font-size: 9px; }

/* Friendly unavailable / error state */
.unavailable-wrap { width: min(660px, calc(100% - 36px)); display: flex; align-items: center; justify-content: center; flex: 1; margin: 40px auto; }
.unavailable-card { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 42px 34px; text-align: center; background: #fff; border: 1px solid #e9edf4; border-radius: 18px; box-shadow: var(--shadow); }
.unavailable-symbol { width: 75px; height: 75px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 20px; color: #7892c4; background: #f0f4fb; }
.unavailable-symbol svg { width: 57px; height: 57px; }
.unavailable-card .section-kicker { margin-bottom: 7px; }
.unavailable-card h1 { margin: 0 0 9px; color: #20314d; font-size: 25px; font-weight: 730; letter-spacing: -.7px; }
.unavailable-card > p { max-width: 420px; margin: 0; color: #8996a9; font-size: 11px; line-height: 1.8; }
.unavailable-hint { width: min(420px, 100%); display: grid; gap: 3px; margin: 21px 0; padding: 13px 15px; text-align: left; background: #f7f9fc; border-radius: 9px; }
.unavailable-hint strong { color: #4d5f7b; font-size: 10px; }
.unavailable-hint span { color: #96a2b3; font-size: 9px; line-height: 1.65; }
.error-code { margin-bottom: 10px; color: #dbe4f4; font-size: 58px; line-height: 1; font-weight: 800; letter-spacing: -3px; }
.unavailable-card .btn-secondary { margin-top: 21px; }

/* Alerts */
.message-stack { padding-top: 15px; }
.message-stack .alert { margin: 0 0 12px; border-radius: 9px; font-size: 11px; }

/* Длинные названия МДК (B1.5): только защита от переполнения */
.topbar-left { min-width: 0; flex: 1 1 auto; }
.topbar-right { flex: 0 0 auto; }
.topbar-context { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.topbar-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-current-subject { align-items: flex-start; }
.sidebar-current-subject .current-subject-dot { margin-top: 5px; }
.sidebar-current-subject span:last-child { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.page-intro > div { min-width: 0; }
.page-intro h1, .section-kicker, .subject-card-body h3, .subject-card-body p,
.breadcrumbs a, .breadcrumbs span { overflow-wrap: anywhere; }
.page-intro h1.is-long { font-size: clamp(20px, 5.6vw, 27px); letter-spacing: -.5px; line-height: 1.3; }

@media (max-width: 1180px) {
    .page-content { padding-inline: 30px; }
    .topbar { padding-inline: 30px; }
    .app-footer { padding-inline: 30px; }
    .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .action-grid { grid-template-columns: 1fr; }
    .action-card { align-items: center; }
}
@media (max-width: 900px) {
    body.sidebar-open { overflow: hidden; }
    .sidebar { transform: translateX(-105%); transition: transform .25s ease; box-shadow: 14px 0 35px rgba(20,37,67,.08); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(14,27,49,.28); backdrop-filter: blur(2px); }
    .sidebar-backdrop.is-visible { display: block; }
    .sidebar-close-button, .mobile-menu-button { display: grid; }
    .app-main { margin-left: 0; }
    .topbar { height: 68px; flex-basis: 68px; }
}
@media (max-width: 680px) {
    .topbar { padding-inline: 17px; }
    .topbar-label { display: none; }
    .topbar-title { font-size: 11px; }
    .topbar-right { gap: 12px; }
    .user-chip { padding-right: 0; border: 0; }
    .user-chip-name { display: none; }
    .logout-button span { display: none; }
    .page-content { padding: 25px 17px 30px; }
    .app-footer { padding: 13px 17px 17px; }
    .app-footer span:last-child { display: none; }
    .page-intro { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 24px; }
    .page-intro h1 { font-size: 25px; }
    .page-intro p { font-size: 11px; }
    .dashboard-intro { min-height: auto; }
    .intro-side-note { margin: 0; }
    .subject-grid { grid-template-columns: 1fr; gap: 11px; }
    .subject-card { min-height: 175px; }
    .section-heading-row { align-items: flex-start; }
    .count-pill { flex: 0 0 auto; }
    .stats-grid { grid-template-columns: 1fr; gap: 9px; margin-bottom: 27px; }
    .stat-card { padding: 13px 15px; }
    .stat-card > strong { font-size: 23px; margin: 4px 0 0; }
    .workspace-intro { align-items: flex-start; }
    .change-subject { min-height: 37px; }
    .action-grid { gap: 9px; }
    .action-card { padding: 14px 12px; }
    .compact-empty { flex-wrap: wrap; }
    .compact-empty .btn-secondary { margin-left: 0; }
    .coming-soon-card { min-height: 400px; padding: 28px 20px; }
    .coming-soon-actions { flex-direction: column; gap: 8px; }
    .page-intro-with-action { align-items: flex-start; }
    .data-table th, .data-table td { padding: 12px 13px; }
    .login-layout { width: calc(100% - 24px); grid-template-columns: 1fr; margin: 17px auto; border-radius: 15px; }
    .login-visual { min-height: auto; padding: 32px 27px 27px; }
    .visual-overline { margin-bottom: 18px; }
    .visual-content h1 { font-size: 26px; margin-bottom: 12px; }
    .visual-content > p { font-size: 10px; }
    .visual-feature-list { grid-template-columns: 1fr; gap: 9px; margin-top: 21px; }
    .visual-feature-list div { font-size: 9px; }
    .visual-footnote { margin-top: 29px; }
    .login-panel-wrap { min-height: 410px; padding: 35px 25px 20px; }
    .login-heading h2 { font-size: 24px; }
    .public-header { height: 65px; padding-inline: 18px; }
    .public-footer { padding: 15px 18px; }
    .public-footer span:last-child { max-width: 170px; text-align: right; }
    .student-page-wrap { margin-top: 22px; }
    .student-test-card { padding: 23px 19px 20px; border-radius: 14px; }
    .student-card-topline { align-items: flex-start; margin-bottom: 22px; }
    .secure-label { font-size: 7px; }
    .test-meta-grid { gap: 12px; grid-template-columns: 1fr; }
    .test-meta-item, .test-meta-item:first-child { padding: 0; border-right: 0; }
    .student-details-form { grid-template-columns: 1fr; }
    .student-start-button { grid-column: auto; }
    .unavailable-card { padding: 33px 22px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ==== B1: типографика, контраст, доступность ==== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-size: var(--fs-base); }
.app-shell, .app-main, .public-body { min-height: 100vh; min-height: 100dvh; }

/* Видимый фокус с клавиатуры */
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid rgba(63, 112, 223, .55); outline-offset: 2px; }
.student-details-form .field-group input:focus-visible { border-color: #87a4e9; box-shadow: 0 0 0 3px rgba(76, 121, 220, .15); }

/* Размеры текста: 12 px */
.brand-copy small, .sidebar-section-label, .sidebar-version, .topbar-label, .app-footer, .section-kicker,
.count-pill, .stat-card > small, .data-table th, .table-subtitle, .status-badge, .subject-card-footer,
.coming-soon-label, .field-error, .login-note, .login-copyright, .visual-overline, .visual-footnote,
.public-header-note, .public-footer, .student-label, .secure-label, .test-meta-item small { font-size: var(--fs-xs); }

/* 13 px */
.sidebar-current-subject, .user-chip-name, .logout-button, .intro-side-note, .section-heading-row p,
.breadcrumbs, .subject-card-body p, .dashboard-tip strong, .dashboard-tip p, .stat-card-top,
.action-card-copy small, .text-link, .data-table td, .data-table td strong, .empty-state p,
.field-group label, .form-alert, .student-subject-line, .student-form-heading p, .stage-notice,
.student-support-line, .unavailable-hint strong, .unavailable-hint span, .user-avatar { font-size: var(--fs-sm); }

/* 14 px */
.side-nav-link, .side-nav-sub, .topbar-title, .page-intro p, .btn-primary, .btn-secondary, .btn-text,
.action-card-copy strong, .coming-soon-card p, .login-heading p, .visual-content > p,
.visual-feature-list div, .message-stack .alert { font-size: var(--fs-md); }

/* 15 px */
.student-test-description, .unavailable-card > p, .test-meta-item strong, .btn-primary-wide { font-size: var(--fs-base); }

/* 16 px */
.subject-card-body h3, .empty-state h3, .student-form-heading h2 { font-size: var(--fs-lg); }
.input-with-icon input, .student-details-form .field-group input { font-size: var(--fs-input); }
.subject-mark { font-size: var(--fs-xs); }

/* Зоны нажатия */
.side-nav-link, .side-nav-sub, .btn-primary, .btn-secondary { min-height: var(--tap); }
.logout-button { min-height: var(--tap); min-width: var(--tap); justify-content: center; }
.password-toggle { width: var(--tap); height: var(--tap); flex-basis: var(--tap); }
.input-with-icon { height: 48px; }
.student-details-form .field-group input { height: 48px; }
.btn-primary-wide { min-height: 48px; }

/* Контраст вторичного текста */
.brand-copy small, .sidebar-section-label, .sidebar-version, .topbar-label, .app-footer, .page-intro p,
.intro-side-note, .section-heading-row p, .count-pill, .breadcrumbs, .subject-card-body p,
.subject-card-footer, .dashboard-tip strong, .dashboard-tip p, .stat-card-top, .stat-card > small,
.action-card-copy small, .data-table th, .data-table td, .table-subtitle, .empty-state p,
.coming-soon-card p, .login-heading p, .login-note, .login-copyright, .public-footer,
.student-test-description, .student-form-heading p, .stage-notice, .student-support-line,
.test-meta-item small, .unavailable-card > p, .unavailable-hint span, .field-group label { color: var(--muted); }
.section-kicker, .coming-soon-label, .student-label, .text-link, .breadcrumbs a { color: var(--kicker); }
.field-error { color: #a8434d; }
.input-with-icon input::placeholder, .student-details-form .field-group input::placeholder { color: #6b7a90; }

/* Шапка: длинное название дисциплины не ломает строку на 360 px */
.topbar-context { min-width: 0; }
.topbar-title { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Нижняя safe-area (верх и бока — в B2/B4 вместе с viewport-fit=cover) */
.sidebar { padding-bottom: calc(17px + env(safe-area-inset-bottom, 0px)); }
.app-footer, .public-footer { padding-bottom: calc(17px + env(safe-area-inset-bottom, 0px)); }

/* Teacher question editor */
.teacher-editor { max-width: 900px; }
div.teacher-editor, .teacher-panel, .teacher-review { padding: clamp(14px, 3vw, 24px); margin-bottom: 14px; }
.teacher-review { max-width: 900px; background: #fff8ea; border: 1px solid #e7d2aa; border-radius: var(--radius); }
.teacher-editor h2 { font-size: 1.1rem; margin: 0 0 10px; }
.teacher-editor form + details, .teacher-editor details + form, .teacher-question p:first-of-type { margin-top: 16px; }
.teacher-panel label, .teacher-editor label { display: block; font-weight: 600; }
.teacher-panel input:not([type="checkbox"]), .teacher-editor input:not([type="checkbox"]), .teacher-editor textarea {
    display: block;
    width: 100%;
    min-height: var(--tap);
    padding: 8px 12px;
    color: var(--ink);
    border: 1px solid #cdd6e5;
    border-radius: 8px;
    font: inherit;
    font-size: var(--fs-input);
}
.teacher-editor .helptext { color: var(--muted); }
.teacher-editor .errorlist { color: #a52828; overflow-wrap: anywhere; }
.teacher-editor textarea { resize: vertical; }
.teacher-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.teacher-question summary, .teacher-review summary, .teacher-editor summary { cursor: pointer; overflow-wrap: anywhere; }
.teacher-question-list { display: grid; gap: 6px; }
.teacher-question-list label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-height: 44px;
    padding: 10px 0;
    cursor: pointer;
    font-weight: 500;
    overflow-wrap: anywhere;
}
.teacher-question-list input { width: 18px; height: 18px; margin-top: 2px; }
.bank-actions { position: sticky; bottom: 0; padding: 8px 0; background: var(--surface); }
ol.teacher-panel { padding-inline-start: 38px; }
ol.teacher-panel li { overflow-wrap: anywhere; }

.teacher-filters label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.teacher-filters select { min-height: var(--tap); border: 1px solid #cdd6e5; border-radius: 8px; background: var(--surface); padding: 6px 10px; }

.teacher-page-intro { display: grid; gap: 10px; }
.teacher-page-intro p { margin: 0; overflow-wrap: anywhere; }
.teacher-create-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.teacher-create-grid h2 { font-size: 1.1rem; margin: 0 0 12px; }
.teacher-create-grid details { margin-top: 18px; }
.teacher-create-grid pre { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.teacher-create-grid .btn-secondary { text-decoration: none; }
.teacher-share { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 8px; }
.teacher-share button[hidden] { display: none; }
.teacher-question-list label[hidden] { display: none; }
.teacher-bank-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.teacher-bank-actions p { margin: 0; color: var(--muted); }
.result-field-label { display: none; }

@media (max-width: 680px) {
    .teacher-create-grid, .teacher-share { grid-template-columns: minmax(0, 1fr); }
    .teacher-results-table, .teacher-results-table tbody { display: block; }
    .teacher-results-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .teacher-results-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 14px;
        padding: 14px;
    }
    .teacher-results-table tr + tr { border-top: 1px solid #edf0f5; }
    .teacher-results-table td { display: block; border: 0; padding: 0; overflow-wrap: anywhere; }
    .teacher-results-table td:first-child, .teacher-results-table td:nth-child(3) { grid-column: 1 / -1; }
    .teacher-results-table td a { display: inline-flex; align-items: center; min-height: var(--tap); }
    .result-field-label { display: block; color: var(--muted); font-size: var(--fs-small, .8rem); }
}
