/* ============================================================
   Inner Doctor — Жар (fever tracker)
   Палитра и типографика — как на innerdoctor.surge.sh:
   Cormorant Garamond (заголовки) + Montserrat (текст)
   ============================================================ */

:root {
  --bg:         #ece4d8;
  --bg-soft:    #f5efe4;
  --card:       #ffffffee;
  --ink:        #3b2e25;
  --ink-soft:   #5a4938;
  --muted:      #6b5a4c;
  --line:       #d9cfbf;

  --accent:      #6c4f3d;   /* deep brown */
  --accent-deep: #5a3f30;
  --accent-soft: #a48672;
  --gold:        #c8a25f;
  --script:      #a85a44;   /* terracotta для рукописного и опасности */

  /* светофор — приглушённые медицинские тона, в гамме сайта */
  --can-bg:     #d9dcc4;    /* sage, можно */
  --can-strong: #b7c4a0;
  --soft-zone:  #e6b89b;    /* peachy beige, аккуратно (можно, не превышая дневной лимит) */
  --hard-zone:  #c5694a;    /* приглушённая terracotta, нельзя */
  --eval-zone:  #4ec5b3;    /* бирюзовый — оценка эффекта (40 мин на противоположной шкале) */

  --nurofen:     #6c4f3d;   /* accent */
  --paracetamol: #c8a25f;   /* gold */

  --shadow-1: 0 6px 18px -10px rgba(40,28,18,.35);
  --shadow-2: 0 14px 40px -18px rgba(40,28,18,.45);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* lining + tabular figures: цифры одной высоты с заглавными буквами */
  font-feature-settings: "lnum" 1, "tnum" 1;
  font-variant-numeric: lining-nums tabular-nums;
}

body {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(108,79,61,0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 70%);
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; font-weight: 400; }
a { color: inherit; text-decoration: none; }

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: max(env(safe-area-inset-top), 16px) 18px max(env(safe-area-inset-bottom), 16px);
  display: flex;
  flex-direction: column;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
/* Compact topbar внутри case-screen — освобождает пространство сверху */
.case-screen .topbar { margin-bottom: 8px; }
.topbar h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar h1 .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 .muted {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
}
.topbar h1 .muted::first-letter { text-transform: uppercase; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  transition: background .2s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn:active { transform: scale(.96); }
.icon-btn .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.icon-btn .icon svg { display: block; }
.topbar-placeholder {
  display: inline-block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.icon-btn.help {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 20px;
  color: var(--script);
  border-color: var(--accent-soft);
}

.link-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  line-height: 1;
}
.link-btn:active { opacity: .7; }

/* ===== Splash ===== */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 20px;
}
.splash.register { gap: 18px; padding: 16px; justify-content: flex-start; padding-top: 28px; }
.logo-art {
  width: 220px; height: 220px;
  display: grid; place-items: center;
  filter: drop-shadow(0 12px 24px rgba(40,28,18,0.12));
}
.splash.register .logo-art { width: 200px; height: 200px; }
.splash h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.05;
  text-wrap: balance;
}
.splash .sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .04em;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 14px;
}
.splash .sub span { display: block; white-space: nowrap; }
.splash .sub span::first-letter { text-transform: uppercase; }
.splash p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  max-width: 28ch;
}

/* ===== Buttons (CTA) ===== */
.cta {
  width: 100%;
  max-width: 320px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 16px 22px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: var(--shadow-2);
  transition: background .2s ease, transform .15s ease;
}
.cta:hover { background: var(--accent-deep); }
.cta:active { transform: translateY(1px); }

.cta.secondary {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.cta.secondary:hover { background: var(--bg-soft); }

/* Зелёная CTA — для "Выздоровление" */
.cta.green {
  background: #6f8b5d;          /* приглушённый sage, темнее var(--can-strong) */
  color: #faf3e3;
  border: 1px solid #5e7a4e;
  box-shadow: 0 6px 18px -10px rgba(60, 80, 45, 0.45), inset 0 -1px 0 rgba(0,0,0,0.08);
}
.cta.green:hover { background: #5e7a4e; }
.cta.green:active { background: #4f6a40; transform: translateY(1px); }

/* Подпись к CTA — мелкая надпись в скобках */
.cta .cta-sub {
  display: inline-block;
  margin-left: 8px;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .08em;
  opacity: 0.78;
  text-transform: none;
}

/* ===== Forms ===== */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 4px;
  font-weight: 500;
}
.field > input, .field > select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 16px;
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
/* iOS Safari: input[type=date] игнорирует width без явного фикса. Сбрасываем
   собственные UA-стили чтобы поле было ровно по ширине родителя. */
.field > input[type="date"] {
  display: block;
  min-height: 52px;             /* такая же высота как у текстовых input */
  font-family: inherit;
}
.field > input::placeholder { color: #b3a795; font-weight: 300; }
.field > input:focus, .field > select:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(164,134,114,.18);
}
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }
.hint {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 0 4px;
  line-height: 1.55;
}

/* ===== Case screen — горизонтальные компактные шкалы ===== */
.scales.scales--horizontal {
  position: relative;            /* для абсолютного позиционирования .scrubber */
  display: flex;
  flex-direction: column;
  gap: 6px;                      /* минимум между шкалами */
  margin: 2px auto 6px;
  padding-bottom: 14px;          /* место под scales-axis */
  touch-action: pan-y;
  max-width: 380px;              /* шире, чем было (было 320) */
  width: 100%;
}
.scales.scales--horizontal .scales-axis {
  position: relative;
  height: 12px;
  margin-top: 0;
}
.scales.scales--horizontal .scales-axis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}
.scales.scales--horizontal .scales-axis span:first-child { transform: translateX(0); }
.scales.scales--horizontal .scales-axis span:last-child { transform: translateX(-100%); }

