/* Кабинет родителя. Цвета — те же, что у кабинета сотрудников
   (TamosTheme), вёрстка — сначала под телефон: одна колонка, крупные
   поля и кнопки (не меньше 44 px по высоте — под палец). Встроенных
   стилей в разметке нет: политика безопасности их запрещает.
   Ревью 07.11.2026 — docs/PARENT-CABINET-DESIGN-REVIEW.md (№ в скобках). */

:root {
    --primary: #3253a8;
    --primary-ink: #ffffff;
    --ink: #131a24;
    --ink-2: #48566a;
    /* Темнее, чем было (#64707f): подсказки на фоне страницы давали
       4,45:1 при норме 4,5:1 (№ 15). */
    --muted: #59636f;
    --bg: #eef1f5;
    --surface: #ffffff;
    --line: #dfe4ea;
    --input: #c4ccd6;
    --ok: #2b7d2f;
    --ok-bg: #e7f3e8;
    --bad: #c11f1a;
    --bad-bg: #fbe9e8;
    --warn: #a14a07;
    --warn-bg: #fdf0e2;
    --mute-bg: #eef1f5;
    --primary-bg: #e8edf8;
    /* Мягкая тень вместо одной рамки — карточки «лежат» на фоне (2-й круг). */
    --shadow: 0 1px 2px rgba(19, 26, 36, 0.05), 0 4px 12px rgba(19, 26, 36, 0.05);
    --radius: 16px;
    --column: 720px;
    --font: "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #8caaf2;
        --primary-ink: #0c1730;
        --ink: #e9eef4;
        --ink-2: #aab6c4;
        --muted: #8a96a6;
        --bg: #0f141a;
        --surface: #181e26;
        --line: #29313b;
        --input: #3a4451;
        --ok: #6ec468;
        --ok-bg: #16281a;
        --bad: #f09087;
        --bad-bg: #2d1716;
        --warn: #e2a862;
        --warn-bg: #2b2013;
        --mute-bg: #222a34;
        --primary-bg: #1f2b45;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 var(--font);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 28px 0 12px; }
/* Заголовок внутри карточки — без верхнего отступа: на входе над ним
   было лишних 24 px (№ 16). */
.card h2 { margin-top: 0; }
p { margin: 0 0 12px; }
a { color: var(--primary); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.muted { color: var(--ink-2); }

/* Только для чтения с экрана: «Назад: » перед подписью кнопки в шапке. */
.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Значки меню и кнопок (Icon.razor): цвет — от текста. */
.icon { width: 24px; height: 24px; flex: none; fill: currentColor; }

/* ---------- шапка, страница, подвал ---------- */

.top {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Шапка — в той же колонке, что содержимое (№ 18). На телефоне в ней
   «Тамос» или «назад» (ревью 09.11, № 36); меню — внизу экрана. */
.top-in {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: var(--column);
    min-height: 56px;
    margin: 0 auto;
    padding: 4px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left));
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

.brand small { color: var(--ink-2); font-weight: 400; margin-left: 4px; }

/* «Назад» в шапке внутренней страницы: под пальцем после любой прокрутки,
   подпись — куда ведёт; длинное ФИО — с многоточием. */
.appbar-back {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 44px;
    margin-left: -8px;
    padding-right: 8px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.appbar-back > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar-back .icon { width: 28px; height: 28px; }

/* Меню разделов (ревью 09.11, № 35). На телефоне — внизу экрана, под
   большим пальцем: четыре равные кнопки, значок над подписью; раздел, в
   котором вы, — подсвечен. Над полосой «Домой» у iPhone — отступ. */
.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(19, 26, 36, 0.06);
}

.tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    border-radius: 12px;
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

/* Подсвеченный раздел: пилюля под значком, как в Android и Kaspi. */
.tabs a .icon { width: 56px; height: 30px; padding: 3px 16px; border-radius: 999px; }
.tabs a.on { color: var(--primary); }
.tabs a.on .icon { background: var(--primary-bg); }

/* На телефоне «назад» заменяет «Тамос» во внутренних страницах; «хлебные
   крошки» над заголовком — только на широком экране (BackLink). */
.brand.inner, .crumbs { display: none; }

.page {
    max-width: var(--column);
    margin: 0 auto;
    /* Снизу — место под меню, чтобы оно не закрывало конец страницы. */
    padding: 20px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* Широкий экран: меню — строкой в шапке справа, «назад» — над заголовком. */
@media (min-width: 768px) {
    .top-in { justify-content: space-between; }
    .appbar-back { display: none; }
    .brand.inner { display: flex; }
    .crumbs { display: block; }

    .tabs {
        position: static;
        display: flex;
        gap: 4px;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }

    .tabs a {
        flex-direction: row;
        gap: 6px;
        min-height: 44px;
        padding: 0 14px 0 10px;
        border-radius: 999px;
        font-size: 0.9375rem;
    }

    .tabs a .icon { width: 22px; height: 22px; padding: 0; background: none; }
    .tabs a.on, .tabs a.on .icon { background: var(--primary-bg); }

    .page { padding-bottom: 40px; }
}

.foot {
    max-width: var(--column);
    margin: 0 auto;
    padding: 0 16px 24px;
    color: var(--muted);
    font-size: 0.875rem;
}

.foot a { font-weight: 600; white-space: nowrap; }

/* ---------- карточки ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card.empty { color: var(--ink-2); }

/* Кабинет закрыт (номер не найден, номер спорный): что делать — кнопкой. */
.card.state .button.primary { margin-top: 8px; }
.card.state .call-number { text-align: center; margin-top: 8px; }

/* Подзаголовок под h1: учебный год на «Мои дети». */
.subtitle { margin: -10px 0 16px; color: var(--ink-2); }

/* ---------- значки: вид договора, ребёнок (2-й круг) ---------- */

.kind-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary-bg);
    color: var(--primary);
}

.kind-icon svg { width: 22px; height: 22px; fill: currentColor; }

.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

/* Белые буквы на всех четырёх — контраст выше 4,5:1. */
.av0 { background: #3253a8; }
.av1 { background: #2b7d2f; }
.av2 { background: #b4470b; }
.av3 { background: #6d3fc4; }

/* Значок или кружок слева от заголовка страницы. */
.page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; }
.page-head .kind-icon { width: 48px; height: 48px; border-radius: 14px; }
.page-head .kind-icon svg { width: 26px; height: 26px; }

.child-head { display: flex; align-items: center; gap: 12px; }
.child-head.page-head { align-items: center; }

/* ---------- вход ---------- */

.auth {
    max-width: 420px;
    margin: 0 auto;
    padding: 32px 16px 16px;
}

.auth + .foot { max-width: 420px; text-align: center; }

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-brand strong { display: block; font-size: 1.25rem; }
.auth-brand span { color: var(--ink-2); }

/* Первый вход — сразу под «Войти» (№ 3), кнопкой (ревью 09.11, № 46). */
.first-time {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-2);
}

.first-time p { margin: 0 0 10px; }

/* ---------- поля и кнопки ---------- */

label {
    display: block;
    font-weight: 600;
    margin: 16px 0 6px;
}

input[type=tel], input[type=password], input[type=text], input[type=number] {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    font: inherit;
    font-size: 1.0625rem;  /* не меньше 16 px — иначе iPhone приближает страницу */
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--input);
    border-radius: 8px;
}

/* Подсказка в поле бледнее введённого текста — раньше «+7 701 123 45 67»
   принимали за уже набранный номер (№ 20). */
input::placeholder { color: var(--muted); opacity: 0.6; }

/* Код из SMS — крупно, с разрядкой, по центру (№ 7). */
input.code {
    font-size: 1.5rem;
    letter-spacing: 0.35em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

input:focus-visible, button:focus-visible, .button:focus-visible, a:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.help { color: var(--muted); font-size: 0.875rem; margin: 6px 0 0; }

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 20px;
    font: inherit;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--input);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
}

/* Кнопка после нажатия — серая, «Отправляем…» (parent.js, № 9). */
button:disabled { opacity: 0.6; cursor: default; }

button.primary, .button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
    width: 100%;
    margin-top: 24px;
}

