/* Компоненты и разметка веб-приложения «Понятно».
 * Зеркалит компоненты приложения (core/designsystem/components/*): PCard, Buttons,
 * Chips, HealthComponents (MiniMetricCard/MetricRow/IndicatorBar/Sparkline), AppBar,
 * BottomBar→боковая навигация, ChatScreen-пузыри, StateViews (CenteredState).
 * Все значения — через токены из tokens.css. */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.56;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-ink); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Типографика (Type.kt) ---------- */
.t-hero    { font-family: var(--head); font-weight: 800; font-size: 32px; line-height: 36px; letter-spacing: -0.03em; }
.t-title   { font-family: var(--head); font-weight: 700; font-size: 22px; line-height: 26px; letter-spacing: -0.02em; }
.t-sub     { font-family: var(--body); font-weight: 400; font-size: 13px; line-height: 16px; color: var(--ink-3); }
.t-card    { font-family: var(--head); font-weight: 600; font-size: 17px; line-height: 22px; letter-spacing: -0.02em; }
.t-section { font-family: var(--head); font-weight: 600; font-size: 14px; line-height: 18px; letter-spacing: -0.02em; }
.t-eyebrow { font-family: var(--head); font-weight: 600; font-size: 13px; line-height: 16px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--accent-ink); }
.t-body    { font-family: var(--body); font-weight: 400; font-size: 16px; line-height: 25px; }
.t-strong  { font-family: var(--body); font-weight: 600; font-size: 16px; line-height: 22px; }
.t-small   { font-family: var(--body); font-weight: 400; font-size: 14px; line-height: 20px; }
.t-caption { font-family: var(--body); font-weight: 400; font-size: 12px; line-height: 16px; color: var(--ink-3); }
.t-metric  { font-family: var(--head); font-weight: 700; font-size: 30px; line-height: 32px; letter-spacing: -0.03em; }
.muted  { color: var(--ink-2); }
.muted3 { color: var(--ink-3); }
.center { text-align: center; }