/* ===== Трекер симптомов ===== */
/*
   Архитектура: scroll-обёртка с overflow-x: auto + sticky первая колонка
   (ручка drag + имя симптома). Строки — flex-row с фиксированными ширинами,
   ячейки СТРОГО 36×36 (никаких 1fr stretch). На mobile при числе колонок > 5
   правая часть уезжает за viewport, юзер скроллит горизонтально, левая колонка
   остаётся на месте — стандартный паттерн как в spreadsheet.
*/
.symptom-tracker {
  margin: 8px auto 12px;
  max-width: 380px;
  width: 100%;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 12px 0 10px;          /* по бокам убираем — даём scroll-обёртке доходить до края */
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}
.symptom-tracker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 12px 10px;
}
.symptom-tracker-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
  flex-shrink: 0;
}
.symptom-tracker-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
}
.symptom-tracker.has-overflow .symptom-tracker-sub::after {
  content: ' · свайп →';
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .06em;
  white-space: nowrap;
}

/* Скролл-обёртка: горизонтальный скролл матрицы при числе колонок > 5,
   правый край подкрашен мягкой тенью — подсказка «здесь есть ещё». */
.sm-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding: 2px 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.sm-scroll::-webkit-scrollbar { height: 8px; }
.sm-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
  border: 2px solid var(--bg-soft);
  background-clip: padding-box;
}
.sm-scroll::-webkit-scrollbar-track {
  background: rgba(200,162,95,0.18);
  border-radius: 999px;
  margin: 0 8px;
}

/* Матрица — простая flex-колонка строк */
.symptom-matrix {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: max-content;            /* реальная ширина по содержимому, скролл ловит её */
  min-width: 100%;
}

/* Каждая строка — flex с фиксированными ширинами */
.sm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  position: relative;
  transition: transform .18s cubic-bezier(.2,.9,.3,1.1);
  /* touch-action: auto — даёт и вертикальный скролл страницы, и горизонтальный скролл таблицы
     при свайпе по любой ячейке. Drag-ручка переопределяет на none. */
  touch-action: auto;
}
.sm-header { height: 24px; margin-bottom: 6px; padding-top: 4px; /* место под edit-badge */ }

.sm-row-dragging {
  z-index: 10;
  transition: none;
  box-shadow: 0 10px 24px -8px rgba(40,28,18,0.35);
  background: rgba(255,255,255,0.96);
  border-radius: 12px;
  cursor: grabbing;
}
.sm-row-placeholder { opacity: 0; pointer-events: none; }

