/* ======================================================================
   КАРТА ЗДОРОВЬЯ · Дизайн-система «Спокойная карта» (мобильная оболочка)

   Спокойная палитра и крупные цели нажатия для мобильного экрана.
   Институтские отступы и сетка держат вертикальный ритм карточек.
   Расстояния и тени заданы через переменные — единый стиль во всём.
   Адаптивная вёрстка: один столбец, безопасные зоны под навигацию.
   Нейтральный фон бережёт глаза при длительном просмотре данных.
   Удобные состояния (норма/внимание/важно) подсвечены цветом статуса.
   Шрифт Golos Text — чистая кириллица для медицинского контекста.
   ====================================================================== */

:root {
  --bg:          #eef2f5;
  --surface:     #ffffff;
  --surface-2:   #f4f7f9;
  --border:      #e4eaee;
  --border-2:    #e8edf0;
  --text:        #16242b;
  --text-2:      #41535b;
  --muted:       #7c8990;
  --muted-2:     #9aa6ad;

  --primary:      #0e7c86;
  --primary-2:    #16a3ad;
  --primary-dark: #0a5c63;
  --primary-bg:   #e4f1f2;

  --ok:   #1f8a5b;  --ok-bg:   #e3f3ea;
  --warn: #b8791b;  --warn-bg: #f6ecd8;
  --bad:  #cf4b4b;  --bad-bg:  #f8e4e3;
  --child: #ed7d31; --child-2: #ffb36a; --child-bg: #fdeede;

  --shadow:    0 6px 16px -12px rgba(16,40,48,.22);
  --shadow-lg: 0 14px 30px -18px rgba(16,40,48,.32);
  --radius:    16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --nav-h: 64px;
  --appbar-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Атрибут hidden должен всегда скрывать, даже если задан display (иначе элементы наслаиваются) */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.value, .metric-card .value, table, .trend, .badge, .vac-status, .counter .n,
input[type="number"], .bmi-big, .pct-big { font-variant-numeric: tabular-nums; }

/* ---------- Оболочка приложения ---------- */
.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 60px -30px rgba(16,40,48,.25);
  position: relative;
}

/* ---------- Верхняя панель ---------- */
.appbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.appbar-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; align-items: center; gap: 6px; }
.appbar-back {
  border: none; background: none; color: var(--text); cursor: pointer;
  width: 34px; height: 34px; display: grid; place-items: center; margin-left: -6px;
}
.appbar-back svg { width: 22px; height: 22px; }
.icon-btn {
  position: relative; border: none; background: none; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 21px; height: 21px; }
.appbar-profile { border: none; background: none; cursor: pointer; padding: 2px; border-radius: 50%; }

/* ---------- Аватары ---------- */
.profile-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--primary-2), var(--primary-dark)); color: #fff;
  font-size: 14px; font-weight: 700; background-size: cover; background-position: center; flex-shrink: 0;
}
.profile-avatar.child { background: linear-gradient(135deg, var(--child-2), var(--child)); }
.profile-avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.profile-avatar.lg { width: 72px; height: 72px; font-size: 26px; }