.button.wide { width: 100%; }

/* «Показать пароль» — кнопка внутри поля (parent.js, № 8). */
.reveal-wrap { position: relative; }
.reveal-wrap input { padding-right: 96px; }

button.reveal {
    position: absolute;
    top: 2px;
    right: 2px;
    bottom: 2px;
    min-height: 0;
    padding: 0 14px;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 0.9375rem;
}

/* ---------- сообщения ---------- */

.notice {
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0 0 8px;
}

.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- мелочи форм ---------- */

/* Ссылки «назад» — 44 px под палец (№ 17). */
.back { margin: 0 0 16px; }
.back a { display: inline-flex; align-items: center; min-height: 44px; }

label.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 400;
    margin-top: 20px;
}

label.check input {
    width: 22px;
    height: 22px;
    margin: 2px 0 0;
    flex: none;
}

/* ---------- согласие на обработку персональных данных ---------- */

/* В форме входа по коду — окно с прокруткой: текст читается там же, где
   ставится отметка, а кнопка не уезжает на три экрана вниз. */
/* .card h2 снимает верхний отступ — здесь он нужен: заголовок идёт после поля. */
.card .consent-title { font-size: 1rem; margin: 24px 0 8px; }

.consent-box {
    max-height: 15rem;
    overflow-y: auto;
    padding: 12px 14px;
    border: 1px solid var(--input);
    border-radius: 8px;
    background: var(--mute-bg);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.consent-box:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.legal { font-size: 0.9375rem; line-height: 1.5; }
.legal h3 { font-size: 0.9375rem; margin: 16px 0 6px; }
.legal ul { margin: 0 0 12px; padding-left: 20px; }
.legal li { margin-bottom: 4px; }
.legal p:last-child { margin-bottom: 0; }
.legal-edition { color: var(--ink-2); font-size: 0.875rem; }

.consent-box .legal { font-size: 0.875rem; }
.consent-box .legal h3 { font-size: 0.875rem; }

/* Ссылка на согласие в подвале — своей строкой и с переносом: на 320 px
   в одну строку не помещается. */
.foot-legal { margin-top: 8px; }

.foot .foot-legal a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    font-weight: 400;
    white-space: normal;
}