/* ---------- Каркас: боковая навигация + контент (адаптация под большой экран) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface);
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-family: var(--head); font-weight: 800; font-size: 19px; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 5px 14px -5px rgba(42, 111, 219, .6); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-md);
  color: var(--ink-3); font-family: var(--head); font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item svg { width: 22px; height: 22px; flex: 0 0 22px; }
.nav-item:hover { background: var(--accent-soft-2); color: var(--ink-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .badge { margin-left: auto; }
.sidebar .nav-spacer { flex: 1; }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line-2); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 24px var(--sp-xxl) 96px; }
.page-narrow { max-width: 720px; }

/* Верхняя панель экрана (AppBar) */
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.topbar .tb-titles { min-width: 0; }
.topbar .tb-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.iconbtn { width: 42px; height: 42px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; position: relative; }
.iconbtn:hover { background: var(--accent-soft-2); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn .badge-dot { position: absolute; top: -3px; right: -3px; }

/* Поисковая «пилюля» (SearchPill) */
.search-pill { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 420px; padding: 11px 16px; border-radius: var(--r-pill); background: var(--accent-soft-2); border: 1px solid var(--line); color: var(--ink-3); }
.search-pill svg { width: 18px; height: 18px; }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.card.pad-lg { padding: 20px; }
.card.tap { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s; }
.card.tap:hover { border-color: #d3dbe6; box-shadow: var(--shadow-sm); }
.card.tap:active { transform: translateY(1px); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head .grow { flex: 1; }
.section-gap { margin-top: var(--section); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.link-more { font-family: var(--head); font-weight: 600; font-size: 13px; color: var(--accent-ink); background: none; border: none; padding: 4px 6px; }

/* ---------- Кнопки (Buttons.kt) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--head); font-weight: 600; font-size: 16px; letter-spacing: -0.02em; border-radius: var(--r-md); border: 1px solid transparent; padding: 0 20px; min-height: 50px; transition: background .15s, border-color .15s, opacity .15s; }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); color: var(--on-accent); min-height: 54px; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:disabled { background: var(--line); color: var(--ink-3); cursor: default; }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { filter: brightness(0.97); }
.btn-secondary { background: none; color: var(--accent-ink); border: none; min-height: 44px; padding: 0 8px; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--accent-soft-2); }
.btn-danger { background: none; color: var(--alert); border: 1px solid var(--alert-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 14px; }

/* ---------- Чипы (Chips.kt) ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--r-sm); font-family: var(--body); font-weight: 500; font-size: 13px; line-height: 16px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.chip svg { width: 15px; height: 15px; }
.chip.sel { border-color: transparent; }
.chip.sel.ok     { background: var(--ok-soft);    color: var(--ok); }
.chip.sel.warn   { background: var(--warn-soft);  color: var(--warn); }
.chip.sel.alert  { background: var(--alert-soft); color: var(--alert); }
.chip.sel.accent { background: var(--accent-soft); color: var(--accent); }
.chip.sel.muted  { background: var(--line-2); color: var(--ink-3); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }

/* Статус-тег / точка / бейдж (StatusTag/StatusDot/PillBadge) */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-sm); font-family: var(--body); font-size: 12px; font-weight: 500; }
.tag.ok     { background: var(--ok-soft);    color: var(--ok); }
.tag.warn   { background: var(--warn-soft);  color: var(--warn); }
.tag.alert  { background: var(--alert-soft); color: var(--alert); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.muted  { background: var(--line-2); color: var(--ink-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.alert { background: var(--alert); } .dot.accent { background: var(--accent); } .dot.muted { background: var(--ink-3); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--alert); color: #fff; font-family: var(--head); font-weight: 700; font-size: 11px; display: inline-grid; place-items: center; }
.badge-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--alert); border: 2px solid var(--surface); display: inline-block; }
.pill-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; font-family: var(--head); }
.pill-badge svg { width: 14px; height: 14px; }
.pill-badge.ok { background: var(--ok-soft); color: var(--ok); } .pill-badge.warn { background: var(--warn-soft); color: var(--warn); } .pill-badge.alert { background: var(--alert-soft); color: var(--alert); } .pill-badge.accent { background: var(--accent-soft); color: var(--accent); }

/* Тренд-дельта (TrendDelta): вверх=зелёный, вниз=красный, флет=серый */
.trend { display: inline-flex; align-items: center; gap: 3px; font-family: var(--head); font-weight: 600; font-size: 12px; }
.trend svg { width: 14px; height: 14px; }
.trend.up { color: var(--ok); } .trend.down { color: var(--alert); } .trend.flat { color: var(--ink-3); }

/* ---------- Note-box (NoteBox / Surfaces.kt) ---------- */
.note { display: flex; gap: 10px; padding: 14px; border-radius: var(--r-md); font-size: 14px; line-height: 20px; }
.note svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.note.neutral { background: var(--accent-soft-2); color: var(--ink-2); border: 1px solid var(--line); }
.note.ok { background: var(--ok-soft); color: var(--ok); } .note.warn { background: var(--warn-soft); color: var(--warn); } .note.alert { background: var(--alert-soft); color: var(--alert); } .note.accent { background: var(--accent-soft); color: var(--accent-ink); }
.note b { color: var(--ink); }
.icon-tile { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; flex: 0 0 40px; }
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile.ok { background: var(--ok-soft); color: var(--ok); } .icon-tile.warn { background: var(--warn-soft); color: var(--warn); } .icon-tile.alert { background: var(--alert-soft); color: var(--alert); } .icon-tile.accent { background: var(--accent-soft); color: var(--accent); } .icon-tile.muted { background: var(--line-2); color: var(--ink-3); }

/* ---------- Мини-карточка показателя (MiniMetricCard) ---------- */
.mini-metric { min-height: 132px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); padding: 12px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color .15s; }
.mini-metric:hover { border-color: #d3dbe6; }
.mini-metric .mm-top { display: flex; align-items: center; gap: 6px; }
.mini-metric .mm-name { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.mini-metric .mm-val { display: flex; align-items: baseline; gap: 4px; }
.mini-metric .mm-unit { font-size: 13px; color: var(--ink-3); }
.mini-metric .mm-spark { height: 34px; margin-top: auto; }
.mini-metric .mm-delta { font-size: 12px; color: var(--ink-3); }
.mini-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.mini-scroll > .mini-metric { flex: 0 0 168px; }

/* ---------- Строка показателя (MetricRow) ---------- */
.metric-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.metric-row:last-child { border-bottom: none; }
.metric-row .mr-main { min-width: 0; flex: 1; }
.metric-row .mr-name { display: flex; align-items: center; gap: 8px; }
.metric-row .mr-val { display: flex; align-items: baseline; gap: 5px; margin-top: 2px; }
.metric-row .mr-spark { width: 92px; height: 38px; flex: 0 0 92px; }
.metric-row .chevron { color: var(--ink-3); }
.metric-row .chevron svg { width: 18px; height: 18px; }

/* ---------- IndicatorBar (референс-диапазон + маркер значения) ---------- */
.indibar { --lo: 0%; --hi: 100%; --pos: 50%; position: relative; height: 30px; margin: 10px 0; }
.indibar .track { position: absolute; top: 13px; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--line-2); }
.indibar .range { position: absolute; top: 13px; height: 4px; border-radius: 2px; background: var(--accent-soft); left: var(--lo); right: calc(100% - var(--hi)); }
.indibar .marker { position: absolute; top: 6px; left: var(--pos); width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); transform: translateX(-50%); }
.indibar .marker.ok { border-color: var(--ok); } .indibar .marker.warn { border-color: var(--warn); } .indibar .marker.alert { border-color: var(--alert); }

/* ---------- Спарклайн (svg) ---------- */
.spark { width: 100%; height: 100%; display: block; overflow: visible; }
.spark-placeholder { border-top: 2px solid var(--line-2); }

/* ---------- Строка события (EventRow / Timeline) ---------- */
.event-row { display: flex; gap: 14px; padding: 14px 4px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.event-row:last-child { border-bottom: none; }
.event-row .ev-body { flex: 1; min-width: 0; }
.timeline-group { margin-top: var(--section); }
.timeline-date { font-family: var(--head); font-weight: 600; font-size: 13px; color: var(--ink-3); margin: 0 4px 4px; }

/* Строка напоминания / статьи / уведомления */
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-body { flex: 1; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 15px; flex: 0 0 40px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; flex: 0 0 56px; }

/* Свитч */
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 44px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line); transition: background .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track + .knob, .switch input:checked ~ .knob { transform: translateX(18px); }

/* ---------- Чат (ChatScreen) ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 0px); max-width: 860px; margin: 0 auto; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px var(--sp-xxl) 12px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 76%; padding: 12px 15px; border-radius: var(--r-lg); font-size: 15px; line-height: 22px; }
.bubble.user { align-self: flex-end; background: var(--accent-soft); color: var(--ink); border-bottom-right-radius: 6px; }
.bubble.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.ai-row { display: flex; gap: 10px; align-self: flex-start; max-width: 82%; }
.ai-spark { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: 0 0 30px; }
.ai-spark svg { width: 17px; height: 17px; }
.chat-action { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; font-family: var(--head); border: none; width: 100%; }
.chat-action svg { width: 18px; height: 18px; }
.chat-action .chev { margin-left: auto; }
.chat-attach { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 12px; border-radius: var(--r-md); background: var(--accent-soft-2); border: 1px solid var(--line); font-size: 13px; }
.chat-important { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 4px 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.suggest-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 var(--sp-xxl) 10px; }
.suggest { padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; }
.suggest:hover { background: var(--accent-soft-2); }
.chat-input { display: flex; align-items: flex-end; gap: 10px; padding: 12px var(--sp-xxl) 20px; border-top: 1px solid var(--line); background: var(--bg); }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 15px; font-family: var(--body); font-size: 15px; background: var(--surface); color: var(--ink); max-height: 140px; }
.chat-send { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; border: none; display: grid; place-items: center; flex: 0 0 46px; }
.chat-send:disabled { background: var(--line); color: var(--ink-3); }

/* ---------- Формы / поля ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-family: var(--head); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font-family: var(--body); font-size: 15px; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); outline: none; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-2); line-height: 20px; }
.checkbox-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }
.otp { display: flex; gap: 10px; justify-content: center; }
.otp input { width: 52px; height: 60px; text-align: center; font-family: var(--head); font-weight: 700; font-size: 24px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); }
.otp input:focus { border-color: var(--accent); outline: none; }
.step-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.step-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.step-dots i.on { background: var(--accent); width: 22px; border-radius: var(--r-pill); }

/* ---------- Экраны состояний (CenteredState) ---------- */
.centered { max-width: 400px; margin: 8vh auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.centered .cs-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; }
.centered .cs-icon svg { width: 34px; height: 34px; }
.centered .cs-icon.accent { background: var(--accent-soft); color: var(--accent); } .centered .cs-icon.muted { background: var(--line-2); color: var(--ink-3); } .centered .cs-icon.alert { background: var(--alert-soft); color: var(--alert); } .centered .cs-icon.warn { background: var(--warn-soft); color: var(--warn); }
.centered .btn { min-width: 220px; margin-top: 6px; }

/* ---------- Загрузка (spinner / skeleton) ---------- */
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.lg { width: 44px; height: 44px; }
.loading-center { display: grid; place-items: center; min-height: 40vh; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, var(--line) 37%, var(--line-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Модалка / drawer ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow-lg); }
@media (min-width: 640px) { .scrim { align-items: center; } .modal { border-radius: var(--r-xl); } }
.modal-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }

