:root{
  --border:#eadff8;
  --text:#261235;
  --muted:#71627d;
  --accent:#7a2dbb;
  --accent-2:#f2a900;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:#fff;
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

a{ color:inherit; }

.sheet{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 22px 40px;
}

.sheet__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.sheet__back{
  text-decoration:none;
  color: var(--accent);
  font-weight:600;
}

.controls{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}

.check{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  color:var(--text);
}

.field{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
}

.field__label{ color:var(--muted); }

.select{
  padding: 7px 10px;
  border: 1px solid rgba(122,45,187,.35);
  background:#fff;
  font-size:14px;
  outline:none;
}

.sheet__right{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.titleInput{
  width: 260px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(122,45,187,.35);
  border-radius: 0;
  outline:none;
  font-size:14px;
}

.btn{
  padding: 8px 14px;
  border: 1px solid rgba(122,45,187,.35);
  background:#fff;
  cursor:pointer;
  font-size:14px;
}

.btn:hover{ background:#fff8e5; }

.worksheetTitle{
  margin: 8px 0 14px;
  font-size: 18px;
  font-weight: 700;
  text-align:center;
}

.worksheet{
  border-top: 1px solid var(--border);
}

/* Уплотняем KaTeX, чтобы формулы не делали большие пустоты */
.worksheet .katex-display{ margin: .35em 0; }

.taskRow{
  display:flex;
  gap:10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items:flex-start;
}

/* Нумерация должна начинаться от левого края, без «колонки» */
.taskNo{
  width:auto;
  min-width: 26px;
  text-align:left;
  padding-top: 2px;
  font-size: 15px;
  color: var(--text);
  white-space:nowrap;
}

.taskBody{ flex:1; }

.eq{ margin: 0; }

/* По умолчанию KaTeX центрирует display-формулы —
   для листка заданий лучше выровнять по левому краю */
.worksheet .katex-display{ text-align:left; }
.worksheet .katex-display > .katex{ text-align:left; }

/* Уменьшаем вертикальные отступы у KaTeX */
.worksheet .katex-display{ margin: 0.35em 0; }
.sub .katex-display{ margin: 0.25em 0; }

.sub{
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.subLabel{
  color: var(--text);
  font-weight: 700;
  margin-bottom: 4px;
}

.sub--solution{
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  color: var(--text);
}

.sub--answer{
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
}

@media print{
  .no-print{ display:none !important; }
  .sheet{ max-width:none; padding:0 0 0 0; }
  a{ color:inherit; text-decoration:none; }
  .btn, .titleInput, input{ display:none !important; }
  body{ -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


.groupHeader{ margin: 18px 0 8px; }

.groupTitleRow{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.groupTitle{
  font-weight: 800;
  font-size: 16px;
}

.groupSubtitleInput{
  width: 340px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(122,45,187,.35);
  font-size:14px;
  outline:none;
}

.groupSubtitle{
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

input, select, button{ accent-color: var(--accent); }
.select:focus-visible, .titleInput:focus-visible, .groupSubtitleInput:focus-visible, .btn:focus-visible{ outline:2px solid var(--accent-2); outline-offset:2px; }