/* ---------- метки ---------- */

.pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.mute { background: var(--mute-bg); color: var(--ink-2); }

/* ---------- сводка «Мои дети» (№ 1) ---------- */

.card.summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-label { color: var(--ink-2); }
.summary-sum { font-size: 2rem; line-height: 1.15; color: var(--bad); font-variant-numeric: tabular-nums; }
.summary-ok { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; color: var(--ok); }
.summary-ok .icon { width: 28px; height: 28px; }

/* За какие месяцы «к оплате сейчас» (ревью 09.11, № 44). */
.due-for { color: var(--ink-2); font-size: 0.9375rem; }
.due-for .pill { margin-left: 4px; }

/* Кнопка «Как оплатить» в сводке — в раздел «Оплата» (№ 38). */
.card.summary .button.primary { margin-top: 16px; }
.card.summary .muted { font-size: 0.9375rem; }

/* Полоса «оплачено из» на договоре (2-й круг). */
progress.paid {
    width: 100%;
    height: 10px;
    margin: 14px 0 6px;
    border: 0;
    border-radius: 999px;
    background: var(--mute-bg);
    overflow: hidden;
    appearance: none;
}

progress.paid::-webkit-progress-bar { background: var(--mute-bg); border-radius: 999px; }
progress.paid::-webkit-progress-value { background: var(--ok); border-radius: 999px; }
progress.paid::-moz-progress-bar { background: var(--ok); border-radius: 999px; }

