:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #071a42;
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }

.page { width: min(1480px, calc(100% - 7%)); margin: 0 auto; padding: 62px 0 48px; }
.topbar { display: flex; justify-content: space-between; align-items: start; gap: 48px; }
h1 { margin: 0; font-size: clamp(2.25rem, 4.1vw, 4rem); letter-spacing: -0.045em; line-height: 1.08; }
.intro { margin: 14px 0 0; color: #697b98; font-size: 1rem; }
.school-field { flex: 0 0 31%; }
label { display: block; font-weight: 700; }
.school-field label { margin-bottom: 10px; font-size: 1.1rem; }
input[type="text"], input[type="file"] { width: 100%; min-height: 58px; border: 1px solid #c7d4e6; border-radius: 9px; background: #fff; color: #071a42; }
input[type="text"] { padding: 13px 18px; }
input::placeholder { color: #91a0b7; }
input:focus-visible, button:focus-visible { outline: 3px solid #83b4ff; outline-offset: 2px; }

.subjects { display: flex; gap: 16px; margin-top: 36px; border-bottom: 1px solid #cbd8ea; }
.subject { min-width: 158px; padding: 18px 28px; border: 0; border-radius: 10px 10px 0 0; background: transparent; color: #071a42; font-size: 1.12rem; font-weight: 700; }
.subject:hover { background: #edf4fd; }
.subject.active { background: #3d75c3; color: #fff; }

.columns { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; margin-top: 34px; }
.panel { min-height: 560px; padding: 30px; border: 1px solid #cbd8ea; border-radius: 10px; }
.panel h2 { margin: 0; font-size: clamp(1.65rem, 2.2vw, 2.25rem); line-height: 1.18; letter-spacing: -0.03em; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.count { color: #687b99; font-size: .9rem; white-space: nowrap; }
.course-list { padding-top: 24px; }
.empty { display: grid; place-content: center; min-height: 425px; text-align: center; }
.empty svg { display: block; margin: 0 auto 22px; color: #b4c4d8; }
.empty strong { font-size: 1.25rem; font-weight: 500; }
.empty p { max-width: 280px; margin: 12px auto 0; color: #7588a4; line-height: 1.45; }
.course-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 0; border-bottom: 1px solid #e1e8f2; }
.course-item:first-child { border-top: 1px solid #e1e8f2; }
.course-title { margin: 0 0 6px; font-size: 1.06rem; font-weight: 700; overflow-wrap: anywhere; }
.course-meta { margin: 0; color: #7386a1; font-size: .88rem; }
.course-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.course-actions button { padding: 9px 12px; border: 1px solid #cbd8ea; border-radius: 7px; background: #fff; color: #245da8; font-weight: 700; }
.course-actions button:hover { background: #edf4fd; }
.course-actions .delete-button { color: #9a3140; }

.upload-panel h2 { padding-bottom: 14px; border-bottom: 1px solid #d9e3ef; }
form { padding-top: 30px; }
form label { margin: 0 0 11px; font-size: 1.08rem; }
form input[type="text"] { margin-bottom: 29px; }
input[type="file"] { padding: 10px; color: #5e708d; }
input[type="file"]::file-selector-button { margin-right: 13px; padding: 8px 13px; border: 1px solid #cbd8ea; border-radius: 6px; background: #f7faff; color: #526782; }
.hint { margin: 8px 0 28px; color: #7183a0; font-size: .88rem; }
.primary-button { width: 100%; min-height: 56px; border: 0; border-radius: 9px; background: #3d75c3; color: #fff; font-weight: 700; font-size: 1.06rem; }
.primary-button:hover { background: #2c62ae; }
.primary-button:disabled { opacity: .65; cursor: wait; }
.form-message { min-height: 1.2em; margin: 10px 0 0; font-size: .9rem; }
.form-message.error { color: #a12d3d; }
.form-message.success { color: #1d7252; }
.notice { margin: 18px 0 0; padding: 17px 20px; border-radius: 9px; background: #eaf3fc; line-height: 1.45; font-size: .92rem; }

#preview-dialog { width: min(940px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 20px; border: 1px solid #cbd8ea; border-radius: 10px; color: #071a42; }
#preview-dialog::backdrop { background: rgba(7, 26, 66, .65); }
.preview-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.preview-header h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.preview-header button { padding: 9px 14px; border: 1px solid #cbd8ea; border-radius: 7px; background: #fff; color: #245da8; font-weight: 700; }
#preview-content { height: min(70vh, 700px); display: grid; place-items: center; background: #f2f6fb; }
#preview-content img, #preview-content iframe { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; }
#preview-download { display: inline-block; margin-top: 14px; color: #245da8; font-weight: 700; }

@media (max-width: 800px) {
  .page { width: min(100% - 32px, 600px); padding: 30px 0; }
  .topbar { display: block; }
  .school-field { margin-top: 26px; }
  .subjects { gap: 0; margin-top: 26px; }
  .subject { flex: 1; min-width: 0; padding: 15px 8px; font-size: 1rem; }
  .columns { grid-template-columns: 1fr; gap: 18px; margin-top: 22px; }
  .panel { min-height: 0; padding: 22px; }
  .empty { min-height: 260px; }
  .course-item { align-items: start; flex-direction: column; }
  .course-actions { justify-content: start; }
}
