/* ============================================================================
   Первая детская поликлиника — личный кабинет пациента для сайта клиники.
   Мир снят с сайта: тёплый коричневый на белом, кремовые скруглённые листы с
   волосяной линией, белые карточки внутри, кнопки-пилюли с обводкой,
   Wix Madefor Display в заголовках, Inter в тексте.
   Свои предметы кабинета: обложка карты пациента, закладки, талон с корешком.
   Залитая кнопка — одна на экран и только у действия, которое что-то создаёт.
   Сначала телефон; раскладка расширяется на 720, 900 и 1100px.
   ========================================================================== */

:root {
    --pd-accent: #8F684B;        /* фирменный коричневый: обводка кнопок, выбранное, подвал */
    --pd-accent-deep: #794F3A;   /* текст и значки на светлом, обложка карты, залитая кнопка */
    --pd-accent-press: #5E3826;  /* наведение и нажатие на залитой кнопке */
    --pd-accent-soft: #B6906F;   /* тихие детали: шевроны, линия отрыва талона */
    --pd-tint: #F0E3D6;          /* тёплая заливка: выбранная строка, корешок талона, чипы */
    --pd-rose: #F3DBD0;          /* наведение на вторичную кнопку */
    --pd-line: #E7E2DA;          /* волосяная линия листов и карточек */
    --pd-line-strong: #D5CBBE;   /* линия чипов выбора и спокойных кнопок */
    --pd-control-line: #A0856D;  /* граница полей ввода и переключателей: 3:1 к фону, поле видно и пустым */
    --pd-bg: #FFFFFF;
    --pd-card: #FAF8F5;          /* кремовый лист */
    --pd-field: #FFFFFF;         /* карточки и поля на листе */
    --pd-header: #FAF7F0;        /* полоса шапки */
    --pd-ink: #3D2E22;           /* заголовки, названия, значения */
    --pd-text: #33302A;          /* текст-чтение */
    --pd-ink-soft: #6E6659;      /* вторичный текст */
    --pd-on-deep: #EADCD0;       /* подписи на обложке */
    --pd-sun-bg: #FFF3D1;        /* «в работе», предупреждение */
    --pd-sun-ink: #7A5200;
    --pd-leaf-bg: #DFF1EE;       /* «готово», «активна» */
    --pd-leaf-ink: #0E6F67;
    --pd-danger: #C62839;
    --pd-danger-bg: #FBE7E9;
    --pd-quiet-bg: #EFEBE5;      /* «отменена», «время прошло» */
    --pd-radius: 20px;           /* карточки */
    --pd-radius-lg: 28px;        /* листы, обложка */
    --pd-radius-field: 12px;     /* поля ввода */
    --pd-radius-small: 14px;     /* строки выбора, чипы */
    --pd-display: "Wix Madefor Display", system-ui, -apple-system, "Segoe UI", sans-serif;
    --pd-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex; flex-direction: column;
    background: var(--pd-bg);
    color: var(--pd-text);
    font-family: var(--pd-sans);
    font-size: 16px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--pd-accent-deep); }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--pd-accent); outline-offset: 2px; }
