:root {
    color-scheme: light;
    --navy: #101f42;
    --blue: #16357d;
    --primary: #16357d;
    --primary-hover: #10285f;
    --gold: #f5b81e;
    --ink: #1a2238;
    --muted: #5c6b7d;
    --line: #dce4ec;
    --canvas: #f5f7fa;
    --white: #fff;
    --radius: 12px;
    --shadow: 0 1px 2px #142a4610, 0 6px 18px #142a4606;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    color: var(--ink);
    background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
input, select { min-width: 0; }
input, select, button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.026em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.8rem, 3vw, 2.35rem); font-weight: 720; }
h2 { font-size: 1.16rem; font-weight: 700; }
h3 { font-size: 1rem; }
p { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.button, .icon-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px;
    font-size: .9rem; font-weight: 650; line-height: 1.2; color: var(--ink);
    background: transparent; text-align: center; white-space: normal;
    transition: background-color 130ms, border-color 130ms, color 130ms;
}
.button:hover, .icon-button:hover { text-decoration: none; }
.button .icon { width: 17px; height: 17px; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--white); border-color: var(--line); }
.button.secondary:hover { background: #edf3fa; border-color: #bfd0e1; }
.button.small { min-height: 35px; padding: 6px 11px; font-size: .84rem; }
.button.danger { color: #fff; background: #a72d32; }
.button.danger:hover { background: #8c2026; }
.button.delete-outline { color: #9c292c; border-color: #e8cfd2; }
.button.delete-outline:hover { background: #fff2f4; }
.button:disabled { opacity: .6; cursor: wait; }
.icon-button { width: 38px; min-height: 38px; padding: 6px; color: #4c6077; }
.icon-button:hover { background: #eaf0f7; color: var(--navy); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.padded { padding: clamp(18px, 3vw, 26px); }
.padded > p { margin: 10px 0 14px; }
.padded.form-stack > p { margin: 0; }
.compact { max-width: 660px; margin-bottom: 18px; }
.muted { color: var(--muted); }
.skip { position: fixed; z-index: 12; top: 10px; left: 12px; padding: 10px 16px; background: #fff; transform: translateY(-160%); }
.skip:focus { transform: none; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: linear-gradient(135deg, #0b1b39, #16357d); }
.login-layout {
    width: min(100%, 1020px); min-height: 578px; display: grid; grid-template-columns: 1fr 1fr;
    border: 1px solid #f5b81e; border-radius: 24px; overflow: hidden; background: #fff;
    box-shadow: 0 24px 60px #12305216, 0 4px 12px #1230520d;
}
.login-identity {
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px; isolation: isolate; overflow: hidden;
    position: relative; padding: clamp(32px, 5vw, 60px); color: #fff;
    background: linear-gradient(145deg, #0b1b39 14%, #16357d 70%, #204ba0);
    border-bottom: 5px solid var(--gold);
}
.login-identity::before, .login-identity::after {
    content: ""; position: absolute; z-index: -1; width: 530px; height: 440px; left: 30%; bottom: -45%;
    border: 1px solid #f5b81e35; border-radius: 72px; transform: rotate(-27deg);
}
.login-identity::after { left: 41%; bottom: -35%; border-color: #f5b81e27; }
.login-brand, .login-mobile-brand { display: flex; align-items: center; gap: 13px; font-size: .9rem; line-height: 1.3; }
.login-brand .brand-mark { width: 58px; height: 58px; }
.login-mobile-brand .brand-mark { width: 48px; height: 48px; }
.login-brand strong { letter-spacing: .01em; }
.identity-title h1 { font-size: clamp(2.1rem, 4.3vw, 3.65rem); letter-spacing: -.057em; }
.identity-title p { margin-top: 14px; color: #fff1c7; }
.identity-foot { display: flex; align-items: center; gap: 9px; font-size: .88rem; color: #fff1c7; }
.identity-foot .icon { width: 17px; height: 17px; }
.login-form-area { display: grid; place-items: center; padding: clamp(26px, 6vw, 62px); }
.login-form-inner { width: 100%; max-width: 380px; }
.login-form-inner h2 { margin-top: 17px; font-size: clamp(1.55rem, 3vw, 2.05rem); }
.login-form-inner > p { margin: 9px 0 22px; }
.login-form-inner form .button { width: 100%; margin-top: 2px; min-height: 46px; }
.login-switch { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .9rem; font-weight: 600; margin-top: 22px; }
.login-switch .icon { width: 16px; height: 16px; }
.login-mobile-brand { display: none; }
.brand-mark, .feature-icon {
    width: 43px; height: 43px; border-radius: 10px; display: inline-grid; place-items: center; flex: none;
}
.brand-mark { color: #fff; background: #285687; }
.brand-mark.has-logo { background: #fff; border: 2px solid var(--gold); border-radius: 50%; padding: 1px; box-shadow: 0 2px 8px #07163145; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.login-brand .brand-mark:not(.has-logo) { background: #ffffff1d; border: 1px solid #ffffff30; }
.feature-icon { background: #fff4d4; color: var(--blue); }
.form-stack { display: grid; gap: 16px; }
.form-stack label { display: grid; gap: 6px; font-size: .9rem; font-weight: 640; }
.form-stack input:not([type=checkbox]), .form-stack select, .sort-form select {
    padding: 10px 11px; border: 1px solid #ccd8e4; border-radius: 8px; min-height: 44px;
    color: var(--ink); background: #fff; font-size: .92rem;
}
.form-stack select, .sort-form select {
    appearance: none; padding-right: 28px;
    background: #fff linear-gradient(45deg, transparent 50%, #536b83 50%) no-repeat calc(100% - 14px) 52% / 5px 5px;
    background-image: linear-gradient(45deg, transparent 50%, #536b83 50%), linear-gradient(135deg, #536b83 50%, transparent 50%);
    background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
}
.form-stack .check-field { display: flex; align-items: center; gap: 9px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--primary); }

.topbar {
    min-height: 74px; display: grid; grid-template-columns: minmax(270px, 1fr) minmax(240px, 520px) minmax(180px, 1fr);
    align-items: center; gap: 20px; padding: 12px 28px; background: var(--navy); color: #fff;
    position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 8px #1b31432b;
}
.topbar.teacher-topbar { grid-template-columns: minmax(0, 1fr) auto; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: #fff; }
.brand:hover { text-decoration: none; }
.brand strong, .brand small { display: block; line-height: 1.3; }
.brand strong { font-size: .98rem; }
.brand small { margin-top: 2px; color: #c2d4e9; font-size: .78rem; }
.search {
    display: flex; align-items: center; border: 1px solid #54708f; border-radius: 9px; min-height: 42px;
    background: #284664; color: #edf4ff;
}
.search button, .search input { border: 0; background: none; color: inherit; }
.search button { padding: 7px 10px 7px 12px; }
.search button .icon { width: 18px; }
.search input { width: 100%; padding: 8px 10px 8px 0; font-size: .9rem; }
.search input::placeholder { color: #d3e0f0; opacity: 1; }
.search input:focus-visible { outline-offset: -2px; }
.session-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.session-tools .icon-button, .topbar .menu-toggle { color: #e7f0fc; }
.session-tools .icon-button:hover, .topbar .menu-toggle:hover { background: #355574; }
.role-pill { display: inline-flex; align-items: center; gap: 6px; color: #e6f0ff; background: #284969; border: 1px solid #446585; border-radius: 8px; padding: 6px 9px; font-size: .79rem; white-space: nowrap; }
.role-pill .icon { width: 15px; height: 15px; }
.menu-toggle { display: none; }
.app-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.sidebar {
    display: flex; flex-direction: column; justify-content: space-between; gap: 25px; padding: 21px 14px 18px;
    background: #fff; border-right: 1px solid #dce5ed; position: sticky; top: 74px; align-self: start;
    min-height: calc(100vh - 74px); max-height: calc(100vh - 74px); overflow-y: auto;
}
.nav-caption { margin: 5px 10px 8px; font-size: .73rem; font-weight: 750; letter-spacing: .075em; color: #62758a; }
.admin-caption { margin-top: 26px; }
.nav-link { display: flex; align-items: center; min-height: 42px; gap: 10px; padding: 7px 9px; border-radius: 8px; color: #41566e; font-size: .86rem; font-weight: 590; }
.nav-link .icon { width: 18px; height: 18px; }
.nav-link.is-active { background: #edf1fc; color: var(--blue); font-weight: 700; }
.nav-link:hover { background: #eff4fa; text-decoration: none; }
.sidebar-foot { display: flex; gap: 8px; padding: 13px 8px 0; border-top: 1px solid var(--line); color: var(--muted); align-items: center; font-size: .78rem; }
.sidebar-foot .icon { width: 16px; height: 16px; }
.main { width: 100%; max-width: 1640px; margin: 0 auto; padding: clamp(19px, 3vw, 39px); }
.page-heading { margin-bottom: 25px; }
.page-heading p { margin-top: 8px; }
.explorer-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin: 0 0 22px; }
.explorer-heading .page-heading { margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.breadcrumbs .icon { width: 14px; height: 14px; }
.breadcrumbs a { color: #445d78; }
.breadcrumbs span { font-weight: 650; }
.section-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 25px 0 12px; }
.section-heading a { font-size: .88rem; font-weight: 650; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 16px; display: grid; justify-items: start; gap: 5px; align-content: start; min-height: 151px; }
.metric-icon, .item-icon, .empty-icon {
    width: 43px; height: 43px; display: grid; place-items: center; border-radius: 10px; flex: none;
}
.gold { background: #fff3d7; color: #975b08; }
.gold .icon { fill: #fbd571; }
.green { background: #e2f4ed; color: #167054; }
.blue { background: #e6f0fc; color: #2863a5; }
.purple { background: #f0eafd; color: #6243a0; }
.metric > strong { display: block; font-size: 1.82rem; line-height: 1.18; margin-top: 3px; }
.metric > span, .metric > a { font-size: .86rem; font-weight: 650; color: #2c455f; }
.metric small { color: var(--muted); font-size: .8rem; }
.storage-panel, .shortcut { display: flex; align-items: center; gap: 12px; padding: 15px 17px; margin-top: 13px; }
.storage-panel > div:nth-child(2), .shortcut > div:nth-child(2) { flex: 1; }
.storage-panel p, .shortcut p { margin-top: 4px; font-size: .88rem; }
.storage-panel progress { width: min(24%, 200px); accent-color: var(--primary); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 14px 0 18px; }
.sort-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .87rem; color: var(--muted); }
.sort-form label { font-weight: 640; margin-right: 5px; }
.sort-form select { min-height: 36px; padding-top: 5px; padding-bottom: 5px; font-size: .84rem; }
.view-switch { display: flex; align-items: center; padding: 2px; gap: 2px; border: 1px solid var(--line); background: #fff; border-radius: 9px; flex: none; }
.view-switch .icon-button { width: 34px; min-height: 32px; }
.view-switch .icon-button.selected { color: var(--blue); background: #edf1fc; }
.items-section { margin-bottom: 22px; }
.items-section h2 { margin-bottom: 10px; font-size: 1rem; }
.items-section h2 span { font-size: .8rem; margin-left: 5px; color: var(--muted); font-weight: 550; }
.section-heading + .items-section h2 { display: none; }
.items.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.items.list { display: grid; gap: 6px; }
.item { display: flex; justify-content: space-between; align-items: center; min-width: 0; gap: 2px; padding: 6px 8px; }
.item:hover { border-color: #afc6e0; }
.item.is-selected { border-color: var(--blue); box-shadow: 0 0 0 2px #16357d22; }
.folder-open-hint { color: var(--blue) !important; font-weight: 650; }
.item-main { display: flex; align-items: center; gap: 10px; padding: 5px; border-radius: 7px; color: var(--ink); flex: 1; min-width: 0; }
.item-main:hover { text-decoration: none; }
.item-main:hover strong { color: var(--blue); text-decoration: underline; }
.item-text { min-width: 0; }
.item-text strong, .item-text small { display: block; overflow-wrap: anywhere; }
.item-text strong { font-size: .91rem; line-height: 1.3; }
.item-text small { margin-top: 3px; color: var(--muted); font-size: .77rem; }
.item-actions { display: flex; align-items: center; align-self: center; }
.file-select { display: grid; place-items: center; width: 34px; height: 38px; flex: none; cursor: pointer; }
.file-select input, .bulk-select-all input, .bulk-actions input { width: 17px; height: 17px; accent-color: var(--blue); }
.bulk-delete { margin-top: 14px; }
.bulk-toolbar, .bulk-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bulk-toolbar { margin: 0 0 12px; color: var(--muted); font-size: .86rem; }
.bulk-select-all { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 650; cursor: pointer; }
.bulk-actions { border: 1px solid #ebc7cb; background: #fffafa; border-radius: 10px; padding: 11px 13px; margin-top: 4px; }
.bulk-actions .check-field { margin: 0; }
.button:disabled { opacity: .52; cursor: not-allowed; }
.item-menu { position: relative; }
.item-menu summary { list-style: none; }
.item-menu summary::-webkit-details-marker { display: none; }
.menu-popover { position: absolute; z-index: 3; top: 35px; right: 0; width: 210px; padding: 4px; border: 1px solid var(--line); background: #fff; border-radius: 9px; box-shadow: 0 7px 22px #18334d23; }
.menu-popover a { display: block; padding: 8px; border-radius: 6px; color: var(--ink); font-size: .85rem; }
.menu-popover a:hover { background: #edf3fa; text-decoration: none; }
.empty { text-align: center; padding: 39px 15px; }
.empty-icon { margin: 0 auto 11px; width: 54px; height: 54px; background: #edf3fa; color: #38618d; }
.empty-icon .icon { width: 25px; height: 25px; }
.empty p { margin-top: 7px; }
.empty .button { margin-top: 15px; }
.upload-panel { margin: 0 0 15px; padding: 14px; scroll-margin-top: 115px; }
.upload-panel .section-heading { margin: 1px 0 11px; }
.drop-zone { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px dashed #a8bfda; border-radius: 9px; background: #f8fbff; }
.drop-zone.is-over { background: #e8f3ff; border-color: #266bbb; }
.drop-zone > div:nth-child(2) { flex: 1; }
.drop-zone strong, .drop-zone span { display: block; }
.drop-zone strong { font-size: .9rem; }
.drop-zone div > span { font-size: .8rem; color: var(--muted); }
.file-picker { display: inline-grid; position: relative; flex: none; }
.file-picker input { opacity: 0; position: absolute; inset: 0; width: 100%; cursor: pointer; }
.file-picker:focus-within .button { outline: 3px solid #2879d9; outline-offset: 3px; }
.upload-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }
.upload-actions span { font-size: .86rem; color: var(--muted); }
.upload-progress { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: .83rem; }
.upload-progress progress { flex: 1; min-width: 0; height: 16px; accent-color: var(--primary); }
.upload-results .notice { margin: 6px 0; }
.refresh { margin-top: 8px; }
.notice { display: flex; gap: 8px; align-items: start; border: 1px solid #cbdbed; background: #edf5ff; color: #254f7a; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; overflow-wrap: anywhere; }
.notice .icon { width: 17px; height: 17px; margin-top: 3px; }
.notice.error { border-color: #f1c9cd; background: #fff2f3; color: #8c2831; }
.notice.success { border-color: #b8ddce; background: #eaf8f1; color: #216346; }
.danger-panel { border-color: #ebc7cb; }
.danger-panel h2 { color: #922b33; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 14px; margin-bottom: 18px; }
.review { display: grid; gap: 15px; margin: 0 0 12px; }
.review-title { display: flex; align-items: center; gap: 10px; }
.review p, .version-row p { font-size: .88rem; margin: 4px 0; }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.comparison section { border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; padding: 13px; }
.comparison .actions { margin-top: 8px; }
.version-list { display: grid; gap: 8px; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.version-row .version-description { min-width: 0; overflow-wrap: anywhere; }
.state { display: inline-block; border-radius: 999px; background: #edf1f6; color: #405772; margin-bottom: 6px; padding: 2px 8px; font-size: .77rem; font-weight: 650; }
.state.current { background: #e6f6ed; color: #245f43; }
.state.pending { background: #fff2da; color: #80510c; }
.state.rejected { background: #fbe8e9; color: #86272c; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .87rem; }
.data-table th, .data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { color: #48617c; background: #f6f8fb; font-weight: 690; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.date-cell { white-space: nowrap; }
.pagination { margin-top: 13px; }
.sheet-tabs { display: flex; overflow-x: auto; gap: 6px; padding: 4px; }
.sheet-tabs a { display: inline-flex; align-items: center; color: #365774; border: 1px solid var(--line); padding: 6px 11px; background: #fff; border-radius: 8px; white-space: nowrap; font-size: .9rem; }
.sheet-tabs a[aria-current] { background: #edf1fc; border-color: #b9c7e9; color: var(--blue); font-weight: 680; }
.sheet-panel { margin-top: 7px; overflow: hidden; }
.sheet-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px; padding: 8px 10px; font-size: .85rem; color: #435e78; }
.sheet-scroll { max-height: 64vh; overflow: auto; }
.sheet-table { border-collapse: separate; border-spacing: 0; min-width: 100%; color: #1e2f42; font-size: .86rem; }
.sheet-table th, .sheet-table td { padding: 5px 8px; border-top: 1px solid #dae2eb; border-right: 1px solid #dae2eb; }
.sheet-table th { background: #eef3f8; color: #415975; white-space: nowrap; }
.sheet-table thead th { position: sticky; top: 0; z-index: 2; }
.sheet-table tbody th, .sheet-table thead th:first-child { position: sticky; left: 0; }
.sheet-table tbody th { z-index: 1; }
.sheet-table thead th:first-child { z-index: 3; }
.sheet-table td { min-width: 92px; max-width: 340px; white-space: pre-wrap; overflow-wrap: anywhere; }
.standalone { padding: 24px; margin: 8vh auto; max-width: 620px; }
.error-panel { max-width: 650px; padding: 25px; }
.error-panel h1 { margin: 10px 0; }
.error-panel p { margin-bottom: 13px; }

@media (max-width: 1040px) {
    .app-shell { grid-template-columns: 211px minmax(0, 1fr); }
    .topbar { padding-inline: 16px; gap: 12px; }
}
@media (max-width: 835px) {
    .topbar { grid-template-columns: minmax(230px, 1fr) minmax(180px, 1fr) auto; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric { min-height: 126px; }
    .explorer-heading { flex-wrap: wrap; }
}
@media (max-width: 690px) {
    .login-page { padding: 16px; }
    .login-layout { min-height: 0; grid-template-columns: 1fr; border-radius: 16px; }
    .login-identity { display: none; }
    .login-mobile-brand { display: flex; margin-bottom: 22px; }
    .login-form-area { padding: 27px 21px; }
    .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; padding: 8px 10px; }
    .topbar.teacher-topbar { grid-template-columns: minmax(0, 1fr) auto; }
    .topbar .menu-toggle { display: inline-grid; }
    .topbar .search { grid-row: 2; grid-column: 1 / -1; min-height: 37px; }
    .brand .brand-mark { width: 36px; height: 36px; border-radius: 50%; }
    .brand strong { font-size: .86rem; }
    .brand small { font-size: .69rem; }
    .role-pill { padding: 5px; }
    .role-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .app-shell { display: block; }
    .sidebar { position: static; min-height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
    .sidebar-foot { display: none; }
    .js .sidebar:not(.is-open) { display: none; }
    .nav-caption { margin-top: 8px; }
    .main { padding: 16px 12px; }
    .section-heading { margin-top: 20px; }
    .comparison { grid-template-columns: 1fr; }
    .version-row, .shortcut { align-items: flex-start; flex-wrap: wrap; }
    .bulk-toolbar, .bulk-actions { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 435px) {
    .drop-zone { flex-wrap: wrap; }
    .drop-zone strong { font-size: .85rem; }
    .file-picker { margin-left: 54px; }
    .sort-form label { width: 100%; }
    .storage-panel { flex-wrap: wrap; }
    .storage-panel progress { width: 100%; }
    .role-pill { padding: 5px; }
    .role-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .metric { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; }
}