.card.summary .paid-line { margin: 0; color: var(--ink-2); font-size: 0.9375rem; }

/* ---------- дети и договоры ---------- */

.card.child h2 { margin: 0; font-size: 1.2rem; }
.card.child h2 a { color: var(--ink); text-decoration: none; }
.card.child .child-head p { margin: 2px 0 0; }

/* Строка договора — ссылка, и это видно: стрелка справа (№ 10); слева —
   значок вида договора (2-й круг). */
a.contract {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
    border-top: 1px solid var(--line);
    padding: 12px 24px 12px 0;
}

.contract-body { flex: 1; min-width: 0; }

.contract-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 6px;
    font-size: 0.9375rem;
}

a.contract::after, a.other::after {
    content: "›";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.75rem;
    line-height: 1;
    color: var(--muted);
}

.card.child a.contract:first-of-type { margin-top: 14px; }

ul.contracts { list-style: none; margin: 0; padding: 0; }
ul.contracts a.card.contract { border: 1px solid var(--line); padding: 14px 40px 14px 14px; margin-bottom: 10px; }
ul.contracts a.card.contract::after { right: 16px; }

/* На компьютере ссылка-карточка откликается на мышь. */
@media (hover: hover) {
    a.contract:hover strong, a.card.other:hover strong { color: var(--primary); }
    a.card.contract:hover, a.card.other:hover { border-color: var(--input); }
}

.contract-head { display: flex; flex-direction: column; }
.contract-head strong { font-size: 1.0625rem; }

a.more {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 4px;
    font-weight: 600;
}

a.more::after { content: "›"; margin-left: 6px; font-size: 1.25rem; line-height: 1; }

h2.year { margin: 24px 0 10px; color: var(--ink-2); font-size: 1rem; }

/* Дети без договоров — внизу и коротко (№ 11). */
ul.others { list-style: none; margin: 0; padding: 0; }

a.card.other {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 2px 12px;
    padding: 14px 40px 14px 16px;
    margin-bottom: 8px;
    color: var(--ink);
    text-decoration: none;
}

a.card.other::after { right: 16px; }

/* ---------- деньги ---------- */

.money { margin: 8px 0 0; }
p.money.ok { color: var(--ok); font-weight: 600; }

/* Деньги в строке договора — подпись над суммой, пары рядом, а на узком
   экране друг под другом: «подпись … сумма» в одну строку рядом со
   значком не помещалось и рвалось (2-й круг). */
