/* «На максимум», сайт школы — разделы «Пробные» (классы tr-) и «Главная» (классы hm-).
   Общие кирпичики (.btn, .inp, .tag, .chip, .seg, .card, .note, .kv, .tbl) — в app.css. */

/* ══════════════════════════ пробные: список ══════════════════════════ */
.tr-red { color: var(--red); }
.linkbtn.tr-red { color: var(--red); }
.tr-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.tr-alert > * + * { margin-top: 0; }

.tr-filters { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 16px; padding: 16px; }
.tr-filters .field { flex: 1 1 170px; max-width: 260px; }
.tr-filters .tr-f-seg { flex: 0 0 auto; max-width: none; }
.tr-filters .inp { height: 40px; min-height: 40px; padding-top: 7px; padding-bottom: 7px; }
.tr-filters .hint { margin-top: 6px; }

.tr-counters { display: grid; gap: 8px; }
.tr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tr-chips .chip { flex: none; }
.tr-over { font-size: 12.5px; font-weight: 600; color: var(--red); white-space: nowrap; }
.chip[aria-pressed="true"] .tr-over { color: #FFB9AB; }
.tr-conv { flex: none; margin-left: 6px; font-size: 14px; color: var(--ink-2); white-space: nowrap; cursor: help; }

.tr-body { container-type: inline-size; container-name: trlist; }
.tbl.tr-tbl { font-size: 14.5px; }
.tbl.tr-tbl th, .tbl.tr-tbl td { padding: 11px 8px; }
.tbl.tr-tbl th:first-child, .tbl.tr-tbl td:first-child { padding-left: 14px; }
.tbl.tr-tbl th:last-child, .tbl.tr-tbl td:last-child { padding-right: 14px; }
.tbl.tr-tbl td { vertical-align: middle; }
.tbl.tr-tbl td:last-child { width: 1%; white-space: nowrap; text-align: right; }
/* имя клиента: обычное не рвётся (столбец не уже 112px), очень длинное переносится и не распирает таблицу */
.tbl.tr-tbl td:nth-child(2) { min-width: 112px; }
.tr-open { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
/* пометки «прошлое пробное», «в архиве» — второй строкой обычным текстом: переносятся и не задают ширину столбца */
.tbl .sub.tr-marks { font-size: 12.5px; line-height: 1.3; }
.acc-badge.tr-acc { max-width: 100%; }
.tbl.tr-tbl .tr-acc { max-width: 132px; }
.tr-acc-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tr-open:hover { color: var(--marker-ink); text-decoration: underline; }
.tr-state .tag + .sub { margin-top: 4px; }
.tbl .sub.tr-red { color: var(--red); }
/* просроченный звонок — красный фон строки, запоздавшая обратная связь — жёлтый */
.tbl.tr-tbl tr.tr-late td, .tbl.tr-tbl tr.go.tr-late:hover td { background: #FCEEEA; }
.tbl.tr-tbl tr.tr-slow td, .tbl.tr-tbl tr.go.tr-slow:hover td { background: #FFF8DD; }

.tr-group + .tr-group { margin-top: 20px; }
.tr-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 2px 8px; }
.tr-group-head h2 { font-size: 18px; overflow-wrap: anywhere; }
.tr-foot > * + * { margin-top: 8px; }

/* ══════════════════════════ пробные: одно пробное ══════════════════════════ */
.tr-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; font-size: 15px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.tr-back:hover { color: var(--marker-ink); }
.tr-back .ic { width: 16px; height: 16px; flex-basis: 16px; }
.tr-head { margin-bottom: 22px; }
.tr-head > * + * { margin-top: 10px; }
.tr-head h1 { overflow-wrap: anywhere; }
.tr-head .lead-text { max-width: none; overflow-wrap: anywhere; }

.tr-cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.tr-col { display: grid; gap: 16px; min-width: 0; }
.tr-cols .card { min-width: 0; scroll-margin-top: 76px; }
.tr-cols .card > * + *, .tr-old > * + * { margin-top: 12px; }
.tr-h { font-size: 18px; }
.tr-cols h3, .tr-old h3 { font-size: 15px; }
.tr-big { font-size: 17px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tr-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.tr-url { overflow-wrap: anywhere; }
.tr-task { font: 500 12px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--marker-ink); }
.tr-timer {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2);
  font-size: clamp(21px, 2.4vw, 26px); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.tr-timer.due { background: var(--marker-soft); border-color: transparent; color: var(--marker-ink); }
.tr-timer.overdue { background: var(--red-soft); border-color: transparent; color: #7c2414; }
.tr-memo { padding: 8px 10px; border-radius: 10px; background: var(--paper-2); font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.tr-nophone > * + * { margin-top: 8px; }

/* пары «подпись — текст»: подпись не шире трети, длинная переносится */
.kv.tr-kv { grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: 8px 14px; }
.kv.tr-kv dt { overflow-wrap: anywhere; line-height: 1.45; }
.kv.tr-info { padding: 10px 12px; border-radius: 10px; background: var(--paper-2); font-size: 14.5px; }
.tr-contacts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.tr-clabel { display: block; font: 500 12px/1.6 var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); }
.tr-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tr-more summary { cursor: pointer; font-size: 14px; color: var(--ink-2); }
.tr-more > p { margin-top: 8px; color: var(--ink-2); }
.tr-tel { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }

.tr-form { display: grid; gap: 14px; min-width: 0; }
.tr-form > * { margin: 0; }
.tr-fields { display: grid; gap: 12px; }
textarea.inp.tr-ta { min-height: 68px; resize: none; overflow: hidden; }
.tr-short .inp { max-width: 180px; }
.tr-bad .inp { border-color: var(--red); background: #FFF8F6; }
.tr-bad > label { color: var(--red); }
.tr-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-pick .chip { min-height: 38px; padding: 7px 14px; font-size: 14.5px; }
.tr-pick .chip[aria-pressed="true"] { background: var(--marker); border-color: var(--marker); }
.tr-pick + .hint { margin-top: 8px; }
.tr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tr-recall .inp { margin-top: 8px; max-width: 200px; }
.tr-reach { flex-wrap: wrap; gap: 8px; }
.tr-alert .linkbtn[aria-pressed="true"] { color: var(--marker-ink); text-decoration-color: currentColor; }
.toast .toast-act { margin-left: 8px; }
@media (pointer: coarse) {
  .tr-pick .chip, .toast .toast-act { min-height: 44px; min-width: 44px; }
  .tr-reach .btn, .tr-actions .btn, .tr-recall .inp { min-height: 44px; }
  .tr-alert .linkbtn, .tr-back-period .linkbtn { min-height: 44px; min-width: 44px; }
  .btn.sm[data-k="outcome-save"] { min-height: 44px; }
}
.tr-clear { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.tr-clear .hint { margin: 0; }

.tr-part > * + * { margin-top: 8px; }
.tr-part + .tr-part, .tr-sub { padding-top: 14px; border-top: 1px solid var(--line); }
.tr-sub > * + * { margin-top: 6px; }
.tr-linkrow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.tr-linkrow .inp { flex: 1 1 200px; min-width: 0; }
.tr-linkrow .btn { flex: none; min-height: 42px; }
.tr-hintrow { overflow-wrap: anywhere; }
.tr-review { display: grid; gap: 8px; justify-items: start; }
.tr-note .inp { margin-top: 10px; }

.tr-prev { margin-top: 26px; }
.tr-prev > * + * { margin-top: 10px; }
.tr-old { padding: 14px 18px; }
.tr-old summary { cursor: pointer; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.tr-old summary:focus-visible { outline-offset: 4px; }

@media (max-width: 899px) {
  /* одна колонка; порядок блоков: что сейчас, обратная связь, репетитор, заявка, ссылки, заметка */
  .tr-cols { display: flex; flex-direction: column; align-items: stretch; }
  .tr-col { display: contents; }
  .tr-now { order: 1; }
  .tr-fb { order: 2; }
  .tr-tutor { order: 3; }
  .tr-lead { order: 4; }
  .tr-links { order: 5; }
  .tr-note { order: 6; }
}

/* таблице тесно (ноутбук, планшет): сначала прячется анкета, потом предмет — они есть на экране пробного */
@media (min-width: 701px) {
  /* если таблица всё же шире своей рамки (длинные слова), кнопка действия остаётся на виду у правого края */
  .tbl.tr-tbl td:last-child { position: sticky; right: 0; background: var(--paper); }
  .tbl.tr-tbl tr.go:not(.tr-late):not(.tr-slow):hover td:last-child { background: var(--paper-2); }
  /* запас ширины: в обычной рамке сайта (1038px) длинная метка состояния может уйти на вторую строку —
     тогда таблица с длинными именами и предметами не становится шире рамки и кнопка не закрывает исход */
  @container trlist (max-width: 1100px) {
    .tbl.tr-tbl .tr-state .tag { white-space: normal; line-height: 1.3; border-radius: 12px; }
  }
  @container trlist (max-width: 1010px) {
    .tbl.tr-tbl th:nth-child(3), .tbl.tr-tbl td:nth-child(3) { display: none; }
  }
  @container trlist (max-width: 850px) {
    .tbl.tr-tbl th:nth-child(4), .tbl.tr-tbl td:nth-child(4) { display: none; }
  }
  /* узкий планшет: поля ячеек меньше, длинная метка состояния переносится на вторую строку */
  @container trlist (max-width: 760px) {
    .tbl.tr-tbl th, .tbl.tr-tbl td { padding-left: 6px; padding-right: 6px; }
    .tbl.tr-tbl th:first-child, .tbl.tr-tbl td:first-child { padding-left: 12px; }
    .tbl.tr-tbl th:last-child, .tbl.tr-tbl td:last-child { padding-right: 12px; }
  }
}

@media (max-width: 700px) {
  .tr-filters { flex-direction: column; align-items: stretch; }
  .tr-filters .field, .tr-filters .tr-f-seg { flex: none; max-width: none; }
  .tr-filters .seg { display: flex; }
  .tr-filters .seg button { flex: 1 1 auto; padding-left: 8px; padding-right: 8px; }
  .tr-filters .inp { height: 44px; min-height: 44px; }
  /* счётчики прокручиваются внутри своей полосы, страница — нет */
  .tr-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .tr-chips::-webkit-scrollbar { display: none; }

  /* карточка пробного: первая строка — когда и клиент, столбец «Клиент» прячется */
  .tbl.cards.tr-tbl td, .tbl.cards.tr-tbl td:first-child, .tbl.cards.tr-tbl td:last-child { padding: 0; }
  .tbl.cards.sortable.tr-tbl tr td:nth-child(2) { display: none; }
  .tbl.cards.tr-tbl td:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
  .tbl.cards.tr-tbl .tr-when { font: 500 13px/1.5 var(--mono); color: var(--ink-2); }
  .tbl.cards.tr-tbl .tr-who { flex: 1 1 100%; font-size: 17px; }
  .tbl.cards.tr-tbl .tr-acc { max-width: 100%; }
  .tbl.cards.tr-tbl .tr-state { text-align: right; }
  .tbl.cards.sortable.tr-tbl tr td:last-child { display: block; width: auto; margin-top: 12px; white-space: normal; }
  .tbl.cards.sortable.tr-tbl tr td:last-child::before { content: none; }
  .tbl.cards.tr-tbl td:last-child .btn { width: 100%; min-height: 42px; }
  .tbl.cards tr.tr-late { background: #FCEEEA; }
  .tbl.cards tr.tr-slow { background: #FFF8DD; }
  .tbl.cards tr.go.tr-late:hover td { background: #FCEEEA; }
  .tbl.cards tr.go.tr-slow:hover td { background: #FFF8DD; }
  /* заголовок группы прилипает под шапкой сайта */
  .tr-group-head { position: sticky; top: var(--tr-top, 57px); z-index: 5; margin: 0 -16px; padding: 8px 16px; background: var(--board); }
}

@media (max-width: 560px) {
  .tr-cols .card { padding: 16px; }
  .kv.tr-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv.tr-kv dd + dt { margin-top: 10px; }
  .tr-timer { text-align: center; }
  .tr-actions.wide { flex-direction: column; align-items: stretch; }
  .tr-actions.wide .btn { width: 100%; }
  .tr-linkrow .inp { flex-basis: 100%; }
  .tr-linkrow .btn { flex: 1 1 auto; }
  .tr-short .inp { max-width: none; }
}

/* ══════════════════════════ главная ══════════════════════════ */
.hm-attn { display: grid; gap: 16px; }
.hm-attn h2 { font-size: 20px; }
.hm-block { display: grid; gap: 6px; }
.hm-block h3 { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 2px; font-size: 16px; }
.hm-block h3 a { font-weight: 500; }
.hm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.hm-row.late { border-color: transparent; background: var(--red-soft); color: #7c2414; }
.hm-row.warn { border-color: transparent; background: var(--sticky-soft); color: var(--sticky-ink); }
.hm-row-t { min-width: 0; overflow-wrap: anywhere; }
.hm-row .btn { flex: none; }
.hm-ok { color: var(--ink-2); }

.hm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.hm-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--ink); text-decoration: none; }
a.hm-tile:hover { border-color: var(--ink-3); }
.hm-label { font: 500 11.5px/1.35 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.hm-big { font-size: 34px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hm-big.word { padding: 6px 0 5px; font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; }
.hm-sub { font-size: 13.5px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
.hm-sub > span { display: block; }
.hm-red, .hm-sub .hm-red { color: var(--red); }
.hm-sub > .hm-accs { display: flex; flex-wrap: wrap; gap: 0 10px; }
/* плитка «Оплата учеников» (история 4.1): строки — ссылки в «Учеников» с отбором «Оплата» */
.hm-sub > a.hm-go { display: block; color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.hm-sub > a.hm-go:hover { text-decoration-color: currentColor; }
.hm-sub > a.hm-go.hm-red { color: var(--red); }
.hm-sub > .hm-warn { color: var(--sticky-ink); background: var(--sticky-soft); border-radius: 6px; padding: 0 4px; margin-left: -4px; width: fit-content; }
@media (pointer: coarse) { .hm-sub > a.hm-go { display: flex; align-items: center; min-height: 44px; } }
.hm-acc { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.hm-acc .dot { position: relative; top: -1px; }
.hm-narrow { display: none; }
/* суммы на плитках денег: число не переносится посреди и помещается в узкую плитку */
.hm-big.hm-sum { font-size: 27px; padding: 4px 0 3px; white-space: nowrap; }
/* окно «Заявки репетиторов» */
.hm-reqlist { display: grid; gap: 10px; }
.hm-req { display: grid; gap: 6px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.hm-req-about { font-weight: 600; overflow-wrap: anywhere; }
.hm-req-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.hm-req-btns { gap: 8px; margin-top: 4px; }

@media (max-width: 560px) {
  .hm-row { flex-direction: column; align-items: stretch; }
  .hm-row .btn { width: 100%; }
  .hm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hm-tile { padding: 12px 12px 14px; }
  .hm-big { font-size: 28px; }
  .hm-big.word { font-size: 18px; }
  .hm-big.hm-sum { font-size: 20px; }
  .hm-req-btns { flex-direction: column; align-items: stretch; }
  .hm-req-btns .btn { width: 100%; min-height: 44px; justify-content: center; }
  .hm-accs .hm-wide { display: none; }
  .hm-accs .hm-narrow { display: inline; }
}
.tr-terms { display: grid; gap: 12px; margin: 10px 0 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.tr-terms[hidden] { display: none; }
.tr-terms .tr-memo { margin: 0; }
.hm-now h2 { font-size: 20px; }
.hm-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hm-more { margin: -2px 0 2px 12px; }
.hm-newclient { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px; border-radius: 12px; background: var(--sticky-soft); color: var(--sticky-ink); font-weight: 600; }
@media (pointer: coarse) { .hm-now .btn.sm, .hm-newclient .btn.sm { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; } }
