/* Кабинет родителя на большом экране (index.html, parent-desk.js). Всё — только при body.pd-on,
   который ставится на широком экране внутри кабинета; на телефоне и на экранах входа не действует. */
:root { --pd-bg: #eef1f5; --pd-panel: #ffffff; --pd-top: 60px; --pd-side: 290px; }
:root[data-theme="dark"] { --pd-bg: #181818; --pd-panel: #1f1f1f; }

.pd-top, .pd-side, .pd-tabs { display: none; }

/* Телефон: нижнее меню разделов (body.pd-tabbar — кабинет на узком экране, есть дети) */
:root { --pd-tabs: 62px; }
body.pd-tabbar .pd-tabs {
  /* Шириной с содержимое кабинета (.lk — 480px): на планшете и в узком окне не растягивается на весь экран */
  position: fixed; z-index: 8; left: 50%; bottom: 0; width: min(100%, 480px); transform: translateX(-50%);
  display: flex; justify-content: space-around; padding: 4px 4px env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
@media (min-width: 481px) { body.pd-tabbar .pd-tabs { border-radius: 18px 18px 0 0; } }
.pd-tab {
  flex: 1 1 0; min-width: 0; height: calc(var(--pd-tabs) - 8px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; line-height: 1.1; color: var(--muted); text-decoration: none; border-radius: 12px;
}
.pd-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-tab .pd-ic { width: 24px; height: 24px; }
.pd-tab.active { color: var(--primary); font-weight: 600; }
/* Содержимое и прилипающие кнопки — над меню */
body.pd-tabbar .auth-layout { padding-bottom: calc(var(--pd-tabs) + 24px + env(safe-area-inset-bottom)); }
body.pd-tabbar .gkp-confirm, body.pd-tabbar .ap-actions { bottom: calc(var(--pd-tabs) + env(safe-area-inset-bottom)); }
body.pd-tabbar .toast { bottom: calc(var(--pd-tabs) + 16px + env(safe-area-inset-bottom)); }

body.pd-on { background: var(--pd-bg); }
body.pd-on .pd-top {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0; height: var(--pd-top);
  display: flex; align-items: center; gap: 10px; padding: 0 16px 0 20px;
  background: var(--pd-panel); border-bottom: 1px solid var(--line);
}
.pd-brand { display: flex; align-items: center; gap: 10px; color: var(--text-strong); text-decoration: none; line-height: 1.15; }
.pd-brand img { width: 36px; height: 36px; object-fit: contain; }
.pd-brand span { font-weight: 600; font-size: 16px; }
.pd-brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.pd-spacer { flex: 1; }
.pd-user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; margin-right: 6px; min-width: 0; }
.pd-user b { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.pd-user span { font-size: 12px; color: var(--muted); }
.pd-icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex: none;
  color: var(--muted); background: none; border: 0; border-radius: 10px; cursor: pointer;
}
.pd-icon-btn:hover { color: var(--primary); background: var(--hover); }
.pd-ic { width: 20px; height: 20px; flex: none; }

body.pd-on .pd-side {
  display: block; position: fixed; z-index: 9; top: var(--pd-top); bottom: 0; left: 0; width: var(--pd-side);
  overflow-y: auto; padding: 14px 12px 24px; background: var(--pd-panel); border-right: 1px solid var(--line);
}
.pd-side-title { margin: 4px 10px 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
/* Выбранный ребёнок; у нескольких детей — кнопка, по нажатию под ней раскрывается список «Дети» */
.pd-switch-wrap { position: relative; margin-bottom: 10px; }
/* «+ Добавить ребёнка» под ребёнком: пунктир цвета кнопок, как плитка на главной */
.pd-add-kid {
  display: flex; gap: 12px; align-items: center; margin: -2px 0 12px; padding: 8px 10px; border: 1.5px dashed var(--primary);
  border-radius: 12px; color: var(--primary); font-weight: 600; text-decoration: none;
}
.pd-add-kid:hover, .pd-add-kid.active { background: var(--hover); }
.pd-add-kid__plus {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 2px dashed var(--primary); font-size: 22px; line-height: 1;
}
.pd-switch {
  width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px; text-align: left;
  font: inherit; color: var(--text); background: var(--hover); border: 1px solid transparent; border-radius: 12px; cursor: pointer;
}
.pd-switch:hover, .pd-switch.open { border-color: var(--border-focus); }
.pd-switch.single { cursor: default; }
.pd-chevron { margin-left: auto; color: var(--muted); transition: transform .15s; }
.pd-switch.open .pd-chevron { transform: rotate(180deg); }
.pd-kids {
  position: absolute; z-index: 2; top: calc(100% + 4px); left: 0; right: 0;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--pd-panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
.pd-kid {
  display: flex; gap: 12px; align-items: center; padding: 8px; text-align: left;
  font: inherit; color: var(--text); background: none; border: 0; border-radius: 9px; cursor: pointer;
}
.pd-kid:hover, .pd-kid:focus-visible { background: var(--hover); outline: 0; }
.pd-kid.active { background: var(--hover); }
.pd-check { margin-left: auto; color: var(--primary); }
.pd-child-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pd-child-text b { font-size: 15px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-child-text small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-child-text small.debt { color: var(--error); font-weight: 600; }
/* Договор закончился: бледная серая аватарка и подпись */
.pd-child-text small.ended { color: var(--warn-text); font-weight: 600; }
.pd-avatar.ended { opacity: .45; filter: grayscale(1); }
.pd-avatar {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: hsl(var(--h) 50% 50%); color: #fff; font-weight: 600; font-size: 17px;
}
.pd-nav { display: flex; flex-direction: column; gap: 1px; }
.pd-nav-item {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px;
  font-size: 15px; color: var(--text); text-decoration: none; border-radius: 9px;
}
.pd-nav-item:hover { background: var(--hover); }
.pd-nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.pd-nav-item .pd-ic { color: var(--muted); }
.pd-nav-item.active .pd-ic { color: #fff; }
.pd-nav-item.soon { color: var(--muted); cursor: default; }
.pd-nav-item.soon:hover { background: none; }
.pd-nav-item small { margin-left: auto; font-size: 11px; }

/* Сам раздел — справа от панели детей, на карточке */
body.pd-on .auth-layout {
  display: block; min-height: 100vh; margin-left: var(--pd-side);
  padding: calc(var(--pd-top) + 24px) 32px 40px;
}
body.pd-on .auth-layout > * { max-width: none; }
body.pd-on .auth-notice, body.pd-on .auth-logo { display: none; }
body.pd-on .lk {
  max-width: 1000px; margin: 0; padding: 22px 32px 32px;
  background: var(--pd-panel); border: 1px solid var(--line); border-radius: 16px;
}
/* Ширина раздела — кнопки в верхней панели (parent-desk.js, data-pd-view на <html>): компактный / обычный / во всё окно */
html[data-pd-view="compact"] body.pd-on .lk { max-width: 720px; }
html[data-pd-view="wide"] body.pd-on .lk { max-width: none; }
.pd-view { margin-right: 6px; }
/* Детей нет (новый клиент, анкета поступающего) — без левой панели, раздел посередине */
body.pd-solo .pd-side { display: none; }
body.pd-solo .auth-layout { margin-left: 0; }
body.pd-solo .lk { margin: 0 auto; }
html[data-pd-view="compact"] body.pd-solo .lk { max-width: 720px; }
html[data-pd-view="wide"] body.pd-solo .lk { max-width: none; }
/* Страницы до входа (вход, регистрация…): кнопки ширины — в углу слева от кнопки темы; компактный — как было (480 px).
   Приветствие над формой входа расширяется вместе с формой. */
.pd-auth-view { display: none; }
body.pd-auth .pd-auth-view { display: flex; position: fixed; z-index: 6; top: calc(12px + env(safe-area-inset-top)); right: 60px; background: var(--card); }
html[data-pd-view="normal"] body.pd-auth .auth-layout > .auth-panel { max-width: 760px; }
html[data-pd-view="wide"] body.pd-auth .auth-layout > .auth-panel { max-width: none; width: auto; align-self: stretch; margin: 8px 24px 0; }
html[data-pd-view="normal"] body.pd-auth .auth-layout > .auth-notice { max-width: 776px; }
html[data-pd-view="wide"] body.pd-auth .auth-layout > .auth-notice { max-width: none; align-self: stretch; width: auto; margin: 0 8px; }
body.pd-on .lk-header { padding: 0 0 14px; margin-bottom: 4px; }
body.pd-on .lk-header__name { font-size: 24px; }
body.pd-on .lk-header__email { font-size: 15px; }
/* Назад, тема и выход — в верхней панели; шапка главной (родитель и почта) — тоже там */
body.pd-on .lk-header__back,
body.pd-on .lk-header .theme-toggle,
body.pd-on .lk-header [data-action="logout"] { display: none; }
body.pd-on .lk-header:has(.lk-header__logo) { display: none; }
body.pd-on .child-tabs--wrap { display: none; }
body.pd-on .lk > .child-card:first-of-type { margin-top: 0; }
body.pd-on .child-card { max-width: 560px; }
body.pd-on .modules { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
body.pd-on .photos { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
/* «Договоры и платежи»: сводка — полоса во всю ширину: слева баланс и ожидаемая оплата, справа QR */
/* .child-card.bal-sum — сильнее «body.pd-on .child-card { max-width }» из theme-a.css */
body.pd-on .child-card.bal-sum { max-width: none; display: flex; align-items: flex-start; gap: 24px; }
body.pd-on .bal-sum__main { flex: 1; min-width: 0; }
body.pd-on .bal-sum .child-card__expected { max-width: 460px; }
body.pd-on .bal-sum__side { flex: 0 0 260px; margin-top: 4px; }
body.pd-on .bal-sum__side .child-card__note { text-align: center; }
body.pd-on .contracts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); align-items: start; }
body.pd-on .meals, body.pd-on .lessons, body.pd-on .st-list, body.pd-on .gkp-weeks,
body.pd-on .gkp-upcoming, body.pd-on .props { max-width: 760px; }
body.pd-on .st-create { max-width: 280px; }
body.pd-on .st-filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); gap: 8px; }
body.pd-on .st-filters__row { display: contents; }
body.pd-on .gkp-confirm { max-width: 760px; background: linear-gradient(transparent, var(--pd-panel) 30%); }

/* Плашка «Тестовый сервер» — рядом с названием, а не поверх логотипа */
html[data-instance="test"] body.pd-on::before { left: 300px; top: 20px; }
