:root {
  --paper: #fff;
  --page: #edf3fa;
  --ink: #203246;
  --blue: #315de5;
  --yellow: #ffd769;
  --error: #b83b47;
  --muted: #5c6c80;
  --line: #dce5f1;
  --soft-blue: #eef2ff;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.5; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button:disabled, select:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 20px; top: -80px; z-index: 10; padding: 12px 20px; background: var(--yellow); border-radius: 6px; }
.skip-link:focus { top: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 25px; font-weight: 700; letter-spacing: -.7px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px 12px 12px 2px; background: var(--blue); color: white; font-size: 28px; line-height: 1; padding-bottom: 4px; letter-spacing: -2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border-radius: 7px; padding: 10px 17px; font-weight: 700; font-size: 14px; border: 1px solid transparent; white-space: nowrap; transition: background .15s, border-color .15s; }
.button-primary { background: var(--blue); color: white; }
.button-primary:hover:not(:disabled) { background: #2249c6; }
.button-secondary { background: var(--paper); border-color: #ced9e8; }
.button-secondary:hover:not(:disabled) { border-color: var(--blue); }
.workspace { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar { padding: 32px 22px 22px; background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; margin: 36px 0 14px; }
.sidebar-heading h2 { font-size: 14px; font-weight: 700; }
.sidebar-heading > span { color: var(--muted); font-size: 13px; }
.student-list { display: flex; flex-direction: column; gap: 8px; }
.student-button { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid transparent; border-radius: 9px; padding: 12px 10px; text-align: left; background: transparent; }
.student-button:hover { background: #f4f7fc; }
.student-button.selected { background: var(--soft-blue); border-color: #ccd8ff; }
.avatar { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; }
.avatar-0 { background: #e1e8ff; color: #2e4fa9; }
.avatar-1 { background: #ffe9ae; color: #775513; }
.avatar-2 { background: #e0ede9; color: #366356; }
.student-description { display: flex; flex-direction: column; min-width: 0; }
.student-button-name { font-size: 13px; font-weight: 700; }
.student-meta { margin-top: 3px; font-size: 11px; color: var(--muted); }
.main-content { width: 100%; max-width: 1440px; padding: 34px 40px 22px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-header h1 { font-size: clamp(25px, 2.4vw, 36px); line-height: 1.2; font-weight: 700; letter-spacing: -1.1px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.swagger-link { color: var(--blue); font-size: 14px; font-weight: 700; text-underline-offset: 3px; }
.header-actions .button-secondary span { font-size: 19px; }
.diary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.sheet { min-width: 0; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 4px 4px 12px 4px; padding: 24px; box-shadow: 0 2px 0 #dfe7f2; }
.grade-sheet, .schedule-sheet { grid-column: 1 / -1; }
.grade-sheet { border-top: 4px solid var(--blue); padding-top: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.section-heading h2 { font-size: 19px; line-height: 1.3; letter-spacing: -.4px; }
.grades-table { border-top: 1px solid var(--line); }
.subject-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr; align-items: center; gap: 20px; min-height: 48px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.subject-name { font-size: 13px; }
.marks { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 7px; font-size: 16px; font-weight: 700; }
.mark-5 { background: #e1e8ff; color: #2e4fa9; }
.mark-4 { background: #e0ede9; color: #366356; }
.mark-3 { background: #fff1bd; color: #775513; }
.mark-2 { background: #ffe7e8; color: var(--error); }
.no-mark { color: var(--muted); font-size: 11px; }
.grade-form { display: flex; gap: 12px; align-items: flex-end; margin-top: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, #login-form label { font-size: 12px; font-weight: 700; }
.subject-field { flex: 1; }
.mark-field { width: 80px; }
select, input { min-height: 44px; width: 100%; border: 1px solid #c9d6e6; border-radius: 7px; background: #fff; color: var(--ink); padding: 9px 12px; }
select { padding-right: 25px; }
.form-message { color: #366356; font-size: 12px; margin-top: 12px; }
.metric-content { min-height: 145px; }
.metric-value { display: flex; align-items: baseline; gap: 8px; }
.metric-number { font-size: 49px; line-height: 1.15; font-weight: 700; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.average-sheet .metric-number { color: var(--blue); }
.metric-unit { color: var(--muted); font-size: 15px; }
.metric-description { margin-top: 10px; color: var(--muted); font-size: 12px; }
.grade-scale { display: flex; gap: 6px; margin-top: 22px; }
.scale-item { display: grid; place-items: center; flex: 1; background: #f2f5fa; border-radius: 4px; font-size: 11px; color: var(--muted); padding: 4px; }
.scale-item.active { background: var(--blue); color: white; }
.attendance-track { height: 7px; background: #e8edf5; border-radius: 4px; margin-top: 29px; overflow: hidden; }
.attendance-fill { height: 100%; background: var(--blue); border-radius: inherit; }
.ranking-list, .homework-list, .schedule-list { list-style: none; margin: 0; padding: 0; }
.ranking-row { display: flex; align-items: center; gap: 11px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ranking-row:first-child { padding-top: 4px; }
.ranking-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.rank-position { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: #f0f4f9; color: var(--muted); font-size: 12px; }
.rank-0 { background: var(--yellow); color: #725211; }
.rank-name { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.rank-current { color: var(--blue); font-size: 10px; margin-top: 3px; }
.rank-count { display: flex; flex-direction: column; align-items: flex-end; }
.rank-count strong { font-size: 22px; font-weight: 700; line-height: 1.1; }
.rank-count > span { color: var(--muted); font-size: 10px; }
.homework-row { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.homework-row:first-child { padding-top: 4px; }
.homework-row:last-child { border-bottom: 0; }
.homework-check { display: grid; place-items: center; width: 18px; height: 18px; flex-shrink: 0; border: 1px solid #a6b6cd; border-radius: 4px; margin-top: 2px; font-size: 12px; }
.homework-check.done { color: #366356; border-color: #9abdb0; background: #e0ede9; }
.homework-description { display: flex; flex-direction: column; align-items: flex-start; }
.homework-subject { color: var(--blue); font-size: 11px; margin-bottom: 3px; }
.homework-description h3 { font-size: 14px; font-weight: 400; line-height: 1.5; }
.homework-due { color: var(--muted); font-size: 11px; margin-top: 6px; }
.done-label { color: #366356; background: #e0ede9; font-size: 10px; padding: 2px 6px; border-radius: 3px; margin-top: 7px; }
.schedule-sheet .section-heading { align-items: center; }
.day-picker { width: 175px; }
.day-picker select { font-size: 12px; min-height: 38px; background: #f6f8fd; }
.lesson-row { display: grid; grid-template-columns: 24px 80px 1fr 90px; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.lesson-row:first-child { border-top: 1px solid var(--line); }
.lesson-number { font-size: 11px; color: var(--muted); }
.lesson-time { font-size: 13px; color: var(--blue); font-weight: 700; font-variant-numeric: tabular-nums; }
.lesson-subject { font-size: 14px; }
.lesson-room { text-align: right; color: var(--muted); font-size: 11px; }
.empty-symbol { color: var(--blue); font-size: 27px; padding: 6px 0; }
.empty-title { font-size: 15px; margin-bottom: 4px; }
.empty-state, .loading-text { color: var(--muted); font-size: 12px; padding: 8px 0; }
.backend-error { background: #fff1f2; border-left: 3px solid var(--error); padding: 14px 15px; border-radius: 0 6px 6px 0; margin-top: 8px; overflow-wrap: anywhere; }
.backend-error .backend-error { margin: 0; border: 0; padding: 0; }
.error-title { color: #922d37; font-size: 13px; font-weight: 700; }
.error-message { margin-top: 7px; font-size: 12px; color: #713940; }
.error-technical { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.error-technical code { font-size: 11px; color: #713940; white-space: normal; }
.global-error { margin-bottom: 20px; }
.login-page { min-height: 100vh; background-color: var(--page); background-image: linear-gradient(#dfe7f2 1px, transparent 1px), linear-gradient(90deg, #dfe7f2 1px, transparent 1px); background-size: 32px 32px; }
.login-layout { min-height: 100vh; width: min(420px, calc(100% - 40px)); margin: 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 40px 0; }
.login-sheet { background: var(--paper); border: 1px solid #d0dced; border-radius: 4px 4px 24px 4px; box-shadow: 8px 8px 0 #d8e2f1; padding: 36px; }
.login-sheet h1 { font-size: 27px; letter-spacing: -.8px; }
#login-form { margin-top: 28px; }
#login-form label { display: block; margin-bottom: 8px; }
#login-form input { height: 48px; }
#login-form .button { width: 100%; margin-top: 18px; height: 47px; }
.form-error { font-size: 12px; color: var(--error); margin-top: 9px; }
@media (min-width: 1500px) {
  .workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .main-content { padding-top: 42px; }
  .sheet { padding: 28px; }
}
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 225px minmax(0, 1fr); }
  .sidebar { padding-left: 15px; padding-right: 15px; }
  .main-content { padding: 27px 24px 22px; }
  .sheet { padding: 20px; }
  .section-heading h2 { font-size: 17px; }
  .header-actions .button { padding: 9px 12px; }
}
@media (max-width: 820px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { padding: 18px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .brand { font-size: 22px; }
  .sidebar .brand-mark { width: 35px; height: 35px; font-size: 24px; }
  .sidebar-heading { display: none; }
  .student-list { flex-direction: row; margin-top: 18px; }
  .student-button { flex: 1; padding: 10px; min-width: 0; }
  .student-button-name { font-size: 12px; }
  .student-meta { font-size: 10px; }
  .avatar { width: 30px; height: 30px; font-size: 10px; }
}
@media (max-width: 580px) {
  .sidebar { padding: 16px; }
  .student-list { gap: 6px; }
  .student-button { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 8px; }
  .student-button-name { font-size: 11px; }
  .student-meta { font-size: 9px; }
  .main-content { padding: 23px 16px 20px; }
  .page-header { align-items: flex-start; gap: 10px; }
  .page-header h1 { font-size: 25px; max-width: 13ch; }
  .header-actions { flex-direction: column; align-items: flex-end; gap: 8px; }
  .header-actions .button { min-height: 35px; padding: 6px 10px; font-size: 11px; }
  .diary-grid { gap: 15px; }
  .sheet { padding: 18px; grid-column: 1 / -1; }
  .section-heading { margin-bottom: 17px; }
  .grade-form { flex-wrap: wrap; gap: 10px; }
  .subject-field { min-width: 140px; }
  .mark-field { width: 65px; }
  .grade-form .button { width: 100%; }
  .subject-row { grid-template-columns: 115px 1fr; gap: 10px; }
  .marks { gap: 6px; }
  .metric-content { min-height: 140px; }
  .metric-number { font-size: 45px; }
  .schedule-sheet .section-heading { flex-wrap: wrap; }
  .day-picker { width: 160px; }
  .lesson-row { grid-template-columns: 16px 52px 1fr 54px; gap: 8px; }
  .lesson-subject { font-size: 12px; }
  .lesson-room { font-size: 10px; }
  .login-sheet { padding: 28px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