/* Ручка drag — узкая колонка с 6-точечной иконкой. Скроллится вместе со строкой. */
.sm-handle {
  flex: 0 0 18px;
  width: 18px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-soft);
  cursor: grab;
  touch-action: none;            /* перехватывает touch для drag, без скролла */
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
/* MINOR m4: расширенная hit-зона до ~44px для удобства тапа на mobile */
.sm-handle::before {
  content: '';
  position: absolute;
  inset: -8px -10px -8px -8px;
  /* не визуально, только клик */
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.sm-handle:hover { color: var(--accent); background: rgba(200, 162, 95, 0.12); }
.sm-handle:active { cursor: grabbing; }
.sm-handle svg { width: 10px; height: 14px; pointer-events: none; }
.sm-row.sm-header .sm-handle {
  cursor: default;
}
.sm-row.sm-header .sm-handle svg { display: none; }

/* Имя симптома — обычная flex-ячейка, скроллится вместе со строкой. */
.sm-symptom {
  flex: 0 0 104px;
  width: 104px;
  height: 32px;
  background: transparent;
  padding: 0 4px 0 2px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Montserrat', sans-serif;
  font-size: 10.5px;
  color: var(--ink);
  line-height: 1.1;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.sm-symptom:hover { background: rgba(200,162,95,0.18); }
.sm-symptom:active { background: rgba(200,162,95,0.28); }
.sm-symptom-label {
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 26px;
  /* Soft-hyphens вшиты в текст; для подстраховки ставим hyphens: auto */
  hyphens: auto;
  -webkit-hyphens: auto;
  word-break: normal;
  overflow-wrap: break-word;
}
.sm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.sm-icon svg { width: 16px; height: 16px; }

/* Шапка: «уголок» — то же место что у handle+symptom (скроллится со строкой) */
.sm-corner {
  flex: 0 0 128px;               /* 18 handle + 6 gap + 104 symptom */
  width: 128px;
  height: 24px;
  background: transparent;
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding-left: 2px;
}

/* Ячейки времени в шапке — фиксированные 36px. Кнопка → тап открывает меню (изменить/удалить). */
.sm-time {
  flex: 0 0 36px;
  width: 36px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--line);
  padding: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border-radius: 5px;
  position: relative;
  transition: background .15s, color .15s, border-color .15s;
}
.sm-time:hover {
  background: rgba(200,162,95,0.18);
  color: var(--accent);
  border-color: var(--accent);
}
.sm-time:active { background: rgba(200,162,95,0.32); }
.sm-time.custom { color: var(--accent); font-weight: 600; border-color: var(--accent); }
.sm-time.current { color: var(--ink); border-color: var(--accent); }

/* Маленький значок редактирования на правом верхнем углу рамки времени */
.sm-time-edit {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 12px;
  height: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  pointer-events: none;          /* клик идёт через на кнопку времени */
}
.sm-time-edit svg { width: 6px; height: 6px; display: block; }
/* старые .sm-time.custom/current правила перекрыты новыми с border-color выше */

/* Кнопка "+" добавления колонки времени — справа в шапке */
.sm-add-col {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  position: relative;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--accent);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
  margin-left: 4px;
}
.sm-add-col:hover { background: var(--accent); color: #faf3e3; border-color: var(--accent); }
.sm-add-col:active { transform: scale(0.92); }
/* MINOR m4: расширенная hit-зона ~44×44 для тапа на mobile */
.sm-add-col::before {
  content: '';
  position: absolute;
  inset: -12px;
}

/* Ячейки оценок — СТРОГО 36×36 */
.sm-cell {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .1s ease, filter .15s ease;
  padding: 0;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(40,28,18,0.05);
}
.sm-cell:hover { filter: brightness(0.95); }
.sm-cell:active { transform: scale(0.94); }
.sm-cell.is-empty {
  background: #fff;
  color: var(--accent-soft);
  border-color: var(--line);
  font-weight: 400;
  padding: 0;            /* защита от глобального .empty { padding: 50px 20px } */
  letter-spacing: 0;
  text-transform: none;
}

.sm-add-symptom {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--accent);
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  box-sizing: border-box;
}
.sm-add-symptom:hover { background: var(--accent); color: #faf3e3; border-color: var(--accent); }

/* Подсказка «скролл вправо» — тень у правого края, видна когда контент шире viewport */
.sm-tracker-fade {
  position: absolute;
  top: 36px; bottom: 36px;
  right: 0;
  width: 18px;
  pointer-events: none;
  background: linear-gradient(to left, var(--bg-soft) 0%, rgba(247,239,224,0) 100%);
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 4;
}
.symptom-tracker.has-overflow .sm-tracker-fade { opacity: 1; }

/* Легенда симптомов под графиком */
.symptom-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0 4px;
  margin-bottom: 6px;
  font-family: 'Montserrat', sans-serif;
  font-size: 9.5px;
  letter-spacing: .02em;
  color: var(--muted);
  line-height: 1.2;
}
.symptom-chart-legend .leg-item { display: inline-flex; align-items: center; gap: 6px; }
.symptom-chart-legend .leg-color { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.symptom-chart-legend .leg-line {
  display: inline-flex;
  align-items: center;
  width: 22px;
  height: 8px;
  flex-shrink: 0;
}

/* ===== Карточки симптомов на экране Истории ===== */
.sym-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0 4px;
}
.sym-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: grab;
  touch-action: pan-y;
  position: relative;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.1), box-shadow .2s ease;
  user-select: none;
  -webkit-user-select: none;
}
.sym-card.is-dragging {
  z-index: 30;
  cursor: grabbing;
  box-shadow: 0 14px 30px -10px rgba(40,28,18,0.4);
  transition: none;
}
.sym-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.sym-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  color: var(--ink);
  line-height: 1.1;
  flex: 1;
  /* мягкие переносы по слогам */
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.sym-card-value {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  flex-shrink: 0;
}
.sym-card-value--low    { color: #5e8b56; }   /* 0-3, успокаивающий зелёный */
.sym-card-value--mid    { color: #ca8a04; }   /* 4-6, золото-янтарный */
.sym-card-value--high   { color: #c2410c; }   /* 7-8, оранжевый */
.sym-card-value--alarm  { color: #b91c1c; }   /* 9-10, тревожный красный */
.sym-card-trend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--muted);
}
.sym-card-trend-arrow {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
}
.sym-card-trend--up    .sym-card-trend-arrow { color: #c2410c; }
.sym-card-trend--down  .sym-card-trend-arrow { color: #5e8b56; }
.sym-card-trend--flat  .sym-card-trend-arrow { color: var(--muted); }
.sym-card-trend--wave  .sym-card-trend-arrow { color: var(--accent); }
.sym-card-spark {
  width: 100%;
  height: 38px;
  margin-top: 2px;
}
.sym-card-spark svg { width: 100%; height: 100%; display: block; }
.sym-card-empty-spark {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  color: var(--accent-soft);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sym-cards-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px;
  margin-bottom: 4px;
}
.sym-cards-empty {
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  color: var(--muted);
  padding: 24px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ===== Утончённая pill-кнопка "Внести показания" ===== */
.temp-record-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: -10px auto 6px;       /* прижата к шкале парацетамола */
  padding: 4px 12px 4px 8px;
  background: transparent;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  color: var(--accent);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.temp-record-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #faf3e3;
}
.temp-record-btn:active { transform: scale(0.97); }
.temp-record-icon {
  flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  opacity: 0.85;
}
.temp-record-label {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
  line-height: 1;
}

/* ===== Заметки — timeline-блок ===== */
.notes-block {
  margin: 12px auto 8px;
  max-width: 460px;
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 0 12px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.notes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 14px 8px;
}
.notes-title {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
}
.notes-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.notes-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding: 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}
.notes-scroll::-webkit-scrollbar { height: 6px; }
.notes-scroll::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 999px;
  border: 1px solid var(--bg-soft);
  background-clip: padding-box;
}
.notes-scroll::-webkit-scrollbar-track { background: transparent; }
.notes-scroll svg { display: block; }
.notes-marker { transition: transform .12s ease; transform-origin: center; transform-box: fill-box; }
.notes-marker:hover { transform: scale(1.15); }

/* Кнопка "+ внести заметку" — в стиле pill температуры */
.notes-add-btn {
  margin: 8px auto 2px;
}
.notes-add-check {
  flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  transition: color .15s;
}
.notes-add-btn:hover .notes-add-check { color: #faf3e3; }

/* ===== Красные флаги — компактная кнопка под матрицей ===== */
.red-flags-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 460px;
  margin: 14px auto 8px;
  padding: 12px 16px;
  background: #dc2626;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font-family: 'Montserrat', sans-serif;
  box-shadow: 0 4px 12px -3px rgba(220,38,38,0.35);
  transition: background .15s ease, transform .1s ease;
}
.red-flags-btn:hover { background: #c01e1e; }
.red-flags-btn:active { transform: scale(0.98); }
.red-flags-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.red-flags-btn-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.red-flags-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.1;
}
.red-flags-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
}
.red-flags-caret {
  flex-shrink: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  opacity: 0.85;
}

/* ===== Экран Red Flags (полноэкранный view с topBar) ===== */
.red-flags-screen {
  padding-bottom: 24px;
}
.red-flags-screen-content {
  padding: 0 16px 12px;
  max-width: 560px;
  margin: 0 auto;
}
.red-flags-intro {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #7f1d1d;
  margin: 4px 0 8px;
  font-weight: 500;
  padding: 12px 14px;
  background: rgba(220,38,38,0.06);
  border-left: 3px solid #dc2626;
  border-radius: 0 6px 6px 0;
}

.rf-section { margin-top: 16px; }
.rf-section-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.rf-section-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  display: grid;
  place-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}
