/* Компоненты кабинета. Цвета — только через переменные из theme.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.55;
  color: var(--text); background: var(--page-bg); background-color: #F2F5F8;
}
html { background-color: #F2F5F8; }
.only-mobile { display: none !important; }
a { color: var(--eva-blue-deep); }
a:hover { color: var(--eva-coral-deep); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 14px; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--eva-blue-deep); outline-offset: 2px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------- Шапка (как на сайте) ---------- */
.top { padding: 18px 0 10px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.logo img { height: 78px; width: auto; }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.circle-btn {
  width: 46px; height: 46px; border-radius: 50%; background: var(--eva-blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; border: 0; text-decoration: none;
}
.circle-btn:hover { background: var(--eva-blue-deep); color: #fff; }
.circle-btn svg { width: 22px; height: 22px; }
.phone { display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; color: var(--text); }
.phone b { font-size: 19px; font-weight: 700; }
.phone span { color: var(--eva-coral-deep); font-weight: 600; font-size: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 5px; background: var(--surface); border-radius: var(--radius-pill); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--eva-coral-soft); color: var(--eva-coral-deep);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.user-chip .name { font-weight: 600; font-size: 15px; }
.link-btn { background: none; border: 0; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-pill); min-height: 38px; }
.link-btn:hover { color: var(--eva-coral-deep); background: var(--surface-alt); }

/* ---------- Меню-«таблетка» (как на сайте) ---------- */
.menu { margin-top: 14px; display: flex; gap: 4px; background: var(--surface-alt); border-radius: var(--radius-pill); padding: 5px;
  overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: var(--radius-pill);
  text-decoration: none; color: var(--text); font-size: 17px; font-weight: 500; white-space: nowrap;
}
.menu a:hover { background: #fff; color: var(--text); }
.menu a.active { background: var(--eva-coral); color: #fff; font-weight: 600; }
.menu .count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--eva-coral); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

main { padding: 28px 0 60px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border-radius: var(--radius-card); padding: 26px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tile { background: var(--surface-alt); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 19px; }
.stat { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }

/* Плашка-бейдж, как «Более 600 семей…» */
.pill { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; background: rgba(255,255,255,.75);
  border-radius: var(--radius-pill); padding: 8px 18px; font-weight: 600; font-size: 15px; }

/* ---------- Герой «Обзор» ---------- */
.hero { position: relative; overflow: hidden; background: rgba(255,255,255,.55); border-radius: 28px; padding: 36px;
  display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; }
.hero::after { content: ""; position: absolute; right: -90px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%;
  background: var(--hero-circle); opacity: .85; pointer-events: none; }
.hero-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.hero-text p { font-size: 18px; color: var(--text-muted); }
.week-card { position: relative; z-index: 1; background: #fff; border-radius: 20px; padding: 22px 26px; min-width: 230px;
  box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 2px; }
.week-card .stat { color: var(--eva-coral-deep); }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 0 24px;
  border-radius: var(--radius-pill); border: 0; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn-cta { background: var(--eva-coral); color: #fff; padding: 8px 8px 8px 32px; min-height: 60px; gap: 28px;
  font-size: 18px; font-weight: 500; letter-spacing: .01em; transition: background .2s ease; }
.btn-cta .arrow { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #1F1F1F; display: inline-flex;
  align-items: center; justify-content: center; flex: none; margin-left: auto; transition: transform .25s ease; }
.btn-cta .arrow svg { width: 20px; height: 20px; stroke-width: 1.9; }
.btn-cta:hover { background: #4A9FE0; color: #fff; }
.btn-cta:hover .arrow { transform: translateX(3px); }
.btn-blue { background: var(--eva-coral); color: #fff; }
.btn-blue:hover { background: #4A9FE0; color: #fff; }
.btn-ghost { background: #fff; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--eva-coral); color: var(--text); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn-danger { background: #fff; color: var(--eva-coral-deep); box-shadow: inset 0 0 0 1.5px var(--eva-coral-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Статусы ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; white-space: nowrap; }
.tone-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tone-wait { background: var(--wait-bg); color: var(--wait-fg); }
.tone-new { background: var(--new-bg); color: var(--new-fg); }
.tone-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

/* ---------- Этапы (полоса) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(104px, 1fr)); gap: 8px; }
.steps-scroll { overflow-x: auto; padding-bottom: 4px; }
.steps li { display: flex; flex-direction: column; gap: 8px; }
.steps .bar { height: 8px; border-radius: 4px; background: var(--line); }
.steps .done .bar { background: var(--eva-blue); }
.steps .current .bar { background: var(--eva-coral); }
.steps .lbl { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.steps .done .lbl { color: var(--eva-blue-deep); }
.steps .current .lbl { color: var(--eva-coral-deep); }
.steps .ttl { font-size: 14px; font-weight: 600; }
.steps .current .ttl { font-weight: 800; }
.steps .todo .ttl { color: var(--text-muted); }

/* ---------- Этапы (вертикально) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 18px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .dot { width: 40px; height: 40px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; border: 2px solid var(--line); color: var(--text-muted); background: #fff; }
.timeline .done .dot { background: var(--eva-blue); border-color: var(--eva-blue); color: #fff; }
.timeline .current .dot { background: var(--eva-coral); border-color: var(--eva-coral); color: #fff; }
.timeline .line { width: 2px; flex: 1; min-height: 22px; background: var(--line); }
.timeline li:last-child .line { display: none; }
.timeline .body { padding: 6px 0 26px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Списки и таблицы ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .main { display: flex; flex-direction: column; min-width: 0; }
.row .main b { font-weight: 600; }
.event { display: flex; gap: 14px; align-items: center; }
.datebox { width: 60px; flex: none; border-radius: 16px; background: var(--eva-blue-soft); padding: 8px 0; display: flex;
  flex-direction: column; align-items: center; }
.datebox b { font-size: 22px; line-height: 1; color: var(--eva-blue-deep); }
.datebox span { font-size: 12px; color: var(--text-muted); }
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 620px; }
th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.right { text-align: right; }
.progress { height: 12px; border-radius: 6px; background: var(--surface-alt); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--eva-blue), var(--eva-coral)); border-radius: 6px; }
.empty { padding: 18px; text-align: center; color: var(--text-muted); background: var(--surface-alt); border-radius: 16px; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number],
input[type=password], input[type=search], input:not([type]), input[type=file], select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: #fff; border: 1.5px solid var(--line);
  border-radius: var(--radius-field); padding: 11px 14px; min-height: 48px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--eva-blue); outline: none; box-shadow: 0 0 0 3px var(--eva-blue-soft); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }

/* ---------- Сообщения ---------- */
.flash { border-radius: 16px; padding: 14px 18px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--wait-bg); color: var(--wait-fg); }

/* ---------- Чат ---------- */
.chat { padding: 0; gap: 0; overflow: hidden; }
.chat-head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.chat-log { padding: 22px; display: flex; flex-direction: column; gap: 12px; height: min(58vh, 520px); overflow-y: auto; background: #FAFBFD; }
.msg { max-width: min(78%, 560px); padding: 12px 16px; border-radius: 20px; display: flex; flex-direction: column; gap: 4px;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.them { align-self: flex-start; background: #fff; box-shadow: inset 0 0 0 1px var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--eva-blue-soft); border-bottom-right-radius: 6px; }
.msg .meta { font-size: 12px; color: var(--text-muted); align-self: flex-end; }
.chat-form { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { min-height: 48px; height: 48px; flex: 1; }

/* ---------- Вход ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.login-page::before { content: ""; position: absolute; right: -200px; bottom: -260px; width: 680px; height: 680px; border-radius: 50%;
  background: var(--hero-circle); opacity: .7; }
.login-card { position: relative; z-index: 1; width: 100%; max-width: 460px; background: #fff; border-radius: 28px; padding: 36px;
  box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 18px; }
.login-card .logo img { height: 110px; margin: 0 auto; }
.code-input { font-size: 28px !important; letter-spacing: .4em; text-align: center; font-weight: 700; }

/* ---------- Панель куратора ---------- */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtabs a { padding: 9px 16px; border-radius: var(--radius-pill); background: #fff; text-decoration: none; color: var(--text);
  font-weight: 600; font-size: 15px; min-height: 42px; display: inline-flex; align-items: center; }
.subtabs a.active { background: var(--eva-coral); color: #fff; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { min-height: 40px; padding: 6px 10px; font-size: 14px; width: auto; }

footer { padding: 20px 0 40px; font-size: 13px; color: var(--text-muted); }

@media (max-width: 640px) {
  .logo img { height: 52px; }
  .top-row { flex-wrap: nowrap; }
  .top-right { gap: 8px; flex-wrap: nowrap; }
  .phone { display: none; }
  .only-mobile { display: inline-flex !important; }
  .circle-btn { width: 42px; height: 42px; }
  .user-chip { padding: 3px; gap: 0; }
  .user-chip .name, .user-chip .avatar { display: none; }
  .link-btn { padding: 8px 10px; }
  .card { padding: 20px; }
  .hero { padding: 24px; }
  .hero::after { width: 260px; height: 260px; right: -120px; bottom: -140px; }
  .menu a { font-size: 15px; padding: 0 16px; min-height: 44px; }
  .btn-cta { font-size: 16px; min-height: 56px; padding-left: 26px; gap: 20px; }
  .btn-cta .arrow { width: 40px; height: 40px; }
  .msg { max-width: 88%; }
}

/* ---------- Обзор: карточка недели ---------- */
.week-link { text-decoration: none; color: var(--text); align-items: flex-start; }
.week-link:hover { color: var(--text); box-shadow: 0 8px 30px rgba(40, 90, 140, .16); }
.row-link { text-decoration: none; color: var(--text); border-radius: 12px; }
.row-link:hover { color: var(--text); background: var(--surface-alt); }
.circle-light { background: #fff; color: var(--text); }
.circle-light:hover { background: var(--eva-blue-soft); color: var(--text); }

/* ---------- Календарь беременности ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.week-title { text-align: center; display: flex; flex-direction: column; }
.week-body { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; }
.week-pic { flex: 1 1 240px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: linear-gradient(160deg, var(--eva-blue-soft), var(--eva-coral-soft)); border-radius: 24px; padding: 20px; }
.week-pic b { font-size: 19px; }
.week-text { flex: 999 1 320px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.week-text h3 { margin-bottom: 4px; }
.fruit { display: block; max-width: 100%; height: auto; }

/* ---------- Медиа ---------- */
.media-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.media-item { margin: 0; background: var(--surface-alt); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.media-item img, .media-item video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #1F2430; display: block; }
.media-item figcaption { padding: 10px 14px 14px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.photo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-row img { width: 140px; height: 140px; object-fit: cover; border-radius: 14px; }
.photo-edit { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Анкеты сурмам ---------- */
.sm-card { display: flex; flex-wrap: wrap; gap: 24px; }
.sm-gallery { flex: 1 1 260px; max-width: 380px; position: relative; border-radius: 22px; overflow: hidden; background: var(--surface-alt);
  aspect-ratio: 3 / 4; }
.sm-gallery img { width: 100%; height: 100%; object-fit: cover; }
.sm-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 8px; }
.sm-dots button { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.6); cursor: pointer; }
.sm-dots button.on { background: #fff; transform: scale(1.25); }
.sm-gallery .sm-prev, .sm-gallery .sm-next { position: absolute; top: 0; bottom: 0; width: 40%; background: none; border: 0; cursor: pointer; }
.sm-gallery .sm-prev { left: 0; } .sm-gallery .sm-next { right: 0; }
.sm-nophoto { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--text-muted); font-weight: 600; background: linear-gradient(160deg, var(--eva-blue-soft), var(--eva-pink-soft)); }
.sm-body { flex: 999 1 320px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sm-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 18px; }
.sm-facts div { display: flex; flex-direction: column; }
.sm-facts dt { font-size: 13px; color: var(--text-muted); }
.sm-facts dd { margin: 0; font-weight: 600; }
.sm-about { margin: 0; padding: 16px 20px; background: var(--surface-alt); border-radius: 16px; font-style: italic; }
.curator-note { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 16px; background: var(--eva-coral-soft); }
.curator-note b { font-size: 13px; color: var(--eva-coral-deep); }
.ask summary { cursor: pointer; color: var(--eva-blue-deep); font-weight: 600; min-height: 32px; }
.sm-thumb { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; flex: none; }
.sm-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.sm-tile { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 18px; background: var(--surface-alt); text-decoration: none; color: var(--text); }
.sm-tile:hover { color: var(--text); box-shadow: inset 0 0 0 2px var(--eva-blue); }
.sm-tile img, .sm-tile .sm-nophoto { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; flex: none; font-size: 11px; }
.sm-tile .main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pick-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pick { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--surface-alt); cursor: pointer; }
.pick:has(input:checked) { box-shadow: inset 0 0 0 2px var(--eva-coral); background: #fff; }
.pick input { width: 20px; height: 20px; flex: none; }
.pick img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; }
.pick .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ---------- Чат: вложения ---------- */
.chat-form .attach { position: relative; flex: none; cursor: pointer; }
.chat-form .attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chat-input { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chat-file-name { font-size: 13px; color: var(--eva-blue-deep); font-weight: 600; }
.msg-img { max-width: 240px; max-height: 240px; border-radius: 12px; object-fit: cover; }
.msg-file { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* ---------- Программы ---------- */
.stage-edit { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.stage-edit li { background: var(--surface-alt); border-radius: 16px; padding: 12px; }
.report .main { display: flex; flex-direction: column; }
.main { display: flex; flex-direction: column; min-width: 0; }


/* ---------- Полировка ---------- */
input[type=file] { padding: 8px 10px; cursor: pointer; color: var(--text-muted); font-size: 14px; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 14px; color: var(--eva-coral-deep); background: var(--eva-coral-soft);
  border: 0; border-radius: var(--radius-pill); padding: 7px 14px; margin-right: 10px; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: #CFE5F8; }
input[type=checkbox] { accent-color: var(--eva-blue); }
.login-card .subtabs { background: var(--surface-alt); border-radius: var(--radius-pill); padding: 4px; align-self: center; gap: 4px; }
.login-card .subtabs a { background: transparent; min-height: 38px; }
.login-card .subtabs a.active { background: var(--eva-coral); }
.stat-sm { font-size: 20px; }
.media-item figcaption { display: block; line-height: 1.45; }
.media-item figcaption .actions { margin-top: 8px; }
.sm-tile { align-items: flex-start; }
.sm-tile .main { gap: 2px; }
.sm-tile .badge { align-self: flex-start; margin-top: 4px; }
.row > .main { flex: 1; }
.subtabs a { white-space: nowrap; }
.hero .pill { max-width: 100%; }

@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .hero { padding: 22px; gap: 18px; }
  .hero-text p { font-size: 16px; }
  .week-card { min-width: 0; width: 100%; }
  .card-head { flex-direction: column; align-items: flex-start; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > .card:first-child:nth-last-child(3) { grid-column: 1 / -1; }
  .stat { font-size: 24px; }
  /* чат: кнопка-иконка, поле во всю ширину */
  .chat-form { gap: 8px; padding: 12px; }
  .chat-form .btn-cta { width: 48px; min-width: 48px; padding: 0 !important; font-size: 0; }
  .chat-form .btn-cta::after { content: ""; width: 22px; height: 22px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22l-4-9-9-4z'/%3E%3C/svg%3E") center/contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2 11 13'/%3E%3Cpath d='M22 2 15 22l-4-9-9-4z'/%3E%3C/svg%3E") center/contain no-repeat; }
  .chat-log { height: 60vh; padding: 14px; }
  /* таблицы превращаются в карточки */
  .table-cards table { min-width: 0; }
  .table-cards thead { display: none; }
  .table-cards tr { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .table-cards tr:last-child { border-bottom: 0; }
  .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0; border: 0; text-align: left; }
  .table-cards td[data-label]::before { content: attr(data-label); font-size: 13px; color: var(--text-muted); font-weight: 400; }
  .table-cards td:first-child { font-size: 16px; }
  .table-cards td.right { justify-content: flex-start; margin-top: 6px; }
  .table-cards td[colspan] { display: block; }
  .pick-grid, .sm-list { grid-template-columns: 1fr; }
  .subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .subtabs::-webkit-scrollbar { display: none; }
}

/* Контакты менеджера и куратора у родителей */
.contacts { display: flex; flex-direction: column; gap: 12px; }
.contact { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-md, 18px); background: var(--surface-alt); flex-wrap: wrap; }
.contact .main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 180px; }
.contact-role { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--eva-coral-deep); }
.contact .actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .contact .actions { width: 100%; } .contact .actions .btn { flex: 1; } }

/* ---------- Мобильная версия: аккуратная шапка, меню-чипсы, без декоративных кругов ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top { padding: 10px 0 0; }
  .logo img { height: 44px; }
  .hide-mobile { display: none !important; }
  .circle-btn { width: 40px; height: 40px; }
  .circle-btn svg { width: 20px; height: 20px; }
  .link-btn { min-height: 40px; font-size: 14px; }
  /* меню: лента во всю ширину экрана, прилипает к верху, справа плавно гаснет */
  .menu { position: relative; margin: 10px -16px 0; padding: 8px 16px; border-radius: 0; gap: 6px;
    background: rgba(241, 244, 247, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .menu.at-end { -webkit-mask-image: none; mask-image: none; }
  .menu a { min-height: 40px; padding: 0 14px; font-size: 15px; background: #fff; }
  .menu a.active { background: var(--eva-coral); }
  main { padding: 18px 0 40px; }
  .stack { gap: 16px; }
  .card { padding: 18px; border-radius: 22px; }
  .hero { padding: 20px; border-radius: 24px; }
  .hero::after, .login-page::before { display: none; }
  .hero .pill { font-size: 13px; padding: 8px 14px; }
  h1 { font-size: 24px; line-height: 1.2; }
  h2 { font-size: 20px; }
  /* этапы: лента прокручивается к текущему этапу */
  .steps-scroll { margin: 0 -18px; padding: 0 18px 4px; scrollbar-width: none; }
  .steps-scroll::-webkit-scrollbar { display: none; }
  .steps { grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: 112px; }
  .steps .ttl { font-size: 13px; }
  /* вкладки семьи: тоже лента */
  .subtabs { margin: 0 -16px; padding: 0 16px 2px; }
  .subtabs a { padding: 8px 14px; font-size: 14px; }
  /* таблицы-карточки: не шире экрана */
  .table-cards table, .table-cards tbody { display: block; width: 100%; }
  .table-cards td { flex-wrap: wrap; }
  .table-cards td > .inline-form { flex: 1; justify-content: flex-end; min-width: 0; }
  .table-cards td > .inline-form input[type=text], .table-cards td > .inline-form input[type=tel] { flex: 1; min-width: 0; width: auto !important; }
  .table-cards td.right .actions { justify-content: flex-start !important; flex-wrap: wrap; }
  /* чат: поле ввода во всю ширину */
  .chat-form { align-items: center; }
  .chat-form textarea { min-width: 0; flex: 1; resize: none; height: 48px; padding: 12px 14px; }
  /* формы в одну колонку */
  .form-grid { grid-template-columns: 1fr !important; }
  .grid-2 { grid-template-columns: 1fr; }
  footer { padding: 10px 0 30px; }
}
.subtabs, .steps-scroll, .menu { position: relative; }
@media (max-width: 640px) {
  .table-cards td > .small { flex-basis: 100%; text-align: right; margin-top: 0 !important; }
  .table-cards td > .inline-form { flex-basis: 60%; }
}

.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
.plain-fieldset[disabled] .btn { display: none; }

fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea, select[disabled] {
  background: var(--surface-alt); color: var(--text); opacity: 1; cursor: default; -webkit-text-fill-color: var(--text); }
.team-table td, .team-table th { padding-left: 8px; padding-right: 8px; }
.team-table .inline-form select { max-width: 150px; }
.team-table .btn-sm { white-space: nowrap; padding: 0 12px; }
.team-table td.right .actions { flex-wrap: nowrap; }
@media (min-width: 641px) { .team-table td.right .actions { flex-direction: column; align-items: stretch; } }

/* Заметки сотрудников */
.notes-list { display: flex; flex-direction: column; gap: 10px; }
.note { background: var(--surface-alt); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.note-private { background: #FFF6E5; }
.note-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .link-btn { align-self: flex-start; padding: 4px 0; min-height: 0; }
.tone-bad { background: #FDE2E4; color: #A12A3C; }

/* ---------- Строки «текст + кнопки»: текст никогда не сжимается в столбик ---------- */
.row { flex-wrap: wrap; }
.row > .main { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.row > .actions { flex: 0 1 auto; justify-content: flex-end; }
@media (max-width: 640px) {
  .row > .actions { flex: 1 1 100%; justify-content: flex-start; }
  .row > .actions .btn { flex: 0 1 auto; }
}

/* ---------- iPhone (Safari): поля даты и времени не вылезают за край и выровнены влево ---------- */
@supports (-webkit-touch-callout: none) {
  input[type=date], input[type=time], input[type=datetime-local] {
    -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%;
    text-align: left; min-height: 48px; line-height: 1.2; }
  input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
input[type=date], input[type=time] { min-width: 0; max-width: 100%; }
.field { min-width: 0; }
.row > .actions { min-width: 0; max-width: 100%; } .row > .actions .badge { white-space: normal; text-align: left; }
@media (max-width: 640px) { .table-cards td:first-child { display: block; } .table-cards td > .inline-form { flex-wrap: nowrap; } }

/* Аватарки */
.avatar-img { object-fit: cover; padding: 0; background: var(--surface-alt); }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; min-height: 0; padding: 0; border: 0; }
.profile-photo .row { gap: 16px; }
.profile-photo .avatar { flex: none; }
.staff-cell { display: flex; align-items: center; gap: 10px; }
.avatar-upload { margin: 0; }
.avatar-upload label { position: relative; display: block; cursor: pointer; }
.avatar-upload input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; padding: 0; cursor: pointer; }
.avatar-plus { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; background: var(--eva-coral);
  color: #fff; font-size: 13px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid #fff; }
.contact .avatar { flex: none; }

/* ---------- Сводка по семье ---------- */
.summary-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .summary-grid { grid-template-columns: 1fr; gap: 16px; } }
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--surface-alt); font-weight: 500; }
.todo:hover { color: var(--text); filter: brightness(.97); }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--eva-blue); }
.todo-bad { background: #FDE2E4; } .todo-bad .todo-dot { background: #D63649; }
.todo-wait { background: #FFF2D9; } .todo-wait .todo-dot { background: #E59A12; }
.todo-text { flex: 1; min-width: 0; }
.todo-go { color: var(--text-muted); }
.ok-empty { background: var(--ok-bg); color: var(--ok-fg); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.facts-list { margin: 0; display: flex; flex-direction: column; }
.facts-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts-list > div:last-child { border-bottom: 0; }
.facts-list dt { color: var(--text-muted); font-size: 14px; flex: none; }
.facts-list dd { margin: 0; text-align: right; font-weight: 600; }
.read-mark { color: var(--ok-fg); }
.stars-sm { color: #F2A93B; }
.ptask.done .main b { text-decoration: line-through; color: var(--text-muted); font-weight: 500; }
.overdue { color: #C0392B; font-weight: 600; }
.ptask-form { margin-top: 12px; }
.mini-msg { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-alt); }
.mini-msg.from-staff { background: var(--eva-blue-soft); }
.mini-body { overflow-wrap: anywhere; }
.todo-badges .badge { white-space: normal; text-align: left; }
@media (max-width: 640px) { .table-cards td[data-label="Что сделать"] { flex-direction: column; align-items: flex-start; } }

/* «Что нужно от вас» у родителей */
.need-card { border: 2px solid var(--eva-coral-soft); }
.need.done .main b { text-decoration: line-through; color: var(--text-muted); font-weight: 500; }
.done-check { color: var(--ok-fg); font-weight: 800; font-size: 20px; }
/* Оценка отчёта */
.rate-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.rate-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1; }
.rate-comment { flex: 1 1 180px; min-height: 40px !important; padding: 8px 12px !important; font-size: 14px !important; }
.star-pick { display: inline-flex; flex-direction: row-reverse; }
.star-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-pick label { font-size: 28px; line-height: 1; color: #D5DBE4; cursor: pointer; padding: 0 2px; }
.star-pick label:hover, .star-pick label:hover ~ label, .star-pick input:checked ~ label { color: #F2A93B; }
.star-pick input:focus-visible + label { outline: 3px solid var(--eva-blue-deep); border-radius: 4px; }
.stars { font-size: 20px; color: #D5DBE4; } .stars .on { color: #F2A93B; }

/* Лента и «что сейчас» у родителей */
.now-card { background: linear-gradient(135deg, #EEF6FD, #FFF1EC); }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { color: var(--text); background: var(--surface-alt); }
.feed-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--eva-blue); }
.feed-report .feed-dot { background: var(--eva-coral); } .feed-uzi .feed-dot { background: #9B7BD4; }
.feed-doc .feed-dot { background: #4FA37A; } .feed-task .feed-dot { background: #E59A12; }
.feed-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feed-text { color: var(--text-muted); overflow-wrap: anywhere; }
.feed-img { width: 160px; max-width: 100%; border-radius: 12px; margin-top: 6px; }
@media (max-width: 640px) {
  .card-head { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
  .card-head > h1, .card-head > form { flex-basis: 100%; }
  .rate-row { flex-direction: column; align-items: stretch; }
  .rate-form { flex-direction: column; align-items: flex-start; }
  .rate-comment { width: 100%; flex: none; }
  .rate-row > a { align-self: flex-start; }
  .facts-list > div { flex-direction: column; gap: 2px; }
  .facts-list dd { text-align: left; }
}

/* Визит + привязанные отчёты */
.visit-item { border-bottom: 1px solid var(--line, #EEE6E8); padding-bottom: 10px; }
.visit-item:last-child { border-bottom: 0; }
.visit-item > .row { border: 0; padding-bottom: 4px; }
.visit-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.visit-report { display: flex; flex-direction: column; gap: 2px; flex: 1 1 100%; padding: 10px 12px; border-radius: 12px; background: #EEF6FD; text-decoration: none; color: inherit; }
.visit-report:hover { background: #E1EFFB; }
:target { scroll-margin-top: 90px; }
article.report:target, .visit-item:target { outline: 2px solid var(--eva-coral); outline-offset: 4px; border-radius: 14px; }

/* Смайлы в стиле кабинета */
img.emo { width: 1.3em; height: 1.3em; vertical-align: -0.28em; margin: 0 .04em; display: inline-block; }
.emo-btn { flex: none; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.emo-btn-sm { gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px 4px 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.emo-btn-sm:hover { border-color: var(--eva-coral); color: var(--eva-coral-deep); }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.emo-host { position: relative; }
.emo-panel { position: absolute; z-index: 30; left: 12px; right: 12px; max-width: 420px; display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px;
  padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 40px rgba(60, 70, 110, .18); max-height: 250px; overflow-y: auto; }
.chat-form .emo-panel { bottom: calc(100% + 6px); }
.field .emo-panel { position: relative; left: 0; right: 0; max-width: none; box-shadow: none; }
.emo-panel button { border: 0; background: none; padding: 6px; border-radius: 12px; cursor: pointer; line-height: 0; }
.emo-panel button:hover, .emo-panel button:focus-visible { background: var(--eva-coral-soft); }
.emo-panel img { width: 30px; height: 30px; }
@media (max-width: 640px) { .chat-form .emo-btn { width: 40px; height: 40px; } }

/* Попытки переноса */
.card.attempts { gap: 4px; padding: 16px 22px; border-left: 4px solid var(--eva-blue); }
.card.attempts-over { border-left-color: var(--eva-coral); background: #FFF6F7; }

/* «Изменить» под записью */
.edit-item { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.edit-item:last-child { border-bottom: 0; }
.edit-item > .row { border: 0; padding-bottom: 2px; }
.edit-box > summary { cursor: pointer; color: var(--eva-blue-deep); font-weight: 600; font-size: 14px; padding: 4px 0; width: fit-content; }
.edit-box[open] { background: #F6F9FD; border-radius: 14px; padding: 6px 14px 14px; margin-top: 4px; }
.edit-box[open] > summary { margin-bottom: 8px; }
tr.edit-row > td { padding-top: 0 !important; border-top: 0 !important; }
.table-cards tr.edit-row { border-top: 0; margin-top: -8px; }