.site-main:focus { outline: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex-shrink: 0; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 16px; top: -64px; z-index: 200;
    padding: 10px 18px; border-radius: 999px;
    background: var(--pd-field); color: var(--pd-accent-deep); border: 2px solid var(--pd-accent);
    font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.wrap { width: 100%; max-width: 1168px; margin: 0 auto; padding: 0 16px; }
.site-main { flex: 1; }

/* ---- шапка: кремовая полоса с волосяной линией, как на сайте ---- */
.site-header { background: var(--pd-header); border-bottom: 1px solid var(--pd-line); }
.site-header-row { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.site-logo { display: flex; align-items: center; flex-shrink: 0; min-height: 44px; border-radius: var(--pd-radius-field); }
.site-logo img { display: block; height: 40px; width: auto; }
.site-header-tag {
    display: none;
    padding-left: 12px; border-left: 1px solid var(--pd-line-strong);
    font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--pd-ink-soft);
}
.site-header-side { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.site-phone {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    min-width: 44px; min-height: 44px; padding: 0 6px; border-radius: var(--pd-radius-field);
    color: var(--pd-ink); text-decoration: none;
}
.site-phone .ico { width: 22px; height: 22px; color: var(--pd-accent-deep); }
/* на телефоне от номера остаётся значок-кнопка; сам номер читается скринридером */
.site-phone-text {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.site-phone-label { font-size: 12px; font-weight: 600; color: var(--pd-ink-soft); }
.site-phone-num { font-size: 15px; font-weight: 700; }
.site-header .site-back { display: none; }

/* ---- кнопки: пилюли; главная — белая с коричневой обводкой, заливается при наведении и нажатии ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 12px 24px;
    font: 700 16px/20px var(--pd-sans); text-align: center; text-decoration: none;
    color: inherit; background: none;
    border: 2px solid transparent; border-radius: 999px; cursor: pointer;
    transition: background-color .18s ease-out, color .18s ease-out, border-color .18s ease-out, transform .18s ease-out;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--pd-field); color: var(--pd-accent-deep); border-color: var(--pd-accent); }
.btn-primary:active { background: var(--pd-accent); color: #fff; }
.btn-secondary { background: var(--pd-tint); color: var(--pd-accent-deep); }
.btn-secondary:active { background: var(--pd-rose); }
.btn-quiet { color: var(--pd-accent-deep); border-color: var(--pd-line-strong); }
.btn-quiet:active { border-color: var(--pd-accent); background: var(--pd-tint); }
.btn-link { padding-left: 8px; padding-right: 8px; min-height: 44px; font-weight: 600; color: var(--pd-accent-deep); }
.btn-danger { background: var(--pd-danger); color: #fff; border-color: var(--pd-danger); }
/* действие, которое что-то создаёт (записаться, отправить заявку, войти) — единственная залитая кнопка экрана */
.btn-commit { background: var(--pd-accent-deep); color: #fff; border-color: var(--pd-accent-deep); }
.btn-commit:active { background: var(--pd-accent-press); border-color: var(--pd-accent-press); }
.btn-on-deep { background: var(--pd-field); color: var(--pd-accent-deep); border-color: var(--pd-field); }
.btn-on-deep:active { background: var(--pd-tint); border-color: var(--pd-tint); }
/* вход через Госуслуги — фирменный синий портала, вне палитры клиники намеренно */
.btn-gosuslugi { background: #0D4CD3; color: #fff; }
.btn-gosuslugi:active { background: #0A3CA8; }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 14px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.is-busy {
    background: var(--pd-card); color: var(--pd-ink-soft); border-color: var(--pd-line-strong);
    cursor: default; pointer-events: none; transform: none;
}

@media (hover: hover) {
    .btn-primary:hover { background: var(--pd-accent); color: #fff; }
    .btn-secondary:hover { background: var(--pd-rose); }
    .btn-quiet:hover { border-color: var(--pd-accent); }
    .btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
    .btn-on-deep:hover { background: var(--pd-tint); border-color: var(--pd-tint); }
    .btn-gosuslugi:hover { background: #0A3CA8; }
    .btn-commit:hover { background: var(--pd-accent-press); border-color: var(--pd-accent-press); }
}
@media (pointer: fine) {
    .btn-small { min-height: 40px; }
    a.footer-line, .footer-phone { min-height: 32px; }
}

/* ---- поля: подпись капсом над полем, как в форме записи на сайте ---- */
.field { display: block; margin-bottom: 16px; }
.field-label {
    display: block; margin-bottom: 7px;
    font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--pd-ink-soft);
}
.field-input {
    display: block; width: 100%; min-height: 48px; padding: 12px 14px;
    font: 400 16px/22px var(--pd-sans); color: var(--pd-ink);
    background-color: var(--pd-field);
    border: 1px solid var(--pd-control-line); border-radius: var(--pd-radius-field);
    transition: border-color .18s ease-out;
}
.field-input::placeholder { color: var(--pd-ink-soft); }
.field-input:focus { outline: 3px solid var(--pd-accent); outline-offset: 2px; border-color: var(--pd-accent); }
textarea.field-input { min-height: 96px; resize: vertical; }
select.field-input {
    -webkit-appearance: none; appearance: none; padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23794F3A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
.field-hint { margin-top: 6px; font-size: 13px; color: var(--pd-ink-soft); }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--pd-accent); }

@media (hover: hover) {
    .field-input:hover { border-color: var(--pd-accent); }
}

/* ---- сообщения ---- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; margin-bottom: 16px; border-radius: var(--pd-radius-small);
    font-size: 15px; line-height: 1.45;
}
.alert .ico { margin-top: 1px; }
.alert-body { min-width: 0; }
.alert-error { background: var(--pd-danger-bg); color: var(--pd-danger); }
.alert-success { background: var(--pd-leaf-bg); color: var(--pd-leaf-ink); }
.alert-info { background: var(--pd-sun-bg); color: var(--pd-sun-ink); }
.alert-detail { display: block; margin-top: 2px; font-size: 13px; }
.alert a { color: inherit; font-weight: 700; white-space: nowrap; }

/* ---- состояния: цвет несёт смысл ---- */
.status {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; line-height: 16px; white-space: nowrap;
    background: var(--pd-tint); color: var(--pd-accent-deep);
}
.status--active, .status--3 { background: var(--pd-leaf-bg); color: var(--pd-leaf-ink); }
.status--draft, .status--0, .status--1 { background: var(--pd-sun-bg); color: var(--pd-sun-ink); }
.status--cancelled, .status--missed, .status--5 { background: var(--pd-quiet-bg); color: var(--pd-ink-soft); }
.status--4 { background: var(--pd-danger-bg); color: var(--pd-danger); }

/* ---- типографика страниц ---- */
.page-title {
    font-family: var(--pd-display); font-weight: 800; font-size: 24px; line-height: 1.15; letter-spacing: -.02em;
    color: var(--pd-ink); text-wrap: balance;
}
.page-sub { margin-top: 6px; color: var(--pd-ink-soft); max-width: 65ch; }
.page-title--done { display: flex; align-items: center; gap: 10px; }
.done-mark {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--pd-leaf-bg); color: var(--pd-leaf-ink);
}
.section-title {
    margin: 28px 0 12px;
    font-family: var(--pd-display); font-weight: 800; font-size: 18px; line-height: 1.25; letter-spacing: -.01em;
    color: var(--pd-ink);
}
.caps { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--pd-ink-soft); }
.meta { font-size: 13px; color: var(--pd-ink-soft); }
.note { font-size: 14px; color: var(--pd-ink-soft); max-width: 65ch; }
.stack > * + * { margin-top: 12px; }

/* ---- карта пациента: обложка, закладки, лист ---- */
.folder-wrap { padding-left: 0; padding-right: 0; }
.folder-cover { background: var(--pd-accent-deep); color: #fff; padding: 16px 16px 0; }
.cover-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.cover-who { display: flex; flex-direction: column; min-width: 0; }
.cover-label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--pd-on-deep); }
.cover-name {
    margin-top: 4px;
    font-family: var(--pd-display); font-weight: 800; font-size: 26px; line-height: 1.1; letter-spacing: -.02em;
    overflow-wrap: anywhere;
}
.cover-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin-top: 2px; font-size: 14px; color: var(--pd-on-deep); }
.cover-link {
    display: inline-flex; align-items: center; min-height: 44px;
    color: #fff; font-weight: 600;
    text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .5);
}
.cover-link:focus-visible, .folder-tab:focus-visible { outline-color: #fff; }
.cover-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.cover-cta { display: none; flex-shrink: 0; margin-bottom: 4px; }

.folder-tabs {
    position: sticky; top: 0; z-index: 10;
    display: flex; gap: 6px;
    padding: 6px 16px 0; background: var(--pd-accent-deep);
    /* обложка и закладки — один предмет: закрываем волосяной просвет между блоками */
    box-shadow: 0 -1px 0 var(--pd-accent-deep);
}
.folder-tab {
    flex: 1 1 0; min-width: 0;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 10px 6px;
    border-radius: var(--pd-radius-small) var(--pd-radius-small) 0 0;
    background: rgba(255, 255, 255, .12); color: #fff;
    font-size: 14px; font-weight: 600; text-decoration: none;
    transition: background-color .18s ease-out;
}
.folder-tab .ico { width: 18px; height: 18px; display: none; }
.folder-tab.is-current { background: var(--pd-card); color: var(--pd-ink); font-weight: 700; }
.folder-tab.is-current:focus-visible { outline-color: var(--pd-accent); outline-offset: -4px; }

.sheet { background: var(--pd-card); padding: 20px 16px 32px; min-height: 52vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.sheet-head--action { justify-content: flex-end; }
.sheet-head--action .btn { flex: 1 1 100%; }

@media (hover: hover) {
    .folder-tab:not(.is-current):hover { background: rgba(255, 255, 255, .22); }
    .cover-link:hover { text-decoration-color: #fff; }
}

/* ---- поверхности на листе ---- */
.card { background: var(--pd-field); border: 1px solid var(--pd-line); border-radius: var(--pd-radius); padding: 16px; }
.card-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.card-title { font-family: var(--pd-display); font-weight: 700; font-size: 17px; line-height: 1.3; letter-spacing: -.01em; color: var(--pd-ink); }
.card-reject { margin-top: 6px; font-size: 14px; color: var(--pd-danger); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; }
.actions form { margin: 0; }
.grid-2 { display: grid; gap: 12px; }

.empty {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    padding: 24px; border-radius: var(--pd-radius);
    background: var(--pd-field); border: 1px dashed var(--pd-line-strong);
}
.empty-ico {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: var(--pd-radius-small);
    background: var(--pd-tint); color: var(--pd-accent-deep);
}
.empty-ico .ico { width: 24px; height: 24px; }
.empty-title { font-family: var(--pd-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--pd-ink); }
.empty-text { font-size: 14px; color: var(--pd-ink-soft); max-width: 52ch; }
.empty .btn { margin-top: 8px; }

/* ---- талон: корешок с датой, линия отрыва с просечками, тело ---- */
.talon {
    --notch: var(--pd-card);
    position: relative;
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto;
    background: var(--pd-field); border: 1px solid var(--pd-line); border-radius: var(--pd-radius);
}
/* корешок идёт на всю высоту талона — и рядом с кнопкой отмены тоже: просечки стоят на кромках */
.talon-stub {
    position: relative; grid-row: 1 / -1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 92px; padding: 16px 10px;
    background: var(--pd-tint); color: var(--pd-accent-deep); text-align: center;
    /* корешок вписан в левые углы талона */
    border-radius: var(--pd-radius) 0 0 var(--pd-radius);
    border-right: 2px dashed var(--pd-accent-soft);
}
/* просечки на линии отрыва: кружки цвета подложки, видна только половина внутри талона */
.talon-stub::before, .talon-stub::after {
    content: ""; position: absolute; right: -9px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--notch); box-shadow: inset 0 0 0 1px var(--pd-line);
}
.talon-stub::before { top: -9px; clip-path: inset(calc(50% - 1px) 0 0 0); }
.talon-stub::after { bottom: -9px; clip-path: inset(0 0 calc(50% - 1px) 0); }
.talon-wd { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.talon-day { font-family: var(--pd-display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: -.02em; color: var(--pd-ink); }
.talon-month { font-size: 14px; font-weight: 600; }
.talon-time {
    margin-top: 8px; padding-top: 8px; min-width: 56px;
    border-top: 1px solid var(--pd-accent-soft);
    font-family: var(--pd-display); font-weight: 800; font-size: 20px; line-height: 1; color: var(--pd-ink);
}
.talon-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px; }
.talon-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }
.talon-doctor { font-family: var(--pd-display); font-weight: 700; font-size: 18px; line-height: 1.25; letter-spacing: -.01em; color: var(--pd-ink); }
.talon-line { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.talon-line .ico { width: 18px; height: 18px; margin-top: 1px; color: var(--pd-accent); }
.talon-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; margin-top: -4px; }
.talon-actions form { margin: 0; }
.talon--lg { max-width: 640px; }

/* ---- отмена: раскрытие вместо диалога. Первое нажатие открывает красную кнопку, повторное по той же
        кнопке закрывает её («Не отменять») — двойное касание ничего не отменит. Работает и без скрипта ---- */
.cancel { display: flex; flex-wrap: wrap; align-items: center; margin: 0 -8px -8px 0; }
.cancel > summary { list-style: none; cursor: pointer; }
.cancel > summary::-webkit-details-marker { display: none; }
.cancel > summary, .cancel > .cancel-form { margin: 0 8px 8px 0; }
.cancel-keep, .cancel[open] .cancel-ask { display: none; }
.cancel[open] .cancel-keep { display: inline; }
/* ведущий талон «Записей» — ближайший приём во всю ширину листа */
.talon--lead { max-width: none; }
/* черновик до подтверждения: пунктир и приглушённый корешок — запись ещё не создана */
.talon--draft { border-style: dashed; border-color: var(--pd-line-strong); }
.talon--draft .talon-stub { background: var(--pd-quiet-bg); border-right-color: var(--pd-line-strong); }

/* ---- списки строк: история визитов, документы ---- */
.rows { background: var(--pd-field); border: 1px solid var(--pd-line); border-radius: var(--pd-radius); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 14px 16px; }
.row + .row { border-top: 1px solid var(--pd-line); }
.row-main { min-width: 0; }
.row-date { font-size: 14px; font-weight: 600; color: var(--pd-ink); }
.row-title { font-weight: 600; color: var(--pd-ink); overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--pd-ink-soft); }
/* формат файла — тихой меткой после рубрики и даты; на телефоне ей нет места (см. блок 480px) */
.file-type {
    display: none; margin-left: 2px; padding: 0 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; line-height: 16px;
    color: var(--pd-ink-soft); border: 1px solid var(--pd-line-strong); border-radius: 999px;
    white-space: nowrap; vertical-align: 1px;
}
.row-ico {
    display: none; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--pd-radius-small);
    background: var(--pd-tint); color: var(--pd-accent-deep);
}