dl.money {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

dl.money div { display: flex; flex-direction: column; }
dl.money dt { color: var(--ink-2); font-size: 0.875rem; }
dl.money dd { margin: 0; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
dl.money .due dd { color: var(--bad); font-size: 1.125rem; }

dl.facts div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}

dl.facts dt { color: var(--ink-2); }
dl.facts dd { margin: 0; font-weight: 600; text-align: right; }

dl.facts { margin: 0; }

.paid-line { margin: 8px 0 0; font-size: 0.9375rem; }

/* На узком экране подпись — над значением: ФИО и школа справа рвались
   на две-три строки (№ 6). */
@media (max-width: 480px) {
    dl.facts div { display: block; padding: 6px 0; }
    dl.facts dd { text-align: left; margin-top: 2px; }
}

/* ---------- график и оплаты строками (№ 4, 5) ---------- */

ul.rows {
    list-style: none;
    margin: 0 0 16px;
    padding: 4px 16px;
}

/* Метка — в колонке постоянной ширины: «долг» и «оплачено» разной длины
   сдвигали суммы, и столбец сумм шёл лесенкой (2-й круг). */
.row {
    display: grid;
    grid-template-columns: 1fr auto 5.5rem;
    align-items: center;
    gap: 2px 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.row:first-child { border-top: 0; }
.row-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sum { white-space: nowrap; font-weight: 600; text-align: right; }
.row-note { grid-column: 1 / -1; color: var(--muted); font-size: 0.875rem; }
.row .pill { justify-self: stretch; text-align: center; padding: 2px 6px; }
.row.total { font-weight: 700; }
ul.rows.two .row { grid-template-columns: 1fr auto; }

/* Месяц: полностью, а на самых узких телефонах — коротко. */
.m-short { display: none; }

@media (max-width: 360px) {
    .m-long { display: none; }
    .m-short { display: inline; }
    ul.rows { padding: 4px 12px; }
    .row { gap: 2px 8px; }
}

/* ---------- оплата ---------- */

.card.pay .button.primary { margin: 0 0 16px; }

.pay-number {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin: 0 0 12px;
    font-size: 1.0625rem;
}

.pay-number strong { font-size: 1.25rem; user-select: all; }

/* «Скопировать» номер договора для Kaspi (parent.js, № 19). */
button.copy { min-height: 44px; padding: 6px 16px; font-size: 0.9375rem; }

/* ---------- 3-й круг (09.11): меню, разделы, переходы ---------- */

/* Отклик на нажатие: подсветка касания выключена (body), и на медленном
   интернете карточку жали ещё раз — не поняв, что нажатие принято (№ 50).
   В iOS :active включает parent.js. */
a.card:active, a.contract:active, .tabs a:active, .kids-switch a:active,
.action:active, details > summary:active { background: var(--mute-bg); }
.button:active, button:active { filter: brightness(0.94); }

/* Переключатель детей на странице ребёнка (№ 42): ряд «пилюль», листается
   вбок; ребёнок, на чьей странице вы, — подсвечен. */
.kids-switch {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: -4px -16px 16px;
    padding: 4px 16px 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.kids-switch::-webkit-scrollbar { display: none; }

.kids-switch a {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 16px 4px 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.kids-switch a.on { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); }

.avatar.sm { width: 34px; height: 34px; font-size: 0.8125rem; }

/* Прошлые годы на странице ребёнка — свёрнуты (№ 43). */
details.past { margin-top: 24px; }

details.past > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

details.past > summary .muted { font-weight: 400; }
details.past[open] > summary { margin-bottom: 4px; }

details > summary::-webkit-details-marker { display: none; }

details.past > summary::after, .faq summary::after {
    content: "›";
    margin-left: auto;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.15s;
}

details[open] > summary::after { transform: rotate(90deg); }

h3.year { margin: 20px 0 10px; color: var(--ink-2); font-size: 1rem; }

/* Шаги оплаты в Kaspi (№ 49): номер в кружке, текст рядом. */
ol.steps {
    list-style: none;
    counter-reset: step;
    margin: 0 0 16px;
    padding: 0;
}

ol.steps li {
    position: relative;
    counter-increment: step;
    min-height: 28px;
    margin-bottom: 10px;
    padding-left: 40px;
}

ol.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: -1px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 700;
}

.card.pay .button.primary { margin: 4px 0 12px; }

/* Раздел «Оплата» (№ 37): договор — карточкой с суммой, номером и кнопками. */
ul.pay-list { list-style: none; margin: 0; padding: 0; }

.pay-head { display: flex; align-items: center; gap: 12px; }
.pay-head strong, .pay-head span { display: block; }
.pay-item dl.money { margin: 12px 0; }

.pay-item .pay-number {
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.pay-actions { display: flex; flex-direction: column; }
.pay-actions .button.primary { margin: 12px 0 0; }
.pay-actions a.more { align-self: flex-start; }

/* Раздел «Помощь» (№ 41). */
.card.call .button.primary { margin-top: 4px; }
.button.call { gap: 8px; }

.card.faq { padding: 0 20px; }

.faq details + details { border-top: 1px solid var(--line); }

.faq summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 0;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.faq details p { margin: 0 0 12px; }
.faq details p:last-child { margin-bottom: 16px; }

/* Раздел «Профиль» (№ 39, 40). */
.card.who { display: flex; flex-direction: column; gap: 2px; }
.who-phone { font-size: 1.375rem; font-variant-numeric: tabular-nums; }

.card.actions { padding: 6px 0; }
.card.actions form { margin: 0; }
.card.actions .help { padding: 0 20px 12px 56px; margin: -6px 0 0; }

.action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 8px 20px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    justify-content: flex-start;
}

.action .icon { color: var(--primary); }
.card.actions > * + .action { border-top: 1px solid var(--line); }

button.exit {
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    border-color: var(--bad);
    color: var(--bad);
}

.help.center { text-align: center; margin-top: 12px; }

/* ---------- 4-й круг (09.11): браузер на компьютере ---------- */

/* «Перейти к содержанию» — видна только при фокусе с клавиатуры (№ 60). */
.skip {
    position: absolute;
    left: 12px;
    top: -80px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--primary);
    color: var(--primary-ink);
    font-weight: 600;
    text-decoration: none;
}

.skip:focus { top: 8px; }
main:focus { outline: none; }

/* «Хлебные крошки» над заголовком внутренней страницы (№ 57). */
.crumbs { margin: -8px 0 8px; font-size: 0.9375rem; }

.crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.crumbs [aria-current] { color: var(--ink-2); }

/* Профиль — узкой колонкой и на широком экране. */
.narrow { max-width: 560px; }

/* «Распечатать» — только на широком экране, включает parent.js (№ 58). */
.print-btn { display: none; }

/* Пояснение у входа — только на широком экране (№ 59). */
.auth-intro { display: none; }

/* Мышь: пункты меню, переключатель детей, вопросы, кнопки отзываются на
   наведение (№ 61). Только там, где есть мышь, — на телефоне подсветка
   «залипала» бы после касания. */
@media (hover: hover) {
    .tabs a:not(.on):hover { background: var(--mute-bg); color: var(--ink); }
    .button:hover, button:hover { filter: brightness(0.95); }
    .kids-switch a:not(.on):hover { border-color: var(--input); }
    .faq summary:hover, details.past > summary:hover { color: var(--primary); }
    .action:hover { background: var(--mute-bg); }
}

/* Широкий экран, от 1024 px: колонка до 1 120 px и раскладка по страницам
   (№ 51) — вместо одной ленты 720 px посреди пустого экрана. */
@media (min-width: 1024px) {
    :root { --column: 1120px; }

    /* «Мои дети»: дети слева, сводка справа и не уезжает (№ 52). */
    .home-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        gap: 24px;
        align-items: start;
    }

    .home-grid > .side { grid-column: 2; grid-row: 1; position: sticky; top: 84px; margin: 0; }
    .home-grid > .home-kids { grid-column: 1; grid-row: 1; }

    /* Строка договора у ребёнка: деньги справа, в той же строке (№ 54). */
    .card.child .contract-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px 24px;
    }

    .card.child .contract-body .money { margin: 0; }
    .card.child a.contract { align-items: center; }

    /* Договор: две колонки (№ 53), как «Мои дети»: слева деньги, график,
       оплаты и сведения; справа «Как оплатить» с номером — и не уезжает при
       прокрутке. Нечего платить — справа сведения о договоре. */
    .contract-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 360px;
        /* Лишняя высота правой колонки — в последнюю строку, а не дырой
           между сводкой и оплатами (у развозки нет графика). */
        grid-template-rows: auto auto auto 1fr;
        gap: 20px 24px;
        align-items: start;
    }

    .contract-grid > .card { margin: 0; }
    .c-summary { grid-column: 1; grid-row: 1; }
    .c-pay { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 84px; }
    .c-schedule { grid-column: 1; grid-row: 2; }
    .c-payments { grid-column: 1; grid-row: 3; }
    .c-about { grid-column: 1; grid-row: 4; }
    .contract-grid.no-pay .c-about { grid-column: 2; grid-row: 1 / span 4; }
    .c-schedule > h2:first-child, .c-payments > h2:first-child, .c-about > h2:first-child { margin-top: 0; }
    .c-pay .button.primary { margin-top: 4px; }

    .print-btn:not([hidden]) { display: flex; margin-bottom: 16px; }

    /* Ребёнок и «Оплата»: карточки договоров — по две в ряд (№ 55). */
    ul.contracts {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    ul.contracts li { display: flex; }
    ul.contracts a.card.contract { flex: 1; margin: 0; }

    .pay-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        gap: 24px;
        align-items: start;
    }

    .pay-grid > .pay-top { grid-column: 2; grid-row: 1; position: sticky; top: 84px; }
    .pay-grid > .pay-contracts { grid-column: 1; grid-row: 1; }
    .pay-contracts > h2 { margin-top: 0; }

    ul.pay-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .pay-item { display: flex; flex-direction: column; margin: 0; }
    .pay-item .pay-number { margin-top: auto; }

    /* «Помощь»: Приёмная слева и не уезжает, вопросы справа (№ 56). */
    .help-grid {
        display: grid;
        grid-template-columns: 340px minmax(0, 1fr);
        gap: 24px;
        align-items: start;
    }

    .help-grid > .call { position: sticky; top: 84px; margin: 0; }
    .faq-wrap > h2 { margin-top: 0; }
}

