/* Кабинет родителя (docs/PARENT-CABINET.md, раздел 1): сначала телефон
   320–390 px, потом широкий экран. Цвета и шрифт — брендбука EduSpaceApp
   (docs/brand/BRANDBOOK.md), те же значения, что у кабинета сотрудников.
   Без встроенных стилей в разметке: их не пускает политика заголовков. */

@font-face {
    font-family: "Onest";
    src: url("fonts/Onest-Variable.woff") format("woff");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --indigo: #3B33C8;
    --indigo-dark: #2F28A6;
    --indigo-light: #EEEDFC;
    --lavender: #C9C5FF;
    --ink: #1B1D3A;
    --graphite: #4A4D6A;
    --fog: #6B6E8A;
    --line: #E3E4EE;
    --input-line: #B9BBCF;
    --paper: #F6F6FB;
    --surface: #FFFFFF;
    --error: #B02A30;
    --error-bg: #FDECEC;
    --info: #1F56B0;
    --info-bg: #EAF1FD;
    --success: #136B43;
    --success-bg: #E8F5EE;
    --font: "Onest", "Golos Text", "Segoe UI", Roboto, Arial, sans-serif;
    /* Сенсорные цели: кнопки и поля — 48 px, не меньше 44 px у ссылок. */
    --touch: 48px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--indigo);
}

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

/* Суммы и даты — моноширинными цифрами: разряды стоят столбиком. */
.money,
.nowrap {
    font-variant-numeric: tabular-nums;
}

.nowrap {
    white-space: nowrap;
}

/* ---------- Кнопки ---------- */

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--touch);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.button-primary {
    background: var(--indigo);
    color: #fff;
}

.button-secondary {
    background: var(--surface);
    border-color: var(--indigo);
    color: var(--indigo);
}

@media (hover: hover) {
    .button-primary:hover {
        background: var(--indigo-dark);
    }

    .button-secondary:hover {
        background: var(--indigo-light);
    }
}

.button-primary:active {
    background: var(--indigo-dark);
}

.button-secondary:active {
    background: var(--indigo-light);
}

/* ---------- Вход, код, ошибки (AuthLayout) ---------- */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.auth-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px 12px max(16px, env(safe-area-inset-bottom));
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px 20px 12px;
    box-shadow: 0 1px 2px rgba(27, 29, 58, 0.04), 0 8px 24px rgba(27, 29, 58, 0.06);
}

.auth-brand {
    margin-bottom: 24px;
}

.auth-brand img {
    display: block;
    height: 28px;
    width: auto;
}

.auth-cabinet {
    margin: 14px 0 0;
    color: var(--indigo);
    font-weight: 600;
}

.auth-client {
    display: block;
    color: var(--graphite);
    font-size: 0.9375rem;
}

.auth-title {
    margin: 0 0 16px;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.333;
    letter-spacing: -0.005em;
}

.auth-lead {
    margin: 0 0 16px;
    color: var(--graphite);
}

.auth-hint {
    margin: 16px 0 0;
    color: var(--fog);
    font-size: 0.875rem;
}

.auth-back {
    margin: 16px 0 0;
}

.auth-back a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 500;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.auth-form label {
    margin-top: 8px;
    color: var(--graphite);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* 17 px в поле ввода: меньше — и iOS увеличивает страницу при фокусе. */
.auth-form input {
    width: 100%;
    min-height: var(--touch);
    padding: 10px 14px;
    border: 1px solid var(--input-line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1.0625rem;
}

.auth-form input:focus {
    outline: 2px solid var(--indigo);
    outline-offset: 0;
    border-color: var(--indigo);
}

.auth-form .button {
    margin-top: 16px;
}

.auth-languages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 6px;
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.auth-languages a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--graphite);
    text-decoration: none;
}

.auth-languages a.current {
    background: var(--indigo-light);
    color: var(--indigo);
    font-weight: 600;
}

