/* Цвета Школы Мая */
:root {
  --teal: #4E9790;        /* фирменный бирюзовый — полосы, акценты */
  --teal-dark: #2F6E68;   /* кнопки и текст-акценты (читается на белом) */
  --teal-darker: #24564F;
  --teal-tint: #E6F1EF;
  --yellow: #F8D849;      /* фирменный жёлтый */
  --yellow-tint: #FDF4CC;
  --yellow-chip: #FDF0B3;
  --gold-text: #5C4700;
  --gold-line: #C99A06;
  --ink: #1B2430;
  --muted: #4A5666;
  --muted-2: #5B6878;
  --line: #DDE7E5;
  --line-soft: #EDF2F1;
  --field: #C5D3D1;
  --ground: #F5F8F7;
  --white: #FFFFFF;
  --danger: #A3261B;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --doc-font: Arial, "Liberation Sans", Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--teal-dark); }
a:hover { color: var(--teal-darker); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Шапка */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); box-shadow: inset 0 -4px 0 var(--yellow); }
.topbar-in { max-width: 1360px; margin: 0 auto; padding: 14px 28px 18px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand b { display: block; font-size: 18px; }
.brand span { font-size: 13px; color: var(--muted); }
.who { display: flex; gap: 12px; align-items: center; text-align: right; }
.who b { display: block; font-size: 15px; }
.who span { font-size: 13px; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--teal-tint); color: var(--teal-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; border-radius: 8px; }
.nav a:hover { background: var(--ground); color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--teal-tint); }

.wrap { max-width: 1360px; margin: 0 auto; padding: 24px 28px 48px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card h2 { font-size: 19px; margin-bottom: 4px; }
.hint { font-size: 14px; color: var(--muted); }
.small { font-size: 13px; color: var(--muted-2); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-dark); }
.page-title { display: flex; flex-direction: column; gap: 4px; }
.page-title h1 { font-size: 30px; }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--teal-dark); background: var(--teal-dark); color: var(--white); font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--teal-darker); color: var(--white); }
.btn.ghost { background: var(--white); color: var(--teal-dark); }
.btn.ghost:hover { background: var(--teal-tint); }
.btn.quiet { background: var(--white); color: var(--ink); border-color: var(--field); font-weight: 600; }
.btn.quiet:hover { background: var(--ground); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: wait; }
label.lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input { height: 44px; border: 1px solid var(--field); border-radius: 10px; padding: 0 12px; background: var(--white); min-width: 0; }
textarea.input { height: auto; min-height: 104px; padding: 12px 14px; line-height: 1.5; resize: vertical; width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .field { flex: 1 1 220px; }
form.inline { display: inline; margin: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--field); background: var(--white); color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.pill:hover { border-color: var(--teal-dark); color: var(--ink); }
.pill.on { background: var(--teal-dark); border-color: var(--teal-dark); color: var(--white); }
.pill .count { font-weight: 600; font-size: 12px; opacity: .8; }

.flash { background: var(--teal-tint); border: 1px solid #B7D6D2; border-radius: 12px; padding: 12px 16px; font-weight: 600; color: var(--teal-darker); }

.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--teal); border-radius: 4px; }

/* Отметки */
.mark { width: 20px; height: 20px; flex: none; }
.chip { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; }
.chip.strong { background: var(--teal-tint); color: var(--teal-darker); }
.chip.growth { background: var(--yellow-chip); color: var(--gold-text); }
.chip.general { padding-left: 0; color: var(--teal-dark); }

