:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e3e6ec;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; }
.auth { width: 100%; max-width: 380px; }
.auth .sub { color: var(--muted); margin: 0 0 18px; }
.logo { width: 48px; height: 48px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.logo svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input:not([type]) {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; color: var(--text); background: #fff; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f1f3f7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fdecec; }
.btn.small { height: 34px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; margin-top: 18px; }
.error { color: var(--danger); min-height: 1.5em; margin: 10px 0 0; font-size: 14px; }
.ok-msg { background: #ecfdf3; border: 1px solid #b7ebc9; color: #14532d; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }

/* Кабинет */
.top { background: #fff; border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; margin: 0; }
.brand .logo svg { width: 19px; height: 19px; }
.who { margin-left: auto; color: var(--muted); font-size: 14px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head .btn { margin-left: auto; }

.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.board-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.board-card .name { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; word-break: break-word; }
.board-card .meta { color: var(--muted); font-size: 13px; }
.board-card .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }
.groups { display: flex; flex-direction: column; gap: 12px; }
details.group { background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
details.group > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; user-select: none;
}
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; width: 10px; }
details.group[open] > summary::before { transform: rotate(90deg); }
details.group > summary .gbtns { margin-left: auto; display: flex; gap: 6px; }
details.group > .boards { padding: 0 16px 16px; }
details.group .board-card { box-shadow: none; background: #fafbfd; }
.avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.gtitle { font-weight: 600; font-size: 16px; }
.count { color: var(--muted); font-size: 14px; }
.empty.small { padding: 14px; font-size: 14px; grid-column: 1 / -1; }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--border); border-radius: 14px; background: #fff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 13px; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 6px; }
.table-card { padding: 0; overflow-x: auto; }

.add-student { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.add-student label { margin-top: 0; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { min-width: 0; }

.info { background: var(--accent-soft); border: 1px solid #c9d7fb; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.info code { background: #fff; padding: 2px 6px; border-radius: 6px; font-size: 14px; user-select: all; }

dialog { border: 0; border-radius: 16px; padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(15, 23, 42, .25); }
dialog::backdrop { background: rgba(15, 23, 42, .35); }
.checks { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.checks label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px; border-radius: 8px; color: var(--text); font-size: 15px; cursor: pointer; }
.checks label:hover { background: #f5f7fb; }
.checks input { width: 18px; height: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Задания */
textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; color: var(--text);
  resize: vertical; outline: none; background: #fff;
}
textarea:focus, input[type=date]:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=date] { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; color: var(--text); background: #fff; }
.select.wide-select { width: 100%; height: 42px; }
.select { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 14px; background: #fff; color: var(--text); }
.count-badge { background: #fff4e5; color: #b45309; border: 1px solid #fcd9a8; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.section-head .select + .btn, .section-head .count-badge + .btn { margin-left: auto; }
#taskFilter { margin-left: auto; }
#taskFilter + .btn { margin-left: 0; }

.tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.task-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; cursor: pointer; }
.task-card .name { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; word-break: break-word; }
.task-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.task-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kind { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.kind-homework { background: #ede9fe; color: #6d28d9; }
.kind-classwork { background: #e0f2fe; color: #0369a1; }
.due { font-size: 13px; color: var(--muted); }
.due.late { color: var(--danger); font-weight: 600; }
.due.today { color: #b45309; font-weight: 600; }
.status-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-new { background: #f1f3f7; color: var(--muted); }
.st-submitted { background: #fff4e5; color: #b45309; }
.st-checked { background: #e7f8ee; color: #15803d; }
.st-returned { background: #fdecec; color: var(--danger); }
.who-list { display: flex; flex-direction: column; gap: 4px; }
.who-chip { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }

.task-page { max-width: 820px; }
.hint-line { color: var(--muted); font-size: 13px; margin: 2px 0 0; min-height: 1.2em; }
.solve { display: flex; flex-direction: column; gap: 12px; }
.solve-row { display: flex; gap: 12px; flex-wrap: wrap; }
.solve > .btn { align-self: flex-start; }
.btn.big { height: auto; min-height: 48px; padding: 10px 18px; font-size: 16px; }
.btn.choice { flex: 1 1 220px; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 18px; text-align: left; white-space: normal; }
.btn.choice .ico { font-size: 28px; }
.btn.choice b { font-size: 17px; }
.muted-p { color: var(--muted); font-size: 14px; font-weight: 400; margin: 0; }
.muted-on { opacity: .8; font-weight: 400; }
.review > .btn.primary { margin-top: 6px; }
.task-page h2 { margin: 28px 0 12px; }
.task-main h1 { font-size: 24px; margin: 10px 0 8px; word-break: break-word; }
.task-main > .btn { margin-top: 14px; }
.task-text { white-space: pre-wrap; word-break: break-word; margin: 8px 0; line-height: 1.55; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.thumb { position: relative; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); display: block; background: #f5f7fb; }
.task-main .thumbs { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.thumb .x { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); border-radius: 50%; width: 28px; height: 28px; }
.task-main .file-list, .card .file-list { margin: 10px 0; }
.file-item a { color: var(--text); text-decoration: none; }
.file-item a:hover { color: var(--accent); }
.note { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; border: 1px solid; }
.note.ok { background: #ecfdf3; border-color: #b7ebc9; color: #14532d; }
.note.bad { background: #fdf2f2; border-color: #f5c2c2; color: #7f1d1d; }
.note.wait { background: #fff8eb; border-color: #fcd9a8; color: #78350f; }
.answer-form { display: flex; flex-direction: column; gap: 10px; }
.answer-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.answer-actions .btn.primary { margin-left: auto; }
.review { margin-bottom: 12px; }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.review-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.review-row { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start; }
.review-row .select { height: 42px; }
.review-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
@media (max-width: 600px) { .review-row { grid-template-columns: 1fr; } }

dialog.wide { width: min(560px, calc(100vw - 32px)); }
.seg { display: flex; gap: 8px; margin-bottom: 4px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; cursor: pointer; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 0; height: 42px; cursor: pointer; }
label.check input { width: 18px; height: 18px; }
.file-btn { margin-top: 2px; }
.file-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.file-list:empty { display: none; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; background: #fafbfd; }
.file-item > span:first-child, .file-item > a:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item.new { border-style: dashed; }
.x { border: 0; background: none; font-size: 20px; color: var(--muted); cursor: pointer; padding: 0 4px; line-height: 1; }
.x:hover { color: var(--danger); }

@media (max-width: 720px) {
  .row2 { grid-template-columns: 1fr; }
  details.group > summary { flex-wrap: wrap; }
  .add-student { grid-template-columns: 1fr; }
  .who { display: none; }
}

/* ---------- Банк заданий ---------- */
main.bank { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.bank-list { padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.bank-list-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.bank-list-head input { height: 38px; }
.small-seg span { padding: 6px; font-size: 13px; }
.bank-items { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.bank-item { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; font: inherit; color: var(--text); }
.bank-item:hover { background: #f5f7fb; }
.bank-item.active { background: var(--accent-soft); border-color: #c9d7fb; }
.bank-item .kind { font-size: 15px; padding: 2px 6px; }
.bi-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bi-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.bank-editor { padding: 20px; min-height: 300px; }
.bank-editor .empty { border: 0; }
.ed-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ed-top .seg { flex: 0 1 380px; margin: 0; }
.saved-note { color: var(--muted); font-size: 13px; margin-left: auto; }
.tpl-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 4px 0 8px; }
.tpl-files:empty { display: none; }
.tf { position: relative; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.tf img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; display: block; border-radius: 10px; cursor: zoom-in; }
.tf.doc { padding: 10px; font-size: 13px; }
.tf .x { position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,.9); border-radius: 50%; }
.scoring { margin-top: 18px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: #fafbfd; }
.scoring label.check { height: auto; font-weight: 600; }
.quick-fill { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 10px 0; }
.quick-fill input { width: 64px; height: 34px; }
.score-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.score-row .sr-label { flex: 1; height: 36px; }
.score-row .sr-max { width: 80px; height: 36px; }
.score-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ed-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.ed-actions .spacer { flex: 1; }
.bank-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 14px; max-width: calc(100vw - 32px); }
@media (max-width: 800px) {
  main.bank { grid-template-columns: 1fr; }
  .bank-list { position: static; max-height: 46vh; }
}

/* ---------- Баллы ---------- */
.scoring-view { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; }
.sc-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.sc-label { flex: 1; }
.sc-input { width: 72px; height: 34px; text-align: center; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.sc-max { color: var(--muted); font-size: 13px; min-width: 48px; }
.sc-total { border-top: 1px solid var(--border); padding-top: 6px; font-size: 15px; }

/* ---------- Кабинет ученика ---------- */
.bank-link { margin-left: auto; }
.bank-link + .who { margin-left: 0; }
.hero {
  background: linear-gradient(135deg, #eef4ff 0%, #f5f0ff 55%, #fff7ed 100%);
  border: 1px solid #e3e8f5; border-radius: 20px; padding: 22px 22px 0; margin-bottom: 20px;
}
.hero-hello h1 { font-size: 26px; margin: 0; }
.hero-hello p { margin: 4px 0 0; color: var(--muted); text-transform: capitalize; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; cursor: pointer;
  background: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.9); border-radius: 14px; font: inherit; color: var(--text);
  box-shadow: 0 1px 2px rgba(15,23,42,.04); text-align: left;
}
.stat:hover { background: #fff; }
.stat b { font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; }
.tabs button {
  border: 0; background: none; font: inherit; font-size: 15px; padding: 10px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 3px solid transparent; border-radius: 10px 10px 0 0;
}
.tabs button.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); background: rgba(255,255,255,.6); }
body.student main.wrap > section > .section-head h2 { display: none; } /* заголовок заменяют вкладки */
body.student #tasksSection .section-head, body.student #boardsSection .section-head { margin-bottom: 0; min-height: 0; }

.diary { display: flex; flex-direction: column; gap: 8px; }
.diary-row {
  display: grid; grid-template-columns: 70px 1fr minmax(120px, 200px) 16px; align-items: center; gap: 12px;
  padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
  font: inherit; color: var(--text); text-align: left; box-shadow: var(--shadow);
}
.diary-row:hover { border-color: #c9d7fb; }
.d-date { color: var(--muted); font-size: 13px; }
.d-title { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.d-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.d-score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bar { width: 100%; height: 6px; background: #eef1f5; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.d-more { color: var(--muted); font-size: 20px; }
.grade-pill { display: inline-block; background: #eef4ff; color: var(--accent); font-weight: 600; font-size: 13px; padding: 2px 10px; border-radius: 999px; margin-left: 6px; }
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat { padding: 10px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 12px; }
  .diary-row { grid-template-columns: 1fr auto; }
  .d-date, .d-more { display: none; }
  .tabs button { padding: 10px 10px; font-size: 14px; }
}
.small-seg span { white-space: nowrap; }

/* ---------- Аватарки и профиль ---------- */
.ava { border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; background: #e5e7eb; }
.me-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font: inherit; font-size: 14px; color: var(--text); }
.me-btn:hover { background: #f5f7fb; }
.profile-dlg { width: min(440px, calc(100vw - 32px)); }
.pf-top { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.pf-ava-btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pf-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-colors button { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; }
.pf-colors button.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--text); }
.pf-pass { margin-top: 14px; }
.pf-pass summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.pf-pass input { margin-top: 8px; }

/* ================= Банк заданий: библиотека ================= */
.top .spacer, .spacer { flex: 1; }
.top .wrap .brand + .spacer { flex: 1; }
.shelves { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.shelves button {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  padding: 16px 18px; border-radius: 18px; border: 2px solid transparent; background: #fff; cursor: pointer; font: inherit; color: var(--text);
  box-shadow: var(--shadow);
}
.shelves button .sh-ico { grid-row: span 2; font-size: 30px; }
.shelves button b { font-size: 17px; }
.shelves button.active { border-color: var(--accent); background: linear-gradient(135deg, #eef4ff, #fff); }
.lib-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 18px; font-weight: 600; }
.crumbs a { cursor: pointer; color: var(--muted); text-decoration: none; }
.crumbs a:last-child { color: var(--text); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: #cbd5e1; }
.lib-search { width: 240px !important; height: 40px; }
.lib-hint { background: #fff8eb; border: 1px solid #fcd9a8; color: #78350f; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.lib-sub { margin: 22px 0 10px; font-size: 15px; color: var(--muted); font-weight: 600; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.lib-grid:empty { display: none; }
.folder-tile {
  position: relative; background: #fff; border-radius: 18px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  border: 1px solid var(--border); transition: transform .15s, box-shadow .15s; outline: none;
}
.folder-tile:hover, .folder-tile:focus { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.ft-cover { aspect-ratio: 16 / 9; background-size: cover; background-position: center; display: grid; place-items: center; }
.ft-emoji { font-size: 44px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.12)); }
.ft-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; }
.ft-body b { font-size: 16px; }
.ft-desc { color: var(--muted); font-size: 13px; line-height: 1.35; }
.ft-path { color: var(--accent); font-size: 12px; }
.ft-count { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ft-edit {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.15); font-size: 15px; opacity: 0; transition: opacity .15s;
}
.folder-tile:hover .ft-edit, .folder-tile:focus-within .ft-edit { opacity: 1; }
@media (hover: none) { .ft-edit { opacity: 1; } }
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tpl-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; background: #fff; border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; cursor: pointer; font: inherit; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.tpl-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.tc-thumb { aspect-ratio: 4 / 3; background-size: cover; background-position: top center; display: grid; place-items: center; font-size: 36px; border-bottom: 1px solid var(--border); }
.tc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.tc-body b { font-size: 15px; line-height: 1.3; }
.tc-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.tc-badges i { font-style: normal; font-size: 12px; background: #f1f5f9; color: #475569; padding: 2px 8px; border-radius: 999px; }
.tc-author { font-size: 12px; color: var(--muted); }

/* обложка в окне папки */
.cover-edit { aspect-ratio: 16 / 9; border-radius: 14px; display: grid; place-items: center; font-size: 48px; margin-bottom: 8px; background-size: cover !important; background-position: center !important; }
.cover-btns { display: flex; gap: 8px; }
.dialog-actions .spacer { flex: 1; }

/* ================= Редактор задания ================= */
body.editing { overflow: hidden; }
.editor-shell { position: fixed; inset: 0; z-index: 20; background: #f1f4f9; overflow-y: auto; }
.ed-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.ed-title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ed-more { position: relative; }
.menu { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; min-width: 190px; display: flex; flex-direction: column; z-index: 3; }
.menu button { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
.menu button:hover { background: #f5f7fb; }
.menu button.danger { color: var(--danger); }
.ed-body { max-width: 860px; margin: 0 auto; padding: 18px 16px 80px; display: flex; flex-direction: column; gap: 16px; }
.ed-author { margin: 0; color: var(--muted); font-size: 14px; min-height: 0; }
.ed-author:empty { display: none; }
.ed-card { background: #fff; border-radius: 18px; border: 1px solid var(--border); padding: 18px 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.ed-card[hidden] { display: none; }
.ed-step { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.ed-step b { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; }
.kind-seg span { display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.kind-seg small { font-weight: 400; color: var(--muted); font-size: 12px; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-pick input { position: absolute; opacity: 0; pointer-events: none; }
.mode-pick span {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 2px solid var(--border); border-radius: 16px; cursor: pointer; height: 100%;
}
.mode-pick i { font-style: normal; font-size: 30px; }
.mode-pick b { font-size: 16px; }
.mode-pick small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.mode-pick input:checked + span { border-color: var(--accent); background: linear-gradient(135deg, #eef4ff, #fff); }
.item-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin-bottom: 12px; background: #fbfcfe; display: flex; flex-direction: column; gap: 10px; }
.ic-head { display: flex; align-items: center; gap: 10px; }
.ic-num { width: 30px; height: 30px; border-radius: 10px; background: #e0e7ff; color: #3730a3; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.ic-label { width: 160px !important; height: 36px !important; font-weight: 600; }
.ic-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 15px; }
.ic-btn.danger { color: var(--danger); }
.ic-text { min-height: 70px; }
.ic-files:empty { display: none; }
.ic-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ic-field { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); }
.ic-field input { width: 74px; height: 34px; }
.ic-field select { height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; font: inherit; background: #fff; }
.add-item { width: 100%; height: 48px; border: 2px dashed #c7d2fe; color: var(--accent); background: #f8faff; font-weight: 600; }
.items-sum { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
@media (max-width: 720px) {
  .shelves { grid-template-columns: 1fr; }
  .shelves button .muted-p { display: none; }
  .lib-search { width: 100% !important; order: 5; }
  .mode-pick { grid-template-columns: 1fr; }
  .ed-head { flex-wrap: wrap; }
  .ed-title { order: -1; flex-basis: 100%; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
.checks label .ava { margin-right: 2px; }
.tprev-items { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.tprev-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #fbfcfe; }
.tprev-item-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tprev-item-head span { color: var(--muted); font-size: 13px; }

/* ================= Кабинет (новый) ================= */
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; }
.topnav a:hover { background: #f1f5f9; color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.top .wrap { gap: 10px; }
.hero { padding: 22px 22px 0; }
.hero-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-ava { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.hero-ava .ava { box-shadow: 0 0 0 4px rgba(255,255,255,.9); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stats.four { grid-template-columns: repeat(4, 1fr); padding-bottom: 18px; margin-bottom: 0; }
.tab-pane { margin-bottom: 30px; }
.pane-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-seg { display: inline-flex; margin: 0; gap: 6px; }
.filter-seg span { padding: 8px 14px; white-space: nowrap; }
.filter-seg b { background: #e2e8f0; color: #334155; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.filter-seg input:checked + span b { background: var(--accent); color: #fff; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.person-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 20px 14px 16px; background: #fff;
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); font: inherit;
  transition: transform .15s, box-shadow .15s; cursor: pointer;
}
.person-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.person-card.static { cursor: default; }
.person-card.static:hover { transform: none; }
.person-card > .ava { margin-bottom: 6px; }
.person-card b { font-size: 16px; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; }
.pc-chips i { font-style: normal; font-size: 12px; background: #f1f5f9; color: #475569; padding: 3px 8px; border-radius: 999px; }
.pc-chips i.hot { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.add-card { border: 2px dashed #c7d2fe; background: #f8faff; box-shadow: none; justify-content: center; }
.add-plus { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 28px; display: grid; place-items: center; margin-bottom: 6px; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.hw-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.hw-who { display: flex; align-items: center; gap: 10px; width: 190px; flex-shrink: 0; text-decoration: none; color: var(--text); font-weight: 600; }
.hw-ico { font-size: 22px; }
.hw-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
.hw-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-score { font-size: 16px; white-space: nowrap; }

.lesson-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 14px; }
.lesson-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.lc-main { display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.lc-thumb { height: 74px; display: grid; place-items: center; font-size: 28px; }
.lc-body { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.lc-body b { font-size: 16px; }
.lc-who { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lc-who .ava { margin-right: -6px; border: 2px solid #fff; }
.lc-who .muted-p { margin-left: 10px; }
.lc-edit { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.15); cursor: pointer; font-size: 16px; }

.task-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); transition: transform .15s; }
.task-row:hover { transform: translateY(-1px); }
.task-row.returned { border-color: #fecaca; background: #fffafa; }
.tr-icon { font-size: 26px; }
.tr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tr-main b { font-size: 16px; }
.sec-title { margin: 26px 0 12px; font-size: 19px; }
.student-hero .hero-hello p { text-transform: none; }

@media (max-width: 720px) {
  .topnav { display: none; }
  .stats.four { grid-template-columns: repeat(2, 1fr); }
  .hw-row { flex-wrap: wrap; }
  .hw-who { width: auto; }
  .filter-seg { flex-wrap: wrap; }
  .hero-actions { width: 100%; }
}
.task-admin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.task-admin label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); }
.task-admin input[type=date] { width: auto; height: 36px; }

/* ---------- Уроки: панели учеников ---------- */
details.sp { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.sp-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; user-select: none; }
.sp-head::-webkit-details-marker { display: none; }
.sp-head::before { content: '▸'; color: var(--muted); transition: transform .15s; width: 10px; }
details.sp[open] > .sp-head::before { transform: rotate(90deg); }
.sp-name { display: flex; flex-direction: column; gap: 1px; }
.sp-name b { font-size: 16px; }
.sp-none { width: 40px; height: 40px; background: #cbd5e1; font-size: 18px; }
.sp-body { padding: 0 16px 16px; }
.lp .lib-grid + .lib-grid { margin-top: 12px; }
.lp .lesson-grid { margin-top: 0; }
.lp-crumbs { font-size: 15px; margin-bottom: 12px; }
.lp .empty.small { padding: 16px; }
.menu-sep { padding: 8px 12px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 4px; }
.menu-note { padding: 6px 12px 10px; font-size: 13px; color: var(--muted); }
.menu button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lp-menu { z-index: 60; max-height: 60vh; overflow-y: auto; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-top: 26px; }
.sec-head .sec-title { margin: 0; }
.sec-note { margin: 4px 0 12px; }
@media (max-width: 600px) { .sp-head { flex-wrap: wrap; } }