/* ---------- Кабинет: шапка и страница (ParentLayout) ---------- */

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.top-home {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.top-home img {
    flex: none;
    width: 32px;
    height: 32px;
}

/* Название организации — до двух строк: на 320 px в одну строку «Образовательный
   комплекс «Демо»» не помещается, а многоточие съедает главное — само имя (ревью 8.8). */
.top-client {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.25;
    font-weight: 600;
}

.page {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 12px max(24px, env(safe-area-inset-bottom));
}

.page-title {
    margin: 0 0 16px;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.333;
}

.page-lead {
    margin: 0 0 16px;
    color: var(--graphite);
}

/* ---------- Сообщения, поля, согласие ---------- */

.message {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    line-height: 1.45;
}

.message-error {
    background: var(--error-bg);
    color: var(--error);
}

.message-info {
    background: var(--info-bg);
    color: var(--info);
}

.problems {
    padding-left: 32px;
}

.field-hint {
    margin: 2px 0 0;
    color: var(--fog);
    font-size: 0.875rem;
}

/* Поле пароля и кнопка «Показать» — в одной рамке. */
.password-field {
    position: relative;
}

.auth-form .password-field input {
    padding-right: 104px;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    min-width: 44px;
    padding: 0 14px;
    border: none;
    background: none;
    color: var(--indigo);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

/* Код из SMS — крупно и с разрядкой: шесть цифр читаются с первого взгляда. */
.auth-form input.code-input {
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    font-variant-numeric: tabular-nums;
}

.check {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 16px;
    color: var(--ink);
    cursor: pointer;
}

.auth-form .check input {
    flex: none;
    width: 24px;
    min-height: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    accent-color: var(--indigo);
}

.consent-box {
    margin-top: 4px;
}

.consent-box summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--indigo);
    font-weight: 500;
    cursor: pointer;
}

.consent-box .consent-text {
    max-height: 280px;
    overflow-y: auto;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.consent-text p {
    margin: 0 0 12px;
    color: var(--graphite);
    font-size: 0.9375rem;
}

.consent-text .consent-edition {
    margin: 0;
    color: var(--fog);
    font-size: 0.875rem;
}

.auth-card form + form {
    margin-top: 12px;
}

/* ---------- Профиль ---------- */

.facts {
    margin: 0 0 24px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.facts > div {
    padding: 12px 16px;
}

.facts > div + div {
    border-top: 1px solid var(--line);
}

.facts dt {
    color: var(--fog);
    font-size: 0.875rem;
}

.facts dd {
    margin: 2px 0 0;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.actions .field-hint {
    margin-top: 6px;
}

.languages {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 24px;
}

.languages a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--graphite);
    text-decoration: none;
}

.languages a.current {
    background: var(--indigo-light);
    color: var(--indigo);
    font-weight: 600;
}

/* ---------- Нижнее меню ---------- */

/* На телефоне — внизу, под большой палец, с отступом под полосу «Домой» у iPhone. */
.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    color: var(--graphite);
    font-weight: 500;
    text-decoration: none;
}

.tab.active {
    color: var(--indigo);
    font-weight: 600;
    box-shadow: inset 0 3px 0 var(--indigo);
}