/* Демо-полоса */
.demo-strip { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; }
.demo-strip a { color: #fff; text-decoration: underline; margin-left: auto; }

/* Тост */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: var(--r-pill); font-size: 14px; z-index: 200; box-shadow: var(--shadow-md); }

/* Хитрости прокрутки */
.hscroll { overflow-x: auto; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; border: none; }
.sp-8 { height: 8px; } .sp-16 { height: 16px; } .sp-24 { height: 24px; }

/* Нижняя мобильная навигация — включается на узком экране */
.bottom-nav { display: none; }

/* ---------- Адаптив: узкий экран → нижняя навигация ---------- */
@media (max-width: 760px) {
  .sidebar { display: none; }
  .page { padding: 16px var(--screen-h) 88px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--ink-3); font-size: 11px; font-family: var(--head); font-weight: 600; background: none; border: none; }
  .bottom-nav .bn-item svg { width: 24px; height: 24px; }
  .bottom-nav .bn-item.active { color: var(--accent); }
  .bottom-nav .bn-item .bn-pill { border-radius: var(--r-pill); padding: 3px 14px; }
  .bottom-nav .bn-item.active .bn-pill { background: var(--accent-soft); }
  .chat-wrap { height: calc(100vh - 64px); }
  .chat-scroll, .suggest-row, .chat-input { padding-left: var(--screen-h); padding-right: var(--screen-h); }
  .topbar .search-pill { display: none; }
}

