/* ─── STUDENTS SCREEN ─── */
.group-section { margin-bottom: 22px; }
.group-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px; cursor: pointer; user-select: none;
}
.group-title { font-size: 15px; font-weight: 700; }
.group-count {
  font-size: 12px; color: var(--text3); background: var(--surface2);
  border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px;
}
.group-toggle { margin-left: auto; color: var(--text3); font-size: 13px; transition: transform 0.2s; }
.group-toggle.collapsed { transform: rotate(-90deg); }
.group-body.hidden { display: none; }
.group-error-msg {
  padding: 14px 16px; margin-top: 8px; background: rgba(var(--red-rgb), 0.07);
  border: 1px solid rgba(var(--red-rgb), 0.2); border-radius: 10px; color: var(--red); font-size: 13px;
}

/* student table cells */
.st-name { font-weight: 600; color: var(--accent-text); cursor: pointer; }
.st-name:hover { text-decoration: underline; }
.st-flag {
  display: inline-block; margin-left: 6px; font-size: 11px; color: var(--orange);
  vertical-align: middle; cursor: help;
}

.comm-select { min-width: 96px; }

.dialog-btns { display: flex; gap: 6px; }
.dialog-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 7px; padding: 5px 9px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid; font-family: inherit; white-space: nowrap; text-decoration: none;
}
.dialog-btn.vk { color: var(--vk-text); border-color: rgba(var(--vk-rgb), 0.4); background: rgba(var(--vk-rgb), 0.08); }
.dialog-btn.vk:hover { background: rgba(var(--vk-rgb), 0.18); }
.dialog-btn.tg { color: var(--tg-text); border-color: rgba(var(--tg-rgb), 0.4); background: rgba(var(--tg-rgb), 0.08); }
.dialog-btn.tg:hover { background: rgba(var(--tg-rgb), 0.18); }
.dialog-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* days-since cell */
.days-cell { font-weight: 700; font-size: 13px; min-width: 70px; display: inline-block; text-align: center;
  border-radius: 8px; padding: 4px 8px; }
.days-green  { color: var(--green);   background: rgba(var(--green-rgb), 0.12); }
.days-orange { color: var(--orange);  background: rgba(var(--orange-rgb), 0.12); }
.days-red    { color: var(--red);     background: rgba(var(--red-rgb), 0.13); }
.days-hard   { color: var(--on-red-hard); background: var(--red-hard); }
.days-none   { color: var(--text3); font-weight: 500; }
.days-loading { color: var(--text3); }

/* comment cell */
.comment-input {
  width: 100%; min-width: 160px; background: var(--input-inset-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; color: var(--text); font-family: inherit;
  font-size: 13px; outline: none; resize: vertical; min-height: 34px;
  overflow: hidden;
}
.comment-input:focus { border-color: var(--accent); }

.comment-ro { max-width: 320px; white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }

.note-saved { color: var(--green); font-size: 11px; opacity: 0; transition: opacity 0.2s; }
.note-saved.show { opacity: 1; }

/* когда обновлялся список учеников */
.sync-note { font-size: 13px; color: var(--text2); margin: -12px 0 16px; }
.sync-note:empty { display: none; }

/* student modal */
/* форма отделена от нередактируемых строк ID и почты сверху */
.student-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.student-modal-grid .field.full { grid-column: 1 / -1; }
.info-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text3); }
.info-row .v { color: var(--text); font-weight: 500; }

/* ─── ТЕЛЕФОН: строка ученика - карточкой ───
   ФИО и дни без связи, ID с почтой, тег коммуникации с кнопками диалога, теги, комментарий */
@media (max-width: 640px) {
  table.st-table tbody tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; row-gap: 8px;
    grid-template-areas:
      "name name days"
      "id email email"
      "comm comm dialog"
      "tags tags tags"
      "comment comment comment";
  }
  table.st-table tbody td { padding: 0; min-height: 0; }
  table.st-table tbody td::before { display: none; }
  table.st-table .td-num { display: none; }
  table.st-table .td-name { grid-area: name; align-self: center; font-size: 15px; }
  table.st-table .td-days { grid-area: days; align-self: center; justify-self: end; }
  table.st-table .td-id { grid-area: id; font-size: 12px; }
  table.st-table .td-email { grid-area: email; font-size: 12px; }
  table.st-table .td-comm { grid-area: comm; display: flex; align-items: center; gap: 8px; }
  table.st-table .td-comm::before { display: block; position: static; width: auto; top: auto; flex-shrink: 0; }
  table.st-table .td-dialog { grid-area: dialog; align-self: center; justify-self: end; }
  table.st-table .td-tags { grid-area: tags; }
  table.st-table .td-comment { grid-area: comment; }
  .comm-select { min-width: 0; width: auto; }
  .dialog-btn { padding: 8px 13px; font-size: 13px; }
  .days-cell { min-width: 0; }
  .comment-input { min-width: 0; }
  .comment-ro { max-width: none; }

  .student-modal-grid { grid-template-columns: 1fr; }
  .info-row { gap: 12px; align-items: baseline; }
  .info-row .v { min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .info-row .chips { justify-content: flex-end; }
  .sync-note { margin: -8px 0 12px; }
}