/* ---- справка: сведения и ход заявки ---- */
.facts { display: grid; gap: 2px 16px; margin: 12px 0 0; font-size: 14px; }
.facts dt { color: var(--pd-ink-soft); }
.facts dd { margin: 0 0 8px; color: var(--pd-ink); overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before {
    content: ""; position: absolute; left: 0; top: 6px;
    width: 10px; height: 10px; border-radius: 50%; background: var(--pd-accent);
}
.timeline li::after { content: ""; position: absolute; left: 4.5px; top: 20px; bottom: 2px; width: 1px; background: var(--pd-line-strong); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline-date { font-size: 12px; color: var(--pd-ink-soft); }
.timeline-text { font-size: 14px; color: var(--pd-ink); }
.steps { margin: 12px 0 0; padding: 0 0 0 20px; font-size: 14px; }
.steps li { padding-left: 4px; }
.steps li + li { margin-top: 8px; }

/* ---- рамка одного действия: запись, заказ справки ---- */
.task-wrap { padding-top: 8px; padding-bottom: 40px; }
.task-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
    font-weight: 600; color: var(--pd-accent-deep); text-decoration: none;
}
.back-link .ico { width: 18px; height: 18px; }
.task-who {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 68%;
    padding: 6px 12px 6px 10px; border-radius: var(--pd-radius-small);
    background: var(--pd-tint); color: var(--pd-ink);
    /* имя не обрезаем: у братьев и сестёр фамилия одна, различает их именно имя */
    font-size: 14px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere;
}
.task-who .ico { width: 16px; height: 16px; color: var(--pd-accent-deep); }
.task-head { margin-bottom: 16px; }
.panel {
    margin: 0 -16px; padding: 16px;
    background: var(--pd-card); border: 1px solid var(--pd-line); border-left: 0; border-right: 0;
}
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 8px; }
/* на телефоне кнопки действия — во всю ширину: по ним попадают большим пальцем */
.form-actions .btn:not(.btn-link) { flex: 1 1 100%; }
/* текстовая ссылка в ряду действий стоит по краю текста, без боковых полей кнопки */
.actions .btn-link, .form-actions .btn-link { padding-left: 0; padding-right: 0; border-width: 0; }
.split { display: grid; gap: 16px; }