/* Место под нижним меню: последняя кнопка страницы не прячется под ним. */
.page {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ---------- Широкий экран ---------- */

@media (min-width: 600px) {
    .auth-main {
        align-items: center;
        padding: 32px 24px;
    }

    .auth-card {
        padding: 32px 32px 16px;
    }

    .auth-brand img {
        height: 32px;
    }

    .top {
        padding: 0 24px;
    }

    .page {
        padding: 24px;
    }

    /* Сведения и кнопки — колонкой для чтения, а не во всю ширину экрана. */
    .facts,
    .actions,
    .page-lead,
    .page > .button {
        max-width: 560px;
    }
}

/* Широкий экран: то же меню — в правой части шапки. */
@media (min-width: 900px) {
    .tabs {
        top: 0;
        bottom: auto;
        left: auto;
        right: 24px;
        height: 56px;
        gap: 4px;
        padding: 0;
        background: transparent;
        border-top: none;
    }

    .tab {
        flex: none;
        padding: 0 16px;
    }

    .tab.active {
        box-shadow: inset 0 -3px 0 var(--indigo);
    }

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

/* ---------- Дети, договоры, деньги (шаг 8.3) ---------- */

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

.section-title {
    margin: 24px 0 8px;
    font-size: 1.125rem;
    font-weight: 600;
}

.ok-note {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--success-bg);
    color: var(--success);
}

/* Главное сверху: сколько к оплате — крупно, по юрлицам. */
.due-box {
    margin: 0 0 16px;
    padding: 16px;
    border-radius: 16px;
    background: var(--indigo-light);
}

.due-title,
.due-label {
    margin: 0 0 8px;
    color: var(--indigo);
    font-size: 1rem;
    font-weight: 600;
}

.due-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 6px 0;
}

.due-row + .due-row {
    border-top: 1px solid var(--lavender);
}

.due-amount {
    margin: 0 0 4px;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink);
}

.due-amount.paid {
    color: var(--success);
}

.due-facts {
    margin: 12px 0 0;
}

/* Не помещается рядом с подписью — значение уходит строкой ниже, вправо, а не за край экрана. */
.due-facts > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 12px;
    padding: 4px 0;
}

.due-facts dt {
    color: var(--graphite);
}

.due-facts dd {
    margin: 0 0 0 auto;
    text-align: right;
}

/* «Как оплатить» под суммами на главной. */
.due-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 4px;
    color: var(--indigo);
    font-weight: 600;
    text-decoration: none;
}

.by-service {
    margin: 8px 0 0;
    padding: 8px 0 0;
    list-style: none;
    border-top: 1px solid var(--lavender);
}

.by-service li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
}

/* Карточка ребёнка и списки договоров. */
.card {
    margin: 0 0 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.card:empty {
    display: none;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 12px 16px 0;
    color: var(--ink);
    text-decoration: none;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.place {
    margin: 2px 16px 8px;
    color: var(--graphite);
}

/* На странице ребёнка — под заголовком, без отступа карточки. */
.page > .place {
    margin: -8px 0 16px;
}

.chevron {
    flex: none;
    color: var(--fog);
    font-size: 1.5rem;
    line-height: 1;
}

.contract-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}

.card > .contract-row:first-child {
    border-top: none;
}

.contract-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.contract-entity {
    font-weight: 600;
}

.contract-main .muted {
    font-size: 0.875rem;
}

.contract-money {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    font-size: 0.875rem;
}

.money.due {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.paid {
    color: var(--success);
    font-weight: 600;
}

@media (hover: hover) {
    .contract-row:hover,
    .card-head:hover {
        background: var(--paper);
    }
}

.switcher {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
    overflow-x: auto;
}

.switcher a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    color: var(--graphite);
    text-decoration: none;
    white-space: nowrap;
}

.switcher a.current {
    border-color: var(--indigo);
    background: var(--indigo-light);
    color: var(--indigo);
    font-weight: 600;
}

.past > summary,
.more > summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 8px;
    color: var(--indigo);
    font-weight: 500;
    cursor: pointer;
}

.back {
    margin: 0 0 4px;
}

.back a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
    font-weight: 500;
}

/* Строки графика, оплат, месяцев: на телефоне — две строки слева, сумма справа. */
.rows {
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
}

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

.row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.row-main .muted {
    font-size: 0.875rem;
}

.row-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: none;
    text-align: right;
}