.rf-section-title-wrap { flex: 1; min-width: 0; }
.rf-section-title {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .03em;
  color: #991b1b;
  line-height: 1.15;
}
.rf-section-sub {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b91c1c;
  margin-top: 3px;
  opacity: 0.7;
}
.rf-list {
  margin: 0 0 0 32px;
  padding: 0;
  list-style: none;
}
.rf-list li {
  position: relative;
  padding-left: 14px;
  margin: 6px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}
.rf-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #dc2626;
}
.rf-note {
  margin: 10px 0 0 32px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.7);
  border-left: 3px solid #dc2626;
  border-radius: 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11.5px;
  line-height: 1.5;
  color: #7f1d1d;
}


/* Пикер баллов 0-10 — сетка из квадратов */
.symptom-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 14px 0 4px;
}
.symptom-pick {
  height: 44px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
  font-variant-numeric: tabular-nums;
}
.symptom-pick:hover { transform: scale(1.05); }
.symptom-pick.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ===== База знаний: заголовки разделов ===== */
.knowledge-section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0 12px;
  margin: 8px 0 4px;
  border-bottom: 1px solid var(--line);
}
.knowledge-section-title--second { margin-top: 32px; }
.knowledge-section-num {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #faf3e3;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .05em;
}
.knowledge-section-title--second .knowledge-section-num { background: var(--script); }
.knowledge-section-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: .03em;
  color: var(--ink);
  line-height: 1.1;
  text-transform: uppercase;
}
.knowledge-section-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== Аптечка в Дубай (нативный рендер PDF) ===== */

.apt-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0 24px;
}

