:root {
  color-scheme: light; --ink: #202038; --muted: #625f78; --brand: #543bc6;
  --brand-dark: #412aa9; --line: #e7e4ef; --canvas: #f8f8fc; --paper: #fff;
  --nav: #18182c; --radius: 16px;
  font-family: "Inter", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #826aff; outline-offset: 3px;
}
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
a { color: inherit; }
[hidden] { display: none !important; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.brand { display: flex; gap: 11px; align-items: center; color: white; text-align: left; border: 0; padding: 0; background: transparent; font-size: 19px; font-weight: 750; letter-spacing: -.025em; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: #7359f0; display: grid; place-items: center; }
.logo .icon { width: 22px; height: 22px; }
.layout { min-height: 100dvh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { background: var(--nav); position: sticky; top: 0; height: 100dvh; padding: 30px 18px 17px; color: #ccc9e1; display: flex; flex-direction: column; }
.sidebar .brand { margin: 0 9px 40px; }
.nav { overflow: auto; }
.nav-label { color: #a7a3c4; font-size: .75rem; font-weight: 700; margin: 28px 12px 10px; letter-spacing: .08em; }
.nav-button { border: 0; display: flex; align-items: center; text-align: left; width: 100%; color: inherit; gap: 11px; border-radius: 9px; padding: 11px 12px; background: transparent; font-size: .875rem; margin-bottom: 3px; min-height: 42px; }
.nav-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-button:hover { background: #252441; color: #fff; }
.nav-button[aria-current="page"] { background: #343052; color: #fff; font-weight: 700; }
.nav-button[aria-current="page"] .icon { color: #b5a4ff; }
.sidebar-footer { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #33314a; display: flex; align-items: center; gap: 9px; }
.sidebar-footer span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 auto; border-radius: 50%; background: #ded5ff; color: #4933a0; font-weight: bold; }
.main { min-width: 0; }
.top { height: 66px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(19px, 3.5vw, 52px); }
.top > span { color: var(--muted); font-size: .88rem; }
.mobile-actions, .mobile-courses { display: none; }
.workspace { max-width: 1440px; margin: auto; padding: 32px clamp(20px, 3.5vw, 52px) 42px; }
.hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 39px 34px; min-height: 183px; border: 1px solid #e6dfff; border-radius: 20px; background: linear-gradient(104deg,#efeaff 3%,#f8f4ff 65%,#e9e3ff); }
.hero::after { content: ""; position: absolute; width: 330px; height: 330px; right: 12%; top: -110px; pointer-events: none; border: 1px solid #bda9fa55; border-radius: 38%; transform: rotate(-25deg); box-shadow: 0 0 0 21px #c5b4ff22, 0 0 0 42px #c5b4ff1a, 0 0 0 63px #c5b4ff17, 0 0 0 84px #c5b4ff12; }
.hero > * { position: relative; z-index: 1; }
.hero p, .course-head p { color: var(--muted); margin: 10px 0 0; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.9rem, 3.8vw, 2.65rem); line-height: 1.2; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.3rem; margin: 0; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
.section { margin-top: 32px; }
.section-head, .course-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; justify-content: space-between; margin-bottom: 15px; }
.course-head { margin: 10px 0 27px; align-items: end; }
.course-head > div:first-child { min-width: min(100%, 220px); flex: 1; }
.course-head > div:last-child { flex-shrink: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 14px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); font-weight: 650; text-decoration: none; font-size: .88rem; line-height: 1.35; }
.btn:hover { background: #f3f0ff; border-color: #cfc4f4; }
.btn.primary { background: var(--brand); color: white; border-color: var(--brand); box-shadow: 0 3px 7px #543bc62c; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: #a92040; border-color: #a92040; color: white; }
.btn.danger:hover { background: #931831; }
.btn.small { min-height: 35px; padding: 5px 9px; font-size: .82rem; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 9px; border: 0; background: transparent; color: inherit; }
.icon-button:hover { background: #9189b328; }
.cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.card { display: flex; flex-direction: column; gap: 17px; align-items: start; text-align: left; min-height: 143px; background: white; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card:hover { border-color: #bcadf4; box-shadow: 0 4px 17px #4f36850c; }
.course-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 12px; color: #6540c9; background: #eee8ff; }
.theme-1 { color: #2253b1; background: #eaf0ff; }
.theme-2 { color: #067461; background: #e1f5ef; }
.theme-3 { color: #a44d19; background: #fff0df; }
.card strong { display: block; margin-bottom: 6px; line-height: 1.4; overflow-wrap: anywhere; }
.card small { color: var(--muted); font-size: .82rem; }
.file-panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; padding: 15px; border-bottom: 1px solid var(--line); }
.filters .search { flex: 1 1 220px; position: relative; }
.search .icon { position: absolute; top: 12px; left: 12px; color: var(--muted); }
.search input { padding-left: 39px; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #dcd8e8; border-radius: 8px; padding: 8px 10px; color: var(--ink); background: #fff; }
.filters select { width: auto; max-width: 100%; font-size: .875rem; }
input::placeholder, textarea::placeholder { color: #726e87; }
textarea { resize: vertical; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 14px; vertical-align: middle; }
th { background: #fbfaff; color: var(--muted); font-weight: 650; font-size: .78rem; white-space: nowrap; }
td { border-bottom: 1px solid #f0edf6; font-size: .85rem; }
tbody tr:last-child td { border-bottom: 0; }
.file-name { display: flex; gap: 9px; align-items: center; min-width: 0; max-width: 440px; }
.file-name > div { min-width: 0; }
.file-link { background: transparent; border: 0; padding: 0; text-align: left; color: var(--ink); font-size: .92rem; font-weight: 680; overflow-wrap: anywhere; }
.file-link:hover { color: var(--brand); text-decoration: underline; }
.file-badge { display: grid; min-width: 44px; min-height: 36px; place-items: center; border-radius: 8px; background: #f1edff; color: #4f369e; font-size: .64rem; font-weight: 800; flex: 0 0 auto; }
.sub { color: var(--muted); font-size: .76rem; margin-top: 4px; }
.status { white-space: nowrap; border-radius: 99px; padding: 5px 8px; font-size: .75rem; font-weight: 700; background: #f0edfa; color: #504475; }
.status.complete { color: #096551; background: #e1f5eb; }
.status.partial { color: #825209; background: #fff1cf; }
.status.failed { color: #9c1e3c; background: #fce8ee; }
.empty { text-align: center; padding: 38px 16px; }
.empty .course-icon { margin: 0 auto 13px; }
.empty h3 { margin-bottom: 5px; }
.empty p, .muted { color: var(--muted); }
.empty p { margin: 0; font-size: .875rem; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 22px; background: radial-gradient(ellipse at 75% 12%,#e5dcff,#f8f8fc 61%); }
.login-card { width: min(100%, 410px); border-radius: 22px; background: white; border: 1px solid var(--line); padding: 35px; box-shadow: 0 16px 65px #28194113; }
.login-card .brand { color: var(--ink); margin-bottom: 29px; }
.login-card h1 { font-size: 1.7rem; margin-bottom: 23px; }
.loading { padding: 3rem 1.5rem; color: var(--muted); }
label { display: block; font-size: .865rem; font-weight: 650; }
label > input, label > select, label > textarea { margin-top: 6px; }
.form-stack { display: grid; gap: 14px; }
.login-card .btn { margin-top: 6px; }
dialog { border: 1px solid var(--line); border-radius: 18px; color: var(--ink); max-width: min(620px, calc(100vw - 26px)); width: 100%; max-height: calc(100dvh - 28px); padding: 0; box-shadow: 0 16px 75px #130e3759; }
dialog::backdrop { background: #18182c69; }
.modal-head { position: sticky; z-index: 2; top: 0; background: white; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 13px 18px; }
.modal-head h2 { overflow-wrap: anywhere; }
.modal-body { padding: 17px 18px 20px; }
.modal-footer { display: flex; justify-content: end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.error { color: #9c1e3c; background: #fff0f3; padding: 8px 10px; border-radius: 8px; font-size: .86rem; margin: 0; overflow-wrap: anywhere; }
.drop { border: 1px dashed #9d89e0; background: #f8f5ff; border-radius: 12px; text-align: center; padding: 15px; }
.drop.active { border-color: var(--brand); background: #e9e0ff; }
.drop p { color: var(--muted); font-size: .82rem; margin: 8px 0; }
.drop .actions { justify-content: center; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.upload-list { display: grid; gap: 6px; }
.upload-item { border: 1px solid var(--line); border-radius: 9px; padding: 8px; }
.upload-item .actions { justify-content: space-between; flex-wrap: nowrap; }
.upload-item strong { font-size: .86rem; overflow-wrap: anywhere; }
.upload-item p { margin: 4px 0; }
progress { width: 100%; height: 9px; accent-color: var(--brand); display: block; margin-top: 6px; }
.preview-image { width: 100%; max-height: 490px; object-fit: contain; background: #f5f3fa; border-radius: 10px; }
.preview-unit { border-bottom: 1px solid var(--line); padding: 12px 0; overflow-wrap: anywhere; }
.preview-unit > h3 { margin-bottom: 8px; }
.preview-unit p { margin: 5px 0 9px; white-space: pre-wrap; line-height: 1.55; }
.preview-unit td { border: 1px solid var(--line); white-space: pre-wrap; }
.warnings { color: #754909; border-radius: 8px; background: #fff5dc; padding: 9px 15px 9px 29px; }
#toast { position: fixed; z-index: 4; bottom: 18px; right: 18px; max-width: calc(100% - 36px); }
#toast:not(:empty) { padding: 12px 15px; border-radius: 9px; background: var(--nav); color: white; box-shadow: 0 7px 18px #0003; }
@media (max-width: 1150px) { .cards { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .top { height: 60px; background: var(--nav); color: white; padding: 0 14px; }
  .top > span { display: none; }
  .mobile-actions { display: flex; align-items: center; gap: 6px; }
  .mobile-actions .brand { font-size: 17px; }
  .mobile-actions .logo { width: 33px; height: 33px; }
  .mobile-courses { display: block; margin-bottom: 15px; }
  .workspace { padding: 17px 13px 30px; }
  .hero { padding: 23px 18px; min-height: auto; flex-wrap: wrap; align-items: start; }
  .hero::after { right: -115px; }
  .section { margin-top: 23px; }
  .card { padding: 13px; min-height: 118px; gap: 12px; }
  .course-head { margin: 10px 0 18px; }
  .filters { padding: 9px; gap: 6px; }
  .filters .search { flex-basis: 100%; }
  .filters select { flex: 1 1 26%; min-width: 0; }
  .files th:nth-child(2), .files td:nth-child(2), .files th:nth-child(4), .files td:nth-child(4) { display: none; }
  .files td,.files th { padding: 10px 7px; }
  .file-badge { min-width: 35px; }
  .files .action-label { display: none; }
  .files .btn.small { min-height: 40px; min-width: 38px; }
}
@media (max-width: 345px) {
  .files .file-badge { display: none; }
  .status { font-size: .68rem; }
  .row { grid-template-columns: 1fr; }
}