/* Вход на широком экране: слева — что в кабинете и как войти первый раз,
   справа — форма (№ 59). Без :has (старый браузер) — как на телефоне. */
@media (min-width: 900px) {
    @supports selector(:has(a)) {
        .auth:has(.auth-split), .auth:has(.auth-split) + .foot { max-width: 1000px; }
        .auth:has(.auth-split) { padding-top: 56px; }

        .auth-split {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 420px;
            gap: 56px;
            align-items: center;
        }

        .auth-intro { display: block; }
    }
}

.auth-intro h2 { margin: 0 0 20px; font-size: 1.75rem; line-height: 1.2; }
.intro-list { list-style: none; margin: 0 0 20px; padding: 0; }

.intro-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    font-size: 1.0625rem;
}

.intro-list .icon {
    width: 44px;
    height: 44px;
    padding: 10px;
    border-radius: 12px;
    background: var(--primary-bg);
    color: var(--primary);
}

/* Печать (Ctrl+P или «Распечатать», № 58): без меню, кнопок, теней и
   серого фона; цвета — светлые и в тёмной теме (иначе светлый текст на
   белой бумаге); строки графика не рвутся между страницами. */
@media print {
    :root {
        --primary: #1d3a8a;
        --ink: #000000;
        --ink-2: #333333;
        --muted: #444444;
        --bg: #ffffff;
        --surface: #ffffff;
        --line: #bbbbbb;
        --ok: #1a5e1f;
        --bad: #9a1410;
        --warn: #7a3a00;
        --primary-bg: #ffffff;
        --mute-bg: #ffffff;
        --shadow: none;
        color-scheme: light;
    }

    @page { margin: 14mm 12mm; }

    body { background: #ffffff; font-size: 11pt; }

    .skip, .tabs, .appbar-back, .kids-switch, details.past, button, .button,
    .card.download, .pay-actions, .notice { display: none !important; }

    .top { position: static; border-bottom: 1px solid var(--line); }
    .top-in { min-height: 0; padding: 0 0 8px; }
    .brand.inner { display: flex; }
    .page { max-width: none; padding: 12px 0 0; }
    .crumbs { display: block; margin: 0 0 8px; }
    .crumbs a { min-height: 0; }
    a { color: inherit; text-decoration: none; }

    .card { box-shadow: none; border: 1px solid var(--line); break-inside: avoid; }
    .row { break-inside: avoid; }
    h2 { break-after: avoid; }
    .pill { border: 1px solid currentColor; }
    progress.paid { display: none; }
    .contract-grid, .home-grid, .pay-grid, .help-grid, ul.contracts, ul.pay-list { display: block; }
}