@media (hover: hover) {
    .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}

/* ---- запись: три уровня выбора; на телефоне виден один, на компьютере — все три колонками ---- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.crumb {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px;
    border-radius: 999px; background: var(--pd-field); border: 1px solid var(--pd-line-strong);
    color: var(--pd-ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.crumb-what { overflow-wrap: anywhere; }
.crumb-change {
    font-weight: 600; color: var(--pd-accent-deep);
    text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--pd-accent-soft);
}
.cols { display: grid; gap: 12px; }
.col {
    display: none; flex-direction: column; min-width: 0;
    background: var(--pd-field); border: 1px solid var(--pd-line); border-radius: var(--pd-radius);
}
.cols[data-step="1"] .col--where,
.cols[data-step="2"] .col--who,
.cols[data-step="3"] .col--when { display: flex; }
.col-head { padding: 16px 16px 8px; }
.col-head:focus { outline: none; }
.col-body { padding: 0 8px 8px; }
.col-note { padding: 4px 16px 20px; font-size: 14px; color: var(--pd-ink-soft); }

.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pick {
    display: flex; align-items: center; gap: 12px;
    min-height: 56px; padding: 10px 12px;
    border-radius: var(--pd-radius-small);
    color: var(--pd-ink); text-decoration: none;
    transition: background-color .18s ease-out;
}
a.pick:active { background: var(--pd-tint); }
.pick.is-current { background: var(--pd-tint); }
.pick.is-loading { background: var(--pd-tint); }
.pick[aria-disabled="true"] { color: var(--pd-ink-soft); }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-title { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pick--doctor .pick-title { font-family: var(--pd-display); font-weight: 700; letter-spacing: -.01em; }
.pick-sub { font-size: 13px; color: var(--pd-ink-soft); }
.pick-near { font-size: 13px; font-weight: 600; color: var(--pd-accent-deep); }
.pick-main .status { align-self: flex-start; margin: 2px 0; }
.pick.is-current .status { background: var(--pd-field); }
.pick.is-current .pick-sub { color: var(--pd-accent-deep); }
.pick-end { display: flex; color: var(--pd-accent-soft); }
.pick-end .ico { width: 18px; height: 18px; }
.pick.is-current .pick-end { color: var(--pd-accent-deep); }
.pick-ico {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: var(--pd-radius-small);
    background: var(--pd-tint); color: var(--pd-accent-deep);
}
.pick-radio {
    position: relative; flex-shrink: 0;
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--pd-control-line); background: var(--pd-field);
}
.pick.is-current .pick-radio { border-color: var(--pd-accent); }
.pick.is-current .pick-radio::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--pd-accent); }

@media (hover: hover) {
    a.pick:not(.is-current):hover { background: var(--pd-card); }
    .crumb:hover { border-color: var(--pd-accent); }
}

/* ---- расписание врача: лента дней и время ---- */
.sched-head { padding: 16px 16px 0; }
.sched-doctor { font-family: var(--pd-display); font-weight: 800; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; color: var(--pd-ink); }
.sched-meta { margin-top: 2px; font-size: 14px; color: var(--pd-ink-soft); }
.sched-where { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; font-size: 14px; }
.sched-where .ico { width: 18px; height: 18px; margin-top: 1px; color: var(--pd-accent); }