.money {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.money.minus {
    color: var(--error);
}

.chip {
    align-self: flex-start;
    margin-top: 4px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--paper);
    color: var(--graphite);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.mark-paid .chip {
    background: var(--success-bg);
    color: var(--success);
}

.mark-partial .chip,
.mark-due .chip {
    background: #FFF4DC;
    color: #8A5100;
}

.mark-due .money {
    font-weight: 700;
}

.mark-ahead {
    color: var(--graphite);
}

/* В графике отметка — под суммой справа: строка в две строчки, а не в три. */
.row-side .chip {
    align-self: flex-end;
}

/* Месяц без оплаты (лето в саду): не «оплачено», а серым. */
.mark-free {
    color: var(--graphite);
}

.facts .line {
    display: block;
}

/* ---------- Как оплатить, оплата (шаг 8.4) ---------- */

.pay-way {
    margin: 0 0 12px;
    padding: 12px 16px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.pay-way-title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
}

.steps {
    margin: 0 0 12px;
    padding-left: 22px;
}

.steps > li + li {
    margin-top: 8px;
}

.copy-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.account {
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--indigo-light);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.copy {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--indigo);
    border-radius: 18px;
    background: var(--surface);
    color: var(--indigo);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.hint {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
}

.bills {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.bills li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
}

.bills .money {
    font-weight: 700;
}

.requisites {
    margin: 0;
}

.requisites > div {
    padding: 6px 0;
}

.requisites > div + div {
    border-top: 1px solid var(--line);
}

.requisites dt {
    color: var(--fog);
    font-size: 0.875rem;
}

.requisites dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.requisites dd .copy {
    margin-left: 8px;
}

.pay-note {
    margin: 0 0 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--info-bg);
    color: var(--info);
    white-space: pre-line;
}

.due-head {
    margin: 0;
    padding-bottom: 12px;
    gap: 12px;
}

/* ---------- Документы и акт сверки (шаг 8.5) ---------- */

.docs .doc-title {
    font-weight: 500;
    text-decoration: none;
}

.docs .row {
    align-items: center;
}

/* «Word» — отдельная кнопка рядом с названием: на телефоне палец не попадёт в соседнюю строку. */
.doc-word {
    display: inline-flex;
    flex: none;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--indigo);
    border-radius: 22px;
    color: var(--indigo);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.page-actions {
    margin: 0 0 8px;
}

.page-actions .button {
    max-width: 320px;
}

/* Лист документа — белый, вёрстку таблиц, кегль и рамки ставит сам документ (DocxPreview). */
.doc-preview {
    margin: 16px -12px 0;
    padding: 8px 0;
    background: var(--line);
    overflow-x: auto;
}

.doc-sheet {
    max-width: 210mm;
    margin: 0 auto;
    padding: 20px 16px;
    background: #fff;
    color: #131a24;
    font-family: "Times New Roman", Georgia, serif;
    line-height: 1.45;
    overflow-wrap: break-word;
}

.doc-sheet p {
    margin: 0 0 6px;
}

/* Fixed: ширины колонок — из документа, длинный ИИК не выталкивает таблицу за лист. */
.doc-sheet .doc-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.doc-sheet .doc-table td {
    padding: 0 5.4pt;
    vertical-align: top;
    overflow-wrap: break-word;
}

.doc-sheet .doc-table td.doc-gap {
    padding: 0;
    border: none;
}

.doc-sheet .doc-table td p {
    margin: 0;
}

.doc-sheet .doc-body {
    line-height: 1.15;
}

.doc-tag {
    padding: 0 3px;
    border-radius: 3px;
    background: #fde7e7;
    color: #b3261e;
    font-weight: 600;
}

.doc-cut,
.doc-empty {
    color: #5f6b7a;
    font-style: italic;
}

/* На телефоне строка в 40 знаков: выравнивание по ширине рвёт её пробелами в полстроки — там текст по левому краю.
   Таблица без сетки Word (график платежей) — колонки по содержимому, а не поровну: иначе дата «10.09.2026»
   рвётся посередине; сетка из Word по-прежнему задаёт доли, длинный ИИК переносится. На бумаге и широком
   экране — всё как в документе. */
@media screen and (max-width: 599.98px) {
    .doc-sheet [style*="text-align:justify"] {
        text-align: left !important;
    }

    .doc-sheet .doc-table {
        table-layout: auto;
    }

    .doc-sheet .doc-table td {
        padding: 0 3px;
        overflow-wrap: anywhere;
    }
}