/* ============================================================================
   DESKTOP-РАСКЛАДКА (переработка под большой экран: топбар + слим-сайдбар +
   master-detail split + слайд-овер панели + поповеры + дашборд-грид).
   Мобильные правила ниже переопределяют это на узком экране.
   ========================================================================== */
:root { --rail-w: 232px; --topbar-h: 60px; }

.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

/* Слим-сайдбар */
.rail { position: sticky; top: 0; height: 100vh; align-self: start; display: flex; flex-direction: column; gap: 3px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.rail .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-family: var(--head); font-weight: 800; font-size: 19px; color: var(--ink); }
.rail .nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); color: var(--ink-3); font-family: var(--head); font-weight: 600; font-size: 15px; letter-spacing: -.01em; border: none; background: none; width: 100%; text-align: left; }
.rail .nav-item svg { width: 21px; height: 21px; flex: 0 0 21px; }
.rail .nav-item:hover { background: var(--accent-soft-2); color: var(--ink-2); }
.rail .nav-item.active { background: var(--accent-soft); color: var(--accent); }
.rail .nav-item .badge { margin-left: auto; }
.rail-spacer { flex: 1; }
.rail-foot { border-top: 1px solid var(--line-2); padding-top: 8px; }

/* Главная область */
.main { display: flex; flex-direction: column; min-width: 0; }

/* Глобальный топбар */
.topbar2 { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: var(--topbar-h); padding: 0 22px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px) saturate(160%); }
.topbar2 .tb-title { font-family: var(--head); font-weight: 700; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; }
.tb-search { position: relative; flex: 1; max-width: 460px; }
.tb-search .search-pill { width: 100%; max-width: none; padding: 9px 15px; cursor: text; }
.tb-search input { border: none; background: none; outline: none; flex: 1; font: inherit; font-size: 14px; color: var(--ink); }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-actions .btn { min-height: 40px; padding: 0 15px; }
.workspace { flex: 1; min-width: 0; }
.wrap-pad { padding: 22px; max-width: 1160px; margin: 0 auto; width: 100%; }