/* на телефоне лента листается пальцем и выходит за поле — обрезанный чип подсказывает прокрутку */
.day-strip {
    display: flex; gap: 8px;
    padding: 14px 16px 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity; scroll-padding: 0 16px;
    scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
    flex: 0 0 auto;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-width: 56px; min-height: 60px; padding: 8px 6px;
    background: var(--pd-field); color: var(--pd-ink);
    border: 1px solid var(--pd-line-strong); border-radius: var(--pd-radius-small);
    text-decoration: none; scroll-snap-align: start;
    transition: background-color .18s ease-out, border-color .18s ease-out, color .18s ease-out;
}
.day-chip-week { font-size: 12px; line-height: 1; color: var(--pd-ink-soft); }
.day-chip-num { font-family: var(--pd-display); font-weight: 800; font-size: 17px; line-height: 1; }
.day-chip:active { border-color: var(--pd-accent); }
.day-chip.is-active { background: var(--pd-accent); border-color: var(--pd-accent); color: #fff; }
.day-chip.is-active .day-chip-week { color: #fff; font-weight: 600; }

.day-panel { padding: 8px 16px 18px; scroll-margin-top: 12px; }
.day-panel:not(.is-active) { display: none; }
.day-title { font-family: var(--pd-display); font-weight: 800; font-size: 18px; line-height: 1.3; letter-spacing: -.01em; color: var(--pd-ink); }
.slot-part { margin-top: 10px; }
.slot-part .caps { display: block; margin-bottom: 7px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.slot {
    display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 4px;
    background: var(--pd-field); color: var(--pd-accent-deep);
    border: 1px solid var(--pd-line-strong); border-radius: 999px;
    font: 700 15px/1 var(--pd-display); text-decoration: none;
    transition: background-color .18s ease-out, border-color .18s ease-out, color .18s ease-out;
}
.slot:active, .slot.is-loading { background: var(--pd-accent); border-color: var(--pd-accent); color: #fff; }

@media (hover: hover) {
    .day-chip:not(.is-active):hover { border-color: var(--pd-accent); }
    .slot:hover { border-color: var(--pd-accent); background: var(--pd-tint); }
    .slot.is-loading:hover { background: var(--pd-accent); }
}

/* ---- вход ---- */
.auth-wrap { padding-top: 24px; padding-bottom: 40px; }
.auth { display: grid; gap: 20px; max-width: 480px; margin: 0 auto; }
.auth-side { background: var(--pd-accent-deep); color: #fff; border-radius: var(--pd-radius); padding: 20px; }
.auth-side-title { font-family: var(--pd-display); font-weight: 800; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; }
.auth-points { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; align-items: flex-start; gap: 12px; }
.auth-point-ico {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: var(--pd-radius-small); background: rgba(255, 255, 255, .16);
}
.auth-point-title { font-weight: 700; }
.auth-point-text { font-size: 14px; color: var(--pd-on-deep); }
.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--pd-ink-soft); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--pd-line); }
.lone { max-width: 560px; margin: 0 auto; }

/* ---- главное действие под пальцем (телефон) ---- */
.action-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    /* цвет шапки, слегка прозрачный: под полосой видно, что лист листается дальше */
    background: var(--pd-header); background: color-mix(in srgb, var(--pd-header) 94%, transparent);
    border-top: 1px solid var(--pd-line);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.action-bar .btn { display: flex; width: 100%; max-width: 480px; margin: 0 auto; }

/* ---- подвал: коричневая полоса сайта ---- */
.site-footer { background: var(--pd-accent); color: #fff; padding: 24px 0; }
.frame-card .site-footer { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.site-footer-row { display: grid; gap: 20px; }
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.footer-label { margin-bottom: 4px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.footer-phone { font-family: var(--pd-display); font-weight: 800; font-size: 20px; line-height: 1.2; color: #fff; text-decoration: none; }
.footer-line { font-size: 14px; font-weight: 600; color: #fff; text-decoration: none; }
.footer-note { font-size: 13px; font-weight: 600; }
a.footer-line, .footer-phone { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer a:focus-visible { outline-color: #fff; }

@media (hover: hover) {
    a.footer-line:hover, .footer-phone:hover { text-decoration: underline; text-underline-offset: 3px; }
}

/* ---- ход перехода: хаб отвечает 1–3 секунды, человек должен видеть, что нажатие принято ---- */
.nav-progress {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 3px;
    background: var(--pd-accent); pointer-events: none;
    opacity: 0; transform: scaleX(0); transform-origin: 0 50%;
}
.is-navigating .nav-progress { opacity: 1; animation: nav-progress 8s cubic-bezier(.1, .7, .1, 1) forwards; }
@keyframes nav-progress { to { transform: scaleX(.92); } }

@media (prefers-reduced-motion: no-preference) {
    /* единственное событие кабинета: на экране «Вы записаны» отметка ложится на талон как штамп */
    .talon--confirmed .status { animation: stamp .36s cubic-bezier(.16, .84, .44, 1) .12s both; }
    @keyframes stamp {
        from { opacity: 0; transform: scale(1.35) rotate(-4deg); }
        to { opacity: 1; transform: none; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .pick, .slot, .day-chip, .folder-tab, .field-input { transition: none; }
    .btn:active { transform: none; }
    .is-navigating .nav-progress { animation: none; transform: scaleX(.6); }
}

/* ---- мелочи раскладки ---- */
.gap-top { margin-top: 16px; }
/* на телефоне это действие уже стоит в полосе под пальцем — вторую такую же кнопку не показываем */
.btn.only-wide, .sheet-head.only-wide { display: none; }
.panel.stack > * + * { margin-top: 16px; }
.sheet > .section-title:first-of-type { margin-top: 4px; }
.row--visit .row-date { grid-column: 1; grid-row: 1; }
.row--visit .status { grid-column: 2; grid-row: 1; }
.row--visit .row-main { grid-column: 1 / -1; grid-row: 2; }
.col-sub { margin: 0; padding: 16px 8px 8px; }
.day-strip, .col-scroll { position: relative; }

/* строка выбора как самостоятельная кнопка-карточка (выбор карты ребёнка) */
button.pick { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.pick--card, button.pick--card {
    min-height: 68px; padding: 14px 16px;
    background: var(--pd-field); border: 1px solid var(--pd-line-strong); border-radius: var(--pd-radius);
    transition: border-color .18s ease-out, background-color .18s ease-out;
}
.pick--card:active { background: var(--pd-tint); border-color: var(--pd-accent); }
.pick.is-busy { background: var(--pd-tint); }

@media (hover: hover) {
    .pick--card:hover { border-color: var(--pd-accent); }
}

@media (max-width: 359px) {
    .folder-tab { font-size: 13px; padding-left: 2px; padding-right: 2px; }
    .folder-tabs { gap: 4px; padding-left: 12px; padding-right: 12px; }
}

/* ============================ планшет ============================ */
@media (min-width: 480px) {
    .site-header-tag { display: block; }
    .folder-tab .ico { display: block; }
    .row--file { grid-template-columns: auto minmax(0, 1fr) auto; }
    .row-ico { display: flex; }
    .file-type { display: inline-block; }
}

@media (min-width: 720px) {
    .wrap { padding: 0 24px; }
    .site-header-row { min-height: 72px; gap: 16px; }
    .site-logo img { height: 46px; }
    .site-phone-text {
        position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto;
        display: flex; flex-direction: column; line-height: 1.25;
    }

    .page-title { font-size: 26px; }
    .section-title { font-size: 20px; }

    .folder-wrap { padding: 0 24px; margin-top: 24px; margin-bottom: 40px; }
    .folder-cover { border-radius: var(--pd-radius-lg) var(--pd-radius-lg) 0 0; padding: 24px 28px 0; }
    .folder-tabs { position: static; gap: 8px; padding: 14px 28px 0; }
    .folder-tab { flex: 0 0 auto; padding: 10px 22px; font-size: 15px; }
    .sheet {
        padding: 28px; min-height: 420px;
        border: 1px solid var(--pd-line); border-top: 0;
        border-radius: 0 0 var(--pd-radius-lg) var(--pd-radius-lg);
    }

    .card { padding: 20px; }
    .form-actions { gap: 8px 16px; }
    .form-actions .btn:not(.btn-link) { flex: 0 0 auto; }
    .form-actions .btn.btn-block { flex: 1 1 100%; }
    .sheet-head--action .btn { flex: 0 0 auto; }
    .card-head { flex-direction: row; justify-content: space-between; gap: 8px; }
    .talon-stub { min-width: 112px; padding: 20px 14px; }
    .talon-body { padding: 20px; }
    .talon-actions { padding: 0 20px 20px; }
    .talon--lg .talon-stub { min-width: 148px; }
    .talon--lg .talon-day { font-size: 52px; }
    .talon--lg .talon-time { font-size: 24px; }
    .talon--lg .talon-doctor { font-size: 20px; }

    .row { padding: 14px 20px; }
    .row--visit { grid-template-columns: 190px minmax(0, 1fr) auto; }
    .row--visit .row-date { grid-column: 1; }
    .row--visit .row-main { grid-column: 2; grid-row: 1; }
    .row--visit .status { grid-column: 3; }
    .facts { grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; }
    .facts dd { margin: 0; }

    .task-wrap { padding-top: 16px; }
    .panel { margin: 0; border: 1px solid var(--pd-line); border-radius: var(--pd-radius-lg); }
    .panel--narrow { max-width: 720px; }

    .auth-wrap { padding-top: 40px; padding-bottom: 56px; }
}

/* две колонки записи: текущий уровень и следующий */
@media (min-width: 720px) and (max-width: 1099px) {
    .cols { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
    .cols[data-step="1"] .col--where, .cols[data-step="1"] .col--who,
    .cols[data-step="2"] .col--where, .cols[data-step="2"] .col--who,
    .cols[data-step="3"] .col--who, .cols[data-step="3"] .col--when { display: flex; }
    .crumbs[data-step="1"], .crumbs[data-step="2"] { display: none; }
}

/* ============================ компьютер ============================ */
@media (min-width: 900px) {
    .site-header .site-back { display: inline-flex; }
    .btn.only-wide { display: inline-flex; }
    .sheet-head.only-wide { display: flex; }
    .cover-name { font-size: 34px; }
    /* ведущий талон: действие — третьей колонкой справа, корешок — в одну строку с телом */
    .talon--lead { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto; }
    .talon--lead .talon-stub { grid-row: 1; }
    .talon--lead .talon-actions { grid-column: 3; grid-row: 1; align-self: center; padding: 20px 24px 20px 0; margin: 0; }
    .cover-cta { display: inline-flex; }
    .action-bar { display: none; }
    .frame-card .site-footer { padding-bottom: 24px; }
    .site-footer { padding: 32px 0; }
    .site-footer-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 32px; }
    .footer-col-end { align-items: flex-end; text-align: right; }

    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }

    .auth {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; max-width: 960px;
        border: 1px solid var(--pd-line); border-radius: var(--pd-radius-lg); overflow: hidden;
    }
    .auth-main { padding: 44px 44px 40px; }
    .auth-side { border-radius: 0; padding: 44px; display: flex; flex-direction: column; justify-content: center; }
    .auth-side-title { font-size: 24px; }
}

@media (min-width: 1100px) {
    .crumbs { display: none; }
    .cols { grid-template-columns: 284px 344px minmax(0, 1fr); gap: 16px; align-items: start; }
    .col { display: flex; }
    /* длинные списки листаются внутри колонки, чтобы все три уровня оставались на экране */
    .col-scroll {
        max-height: calc(100vh - 252px); min-height: 240px; overflow-y: auto;
        scrollbar-width: thin; scrollbar-color: var(--pd-accent-soft) transparent;
    }
    .day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: visible; }
    .day-chip { min-width: 0; }
    .col--where, .col--who { position: sticky; top: 16px; }
    .slot-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* ============================ печать талона ============================ */
@media print {
    .site-header, .site-footer, .action-bar, .folder-cover, .folder-tabs, .task-strip,
    .nav-progress, .skip-link, .no-print { display: none !important; }
    body { background: #fff; }
    .sheet, .panel { border: 0; padding: 0; background: #fff; min-height: 0; }
    .talon { break-inside: avoid; --notch: #fff; }
}