/* Период акта: две даты и кнопки; на телефоне — столбиком. */
.period {
    display: grid;
    gap: 8px 12px;
    margin: 0 0 16px;
}

.period .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--graphite);
    font-size: 0.9375rem;
    font-weight: 500;
}

.period .input {
    width: 100%;
    min-height: var(--touch);
    padding: 8px 12px;
    border: 1px solid var(--input-line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1.0625rem;
}

.period-actions {
    display: flex;
    gap: 8px;
    align-self: end;
}

.period-actions .button {
    width: auto;
    flex: 1;
    padding: 10px 20px;
    white-space: nowrap;
}

.act {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.act-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
}

.act-subtitle {
    margin: 4px 0 16px;
    color: var(--graphite);
    text-align: center;
}

.act-parties {
    margin: 0 0 16px;
}

.act-parties > div {
    padding: 4px 0;
}

.act-parties dt {
    color: var(--fog);
    font-size: 0.875rem;
}

.act-parties dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Таблица акта шире телефона — листается вбок внутри себя, а не всей страницей. */
.act-scroll {
    overflow-x: auto;
}

.act-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.act-table th,
.act-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.act-table th {
    color: var(--fog);
    font-size: 0.8125rem;
    font-weight: 500;
}

.act-table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.act-total td {
    font-weight: 600;
}

.act-date {
    white-space: nowrap;
}

/* Телефон: акт строками — дата, операция, сумма с подписью. Суммы не уходят за край экрана. */
@media screen and (max-width: 599.98px) {
    .act-scroll {
        overflow: visible;
    }

    .act-table {
        min-width: 0;
    }

    .act-table thead {
        display: none;
    }

    .act-table,
    .act-table tbody,
    .act-table tr,
    .act-table td {
        display: block;
    }

    .act-table tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--line);
    }

    .act-table td {
        padding: 0;
        border: none;
    }

    .act-table .act-date {
        color: var(--fog);
        font-size: 0.875rem;
    }

    .act-table td.num {
        display: flex;
        justify-content: space-between;
        gap: 12px;
    }

    .act-table td.num::before {
        content: attr(data-label);
        color: var(--fog);
        font-size: 0.875rem;
        font-weight: 400;
    }

    /* Пустая ячейка (нет даты у итога, нет суммы в другой колонке) — без строки. После правила сумм: та же сила. */
    .act-table td:empty {
        display: none;
    }
}

.act-conclusion {
    margin: 16px 0 4px;
    font-weight: 500;
}

.act-made {
    margin: 0;
    font-size: 0.875rem;
}

@media (min-width: 600px) {
    .doc-preview {
        margin: 16px 0 0;
        padding: 20px 12px;
        border-radius: 12px;
    }

    .doc-sheet {
        padding: 48px 56px;
        border: 1px solid #cfd6dd;
        border-radius: 4px;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.14);
    }

    .period {
        grid-template-columns: repeat(2, minmax(0, 200px)) auto;
        justify-content: start;
    }

    .act {
        padding: 24px;
    }
}

/* Печать: только акт или лист документа — без шапки, меню и формы периода. */
@media print {
    body {
        background: #fff;
    }

    .top,
    .tabs,
    .no-print,
    .back,
    .page-actions,
    .page-actions + .muted {
        display: none !important;
    }

    .page {
        max-width: none;
        padding: 0;
    }

    .act,
    .doc-preview,
    .doc-sheet {
        padding: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: #fff;
    }

    .act-scroll {
        overflow: visible;
    }

    .act-table {
        min-width: 0;
    }
}

/* Переключатель языков на 320 px — в одну строку: три названия с полями 12 px
   не помещались, и «English» уезжал отдельной строкой (ревью 8.8). */
@media (max-width: 359.98px) {
    .auth-languages,
    .languages {
        gap: 4px 2px;
    }

    .auth-languages a,
    .languages a {
        padding: 0 8px;
    }
}
