:root {
    color-scheme: light;
    font-family: Inter, 'Segoe UI', sans-serif;
    color: #17233a;
    background: #f5f7fb;
    font-synthesis: none;
    --ink: #17233a;
    --muted: #57667e;
    --line: #e5eaf2;
    --blue: #284bcf;
    --blue-dark: #1d3aae;
    --focus: #586eed;
    --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
svg { flex: none; vertical-align: middle; }

.app-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; background: #fff; border-right: 1px solid var(--line); padding: 25px 16px 16px; z-index: 2; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 5px; }
.brand-icon { display: grid; place-items: center; flex: none; background: #284acd; color: white; width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 3px 7px #1838b429; }
.brand strong, .brand small, .profile-name strong, .profile-name small { display: block; }
.brand strong { font-size: 1rem; font-weight: 750; letter-spacing: -.025em; }
.brand small { margin-top: 3px; font-size: .72rem; color: var(--muted); }
.navigation { display: grid; gap: 4px; margin-top: 45px; }
.nav-caption { font-size: .66rem; color: #5d6c84; letter-spacing: .11em; font-weight: 750; margin: 0 10px 8px; }
.navigation button, .help-button { display: flex; align-items: center; gap: 11px; padding: 11px 10px; min-height: 42px; text-align: left; border: 0; border-radius: 8px; color: #52617a; background: transparent; font-size: .86rem; font-weight: 620; }
.navigation button:hover, .help-button:hover { background: #f3f6fc; }
.navigation button[aria-current] { background: #eaf0ff; color: #2445bd; }
.sidebar-bottom { margin-top: auto; }
.help-button { width: 100%; margin-bottom: 12px; }
.profile { display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); padding: 15px 2px 0; }
.profile-avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; color: #2a48b8; background: #e8eeff; border-radius: 50%; font-weight: 750; font-size: .84rem; }
.profile-name { min-width: 0; flex: 1; }
.profile-name strong { font-size: .8rem; overflow-wrap: anywhere; }
.profile-name small { margin-top: 3px; font-size: .68rem; color: var(--muted); }

.topbar { min-height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 12px 33px; background: #fff; border-bottom: 1px solid var(--line); gap: 14px; }
.breadcrumb, .topbar-meta, .today, .live { display: flex; align-items: center; }
.breadcrumb,.topbar-meta { gap: 12px; font-size: .8rem; }
.breadcrumb > span, .breadcrumb svg, .today { color: var(--muted); }
.today { gap: 7px; }
.today span::first-letter { text-transform: uppercase; }
.live { gap: 7px; padding: 5px 9px; border-radius: 100px; font-weight: 700; white-space: nowrap; color: #58677d; background: #edf1f6; }
.live i, .badge i { display: block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live[data-state='online'] { color: #146447; background: #e6f7ee; }
.live[data-state='offline'] { color: #8a4219; background: #fff0db; }

.content { max-width: 1490px; margin: 0 auto; padding: 28px 33px 36px; }
.page-heading, .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { font-size: clamp(1.55rem, 2.45vw, 2rem); font-weight: 760; line-height: 1.18; letter-spacing: -.045em; }
.page-heading p, .panel-heading p { margin-top: 6px; color: var(--muted); font-size: .87rem; line-height: 1.45; }
.heading-actions { flex: none; display: flex; flex-wrap: wrap; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 8px 12px; border-radius: 8px; border: 1px solid transparent; font-size: .81rem; font-weight: 680; white-space: nowrap; }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 2px 3px #203fb029; }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary { border-color: #dce4ef; background: white; color: #334362; }
.button.secondary:hover:not(:disabled) { background: #f4f7ff; border-color: #b8c7e7; }

.hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 152px; padding: 23px 27px; border-radius: var(--radius); color: #fff; background: linear-gradient(115deg, #193b9e, #2b51cf 60%, #355bdc); }
.hero::before, .hero::after { position: absolute; content: ''; z-index: -1; width: 355px; height: 355px; border: 1px solid #ffffff20; border-radius: 50%; pointer-events: none; }
.hero::before { right: -64px; top: -220px; box-shadow: 0 0 0 27px #ffffff0b, 0 0 0 55px #ffffff09, 0 0 0 83px #ffffff05; }
.hero::after { width: 285px; height: 285px; right: -46px; top: -186px; }
.hero-copy { flex: 1; max-width: 510px; }
.hero h2 { font-size: 1.26rem; font-weight: 740; letter-spacing: -.022em; }
.hero p { margin-top: 6px; color: #f1f4ff; font-size: .87rem; }
.hero progress { display: block; width: 100%; height: 8px; margin-top: 18px; appearance: none; border: 0; border-radius: 5px; overflow: hidden; color: #cbd9ff; background: #ffffff38; }
progress::-webkit-progress-bar { background: #ffffff38; }
progress::-webkit-progress-value { border-radius: 5px; background: #dce8ff; transition: width .24s ease; }
progress::-moz-progress-bar { border-radius: 5px; background: #dce8ff; }
.percentage { font-size: clamp(2.35rem, 4.55vw, 3.85rem); font-weight: 760; line-height: 1; letter-spacing: -.065em; padding-right: 13px; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 17px 0 23px; }
.stat { display: flex; align-items: center; gap: 11px; background: #fff; min-width: 0; min-height: 86px; text-align: left; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px #20315306; }
.stat:hover { border-color: #bccccf; }
.stat-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; }
.stat-icon.total { color: #3b54bc; background: #ecf0ff; }
.stat-icon.done { color: #177554; background: #e7f6ee; }
.stat-icon.pending { color: #925417; background: #fff3df; }
.stat-icon.review { color: #764aa6; background: #f4ebff; }
.stat-label { display: block; color: var(--muted); font-size: .77rem; font-weight: 620; }
.stat strong { display: block; margin-top: 2px; font-size: 1.4rem; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 4px #20315306; overflow: hidden; }
.panel-heading { padding: 18px 20px 15px; }
.panel-heading h2 { font-size: 1.13rem; letter-spacing: -.025em; }
.panel-heading p { font-size: .8rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 0 20px 14px; }
.status-filters { display: flex; gap: 2px; max-width: 100%; background: #f2f5fa; padding: 3px; border-radius: 8px; overflow: auto; }
.status-filters button { color: #52617b; border: 0; background: transparent; padding: 6px 9px; font-weight: 650; font-size: .76rem; line-height: 1.35; border-radius: 6px; white-space: nowrap; }
.status-filters button:hover { color: var(--blue-dark); }
.status-filters button[aria-pressed='true'] { color: var(--blue-dark); background: #fff; box-shadow: 0 1px 3px #2438531c; }
.search-filters { display: flex; gap: 8px; }
.search, .course-filter { display: flex; gap: 5px; align-items: center; background: #fff; color: #61718b; border: 1px solid #dce4ef; border-radius: 8px; padding: 0 8px; }
.search input, .course-filter select { min-height: 35px; background: transparent; border: 0; font-size: .77rem; padding: 2px 3px; color: var(--ink); }
.search input { width: 143px; }
.search input::placeholder { color: #5d6e88; }
.course-filter select { width: 125px; }
.search:focus-within, .course-filter:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search input:focus, .course-filter select:focus { outline: none; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; text-align: left; }
th { background: #f5f7fb; color: #51627c; border-block: 1px solid var(--line); padding: 10px 12px; font-size: .72rem; font-weight: 720; white-space: nowrap; }
#history th { border-top: 0; }
td { padding: 10px 12px; border-bottom: 1px solid #edf0f6; height: 56px; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
.right { text-align: right; }
.student { display: flex; gap: 9px; align-items: center; min-width: 154px; }
.student strong { display: block; font-weight: 680; }
.student small, .updated-by, .row-note { display: block; margin-top: 3px; font-size: .72rem; color: var(--muted); }
.student-avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: .7rem; font-weight: 750; color: #354cb2; background: #eaf0ff; }
.student-avatar.tone-1 { color: #774c9e; background: #f3e9fb; }
.student-avatar.tone-2 { color: #22694e; background: #e4f4ea; }
.student-avatar.tone-3 { color: #8a5433; background: #faeee1; }
.student-avatar.tone-4 { color: #256280; background: #e3f2f9; }
.course-name { white-space: nowrap; color: #455572; }
.mobile-course { display: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; padding: 4px 8px; border-radius: 100px; white-space: nowrap; }
.badge.done { color: #116045; background: #e5f7ed; }
.badge.pending { color: #805011; background: #fff3dc; }
.badge.review { color: #71439b; background: #f3eafa; }
.badge.added { color: #2d469e; background: #ecf1ff; }
.badge i { width: 6px; height: 6px; }
.row-note { max-width: 170px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.row-action { min-height: 31px; color: #2347bd; border-color: #dce5ff; background: #eef3ff; font-size: .74rem; padding: 4px 8px; }
.row-action:hover:not(:disabled) { background: #dfe8ff; border-color: #b3c6ff; }
.completed-mark { display: flex; align-items: center; gap: 4px; color: #52697d; font-size: .73rem; white-space: nowrap; }
.completed-mark svg { color: #20815b; }
.icon-button { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 7px; width: 31px; height: 31px; padding: 0; color: #54637d; }
.icon-button:hover:not(:disabled) { background: #f1f5ff; color: var(--blue-dark); }
.icon-button.more { background: transparent; border-color: transparent; }
.icon-button.more:hover:not(:disabled) { background: #eef3ff; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.pagination { display: flex; align-items: center; gap: 9px; }

.login-page { min-height: 100vh; display: grid; align-items: center; justify-items: center; padding: 20px; background: radial-gradient(ellipse at 20% 10%, #e5ebff, transparent 65%), #f5f7fb; }
.login-card { width: min(100%, 420px); background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 27px; box-shadow: 0 16px 54px #20346a16; }
.login-card .brand { padding: 0; margin-bottom: 24px; }
.login-card h1 { font-size: 1.6rem; letter-spacing: -.04em; }
.login-card p, #modal-content > p { color: var(--muted); font-size: .87rem; line-height: 1.5; margin: 8px 0 16px; }
dialog { width: min(460px, calc(100% - 30px)); max-height: 90vh; padding: 20px; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 16px 54px #14204340; color: var(--ink); }
dialog::backdrop { background: #19294b60; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.dialog-heading h2 { font-size: 1.14rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.dialog-heading button { flex: none; }
.form-fields, .form-fields label { display: grid; gap: 7px; }
.form-fields { gap: 13px; }
.form-fields label { font-weight: 650; font-size: .83rem; }
.form-fields input, .form-fields select, .form-fields textarea { width: 100%; border: 1px solid #d3deed; border-radius: 7px; padding: 8px 9px; background: #fff; font-size: .88rem; font-weight: 400; }
.form-fields textarea { resize: vertical; }
.form-error { color: #a42b34 !important; font-size: .84rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; }
.text-button { padding: 0; border: 0; margin-bottom: 17px; color: var(--blue-dark); background: transparent; text-decoration: underline; text-underline-offset: 3px; font-weight: 680; font-size: .82rem; }
.help-list { padding-left: 23px; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.help-list li + li { margin-top: 8px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 4; width: max-content; max-width: calc(100% - 40px); padding: 11px 15px; background: #173a30; color: white; border-radius: 9px; box-shadow: 0 7px 28px #17233a40; font-size: .88rem; font-weight: 650; }
.toast.error { background: #842b36; }

@media (max-width: 1080px) {
    .app-layout { grid-template-columns: 196px minmax(0, 1fr); }
    .topbar, .content { padding-inline: 22px; }
    .stat { padding-inline: 10px; gap: 8px; }
}
@media (max-width: 820px) {
    .app-layout { display: block; }
    .sidebar { position: static; display: flex; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 11px; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 11px 16px; }
    .brand { padding: 0; }
    .navigation { display: flex; margin: 0; }
    .navigation button { gap: 6px; min-height: 36px; padding: 7px; }
    .nav-caption, .help-button, .profile-name { display: none; }
    .sidebar-bottom { margin: 0; }
    .profile { border: 0; padding: 0; }
    .topbar { min-height: 46px; }
}
@media (max-width: 580px) {
    .today { display: none; }
    .topbar, .content { padding-inline: 13px; }
    .content { padding-top: 19px; }
    .sidebar { padding-inline: 13px; gap: 8px; }
    .sidebar .profile-avatar { display: none; }
    .navigation { order: 3; flex-basis: 100%; }
    .navigation button { padding-inline: 11px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 16px; }
    .hero { min-height: 118px; padding: 16px; gap: 10px; }
    .hero h2 { font-size: 1.04rem; }
    .hero p { font-size: .78rem; }
    .percentage { padding-right: 3px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
    .stat { min-height: 64px; padding-block: 8px; }
    .stat strong { font-size: 1.15rem; }
    .stat-icon { width: 34px; height: 34px; }
    .panel-heading, .toolbar, .table-footer { padding-inline: 12px; }
    .panel-heading { align-items: flex-start; }
    .search-filters { width: 100%; }
    .search { flex: 1; min-width: 110px; }
    .search input { width: 100%; min-width: 0; }
    th:first-child, td:first-child { padding-left: 12px; }
    th:last-child, td:last-child { padding-right: 12px; }
    #dashboard tr > :is(:nth-child(2), :nth-child(4)) { display: none; }
    #dashboard th, #dashboard td { padding-inline: 6px; }
    #dashboard tr > :first-child { padding-left: 12px; }
    #dashboard tr > :last-child { padding-right: 8px; }
    .mobile-course { display: inline; }
    .student { min-width: 0; overflow-wrap: anywhere; }
    .student-avatar { display: none; }
    .row-note { max-width: 84px; }
    .row-actions { gap: 2px; }
    .completed-mark { display: none; }
    .row-action { padding-inline: 5px; }
    .row-action svg { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    progress::-webkit-progress-value { transition: none; }
}