/* ---------- Основная область / панели ---------- */
main { display: block; }
.panel { display: none; padding: 16px 16px calc(var(--nav-h) + 24px); }
.panel.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: -.02em; }
.hint { color: var(--muted); margin: 8px 0 0; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.screen-meta { color: var(--muted); font-size: 13px; margin: 0 0 12px; font-weight: 600; }

.block { margin-bottom: 22px; }
.block-title { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.block-head .block-title { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Приветствие (Главное) ---------- */
.screen-greeting { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.greeting-sub { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: capitalize; }
.greeting-title { margin: 2px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

/* ---------- Баннер статуса дня ---------- */
.status-banner {
  display: flex; gap: 14px; align-items: center;
  padding: 18px; border-radius: var(--radius-lg);
  color: #fff; box-shadow: var(--shadow-lg); margin-bottom: 14px;
  background: linear-gradient(160deg, var(--primary-2), var(--primary-dark));
}
.status-banner.ok   { background: linear-gradient(160deg, #2bb37a, #1f8a5b); }
.status-banner.warn { background: linear-gradient(160deg, #d2a23f, #9a6510); }
.status-banner.bad  { background: linear-gradient(160deg, #e06464, #a83232); }
.status-banner.neutral { background: linear-gradient(160deg, #8aa0a8, #5f7079); }
.status-banner .sb-icon {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 22px; font-weight: 800; flex-shrink: 0; background: rgba(255,255,255,.2);
}
.status-banner .sb-title { font-weight: 800; font-size: 17px; }
.status-banner .sb-text { font-size: 13.5px; color: rgba(255,255,255,.92); margin-top: 2px; }

/* ---------- Счётчики ---------- */
.counter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.counter {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; text-align: center; box-shadow: var(--shadow);
}
.counter .n { font-size: 24px; font-weight: 800; line-height: 1; }
.counter .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.counter.ok .n { color: var(--ok); }
.counter.warn .n { color: var(--warn); }
.counter.good .n { color: var(--primary); }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.card-eyebrow { margin: 0 0 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }

/* ---------- Карточки-показатели ---------- */
.metric-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.metric-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted-2);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow); position: relative;
}
.metric-card.ok { border-left-color: var(--ok); }
.metric-card.warn { border-left-color: var(--warn); }
.metric-card.bad { border-left-color: var(--bad); }
.metric-card .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.metric-card .value { font-size: 24px; font-weight: 800; margin: 4px 0 2px; letter-spacing: -.01em; }
.metric-card .unit { font-size: 12px; color: var(--muted); font-weight: 600; }
.metric-card .meta { font-size: 12px; color: var(--muted); }
.metric-card .pin-x {
  position: absolute; top: 8px; right: 8px; border: none; background: none; cursor: pointer;
  color: var(--muted-2); font-size: 15px; line-height: 1; padding: 2px 4px;
}
.metric-card .pin-x:hover { color: var(--bad); }

/* ---------- Сегментированные под-вкладки ---------- */
.segmented {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.seg {
  flex: 1; border: none; background: none; cursor: pointer; font-family: inherit;
  padding: 9px 10px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-radius: 999px; transition: background .15s, color .15s;
}
.seg.active { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: var(--shadow); }
.subpanel { display: none; }
.subpanel.active { display: block; animation: fade .2s ease; }

/* ---------- Чипы-фильтры ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Формы ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit; color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,124,134,.12); }
textarea { resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 90px; }
.field { position: relative; display: block; }
.field input { padding-right: 38px; }
.unit-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(calc(-50% + 3px)); color: var(--muted); font-size: 13px; pointer-events: none; }
.form-group-title { margin: 18px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); font-weight: 700; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.checkbox-label input { width: auto; margin: 0; }
.inline-hint { font-size: 13px; min-height: 18px; margin: 4px 0 8px; font-weight: 600; }
.inline-hint.bad { color: var(--bad); }
.inline-hint.ok { color: var(--ok); }
.inline-controls { display: flex; align-items: center; gap: 10px; }
.mini-select { width: auto; margin: 0; padding: 7px 10px; font-size: 13px; }

/* раскрывающаяся форма-карточка */
.add-form > summary {
  cursor: pointer; font-weight: 700; color: var(--primary); list-style: none; font-size: 14px;
}
.add-form > summary::-webkit-details-marker { display: none; }
.add-form[open] > summary { margin-bottom: 14px; }
.add-form > form { display: block; }

/* ---------- Кнопки ---------- */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 14px; cursor: pointer; font-weight: 700; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -10px rgba(14,124,134,.6); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-tiny { padding: 5px 10px; font-size: 12px; background: transparent; border-color: var(--border); color: var(--muted); font-weight: 600; }
.btn-tiny:hover { color: var(--bad); border-color: var(--bad); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-pin { white-space: nowrap; }
.btn-pin.on { color: var(--primary); border-color: var(--primary); background: var(--primary-bg); }

/* ---------- Бейджи / статусы ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }

.trend { font-size: 12px; margin-left: 6px; white-space: nowrap; font-weight: 600; }
.trend.good { color: var(--ok); }
.trend.bad { color: var(--bad); }
.trend.neutral { color: var(--muted); }
.trend.minor { opacity: .85; font-weight: 500; }
.trend.moderate { font-weight: 700; }
.trend.strong { font-weight: 800; }

/* ---------- Алерты (Требует внимания) ---------- */
.alert-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted-2);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
}
.alert-card.bad { border-left-color: var(--bad); }
.alert-card.warn { border-left-color: var(--warn); }
.alert-card.ok { border-left-color: var(--ok); }
.alert-card .ac-body { flex: 1; }
.alert-card .ac-title { font-weight: 700; font-size: 14px; }
.alert-card .ac-text { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.alert-card .ac-val { font-size: 20px; font-weight: 800; }
.empty { color: var(--muted); padding: 22px; text-align: center; font-size: 14px; }
.empty-state { color: var(--muted); padding: 28px 18px; text-align: center; font-size: 14px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- Измерения дневника (карточки) ---------- */
.entry-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow); }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.entry-date { font-weight: 700; font-size: 14px; }
.entry-tag { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.entry-metrics { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.em { display: flex; flex-direction: column; gap: 1px; }
.em .em-l { font-size: 11px; color: var(--muted); font-weight: 600; }
.em .em-v { font-size: 15px; font-weight: 700; }
.em .em-v.ok { color: var(--ok); }
.em .em-v.warn { color: var(--warn); }
.em .em-v.bad { color: var(--bad); }
.entry-foot { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; }
.entry-note { font-size: 13px; color: var(--text-2); }
.harm-row { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 13px; color: var(--warn); font-weight: 600; background: var(--warn-bg); border-radius: var(--radius-sm); padding: 8px 11px; }
.harm-row svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Лабораторный показатель ---------- */
.lab-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); }
.lab-card.highlight { border-color: var(--primary); border-left: 4px solid var(--primary); }
.lab-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.lab-name { font-weight: 700; font-size: 15px; }
.lab-norm { font-size: 12px; color: var(--muted); margin-top: 1px; }
.lab-right { text-align: right; }
.lab-value { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.lab-value .lab-unit { font-size: 12px; color: var(--muted); font-weight: 600; }
.lab-statusline { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.lab-actions { display: flex; gap: 8px; margin-top: 10px; }
.lab-history { margin-top: 10px; }
.lab-history summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.lab-history table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.lab-history th, .lab-history td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.lab-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin: 8px 2px 4px; }

/* кнопка пояснения «за что отвечает» */
.info-dot {
  border: none; background: var(--surface-2); color: var(--primary); cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; font-size: 12px; font-weight: 800; line-height: 18px;
  display: inline-grid; place-items: center; margin-left: 6px; padding: 0;
}
.annot { margin-top: 10px; background: var(--primary-bg); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px; color: var(--text-2); }
.annot.hidden { display: none; }

/* ---------- ИМТ ---------- */
.bmi-card { text-align: center; }
.bmi-big { font-size: 46px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.bmi-scale { margin-top: 16px; }
.bmi-bar { height: 10px; border-radius: 999px; display: flex; overflow: hidden; }
.bmi-bar span { display: block; height: 100%; }
.bmi-bar .s-def { background: #cdd9dd; }
.bmi-bar .s-norm { background: var(--ok); }
.bmi-bar .s-over { background: var(--warn); }
.bmi-bar .s-ob { background: var(--bad); }
.bmi-ticks { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
.bmi-pointer { position: relative; height: 14px; }
.bmi-pointer .pin { position: absolute; transform: translateX(-50%); font-size: 12px; color: var(--text); }

.bmi-preview { margin: 6px 0 14px; padding: 13px 15px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; border: 1px solid var(--border); }
.bmi-preview strong { font-size: 19px; font-weight: 800; }

/* ---------- Графики ---------- */
.chart { width: 100%; overflow-x: auto; margin-bottom: 6px; }
.chart svg { display: block; }
.chart .axis-label { font-size: 10px; fill: var(--muted); }
.chart .ref-band { fill: var(--primary-bg); opacity: .7; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--primary); }
.chart .dot.bad { fill: var(--bad); }
.chart .dot.warn { fill: var(--warn); }
/* перцентильный коридор */
.chart .pct-band { fill: var(--primary-bg); opacity: .55; }
.chart .pct-line { fill: none; stroke: var(--muted-2); stroke-width: 1.2; stroke-dasharray: 3 3; }
.chart .pct-mid { stroke: var(--muted-2); stroke-dasharray: none; stroke-width: 1.4; }
.pct-big { font-size: 22px; font-weight: 800; }

/* ---------- Лица настроения ---------- */
.mood-faces { display: flex; gap: 8px; margin: 6px 0 16px; }
.mood-faces .mf {
  flex: 1; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  padding: 10px 4px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: border-color .15s, background .15s;
}
.mood-faces .mf svg { width: 26px; height: 26px; }
.mood-faces .mf span { font-size: 11px; color: var(--muted); font-weight: 600; }
.mood-faces .mf.active { border-color: var(--primary); background: var(--primary-bg); }
.mood-faces .mf.active span { color: var(--primary); }

/* ---------- Лента записей / журнал ---------- */
.journal-entry { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); }
.journal-entry .je-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.journal-entry .je-date { font-weight: 700; }
.journal-entry .je-section { margin: 6px 0; font-size: 14px; }
.journal-entry .je-section .lbl { color: var(--muted); font-size: 12px; display: block; }
.complaint { color: var(--bad); font-weight: 600; }

/* ---------- Самочувствие: цвета по 5 уровням и сводка ---------- */
.mood-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #fff; }
.mood-badge.mood-5 { background: #1f8a5b; }
.mood-badge.mood-4 { background: #5bb98c; }
.mood-badge.mood-3 { background: #d9a521; }
.mood-badge.mood-2 { background: #e08a3c; }
.mood-badge.mood-1 { background: #cf4b4b; }
.journal-entry.mood-5 { border-left: 4px solid #1f8a5b; }
.journal-entry.mood-4 { border-left: 4px solid #5bb98c; }
.journal-entry.mood-3 { border-left: 4px solid #d9a521; }
.journal-entry.mood-2 { border-left: 4px solid #e08a3c; }
.journal-entry.mood-1 { border-left: 4px solid #cf4b4b; }
.mood-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.mood-donut { flex: none; }
.md-total { font-size: 24px; font-weight: 800; fill: var(--text); }
.md-total-l { font-size: 10px; fill: var(--muted); }
.mood-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 150px; }
.mood-leg { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.mood-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.mood-leg-l { flex: 1; color: var(--text); }
.mood-leg-n { font-weight: 700; color: var(--text); }

/* ---------- Диагностика ---------- */
.imaging-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); border-left: 4px solid var(--muted-2); }
.imaging-card.attention { border-left-color: var(--warn); }
.imaging-card.important { border-left-color: var(--bad); }
.imaging-card.norm { border-left-color: var(--ok); }
.imaging-card .ic-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.imaging-card .ic-type { font-weight: 700; font-size: 15px; }
.imaging-card .ic-date { font-size: 12px; color: var(--muted); margin-top: 1px; }
.imaging-card .ic-sec { font-size: 13.5px; margin-top: 8px; }
.imaging-card .ic-sec .lbl { color: var(--muted); font-size: 11px; display: block; }
.attach { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--primary); background: var(--primary-bg); border-radius: 999px; padding: 3px 10px; margin-top: 8px; }

/* ---------- Таймлайн (прививки, кормления) ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted-2); margin-top: 4px; flex-shrink: 0; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.tl-dot.done { background: var(--ok); }
.tl-dot.overdue { background: var(--bad); }
.tl-dot.upcoming { background: var(--muted-2); }
.tl-line { width: 2px; flex: 1; background: var(--border); margin: 2px 0; }
.tl-item:last-child .tl-line { display: none; }
.tl-body { flex: 1; padding-bottom: 16px; }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); }
.tl-title { font-weight: 700; font-size: 14px; }
.tl-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-card .vac-edit { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.tl-card .vac-edit .vac-field { margin: 0; flex: 1; min-width: 110px; display: flex; flex-direction: column; gap: 2px; }
.tl-card .vac-edit .vac-cap { font-size: 11px; color: var(--muted); }
.tl-card .vac-edit input { font-size: 13px; padding: 6px 8px; }
.tl-card .vac-edit .vac-inp { display: flex; gap: 4px; align-items: center; }
.tl-card .vac-edit .vac-inp input { flex: 1; min-width: 0; }
.tl-card .vac-edit .vac-clear { flex: none; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; }
.tl-card .vac-edit .vac-clear:active { background: var(--bg); }
.risk-tag { font-size: 11px; color: var(--warn); font-weight: 700; }

/* ---------- Ежедневное приветствие ---------- */
.greeting-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 16px 16px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.greet-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: none; background: none; color: var(--muted-2); font-size: 14px; line-height: 1; cursor: pointer; border-radius: 8px; }
.greet-close:active { background: var(--surface-2); }
.greet-hello { font-size: 16px; font-weight: 800; color: var(--primary); padding-right: 30px; }
.greet-body { font-size: 14px; line-height: 1.5; color: var(--text); margin-top: 6px; }
.greet-actions { margin-top: 12px; }
.greet-cta { display: inline-flex; align-items: center; gap: 7px; background: var(--primary); color: #fff; border: none; border-radius: 12px; padding: 10px 18px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.greet-cta:active { opacity: .9; }
.greet-divider { height: 1px; background: var(--border); margin: 14px 0 12px; }
.greet-q { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.greet-moods { display: flex; gap: 6px; }
.greet-mf { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; color: var(--primary); cursor: pointer; font-size: 11px; font-family: inherit; }
.greet-mf svg { width: 24px; height: 24px; }
.greet-mf:active { background: var(--surface); }
.greet-mf.active { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 1px var(--primary) inset; }
.greet-mood-done { font-size: 13px; color: var(--ok); font-weight: 600; }
.greet-notes { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.greet-ta { width: 100%; resize: vertical; font-family: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); }
.greet-notes-act { display: flex; align-items: center; gap: 14px; }
.greet-link { background: none; border: none; color: var(--primary); font-weight: 600; font-size: 12.5px; cursor: pointer; font-family: inherit; padding: 0; }

/* кольца-сводка кормления */
.feed-rings { display: flex; align-items: center; gap: 16px; }
.feed-ring-num { font-size: 30px; font-weight: 800; }
.feed-ring-sub { font-size: 12px; color: var(--muted); }
.feed-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.feed-stat .fs-n { font-size: 18px; font-weight: 800; }
.feed-stat .fs-l { font-size: 11px; color: var(--muted); }

/* ---------- Навыки ---------- */
.skills { display: flex; flex-direction: column; gap: 8px; }
.skill { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.skill .sk-box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.skill.done .sk-box { background: var(--ok); border-color: var(--ok); }
.skill .sk-text { font-size: 14px; }
.skill.soon { opacity: .6; }
.skill .sk-soon { font-size: 11px; color: var(--muted); margin-left: auto; }

/* ---------- «Ещё»: списки ---------- */
.list-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin: 18px 4px 8px; }
.profile-list-v { display: flex; flex-direction: column; gap: 8px; }
.profile-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.profile-row.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow); }
.profile-row .pr-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.profile-row .pr-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.profile-row .pr-sub { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.profile-row .pr-edit { color: var(--muted-2); font-size: 16px; padding: 4px; }
.profile-row .pr-edit:hover { color: var(--primary); }
.menu-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row-link {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--border); padding: 14px 15px; cursor: pointer; font-family: inherit; font-size: 15px; color: var(--text); font-weight: 600;
}
.menu-list .row-link:last-child { border-bottom: none; }
.row-link:hover { background: var(--surface-2); }
.row-link-ic { width: 24px; text-align: center; }
.row-link-text { flex: 1; }
.row-link-chev { color: var(--muted-2); }
.add-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; box-shadow: var(--shadow); color: var(--primary); }
.add-row .row-link-ic { color: var(--primary); font-weight: 800; }
.data-note { margin-top: 14px; padding: 0 4px; }

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 70;
  width: 100%; max-width: 600px; height: var(--nav-h);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.94); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  border: none; background: none; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600; transition: color .15s;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--primary); }
.nav-item[hidden] { display: none; }

/* ---------- Уведомления ---------- */
.notif-wrap { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: var(--bad); color: #fff; border-radius: 999px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: 90vw; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 250; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 15px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.notif-item { display: flex; gap: 10px; padding: 10px 11px; border-radius: var(--radius-sm); font-size: 13px; align-items: flex-start; border: 1px solid transparent; }
.notif-item.bad { background: var(--bad-bg); border-color: #f0cfcf; }
.notif-item.warn { background: var(--warn-bg); border-color: #ecddbf; }
.notif-item.ok { background: var(--ok-bg); border-color: #c4e5d2; }
.notif-icon { font-weight: 700; }
.notif-item.bad .notif-icon { color: var(--bad); }
.notif-item.warn .notif-icon { color: var(--warn); }
.notif-item.ok .notif-icon { color: var(--ok); }
.notif-prof { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- Импорт PDF ---------- */
.import-card { border-left: 4px solid var(--primary); }
.dropzone { border: 2px dashed #cdd9dd; border-radius: var(--radius-sm); padding: 22px; text-align: center; background: #fafcfc; transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--primary); background: var(--primary-bg); }
.dropzone p { margin: 4px 0; }

/* ---------- Таблицы (импорт-модалка) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }

/* ---------- Модальные окна ---------- */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; background: rgba(16, 30, 38, .5); display: flex; align-items: flex-start; justify-content: center; padding: 20px; z-index: 300; overflow-y: auto; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal-box { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 760px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 92vh; }
.modal-narrow { max-width: 460px; }
.modal-head, .modal-foot { padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-foot { border-bottom: none; border-top: 1px solid var(--border); gap: 8px; justify-content: flex-end; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-body td input { margin: 0; padding: 7px 9px; font-size: 13px; }
.modal-body td:first-child { width: 28px; text-align: center; }
.profile-photo-row { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.raw-text { margin-top: 16px; }
.raw-text summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.raw-text pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 12px; border-radius: 8px; font-size: 12px; max-height: 240px; overflow-y: auto; margin-top: 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 400; }

@media (min-width: 560px) {
  .metric-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ====================== Дашборд «Вариант A» ====================== */
.appbar-lead { display: flex; align-items: center; gap: 11px; border: none; background: none; cursor: pointer; padding: 0; flex: 1; min-width: 0; }
.appbar-lead .profile-avatar { width: 42px; height: 42px; font-size: 16px; }
.appbar-lead-txt { display: flex; flex-direction: column; text-align: left; }
.appbar-date { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.2; text-transform: capitalize; }
.appbar-hello { font-size: 17px; color: var(--text); font-weight: 700; line-height: 1.25; max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-lead { overflow: hidden; }

/* герой со счётчиками */
.status-hero { border-radius: 22px; padding: 20px; color: #fff; margin-bottom: 22px;
  background: linear-gradient(160deg, var(--primary), var(--primary-dark)); box-shadow: 0 14px 28px -12px rgba(14,124,134,.6); }
.status-hero.ok   { background: linear-gradient(160deg, #2bb37a, #1f8a5b); box-shadow: 0 14px 28px -12px rgba(31,138,91,.55); }
.status-hero.warn { background: linear-gradient(160deg, #d2a23f, #9a6510); box-shadow: 0 14px 28px -12px rgba(184,121,27,.5); }
.status-hero.bad  { background: linear-gradient(160deg, #e06464, #a83232); box-shadow: 0 14px 28px -12px rgba(207,75,75,.5); }
.status-hero.neutral { background: linear-gradient(160deg, #8aa0a8, #5f7079); box-shadow: var(--shadow); }
.sh-row { display: flex; align-items: center; gap: 11px; }
.sh-icon { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; flex-shrink: 0; }
.sh-icon svg { width: 22px; height: 22px; }
.sh-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.sh-sub { font-size: 13px; opacity: .85; margin-top: 1px; }
.sh-stats { display: flex; gap: 8px; margin-top: 16px; }
.sh-stat { flex: 1; background: rgba(255,255,255,.12); border-radius: 13px; padding: 10px 12px; }
.sh-stat .n { font-size: 21px; font-weight: 700; line-height: 1; }
.sh-stat .l { font-size: 11.5px; opacity: .82; margin-top: 3px; }
.link-all { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--primary); }

/* карточка «требует внимания» с иконкой и спарклайном */
.alert-card { display: flex; align-items: center; gap: 13px; background: #fff; border: 1px solid var(--border);
  border-left: 4px solid var(--muted-2); border-radius: 16px; padding: 14px 15px; box-shadow: 0 6px 16px -10px rgba(16,40,48,.2); }
.alert-card.bad { border-color: #efc9c7; border-left-color: var(--bad); }
.alert-card.warn { border-color: #efdcc4; border-left-color: var(--warn); }
.alert-card.ok { border-color: #c4e5d2; border-left-color: var(--ok); }
.alert-card .ac-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.alert-card .ac-ic svg { width: 20px; height: 20px; }
.alert-card.bad .ac-ic { background: var(--bad-bg); color: var(--bad); }
.alert-card.warn .ac-ic { background: var(--warn-bg); color: var(--warn); }
.alert-card.ok .ac-ic { background: var(--ok-bg); color: var(--ok); }
.alert-card .ac-body { flex: 1; min-width: 0; }
.alert-card .ac-title { display: flex; align-items: baseline; gap: 7px; }
.alert-card .ac-name { font-size: 15px; font-weight: 700; color: var(--text); }
.alert-card .ac-num { font-size: 15px; font-weight: 700; }
.alert-card.bad .ac-num { color: var(--bad); } .alert-card.warn .ac-num { color: var(--warn); } .alert-card.ok .ac-num { color: var(--ok); }
.alert-card .ac-unit { font-size: 12px; color: var(--muted); }
.alert-card .ac-text { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.alert-card .ac-spark { flex-shrink: 0; }

/* закреплённые карточки (Вариант A) */
.metric-card .pc-top { display: flex; align-items: center; justify-content: space-between; }
.metric-card .pc-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.metric-card .pc-ic svg { width: 17px; height: 17px; }
.metric-card .pc-dot { width: 7px; height: 7px; border-radius: 50%; }
.metric-card .pc-dot.ok { background: var(--ok); } .metric-card .pc-dot.warn { background: var(--warn); } .metric-card .pc-dot.bad { background: var(--bad); } .metric-card .pc-dot.neutral { background: var(--muted-2); }
.metric-card .pc-label { font-size: 12px; color: var(--muted); margin-top: 10px; }
.metric-card .pc-value { display: flex; align-items: baseline; gap: 4px; margin-top: 1px; }
.metric-card .pc-value .v { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.metric-card .pc-value .u { font-size: 12px; color: var(--muted); }
.metric-card .pc-trend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; margin-top: 3px; }
.metric-card .pc-trend svg { width: 13px; height: 13px; }
.metric-card .pc-trend.good { color: var(--ok); } .metric-card .pc-trend.bad { color: var(--bad); } .metric-card .pc-trend.neutral { color: var(--muted); }
.metric-card.has-pin { border-left: 1px solid var(--border); padding: 14px; }
.metric-card .pin-x { z-index: 2; }

/* карточка-график давления */
.bp-card { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 16px 16px 12px; box-shadow: var(--shadow); margin-bottom: 14px; }
.bp-head { display: flex; align-items: flex-start; justify-content: space-between; }
.bp-title { font-size: 15px; font-weight: 700; color: var(--text); }
.bp-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.bp-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; }
.bp-delta.good { color: var(--ok); background: var(--ok-bg); } .bp-delta.bad { color: var(--bad); background: var(--bad-bg); } .bp-delta.neutral { color: var(--muted); background: var(--surface-2); }
.bp-legend { display: flex; gap: 14px; margin: 12px 0 8px; }
.bp-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.bp-legend .sw { width: 14px; height: 3px; border-radius: 2px; }

/* герой кликабелен, раскрывает блоки */
.status-hero { cursor: pointer; }
.sh-caret { width: 20px; height: 20px; opacity: .8; transition: transform .2s; flex-shrink: 0; }
.status-hero.open .sh-caret { transform: rotate(180deg); }

/* подписи значений на графике */
.pt-label { font-size: 9px; fill: var(--text-2); font-weight: 700; }

/* спарклайн в карточке анализа */
.lab-spark { margin: 4px 0 2px; }
.lab-spark svg { width: 100%; height: 40px; display: block; }

/* ---------- Экран «нет соединения» ---------- */
#offline-gate { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: grid; place-items: center; padding: 24px; text-align: center; }
#offline-gate .offline-box { max-width: 360px; }
#offline-gate .offline-ic { font-size: 48px; margin-bottom: 10px; }
#offline-gate h2 { font-size: 20px; margin: 0 0 8px; font-weight: 800; }
#offline-gate p { margin: 0 0 18px; }

/* ---------- Ограничения по тарифу (см. license.js → window.HcardLicense) ---------- */
/* Базовый тариф (Free): функции полного тарифа скрыты. */
body[data-tier="basic"] .full-only { display: none !important; }
/* Подсказка об ограничении истории на базовом тарифе. */
.tier-history-note { margin: 4px 0 10px; font-size: 12.5px; color: var(--muted, #7a8a8d); }