/* Поповеры (уведомления, меню профиля, результаты поиска) */
.popover { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.popover-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.popover-body { max-height: min(70vh, 520px); overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px; border: none; background: none; text-align: left; color: var(--ink); font-family: var(--body); font-size: 14px; font-weight: 500; cursor: pointer; }
.menu-item:hover { background: var(--accent-soft-2); }
.menu-item svg { width: 18px; height: 18px; color: var(--ink-3); }
.menu-item.danger { color: var(--alert); } .menu-item.danger svg { color: var(--alert); }
.menu-sep { height: 1px; background: var(--line-2); margin: 4px 0; }

/* Слайд-овер панель (детали / чат-rail / настройки) */
.panel-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 70; opacity: 0; transition: opacity .18s; }
.panel-backdrop.on { opacity: 1; }
.panel { position: fixed; top: 0; right: 0; height: 100vh; width: var(--panel-w, 440px); max-width: 94vw; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 71; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s cubic-bezier(.4,0,.2,1); }
.panel.on { transform: translateX(0); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.panel-head .t-card { flex: 1; min-width: 0; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; }
.panel-body.flush { padding: 0; }

/* Master-detail split */
.split { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; min-height: calc(100vh - var(--topbar-h)); }
.split-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - var(--topbar-h)); }
.split-list-head { position: sticky; top: 0; background: var(--bg); padding: 16px 18px 10px; z-index: 2; }
.split-list-inner { padding: 0 12px 24px; }
.split-detail { overflow-y: auto; max-height: calc(100vh - var(--topbar-h)); }
.split-detail-inner { padding: 24px 28px; max-width: 760px; }
.split-empty { display: grid; place-items: center; height: 100%; color: var(--ink-3); text-align: center; padding: 40px; }

/* Строка выбора в списке split */
.pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent; }
.pick:hover { background: var(--accent-soft-2); }
.pick.sel { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.pick .pick-body { flex: 1; min-width: 0; }
.pick .mr-spark { width: 70px; height: 30px; flex: 0 0 70px; }

/* Дашборд-грид */
.dash { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.dash .col-8 { grid-column: span 8; } .dash .col-6 { grid-column: span 6; } .dash .col-4 { grid-column: span 4; } .dash .col-12 { grid-column: span 12; }
.dash .widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.widget-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ki-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-tiny { display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 1100px) { .dash .col-8, .dash .col-6, .dash .col-4 { grid-column: span 12; } }

/* Адаптив: узкий экран → сайдбар в бургер/низ, split в стек */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; z-index: 90; width: 240px; transform: translateX(-100%); transition: transform .2s; }
  .rail.on { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .split { grid-template-columns: 1fr; }
  .split-detail { display: none; }
  .split.detail-open .split-list { display: none; }
  .split.detail-open .split-detail { display: block; max-height: none; }
  .panel { --panel-w: 100vw; }
  .tb-search { max-width: none; }
  .topbar2 .tb-actions .btn span.lbl { display: none; }
}
.rail-toggle { display: none; }
@media (max-width: 900px) { .rail-toggle { display: grid; } }

/* Чат внутри слайд-овер панели */
.panel-body.flush { display: flex; }
.chat-wrap.in-panel { height: 100%; width: 100%; max-width: none; }
.chat-wrap.in-panel .chat-scroll { padding: 16px 16px 10px; }
.chat-wrap.in-panel .suggest-row, .chat-wrap.in-panel .chat-input { padding-left: 16px; padding-right: 16px; }
.chat-wrap.in-panel .chat-input { padding-bottom: 16px; }

/* Выпадашка глобального поиска */
#searchDrop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); max-height: 62vh; overflow-y: auto; display: none; z-index: 60; padding: 4px 0; }
#searchDrop.on { display: block; }

/* ============================================================================
   ВЕРХНЯЯ НАВИГАЦИЯ (вкладки сверху вместо сайдбара) + masonry-дашборд.
   Переопределяет раскладку выше — раздел идёт последним, побеждает.
   ========================================================================== */
:root { --header-h: 108px; }
.app-top { min-height: 100vh; display: flex; flex-direction: column; }
.hdr { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px) saturate(160%); border-bottom: 1px solid var(--line); }
.hdr-row1 { display: flex; align-items: center; gap: 18px; height: 62px; padding: 0 24px; }
.hdr .brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 800; font-size: 19px; color: var(--ink); white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 18px; box-shadow: 0 6px 16px -6px rgba(42,111,219,.65); }
.hdr-tabs { display: flex; gap: 2px; padding: 0 16px; height: 46px; overflow-x: auto; scrollbar-width: none; }
.hdr-tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: none; background: none; color: var(--ink-3); font-family: var(--head); font-weight: 600; font-size: 14px; letter-spacing: -.01em; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.tab svg { width: 18px; height: 18px; }
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .badge { margin-left: 2px; }

/* Контент на всю ширину */
.workspace { flex: 1; min-width: 0; }
.wrap-pad { padding: 22px 24px; max-width: 1280px; margin: 0 auto; width: 100%; }

/* Высоты split под новую шапку */
.split { min-height: calc(100vh - var(--header-h)); }
.split-list, .split-detail { max-height: calc(100vh - var(--header-h)); }