.apt-cover {
  text-align: center;
  padding: 26px 18px 30px;
  background: linear-gradient(180deg, #1a1c20 0%, #2a2d33 100%);
  color: #faf3e3;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  position: relative;
  overflow: hidden;
}
.apt-cover-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 38px;
  letter-spacing: .03em;
  line-height: 1.05;
  margin: 0 0 4px;
  text-transform: uppercase;
}
.apt-cover-title::first-line { color: #faf3e3; }
.apt-cover-title {
  background: linear-gradient(180deg, #faf3e3 60%, #e85d40 60%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.apt-cover-sub {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 13px;
  color: rgba(250, 243, 227, 0.78);
  margin: 0 auto 22px;
  max-width: 280px;
  line-height: 1.5;
}
.apt-cover-tags {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 22px auto;
  max-width: 280px;
}
.apt-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  color: #fff;
  box-shadow: var(--shadow-1);
}
.apt-tag-orange      { background: #e85d40; }
.apt-tag-orange-deep { background: #cf4929; }
.apt-tag-teal        { background: #4ec5b3; }
.apt-tag-num {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 999px;
  background: rgba(255,255,255,0.20);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}
.apt-tag-orange      .apt-tag-num { background: #cf4929; }
.apt-tag-orange-deep .apt-tag-num { background: #a73815; }
.apt-tag-teal        .apt-tag-num { background: #2fa999; }
.apt-tag-label { flex: 1; }
.apt-cover-footer {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: rgba(250, 243, 227, 0.7);
  margin-top: 18px;
  letter-spacing: .03em;
}
.apt-heart { color: #e85d40; font-size: 14px; }

/* Section heading */
.apt-section {
  padding: 12px 4px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.apt-section h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .02em;
  color: var(--ink);
  margin: 0;
  text-transform: uppercase;
  line-height: 1.1;
}
.apt-section-num {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  background: #6f8b5d;
  color: #faf3e3;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 16px;
}
.apt-section-sub {
  width: 100%;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
  font-weight: 400;
}

/* Items — карточки с цветной плашкой */
.apt-item {
  background: #fff;
  border-radius: var(--r-md);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.apt-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #fff;
}
.apt-item-num {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.apt-item-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.2;
}
.apt-item-text {
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  margin: 12px 16px 0;
  white-space: pre-line;
}
.apt-item-text:last-child { margin-bottom: 16px; }

/* Тоны (палитра PDF) */
.apt-item-orange     .apt-item-head { background: #e85d40; }
.apt-item-amber      .apt-item-head { background: #e9a52a; }
.apt-item-olive      .apt-item-head { background: #8aa05a; }
.apt-item-green      .apt-item-head { background: #5e8b56; }
.apt-item-dark-green .apt-item-head { background: #2f4d3b; }
.apt-item-teal       .apt-item-head { background: #4ec5b3; }

/* Notes — warning/info карточки */
.apt-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-family: 'Montserrat', sans-serif;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
  font-style: italic;
}
.apt-note-icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.4;
  color: var(--script);
}
.apt-note-teal-soft  { background: #d8f0eb; border-left: 3px solid #4ec5b3; }
.apt-note-amber-soft { background: #fcecd1; border-left: 3px solid #e9a52a; }

/* Doctor card (последняя страница) */
.apt-doctor {
  background: linear-gradient(180deg, #fff 0%, #f5efe4 100%);
  border-radius: var(--r-lg);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line);
  position: relative;
}
.apt-doctor-brand {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}
.apt-doctor-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink);
  margin: 0 0 14px;
  line-height: 1.05;
}
.apt-doctor-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.apt-doctor-bullets li {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  padding-left: 18px;
  position: relative;
}
.apt-doctor-bullets li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}
.apt-doctor-motto {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.4;
  margin: 14px 0 16px;
  padding: 12px 14px;
  background: rgba(108, 79, 61, 0.06);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--accent);
}
.apt-doctor-contacts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.apt-doctor-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.apt-doctor-ico {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #faf3e3;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}
.apt-doctor-ico-wa::before  { content: '☎'; }
.apt-doctor-ico-ig::before  { content: '◎'; }
.apt-doctor-ico-loc::before { content: '◉'; }
.apt-doctor-ico-pc::before  { content: '▢'; }

/* Скользящий курсор: горизонтальная линия + ярлык времени.
   Появляется при касании/нажатии на .scales и едет за пальцем. */
/* Скруббер — вертикальная линия, едет по X, пересекает обе полосы */
.scrubber {
  position: absolute;
  top: 0;
  bottom: 16px;                  /* до scales-axis */
  width: 2px;
  background: var(--accent);
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity .15s ease;
}
.scrubber.active { opacity: 0.85; }
.scrubber::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -4px;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
}
.scrubber-label {
  position: absolute;
  left: 50%;
  top: -22px;
  transform: translateX(-50%);
  background: var(--accent);
  color: #faf3e3;
  padding: 2px 8px 3px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(40, 28, 18, 0.25);
}

/* Горизонтальная строка-шкала: «Дать» сверху + header + bar */
.scale-row {
  display: flex;
  flex-direction: column;
  gap: 1px;                       /* надпись вплотную к шкале */
}
.scale-row-give-line {
  display: flex;
  justify-content: flex-start;    /* кнопка выровнена с названием */
  line-height: 1;
  margin-bottom: 1px;
}
.scale-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  line-height: 1;
}
.scale-row-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
.scale-row-spacer { flex: 1; }
.scale-row .dot { width: 8px; height: 8px; border-radius: 999px; }
.scale-row[data-drug="ibuprofen"] .dot { background: var(--nurofen); }
.scale-row[data-drug="paracetamol"] .dot { background: var(--paracetamol); }

/* Кнопка «Дать» — округлый прямоугольник, одного коричневого цвета, заметная */
.scale-row-give {
  padding: 5px 22px 6px;
  border-radius: 999px;
  color: #faf3e3;
  background: var(--accent);     /* одинаковый коричневый для обоих препаратов */
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.2;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  flex-shrink: 0;
  transition: background .2s ease, transform .15s ease;
  white-space: nowrap;
}
.scale-row-give:hover  { background: var(--accent-deep); }
.scale-row-give:active { transform: scale(0.96); }
.scale-row-give.muted {
  background: #fff !important;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}

/* Горизонтальная полоса-шкала (одни сутки 0→24) — тоньше */
.scale-bar {
  position: relative;
  height: 20px;
  border-radius: 10px;
  background: linear-gradient(to right, #e6e9d4, var(--can-bg));
  overflow: visible;             /* eval-q и dose-mark могут выходить за bar */
  box-shadow: inset 0 0 0 1px rgba(60,45,35,0.08), var(--shadow-1);
}
/* Обёртка для зон — клипает их по округлым краям bar'а */
.scale-bar-zones {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  z-index: 1;
}

.zone {
  position: absolute;
  top: 0; bottom: 0;
  pointer-events: none;
}
.zone.hard { background: var(--hard-zone); }
.zone.soft { background: var(--soft-zone); }
.zone.eval {
  background: var(--eval-zone);
  z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
/* Скруглённые края — общий контейнер уже круглый, маскируем .zone */
.scale-bar { isolation: isolate; }
.scale-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(60,45,35,0.08);
}
.zone, .dose-mark, .now-marker, .eval-q { /* clip-path не используем — будут видны строго в пределах bar */ }

.eval-q {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--eval-zone);
  color: var(--eval-zone);
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  z-index: 5;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(40,28,18,0.20);
  padding: 0;
  animation: eval-pulse 2.4s ease-in-out infinite;
}
.eval-q:active { transform: translate(-50%, -50%) scale(0.92); animation: none; }
/* MINOR m4: расширенная hit-зона до ~44×44 */
.eval-q::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 999px;
}
@keyframes eval-pulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(40,28,18,0.20), 0 0 0 0 rgba(78,197,179,0.55); }
  50%      { box-shadow: 0 2px 6px rgba(40,28,18,0.20), 0 0 0 6px rgba(78,197,179,0);   }
}

/* "Сейчас" — вертикальная линия на полосе. Время не дублируем в подписи
   (видно по позиции относительно оси 0—24), чтобы не сталкиваться с status-pill. */
.now-marker {
  position: absolute;
  top: -4px; bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  pointer-events: none;
  z-index: 3;
}
/* Маленький треугольник снизу — указывает на ось 0-24 */
.now-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--ink);
}

/* Точка приёма (✓) — кружок на полосе в месте дозы */
.dose-mark {
  position: absolute;
  top: 50%;
  width: 16px; height: 16px;
  margin-left: -8px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--accent);
  box-shadow: 0 2px 5px rgba(40,28,18,0.25);
  display: grid; place-items: center;
  z-index: 4;
  transform: translateY(-50%);
}
.dose-mark::after { content: '✓'; color: var(--accent); font-weight: 700; font-size: 9px; }
.scale-bar[data-drug="paracetamol"] .dose-mark { border-color: var(--gold); }
.scale-bar[data-drug="paracetamol"] .dose-mark::after { color: var(--gold); }

.status-pill {
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .04em;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.status-pill.can  { background: var(--can-bg); color: #4a5a3a; }
.status-pill.soft { background: var(--soft-zone); color: #6b3a26; }
.status-pill.hard { background: var(--hard-zone); color: #fff; }

/* ===== Легенда цветов под шкалами — компактная ===== */
.scale-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin: 0 0 6px;
  padding: 0 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 9.5px;
  letter-spacing: .02em;
  color: var(--muted);
  line-height: 1.2;
}
.scale-legend .leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scale-legend .leg-color {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.scale-legend .leg-color.can  { background: var(--can-bg); border: 1px solid var(--can-strong); }
.scale-legend .leg-color.soft { background: var(--soft-zone); }
.scale-legend .leg-color.hard { background: var(--hard-zone); }
.scale-legend .leg-color.eval { background: var(--eval-zone); }

/* "?" кнопка-помощник рядом с легендой "аккуратно" */
.scale-legend .leg-q {
  display: inline-grid;
  place-items: center;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--soft-zone);
  color: #fff;
  border: none;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  margin-left: 2px;
  transition: transform .15s ease, background .15s ease;
}
.scale-legend .leg-q:hover  { background: var(--hard-zone); }
.scale-legend .leg-q:active { transform: scale(0.9); }

/* ===== Bottom toolbar ===== */
.bottom-bar {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.bottom-bar .cta {
  width: 100%;
  max-width: none;
  padding: 14px 12px;
  font-size: 11px;
  letter-spacing: .18em;
}
/* "Выздоровление" — нижний ряд, во всю ширину */
.bottom-bar .cta.green {
  grid-column: 1 / -1;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,12,6,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  animation: fadeIn .25s ease;
}
@media (min-height: 680px) {
  .modal-backdrop { align-items: center; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, #fffaf2 0%, #f3e9d9 100%);
  border-radius: var(--r-lg) var(--r-lg) var(--r-md) var(--r-md);
  padding: 22px 22px max(env(safe-area-inset-bottom), 22px);
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .35s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -30px 80px rgba(0,0,0,.5);
}
@keyframes slideUp { from { transform: translateY(40px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-grab {
  width: 42px; height: 4px;
  background: var(--line);
  border-radius: 99px;
  margin: -6px auto 16px;
}
.modal h3 {
  margin: 0 0 18px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 28px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
  line-height: 1;
}
.modal h3 small {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.2;
}
.modal h3 small::first-letter { text-transform: uppercase; }

/* Симметричные модалки симптомов — всё содержимое выравнено по центру */
.modal.modal-symmetric label,
.modal.modal-symmetric .field > label,
.modal.modal-symmetric .hint,
.modal.modal-symmetric p,
.modal.modal-symmetric > div > div:first-child {
  text-align: center;
}
.modal.modal-symmetric .field { text-align: center; }
.modal.modal-symmetric .field input,
.modal.modal-symmetric .field select,
.modal.modal-symmetric .field textarea {
  text-align: center;
}
.modal.modal-symmetric .sub-divider {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 4px 0 10px;
  position: relative;
}
.modal.modal-symmetric .sub-divider::before,
.modal.modal-symmetric .sub-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 70px);
  height: 1px;
  background: var(--line);
}
.modal.modal-symmetric .sub-divider::before { left: 0; }
.modal.modal-symmetric .sub-divider::after { right: 0; }
.modal.modal-symmetric .chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.segmented.three { grid-template-columns: 1fr 1fr 1fr; }
.segmented > button {
  padding: 13px 12px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: var(--ink);
  transition: background .2s ease, color .2s ease;
}
.segmented > button + button { border-left: 1px solid var(--line); }
.segmented > button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

.dosage-card {
  background: linear-gradient(135deg, #fffaef 0%, #f5e8c9 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dosage-card .big {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink);
  line-height: 1.15;
}
.dosage-card .muted {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.info-section { padding: 0 4px 12px; }
.info-section h4 {
  margin: 20px 0 8px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.info-section h4:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.info-section p { margin: 0 0 10px; font-size: 14px; color: var(--ink); line-height: 1.55; }
.info-section ul { margin: 6px 0 12px; padding-left: 20px; }
.info-section li { margin-bottom: 6px; font-size: 14px; color: var(--ink); line-height: 1.4; }
.info-section li.warn { color: var(--script); font-weight: 500; }

/* ===== History (chart) ===== */
.history-screen { display: flex; flex-direction: column; gap: 14px; }
.chart-wrap {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.legend {
  display: flex; gap: 14px;
  padding: 4px 4px 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 999px; }

.dose-list {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 4px 8px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.dose-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.dose-row:last-child { border-bottom: 0; }
.dose-row .pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 12px;
  border-radius: 999px;
}
.dose-row .pill[data-drug="ibuprofen"] { background: rgba(108,79,61,0.10); color: var(--accent); }
.dose-row .pill[data-drug="paracetamol"] { background: rgba(200,162,95,0.18); color: #8a6a2a; }
.dose-row .pill[data-drug="other"] { background: var(--bg-soft); color: var(--muted); }
.dose-row .when {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.dose-row .temp {
  margin-left: auto;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--script);
}

/* ===== Алгоритм действий при ОРВИ ===== */
.algorithm-content { padding: 0 0 12px; }
.algorithm-content p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.algorithm-content > ul { margin: 0 0 16px; padding-left: 22px; }
.algorithm-content > ul > li { margin: 4px 0; font-size: 14px; color: var(--ink); line-height: 1.5; }

.algo-intro {
  font-size: 12px !important;
  letter-spacing: .04em;
  color: var(--muted) !important;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px !important;
}

.algo-step {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.algo-step:first-child, .algo-step + .algo-step { border-top: 1px solid var(--line); }
.algorithm-content > .algo-step:first-of-type { border-top: 0; padding-top: 4px; }
.algo-step-num {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  border-radius: 10px;
  flex-shrink: 0;
}
.algo-step-extra .algo-step-num { background: var(--gold); color: var(--ink); }
.algo-step-text { flex: 1; min-width: 0; }
.algo-step-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.1;
}
.algo-step-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .02em;
  color: var(--muted);
  margin-top: 4px;
}
.algo-step-sub::first-letter { text-transform: uppercase; }

.algo-subhead {
  margin: 16px 0 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--script);
}

.algo-callout {
  margin: 10px 0 14px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.5;
}
.algo-callout-red {
  background: rgba(197,105,74,0.10);
  border-left: 3px solid var(--hard-zone);
  color: var(--ink);
}
.algo-callout-red .algo-callout-label { color: var(--hard-zone); }
.algo-callout-dark {
  background: rgba(31,32,34,0.78);
  color: #fff;
  border-left: 3px solid var(--ink);
}
.algo-callout-dark .algo-callout-label { color: #fff; }
.algo-callout-dark ul li { color: #f2ece0; }
.algo-callout-plain {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent-soft);
}
.algo-callout-plain .algo-callout-label { color: var(--ink); }
.algo-callout-gold {
  background: rgba(200,162,95,0.14);
  border-left: 3px solid var(--gold, #c8a25f);
  color: var(--ink);
}
.algo-callout-gold .algo-callout-label { color: #8a6512; }
.algo-callout-gold ul li { font-size: 13.5px; line-height: 1.55; }
.algo-callout-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.algo-callout ul {
  margin: 0;
  padding-left: 18px;
}
.algo-callout li {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.45;
}
.algo-callout-suffix {
  margin: 8px 0 0 !important;
  font-size: 12px !important;
  font-style: italic;
}

.algo-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px;
  font-size: 13px;
}
.algo-table th {
  text-align: left;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
}
.algo-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
.algo-table td:first-child {
  font-weight: 500;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: .02em;
  white-space: nowrap;
}

.algo-highlight {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 16px;
  margin: 14px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.algo-highlight-big {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--gold);
  flex-shrink: 0;
}
.algo-highlight-text {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.9;
}

.algo-alert {
  background: var(--hard-zone);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.algo-disclaimer {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  letter-spacing: .02em;
}

.algorithm-btn {
  background: linear-gradient(135deg, #fffaef 0%, #f5e8c9 100%) !important;
  color: var(--ink) !important;
  border: 1px solid var(--gold) !important;
  border-left: 3px solid var(--gold) !important;
  position: relative;
  text-align: left;
  padding-left: 20px !important;
  padding-right: 36px !important;
}
.algorithm-btn::after {
  content: '★';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 14px;
  text-shadow: 0 0 12px rgba(200,162,95,.55);
}

.archive-list { display: flex; flex-direction: column; gap: 12px; }
.archive-tools {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 4px 6px;
}
.archive-danger {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.archive-card { position: relative; padding: 0; overflow: hidden; }
.archive-card .archive-main {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding: 16px 88px 16px 18px;  /* место под rename + delete справа */
  background: transparent;
}
.archive-card .archive-del,
.archive-card .archive-edit,
.archive-card .archive-rename {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  background: transparent;
  line-height: 1;
}
.archive-card .archive-del { font-size: 20px; }
.archive-card .archive-del:hover { background: rgba(168,90,68,0.10); color: var(--script); }
.archive-card .archive-edit:hover,
.archive-card .archive-rename:hover { background: var(--bg-soft); color: var(--accent); }
.archive-card .archive-del:active,
.archive-card .archive-edit:active,
.archive-card .archive-rename:active { transform: scale(0.92); }
/* Если на карточке есть и rename и delete — сдвигаем rename влево от × */
.archive-card .archive-rename { right: 48px; }
.archive-card .archive-rename .icon { display: inline-flex; }
.archive-card .archive-rename svg { width: 18px; height: 18px; }

/* Пенсил-иконка справа в topBar случая */
.case-edit-btn .icon { display: inline-flex; }
.case-edit-btn svg { width: 18px; height: 18px; }
.archive-card {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.archive-card.closed { border-left-color: var(--accent-soft); }
.archive-card .ttl {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .04em;
  color: var(--ink);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.archive-card .sub {
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.archive-card .chev { color: var(--accent-soft); font-size: 22px; margin-left: auto; }

/* ===== Patient cards (отдельный стиль для списка пациентов) ===== */
.patient-list { gap: 14px; }
.patient-card {
  padding: 0 !important;          /* контент внутри archive-main */
  border-left-width: 4px;
  background: linear-gradient(180deg, #fff 0%, var(--bg-soft) 100%);
}
.patient-card .archive-main {
  padding: 18px 60px 18px 20px;
  align-items: center;
  gap: 16px;
}
.patient-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.patient-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: .02em;
  color: var(--ink);
  line-height: 1.1;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patient-age {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.patient-age-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
}
.patient-age-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.patient-card .chev {
  color: var(--accent);
  font-size: 28px;
  font-weight: 300;
  margin-left: 4px;
}

/* Карандаш редактирования — отдельная кнопка справа */
.patient-edit-btn {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-1);
  transition: background .15s ease, transform .15s ease, color .15s ease, border-color .15s ease;
  cursor: pointer;
}
.patient-edit-btn:hover {
  background: var(--accent);
  color: #faf3e3;
  border-color: var(--accent);
}
.patient-edit-btn:active { transform: translateY(-50%) scale(0.92); }
.patient-edit-btn .icon { display: inline-flex; }

/* Если есть chev (выбор для нового случая) — карандаш сдвигаем влево, чтобы оба влезли */
.patient-card:has(.chev) .patient-edit-btn { right: 52px; }

.action-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  background: var(--card);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  font-size: 15px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: background .2s ease;
}
.action-list button:hover { background: var(--bg-soft); }

.empty {
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  color: var(--muted);
  padding: 50px 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* misc */
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

.danger-btn {
  background: transparent;
  color: var(--script);
  padding: 12px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.danger-btn:hover { background: rgba(168,90,68,0.08); }

.case-screen, .history-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ===== Promo bar (в самом низу страницы во время случая) ===== */
.promo-bar {
  align-self: center;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgba(40,28,18,0.45);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: transform .15s ease, filter .2s ease;
  user-select: none;
}
.promo-bar:hover { filter: brightness(1.08); }
.promo-bar:active { transform: translateY(1px); }
.promo-bar .promo-tag {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.promo-bar .promo-cta {
  color: var(--gold);
  font-weight: 500;
  border-left: 1px solid rgba(255,255,255,0.22);
  padding-left: 10px;
}

@media (max-width: 380px) {
  .splash h2 { font-size: 38px; }
  .splash .sub { font-size: 26px; }
  .topbar h1 { font-size: 19px; }
  .modal h3 { font-size: 24px; }
}

/* ============================================================
   Install prompt — Add-to-Home-Screen wizard
   ============================================================ */

.install-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.install-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.install-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 28, 18, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.install-card {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 20px));
  margin: 0 10px max(12px, env(safe-area-inset-bottom));
  padding: 26px 22px 20px;
  background: var(--bg-soft);
  border-radius: 22px 22px 16px 16px;
  box-shadow: 0 -16px 50px -14px rgba(40, 28, 18, 0.45);
  transform: translateY(24px);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.15);
  font-family: 'Montserrat', sans-serif;
  color: var(--ink);
}
.install-overlay--visible .install-card {
  transform: translateY(0);
}

@media (min-width: 700px) {
  .install-overlay { align-items: center; }
  .install-card {
    margin: 0;
    border-radius: 18px;
  }
}

.install-close {
  position: absolute;
  top: 8px; right: 10px;
  width: 34px; height: 34px;
  border: none; background: none;
  color: var(--muted);
  font-size: 26px; line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.install-close:hover { background: rgba(0,0,0,.05); color: var(--ink); }

.install-title {
  margin: 0 0 6px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.15;
  color: var(--ink);
}

.install-sub {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.5;
}

.install-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.install-steps li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}
.install-steps strong {
  font-weight: 500;
  color: var(--ink);
}
.install-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #faf3e3;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.install-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.install-cta {
  display: block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #faf3e3;
  font-family: inherit;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s, transform .1s;
}
.install-cta:active { transform: scale(.98); }
.install-cta:hover { background: var(--accent-deep); }

.install-cta--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.install-cta--ghost:hover { background: rgba(0,0,0,.04); color: var(--ink); }

/* Pulsing indicator near the Safari Share button location.
   iPhone — bottom toolbar, centered. iPad — top-right URL bar.
   These are heuristics; positions vary by iOS version & orientation. */
.install-pulse {
  position: fixed;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  background: var(--script);
  opacity: 0;
  animation: install-pulse 1.6s ease-out infinite;
  animation-delay: .8s;
}
.install-pulse--bottom {
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  transform: translateX(-50%);
}
.install-pulse--top-right {
  top: 18px;
  right: 90px;
}

@keyframes install-pulse {
  0%   { transform: translateX(var(--tx, 0)) scale(.6); opacity: .55; }
  70%  { transform: translateX(var(--tx, 0)) scale(2.4); opacity: 0; }
  100% { transform: translateX(var(--tx, 0)) scale(2.4); opacity: 0; }
}
.install-pulse--bottom { --tx: -50%; }