/* Учитель */
.side { flex: 1 1 280px; max-width: 330px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.editor { flex: 3 1 420px; min-width: 0; }
.preview-col { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.list { background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.list-head { padding: 12px 14px; font-size: 12px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line-soft); }
.list a.item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-top: 1px solid var(--line-soft); border-left: 4px solid transparent; color: var(--ink); text-decoration: none; font-size: 14px; }
.list a.item:first-of-type { border-top: none; }
.list a.item:hover { background: var(--ground); }
.list a.item.on { background: var(--teal-tint); border-left-color: var(--teal); font-weight: 700; }
.list a.item .st { margin-left: auto; font-size: 12px; font-weight: 600; }
.st.ok { color: var(--teal-dark); }
.st.no { color: #7A5E00; }
.assign-tabs { display: flex; flex-direction: column; gap: 6px; }
.assign-tabs a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.assign-tabs a.on { border-color: var(--teal-dark); background: var(--teal-tint); }
.assign-tabs a span { color: var(--muted-2); font-weight: 600; font-size: 13px; }
.field-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.field-head label { font-size: 15px; font-weight: 800; padding: 2px 10px; border-radius: 6px; }
.field-head label.general { padding-left: 0; }
.field-head label.strong { background: var(--teal-tint); }
.field-head label.growth { background: var(--yellow-chip); }
.doc-preview { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--teal); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; font-family: var(--doc-font); }
.doc-preview .sec { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.doc-preview .txt { font-size: 15px; line-height: 1.6; white-space: pre-line; }
.doc-preview .txt.empty { color: var(--muted-2); font-style: italic; }
.doc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.doc-head b { font-size: 16px; color: var(--teal-dark); }

/* Сводная */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .num { font-size: 30px; font-weight: 800; }
.stat .num span { font-size: 16px; color: var(--muted-2); font-weight: 600; }
.matrix-box { overflow-x: auto; }
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; }
table.matrix th { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 4px 8px; text-align: center; vertical-align: bottom; border-bottom: 1px solid var(--line); }
table.matrix th:first-child { text-align: left; }
table.matrix td { padding: 5px 4px; border-bottom: 1px solid var(--line-soft); text-align: center; }
table.matrix td.name { text-align: left; white-space: nowrap; font-weight: 600; font-size: 14px; }
.cell-ok { display: inline-flex; width: 34px; height: 30px; border-radius: 6px; background: var(--teal-dark); align-items: center; justify-content: center; }
.cell-no { display: inline-block; width: 30px; height: 26px; border-radius: 6px; border: 2px dashed var(--gold-line); background: var(--yellow-tint); }
.cnt { font-weight: 700; font-size: 13px; }
.dl-links { font-size: 12px; font-weight: 600; white-space: nowrap; }
.dl-links a { margin-left: 6px; }
.debtor { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--ground); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.sw-ok { width: 16px; height: 16px; border-radius: 4px; background: var(--teal-dark); display: inline-block; }
.sw-no { width: 14px; height: 14px; border-radius: 4px; border: 2px dashed var(--gold-line); background: var(--yellow-tint); display: inline-block; }

/* Настройки */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
table.list-table { width: 100%; border-collapse: collapse; }
table.list-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; padding: 0 10px 8px 0; border-bottom: 1px solid var(--line); }
table.list-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.linkbox { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--teal-darker); background: var(--ground); border-radius: 6px; padding: 6px 8px; word-break: break-all; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.assign-grid select { width: 100%; min-width: 120px; height: 40px; border-radius: 8px; border: 1px solid var(--field); background: var(--white); padding: 0 6px; font-size: 13px; }
.assign-grid select.empty { border-style: dashed; border-color: var(--gold-line); background: var(--yellow-tint); }
.assign-grid td, .assign-grid th { padding: 4px; }
.assign-grid th { font-size: 12px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; }
.assign-grid td.subj { font-weight: 700; font-size: 14px; white-space: nowrap; padding-right: 12px; }
details.edit summary { cursor: pointer; color: var(--teal-dark); font-size: 13px; font-weight: 600; list-style: none; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] { background: var(--ground); border-radius: 10px; padding: 10px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 24px; }
.st-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.st-row .nm { flex: 1; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; background: var(--yellow-chip); color: var(--gold-text); }

.center-msg { max-width: 520px; margin: 12vh auto; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 0 20px; }
.center-msg img { width: 72px; height: 72px; }

@media (max-width: 700px) {
  .wrap, .topbar-in { padding-left: 16px; padding-right: 16px; }
  .side { max-width: none; }
  .preview-col { position: static; }
}
.cell-na { color: var(--muted-2); font-weight: 600; }

/* Группы */
a.item-link { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
a.item-link:hover { background: var(--ground); }
a.item-link.on { border-color: var(--teal-dark); background: var(--teal-tint); }
.class-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
fieldset.class-box { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
fieldset.class-box legend { font-weight: 800; padding: 0 6px; display: flex; gap: 8px; align-items: baseline; }
.link-btn { border: none; background: none; color: var(--teal-dark); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
label.check { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 14px; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--teal-dark); flex: none; }
label.check.busy span { color: var(--muted-2); }