/* Masonry-дашборд: полноширинные карточки сверху + две колонки-стека */
.dash-full { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.dash-cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
@media (max-width: 1000px) { .dash-cols { grid-template-columns: 1fr; } }

/* Search dropdown под новой шапкой уже позиционируется относительно .tb-search */
@media (max-width: 720px) {
  .hdr-row1 { gap: 10px; padding: 0 12px; }
  .hdr .brand span.bt { display: none; }
  .tb-actions .btn span.lbl { display: none; }
  .wrap-pad { padding: 16px 14px; }
}

/* Чат как отдельная страница */
.chat-page { height: calc(100vh - var(--header-h)); display: flex; flex-direction: column; max-width: 920px; margin: 0 auto; }
.chat-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px 6px; }
.chat-page-body { flex: 1; min-height: 0; display: flex; }
.chat-wrap.in-page { height: 100%; width: 100%; max-width: none; }
.chat-wrap.in-page .chat-scroll { padding: 16px 24px 10px; }
.chat-wrap.in-page .suggest-row, .chat-wrap.in-page .chat-input { padding-left: 24px; padding-right: 24px; }

/* Поиск в шапке — растягиваем до блока действий */
.hdr .tb-search { flex: 1; max-width: none; }

/* Узкая шапка: поиск обязан сжиматься, а не выдавливать кнопки.
   У <input> собственная минимальная ширина (~20 символов), поэтому во флексе он
   отказывается ужиматься и плейсхолдер уезжает под кнопки — лечится min-width:0
   на самом инпуте и на его контейнерах. Блок действий, наоборот, не сжимаем. */
.hdr .tb-search { min-width: 0; }
.hdr .search-pill { min-width: 0; overflow: hidden; }
.hdr .tb-search input { min-width: 0; text-overflow: ellipsis; }
.hdr .search-pill svg { flex: none; }
.hdr .tb-actions { flex: none; }

/* В Telegram Mini App шапка Telegram уже показывает имя приложения, а роль
   ассистента играет сам чат с ботом — дублировать их в топбаре незачем, и это
   как раз та ширина, которой не хватает поиску. */
.in-telegram .hdr .brand,
.in-telegram #tbAssistant { display: none; }

/* Детальная панель — контент во всю ширину, карточки masonry-колонками */
.split-detail-inner { max-width: 1120px; }
.detail-head { margin-bottom: 4px; }
.detail-cols { columns: 340px; column-gap: 16px; margin-top: 16px; }
.detail-cols > * { break-inside: avoid; margin: 0 0 16px !important; display: block; width: 100%; }
.detail-full { margin-top: 16px; }

/* Чат: слева контекст (показатели+хронология), справа переписка */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - var(--header-h)); }
.chat-aside { border-right: 1px solid var(--line); overflow-y: auto; padding: 18px 16px; background: var(--surface); }
.chat-aside .ctx-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-md); cursor: pointer; }
.chat-aside .ctx-row:hover { background: var(--accent-soft-2); }
.chat-main { position: relative; min-height: 0; display: flex; flex-direction: column; }
.chat-main .chat-page-body { flex: 1; min-height: 0; display: flex; }
.chat-clear { position: absolute; top: 12px; right: 18px; z-index: 3; width: 36px; height: 36px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
/* Поддержка — рядом с «очистить», левее: за помощью идут тогда, когда что-то
   не получилось, и прятать кнопку в меню значит добавлять шаг в худший момент. */
/* Кнопка поддержки в углу переписки — ТОЛЬКО для узких экранов, где левой
   панели нет. На широких переключение живёт слева (.pane-switch): держать две
   кнопки для одного действия — значит спрашивать у человека, чем они
   отличаются. */
.chat-support { display: none; position: absolute; top: 12px; right: 62px; z-index: 3; width: 36px; height: 36px; background: color-mix(in srgb, var(--bg) 70%, transparent); }

/* С кем говорим: ассистент или поддержка. Капсула на две вкладки — тот же
   приём, что в приложении: выбранный вариант на светлой подложке. */
.pane-switch { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px;
  background: var(--line-2); border-radius: var(--r-md); }
.pane-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 6px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-sm); color: var(--ink-3); font: inherit; font-size: 13px;
  font-weight: 600; font-family: var(--head); }
.pane-tab svg { width: 16px; height: 16px; }
.pane-tab.on { background: var(--surface); color: var(--ink); }
.pane-tab:hover { color: var(--ink); }
@media (max-width: 900px) { .chat-layout { grid-template-columns: 1fr; } .chat-aside { display: none; }
  .chat-support { display: inline-flex; } }

/* Markdown в пузыре ассистента */
.bubble.md p { margin: 0 0 8px; } .bubble.md p:last-child { margin-bottom: 0; }
.bubble.md ul { margin: 6px 0; padding-left: 20px; } .bubble.md li { margin: 3px 0; }
.bubble.md h2, .bubble.md h3 { font-family: var(--head); font-size: 15px; margin: 8px 0 4px; }
.bubble.md b { color: var(--ink); }

/* Ряд действий в деталях — обычные кнопки, не во всю ширину */
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* Блок-подсказка «что это и как пользоваться» в левых панелях */
.hint-block { display: flex; gap: 8px; padding: 10px 12px; margin-bottom: 12px; background: var(--accent-soft-2); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink-2); font-size: 12.5px; line-height: 17px; }
.hint-block svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--accent); margin-top: 1px; }

/* Индикатор «ассистент печатает» */
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 3px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Быстрые вопросы в левой панели чата */
.aside-sug { display: flex; flex-direction: column; gap: 6px; }
.aside-sug .suggest { display: block; width: 100%; text-align: left; }

/* Теплокарта трекера: недели-колонки заполняют ширину, ячейки квадратные —
   без горизонтального скролла (см. heatmap() в js/screens/trackers.js). */
.heat { display: flex; gap: 3px; width: 100%; max-width: 340px; }
.heat .hc-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.heat .hc-col > i { display: block; width: 100%; aspect-ratio: 1; border-radius: 2px; }
.heat .hc-col > i.hc-empty { background: transparent; }

/* Иконка внутри плитки — строго по центру, без baseline-сдвига */
.icon-tile svg { display: block; }

/* Имя трекера в компактной строке (главная) не переносится криво */
.trk-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Карточка клиники в профиле врача: нормальные поля (не как у .list-row с 4px),
   пин-иконка сверху ровно у названия, строка метро — ровный флекс без «пляски»
   собственного отступа эмодзи. */
.dr-loc { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
          background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.dr-loc .lr-body { flex: 1; min-width: 0; }
.dr-metro { display: flex; align-items: center; gap: 6px; margin-top: 4px;
            color: var(--ink-3); font-size: 13px; line-height: 1.35; }
.dr-metro .dr-metro-ic { flex: 0 0 auto; font-size: 13px; line-height: 1; }

/* ============================================================================
   МОБИЛЬНАЯ ДОВОДКА. Только узкие экраны (≤640/≤400) — десктоп не затрагивается.
   Активная раскладка: header.hdr + .hdr-tabs + .workspace/.wrap-pad + .dash-*.
   Цель — вернуть контенту ширину (тоньше поля/паддинги), схлопнуть все сетки в
   одну колонку и убрать горизонтальный проскролл всей страницы.
   ========================================================================== */
@media (max-width: 640px) {
  :root { --header-h: 98px; --screen-h: 12px; }

  /* Не даём всей странице ехать вбок — прокрутка только внутри спец-рядов
     (.hdr-tabs / .mini-scroll / .chip-scroll со своим overflow-x). */
  html, body { max-width: 100%; overflow-x: hidden; }
  img, svg, canvas, video { max-width: 100%; }
  pre { max-width: 100%; overflow-x: auto; }

  /* Компактная шапка: поиск не выдавливает действия, кнопки уже */
  .hdr-row1 { gap: 8px; padding: 0 12px; height: 56px; }
  .hdr-tabs { height: 42px; padding: 0 10px; }
  .hdr-tabs .tab { padding: 0 12px; }
  .tb-search { min-width: 0; }
  .tb-search .search-pill { padding: 8px 12px; }
  .tb-actions { gap: 6px; }
  .tb-actions .btn { padding: 0 12px; min-height: 38px; }
  .iconbtn { width: 38px; height: 38px; }

  /* Больше полезной ширины: тоньше поля контента и внутренние паддинги карточек */
  .wrap-pad { padding: 14px 12px; }
  .page { padding: 14px 12px 88px; }
  .card { padding: 14px; }
  .card.pad-lg { padding: 16px; }
  .widget, .dash .widget { padding: 14px; }

  /* Все сетки — в одну колонку (12-колоночный дашборд тоже), чтобы содержимое
     не сжималось в нечитаемую кашу. */
  .dash { grid-template-columns: 1fr; gap: 12px; }
  .dash .col-8, .dash .col-6, .dash .col-4, .dash .col-12 { grid-column: 1 / -1; }
  .dash-cols { grid-template-columns: 1fr; gap: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .ki-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .detail-cols { columns: 1 !important; }

  /* Ряды показателей: тексту больше места, спарклайн уже */
  .metric-row { gap: 10px; padding: 12px 2px; }
  .metric-row .mr-spark { width: 64px; flex: 0 0 64px; }

  /* Заголовки чуть меньше — меньше кривых переносов на узком экране */
  .t-hero { font-size: 26px; line-height: 30px; }
  .t-title { font-size: 20px; line-height: 24px; }
  .t-metric { font-size: 26px; line-height: 28px; }

  /* Чат: пузыри шире, поля ввода тоньше */
  .bubble { max-width: 88%; }
  .ai-row { max-width: 92%; }
  .chat-scroll, .suggest-row, .chat-input,
  .chat-wrap.in-page .chat-scroll,
  .chat-wrap.in-page .suggest-row,
  .chat-wrap.in-page .chat-input { padding-left: 12px; padding-right: 12px; }

  /* OTP-код: 4–6 ячеек должны влезать по ширине */
  .otp { gap: 7px; }
  .otp input { width: 44px; height: 54px; font-size: 21px; }
}

@media (max-width: 400px) {
  .wrap-pad, .page { padding-left: 10px; padding-right: 10px; }
  .card, .widget, .dash .widget { padding: 12px; }
  .ki-grid { grid-template-columns: 1fr; }   /* совсем узкий — KPI по одному в ряд */
  .tb-actions .btn { padding: 0 10px; }
  .otp input { width: 40px; height: 50px; font-size: 19px; }
}

/* ---------------------------------------------------------------------------
   «Мой цикл»: сетка календаря.

   ГЛАВНОЕ ПРАВИЛО: факт и прогноз выглядят по-разному и не смешиваются.
   Состоявшаяся менструация — залитый кружок, предсказанная — только обводка.
   Человек должен с одного взгляда понимать, где его данные, а где наш расчёт:
   иначе календарь читается как расписание, которого никто не обещал.
   --------------------------------------------------------------------------- */
/* Два месяца рядом на широком экране, один — на узком. Ограничение ширины у
   самой сетки остаётся: без него ячейки с aspect-ratio раздувались до полутора
   сотен пикселей и календарь занимал экран целиком. */
/* Раздел «Мой цикл»: две колонки в общем потоке страницы. Слева — состояние
   (узкая, содержимое короткое), справа — календарь и гормоны. align-items: start
   не даёт короткой колонке растягиваться под высоту длинной. */
.cyc-cols { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.cyc-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1000px) { .cyc-cols { grid-template-columns: 1fr; } }

.cyc-months { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.cyc-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  max-width: 340px; margin: 0 auto;
}
.cyc-wd { text-align: center; font-size: 11px; color: var(--ink-3); padding-bottom: 4px; }
.cyc-day {
  position: relative; aspect-ratio: 1; max-width: 44px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 13px; color: var(--ink); cursor: pointer;
  border: 1px solid transparent; transition: background .12s ease;
}
.cyc-day:hover { background: var(--line-2); }
.cyc-day.is-period { background: var(--accent); color: #fff; }
.cyc-day.is-predicted { border-color: var(--accent); }
.cyc-day.is-fertile { border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.cyc-day.is-today { box-shadow: inset 0 0 0 2px var(--ink); }
/* Точка «в этот день есть отметки» — маленький и честный признак заполненности. */
.cyc-dot { position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); }
.cyc-day.is-period .cyc-dot { background: #fff; }
.chip-static {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600;
}

/* Ряд чипов с переносом. Отдельный примитив, потому что чипы в разделах ставятся
   пачками (варианты ответа, симптомы, длины цикла) и раскладывать их каждый раз
   инлайновым flex — способ получить пять разных отступов. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Доступность ---------- */

/* Текст только для экранного диктора: глазами не виден, но читается и
 * попадает в поиск по странице у диктора. clip-path вместо display:none —
 * скрытое через display диктор пропускает вместе со смыслом. */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; white-space: nowrap; border: 0;
  clip-path: inset(50%);
}

/* «Сразу к содержимому»: первая цель Tab на странице. Незрячий и работающий с
 * клавиатуры иначе проходят шапку, поиск и восемь вкладок на КАЖДОМ экране. */
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: var(--r-md); font-weight: 600; text-decoration: none;
  transition: top .12s;
}
.skip-link:focus { top: 8px; }

/* Видимый фокус. Браузерный контур мы нигде не убирали, но у нажимаемых
 * карточек его почти не видно на светлом фоне — задаём явный. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
