@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+Armenian:wght@400;500;600&display=swap');

/* ============================================================
   AURA · Warm Clinical
   Дизайн-система макетов клиники лечебного массажа
   ============================================================ */

:root {
  /* Поверхности */
  --paper:      #FBF8F3;
  --paper-2:    #F4EFE6;
  --paper-3:    #EBE3D6;
  --surface:    #FFFFFF;
  --line:       #DFD5C4;
  --line-soft:  #EDE6DA;

  /* Чернила */
  --ink:        #1C2620;
  --ink-2:      #4C5C53;
  --ink-3:      #8A968E;

  /* Акценты */
  --sage:       #2F6B54;
  --sage-deep:  #1E4A39;
  --sage-soft:  #E3EDE7;
  --clay:       #C8734A;
  --clay-soft:  #F8E8DC;
  --alert:      #B4453C;
  --alert-soft: #F9E4E1;
  --amber:      #B5862B;
  --amber-soft: #F7EFDB;

  /* Типографика */
  --display: 'Fraunces', Georgia, serif;
  --body:    'Inter', 'Noto Sans Armenian', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Радиусы: пациент дышит, рабочие кабинеты собраны */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(28,38,32,.05);
  --shadow-2: 0 4px 16px rgba(28,38,32,.07);
  --shadow-3: 0 18px 48px rgba(28,38,32,.14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper-2);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   Типографика
   ============================================================ */

.t-display {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.1;
}

.t-h1 { font-family: var(--display); font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.t-h2 { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0; }
.t-h3 { font-size: 15px; font-weight: 600; margin: 0; }

.t-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.t-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.t-num  { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.t-muted { color: var(--ink-2); }
.t-faint { color: var(--ink-3); }
.t-sm    { font-size: 12.5px; }
.t-xs    { font-size: 11.5px; }
.t-sage  { color: var(--sage); }
.t-clay  { color: var(--clay); }
.t-alert { color: var(--alert); }

/* Сигнатурная линейка раздела: подпись моно + волосяная линия до края */
.chart-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.chart-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.chart-rule > .t-eyebrow { flex: none; }

/* ============================================================
   Кнопки
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--paper-3);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--line-soft); }

.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--sage-deep); }

.btn-clay { background: var(--clay); color: #fff; }
.btn-clay:hover { background: #B0623C; }

.btn-outline { background: transparent; border-color: var(--line); }
.btn-outline:hover { background: var(--paper-2); border-color: var(--ink-3); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }

.btn-danger { background: var(--alert-soft); color: var(--alert); }
.btn-danger:hover { background: #F3D5D1; }

.btn-lg   { padding: 13px 22px; font-size: 15px; border-radius: var(--r-md); }
.btn-sm   { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-full { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
}
.btn-icon:hover { background: var(--paper-3); color: var(--ink); }

/* ============================================================
   Чипы и бейджи
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--paper-3);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.5;
  white-space: nowrap;
}
.chip-sage  { background: var(--sage-soft);  color: var(--sage-deep); }
.chip-clay  { background: var(--clay-soft);  color: #9A5433; }
.chip-alert { background: var(--alert-soft); color: var(--alert); }
.chip-amber { background: var(--amber-soft); color: #8A6519; }
.chip-outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.chip-solid { background: var(--sage); color: #fff; }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}
.dot-sage { background: var(--sage); }
.dot-clay { background: var(--clay); }
.dot-alert{ background: var(--alert); }
.dot-amber{ background: var(--amber); }

.stage-badge {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--paper-3);
  color: var(--ink-3);
}
.stage-badge.e1 { background: var(--sage-soft); color: var(--sage-deep); }
.stage-badge.e2 { background: var(--clay-soft); color: #9A5433; }
.stage-badge.e3 { background: var(--paper-3);   color: var(--ink-3); }

/* ============================================================
   Карточки и поверхности
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 16px;
}
.card-flat { background: var(--paper); border: none; }
.card-pad-0 { padding: 0; }
.card-sage  { background: var(--sage-soft); border-color: #CFE0D5; }
.card-clay  { background: var(--clay-soft); border-color: #EFD5C3; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-body { padding: 16px; }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); background: var(--paper); border-radius: 0 0 var(--r-sm) var(--r-sm); }

.divider { height: 1px; background: var(--line-soft); border: 0; margin: 14px 0; }

/* Утилиты компоновки */
.row  { display: flex; align-items: center; gap: 10px; }
.row-b{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col  { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.gap-4{ gap: 4px; } .gap-6{ gap: 6px; } .gap-8 { gap: 8px; }
.gap-14{ gap: 14px; } .gap-18{ gap: 18px; } .gap-24{ gap: 24px; }
.mt-4{margin-top:4px;} .mt-8{margin-top:8px;} .mt-12{margin-top:12px;}
.mt-16{margin-top:16px;} .mt-24{margin-top:24px;} .mb-8{margin-bottom:8px;}
.mb-12{margin-bottom:12px;} .mb-16{margin-bottom:16px;} .mb-24{margin-bottom:24px;}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ============================================================
   Аватары
   ============================================================ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-weight: 600;
  font-size: 13px;
  flex: none;
  letter-spacing: .02em;
}
.avatar.sz-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.sz-lg { width: 52px; height: 52px; font-size: 17px; }
.avatar.sz-xl { width: 72px; height: 72px; font-size: 22px; }
.avatar.av-clay  { background: var(--clay-soft);  color: #9A5433; }
.avatar.av-amber { background: var(--amber-soft); color: #8A6519; }
.avatar.av-ink   { background: var(--paper-3);    color: var(--ink-2); }

/* ============================================================
   Формы
   ============================================================ */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 550; color: var(--ink-2); }
.field-hint  { font-size: 11.5px; color: var(--ink-3); }
.field-label .req { color: var(--clay); }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px var(--sage-soft);
}
.textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238A968E' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.input-mono { font-family: var(--mono); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
}
.check input { margin: 2px 0 0; accent-color: var(--sage); width: 15px; height: 15px; flex: none; }

.switch {
  position: relative;
  width: 38px; height: 22px;
  border-radius: var(--r-full);
  background: var(--line);
  flex: none;
  cursor: pointer;
  transition: background .18s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform .18s;
}
.switch.is-on { background: var(--sage); }
.switch.is-on::after { transform: translateX(16px); }

/* Сегментированный переключатель */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--paper-3);
  border-radius: var(--r-sm);
}
.seg-item {
  padding: 6px 13px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  cursor: pointer;
}
.seg-item.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* Табы */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--sage); border-bottom-color: var(--sage); }
.tab .count { font-family: var(--mono); font-size: 11px; opacity: .7; margin-left: 4px; }

.pane { display: none; }
.pane.is-active { display: block; }

/* ============================================================
   Таблицы (рабочие кабинеты)
   ============================================================ */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 9px 12px;
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--paper);
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--paper); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.table .w-1 { width: 1%; white-space: nowrap; }

/* ============================================================
   Статистика и метрики
   ============================================================ */

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .v {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat .l { font-size: 11.5px; color: var(--ink-3); }
.stat .d { font-family: var(--mono); font-size: 11px; }
.stat .d.up   { color: var(--sage); }
.stat .d.down { color: var(--alert); }

.kpi {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-hero { background: var(--sage); border-color: var(--sage); color: #fff; }
.kpi-hero .l, .kpi-hero .t-eyebrow { color: rgba(255,255,255,.7); }

.meter {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--paper-3);
  overflow: hidden;
}
.meter > i { display: block; height: 100%; background: var(--sage); border-radius: var(--r-full); }
.meter.clay > i { background: var(--clay); }
.meter.alert > i { background: var(--alert); }

/* Прогресс курса: сеансы точками */
.course-dots { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.course-dots i {
  width: 13px; height: 13px;
  border-radius: 4px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  display: block;
}
.course-dots i.done { background: var(--sage); border-color: var(--sage); }
.course-dots i.next { background: var(--surface); border: 1.5px dashed var(--sage); }
.course-dots i.miss { background: var(--alert-soft); border-color: #E7BDB7; }

/* ============================================================
   Красные флаги — баннер противопоказаний
   ============================================================ */

.flags {
  border: 1px solid #E7BDB7;
  border-left: 3px solid var(--alert);
  border-radius: var(--r-sm);
  background: var(--alert-soft);
  padding: 12px 14px;
}
.flags.rel { border-color: #E8D6A8; border-left-color: var(--amber); background: var(--amber-soft); }
.flags.ok  { border-color: #CFE0D5; border-left-color: var(--sage); background: var(--sage-soft); }
.flags-title { font-size: 12.5px; font-weight: 650; color: var(--alert); display: flex; align-items: center; gap: 7px; }
.flags.rel .flags-title { color: #8A6519; }
.flags.ok  .flags-title { color: var(--sage-deep); }
.flags-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.flags-list li { font-size: 12.5px; display: flex; gap: 8px; align-items: baseline; }
.flags-list .meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }

/* ============================================================
   СИГНАТУРА · Карта тела (сегментированный манекен)
   ============================================================ */

.bodymap {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
}
.bodymap svg { display: block; height: auto; }
.bodymap-view { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bodymap-view .cap {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.zone {
  fill: #EDE5D7;
  stroke: #D6CAB6;
  stroke-width: 1;
  transition: fill .15s, stroke .15s;
}
.bodymap.is-interactive .zone { cursor: pointer; }
.bodymap.is-interactive .zone:hover { fill: #E3D9C6; stroke: var(--ink-3); }
.zone.inert { fill: #F3EDE2; stroke: #E2D9C8; pointer-events: none; }
.zone.is-pain    { fill: #F0CDB2; stroke: var(--clay);  stroke-width: 1.3; }
.zone.is-treated { fill: #C6DDCE; stroke: var(--sage);  stroke-width: 1.3; }
.zone.is-flag    { fill: #F2C7C1; stroke: var(--alert); stroke-width: 1.3; }
.zone.is-sel     { fill: var(--sage); stroke: var(--sage-deep); stroke-width: 1.3; }

/* Точки на карте: триггерные точки и гипертонус */
.marker { pointer-events: none; }
.marker.tp   { fill: var(--alert); }
.marker.tone { fill: none; stroke: var(--clay); stroke-width: 1.6; }

.bodymap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 11px;
  color: var(--ink-2);
}
.bodymap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bodymap-legend i {
  width: 11px; height: 11px; border-radius: 3px; display: block;
  border: 1px solid var(--line); background: var(--paper-3);
}
.bodymap-legend i.pain    { background: #F0CDB2; border-color: var(--clay); }
.bodymap-legend i.treated { background: #C6DDCE; border-color: var(--sage); }
.bodymap-legend i.flag    { background: #F2C7C1; border-color: var(--alert); }

/* Шкала боли 0–10 (NRS) */
.pain-scale { display: flex; flex-direction: column; gap: 6px; }
.pain-ticks { display: flex; gap: 3px; }
.pain-ticks button {
  flex: 1;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.pain-ticks button:hover { border-color: var(--ink-3); }
.pain-ticks button.is-sel { background: var(--clay); border-color: var(--clay); color: #fff; font-weight: 700; }
.pain-scale .ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); }

/* ============================================================
   Мобильный кабинет пациента
   ============================================================ */

.screen {
  width: 420px;
  min-height: 880px;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.is-patient { background: var(--paper-2); padding: 0; }

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  flex: none;
}
.status-bar .icons { display: flex; gap: 5px; align-items: center; opacity: .75; }

.app-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 14px;
  flex: none;
}
.app-bar .t-h1 { font-size: 24px; }
.app-bar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.screen-body.flush { padding-left: 0; padding-right: 0; }

.tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 8px 6px 14px;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 550;
  color: var(--ink-3);
  padding: 4px 0;
  position: relative;
}
.tabbar a.is-active { color: var(--sage); }
.tabbar svg { width: 21px; height: 21px; }
.tabbar .badge {
  position: absolute;
  top: 1px; right: 50%;
  transform: translateX(16px);
  min-width: 15px; height: 15px;
  border-radius: var(--r-full);
  background: var(--clay);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* Плавающая кнопка */
.fab {
  position: absolute;
  right: 20px; bottom: 86px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-3);
  border: none;
  cursor: pointer;
}

/* Карточка ближайшего визита — характерный блок главной */
.next-visit {
  background: var(--sage);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.next-visit::after {
  content: '';
  position: absolute;
  right: -34px; top: -34px;
  width: 132px; height: 132px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
}
.next-visit::before {
  content: '';
  position: absolute;
  right: -8px; bottom: -46px;
  width: 132px; height: 132px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
}
.next-visit .when {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1;
}
.next-visit .t-eyebrow { color: rgba(255,255,255,.65); }
.next-visit .sub { color: rgba(255,255,255,.85); font-size: 13px; }
.next-visit .actions { display: flex; gap: 8px; margin-top: 16px; position: relative; }
.next-visit .actions .btn { flex: 1; background: rgba(255,255,255,.16); color: #fff; }
.next-visit .actions .btn:hover { background: rgba(255,255,255,.26); }
.next-visit .actions .btn.solid { background: #fff; color: var(--sage-deep); }

/* Список-строка */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-row .lead { flex: none; }
.list-row .body { flex: 1; min-width: 0; }
.list-row .title { font-size: 13.5px; font-weight: 600; }
.list-row .sub { font-size: 12px; color: var(--ink-3); }
.list-row .trail { margin-left: auto; text-align: right; flex: none; }

/* Пустое состояние */
.empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty .t-h3 { color: var(--ink-2); }

/* ============================================================
   Рабочие кабинеты: консоль
   ============================================================ */

body.is-console {
  background: var(--paper-2);
  font-size: 13.5px;
}
.console {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 54px 1fr;
  grid-template-areas: 'brand top' 'nav main';
  min-height: 100vh;
}

.console-brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  background: var(--paper);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.console-top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}
.console-nav {
  grid-area: nav;
  background: var(--paper);
  border-right: 1px solid var(--line-soft);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.console-main {
  grid-area: main;
  padding: 22px 26px 40px;
  overflow-y: auto;
}

.brand-mark {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand-mark .pt { color: var(--clay); }
.brand-role {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
}

.nav-group { margin: 12px 0 4px; padding: 0 10px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  position: relative;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.is-active { background: var(--sage-soft); color: var(--sage-deep); font-weight: 600; }
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -10px; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sage);
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .75; }
.nav-item .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--paper-3);
  border-radius: var(--r-full);
  padding: 1px 6px;
}
.nav-item.is-active .count { background: #fff; }
.nav-item .count.hot { background: var(--clay); color: #fff; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head .t-h1 { font-size: 25px; }

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
.crumbs a:hover { color: var(--sage); }

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  min-width: 280px;
  color: var(--ink-3);
  font-size: 13px;
}

.lang-switch { display: inline-flex; gap: 1px; background: var(--paper-3); border-radius: var(--r-xs); padding: 2px; }
.lang-switch button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 7px; border-radius: 4px; color: var(--ink-3);
}
.lang-switch button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ============================================================
   Расписание
   ============================================================ */

.sched {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.sched-head {
  display: contents;
}
.sched-head > div {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}
.sched-time {
  border-right: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  padding: 4px 8px;
  text-align: right;
  height: 46px;
}
.sched-col {
  border-right: 1px solid var(--line-soft);
  position: relative;
  height: 46px;
}
.sched-col:last-child { border-right: 0; }
.sched-col.hour { border-top: 1px solid var(--line-soft); }
.sched-col.half { border-top: 1px dashed var(--line-soft); }
.sched-col.off  { background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 5px, var(--paper) 5px, var(--paper) 10px); }

.appt {
  position: absolute;
  left: 4px; right: 4px;
  border-radius: var(--r-xs);
  padding: 6px 8px;
  background: var(--sage-soft);
  border: 1px solid #C6DCCE;
  border-left: 3px solid var(--sage);
  font-size: 11.5px;
  line-height: 1.35;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
}
.appt:hover { box-shadow: var(--shadow-2); }
.appt .who { font-weight: 650; }
.appt .what { color: var(--ink-2); font-size: 11px; }
.appt .tm { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.appt.st-confirmed { background: var(--sage-soft); border-left-color: var(--sage); }
.appt.st-scheduled { background: var(--paper-2);  border-left-color: var(--ink-3); border-color: var(--line); }
.appt.st-attention { background: var(--amber-soft); border-left-color: var(--amber); border-color: #E8D6A8; }
.appt.st-blocked   { background: var(--alert-soft); border-left-color: var(--alert); border-color: #E7BDB7; }
.appt.st-done      { background: var(--paper); border-left-color: var(--line); border-color: var(--line-soft); color: var(--ink-3); }
.appt.st-ai::after {
  content: 'ИИ';
  position: absolute;
  top: 5px; right: 6px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--sage);
  background: rgba(255,255,255,.8);
  border-radius: 3px;
  padding: 0 3px;
}

/* Слоты в PWA */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}
.slot:hover { border-color: var(--sage); }
.slot.is-sel { background: var(--sage); border-color: var(--sage); color: #fff; font-weight: 700; }
.slot.is-off { background: var(--paper-2); color: var(--ink-3); border-style: dashed; pointer-events: none; }

.daystrip { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.daystrip::-webkit-scrollbar { display: none; }
.daystrip button {
  flex: none;
  width: 52px;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.daystrip .dw { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.daystrip .dd { font-family: var(--display); font-size: 17px; font-weight: 600; }
.daystrip button.is-sel { background: var(--sage); border-color: var(--sage); color: #fff; }
.daystrip button.is-sel .dw { color: rgba(255,255,255,.7); }
.daystrip button.is-off { opacity: .4; pointer-events: none; }

/* ============================================================
   Чат
   ============================================================ */

.chat { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.msg { display: flex; gap: 9px; max-width: 88%; }
.msg .bubble {
  padding: 10px 13px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
}
.msg.ai .bubble   { background: var(--surface); border: 1px solid var(--line-soft); border-bottom-left-radius: 5px; }
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.msg.me .bubble   { background: var(--sage); color: #fff; border-bottom-right-radius: 5px; }
.msg.sys { max-width: 100%; justify-content: center; }
.msg.sys .bubble  { background: var(--paper-3); color: var(--ink-2); font-size: 11.5px; border-radius: var(--r-full); padding: 5px 12px; }
.msg .tm { font-family: var(--mono); font-size: 10px; color: var(--ink-3); align-self: flex-end; }

.msg-slots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.msg-slots button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
}
.msg-slots button:hover { border-color: var(--sage); background: var(--sage-soft); }

.composer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
.composer .input { border-radius: var(--r-full); }

.channel-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: var(--r-full);
}
.channel-tag.wa { background: #E3F0E7; color: #1F6B3A; }
.channel-tag.tg { background: #E1EEF8; color: #1F5F8B; }
.channel-tag.ig { background: #F9E6EE; color: #96305A; }
.channel-tag.web{ background: var(--paper-3); color: var(--ink-2); }

/* ============================================================
   Воронка и маркетинг
   ============================================================ */

.funnel { display: flex; flex-direction: column; gap: 3px; }
.funnel-step {
  display: grid;
  grid-template-columns: 200px 1fr 110px 90px;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
}
.funnel-bar { height: 30px; border-radius: var(--r-xs); background: var(--sage); position: relative; min-width: 3px; }
.funnel-bar.s2 { background: #3C7C63; }
.funnel-bar.s3 { background: #4B8C72; }
.funnel-bar.s4 { background: #5D9C82; }
.funnel-bar.s5 { background: var(--clay); }
.funnel-bar.s6 { background: #D4885F; }
.funnel-bar.s7 { background: #DE9D78; }
.funnel-step .lab { font-size: 12.5px; font-weight: 550; }
.funnel-step .cnt { font-family: var(--mono); font-size: 13px; text-align: right; }
.funnel-step .cvr { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); text-align: right; }
.funnel-step .cvr.drop { color: var(--alert); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.spark i { flex: 1; background: var(--sage-soft); border-radius: 2px 2px 0 0; display: block; }
.spark i.hi { background: var(--sage); }

.path { display: flex; flex-direction: column; gap: 0; }
.path-item { display: flex; gap: 14px; }
.path-rail { display: flex; flex-direction: column; align-items: center; flex: none; width: 18px; }
.path-rail .pin {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--sage); background: var(--surface); margin-top: 4px;
}
.path-rail .pin.clay { border-color: var(--clay); }
.path-rail .pin.solid { background: var(--sage); }
.path-rail .ln { flex: 1; width: 1px; background: var(--line); margin: 3px 0; min-height: 14px; }
.path-body { padding-bottom: 16px; flex: 1; }

/* ============================================================
   Drawer и модалка
   ============================================================ */

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(28,38,32,.34);
  z-index: 30;
}
.drawer {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 460px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  z-index: 31;
  display: flex;
  flex-direction: column;
}
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); background: var(--surface); display: flex; gap: 10px; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  z-index: 31;
  padding: 8px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sheet::before {
  content: '';
  width: 38px; height: 4px;
  border-radius: var(--r-full);
  background: var(--line);
  margin: 0 auto 6px;
}

/* ============================================================
   Галерея макетов
   ============================================================ */

body.gallery { background: var(--paper); }
.gal-wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px 80px; }

.gal-head { padding: 64px 0 40px; }
.gal-head .t-h1 {
  font-size: clamp(44px, 7vw, 78px);
  letter-spacing: -.035em;
  line-height: .95;
}
.gal-head .lede { max-width: 620px; font-size: 15.5px; line-height: 1.65; color: var(--ink-2); margin: 18px 0 0; }

.gal-stats { display: flex; gap: 44px; flex-wrap: wrap; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }

.gal-section { margin-top: 56px; }
.gal-section > .t-h2 { margin-bottom: 4px; }
.gal-section .section-sub { color: var(--ink-2); font-size: 13.5px; margin: 0 0 20px; max-width: 640px; }

.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 22px; }
.gal-card { display: block; }
.gal-card .frame {
  position: relative;
  aspect-ratio: 420 / 880;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper);
  transition: box-shadow .2s, border-color .2s, transform .2s;
}
.gal-card:hover .frame { box-shadow: var(--shadow-3); border-color: var(--sage); transform: translateY(-3px); }
.gal-card .frame iframe {
  width: 420px;
  height: 880px;
  border: 0;
  transform-origin: top left;
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
}
.gal-card.desk .frame { aspect-ratio: 16 / 10; }
.gal-card.desk .frame iframe { width: 1440px; height: 900px; }
.gal-card .no {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  background: rgba(251,248,243,.92);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  z-index: 2;
}
.gal-card .meta { padding: 11px 2px 0; }
.gal-card .meta h3 { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.gal-card .meta .d { font-size: 12px; color: var(--ink-3); }
.gal-card .meta .top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }

.gal-tokens { display: flex; gap: 8px; flex-wrap: wrap; }
.gal-swatch { width: 46px; height: 46px; border-radius: var(--r-sm); border: 1px solid rgba(28,38,32,.08); }

/* ============================================================
   Документ ТЗ
   ============================================================ */

body.doc { background: var(--paper); }
.doc-wrap { max-width: 840px; margin: 0 auto; padding: 48px 28px 96px; font-size: 15px; line-height: 1.7; }
.doc-wrap h1 { font-family: var(--display); font-size: 42px; font-weight: 600; letter-spacing: -.03em; line-height: 1.08; margin: 0 0 8px; }
.doc-wrap h2 { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 52px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.doc-wrap h3 { font-size: 17px; font-weight: 650; margin: 30px 0 10px; }
.doc-wrap h4 { font-size: 14.5px; font-weight: 650; margin: 22px 0 8px; color: var(--ink-2); }
.doc-wrap p  { margin: 0 0 14px; }
.doc-wrap ul, .doc-wrap ol { margin: 0 0 16px; padding-left: 22px; }
.doc-wrap li { margin-bottom: 6px; }
.doc-wrap code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
.doc-wrap pre {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 16px;
  overflow-x: auto;
}
.doc-wrap pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.doc-wrap table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 0 0 20px; }
.doc-wrap th {
  text-align: left; padding: 9px 11px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  font-size: 11.5px; font-weight: 650;
}
.doc-wrap td { padding: 9px 11px; border: 1px solid var(--line-soft); vertical-align: top; }
.doc-wrap blockquote { margin: 0 0 16px; padding: 2px 0 2px 18px; border-left: 3px solid var(--clay); color: var(--ink-2); }
.doc-wrap hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.doc-wrap hr + h2 { border-top: 0; padding-top: 0; margin-top: 0; }
.doc-wrap a { color: var(--sage); text-decoration: underline; text-underline-offset: 2px; }

/* Превью экранов внутри документа */
.previews {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 16px;
  margin: 20px -120px 30px;
}
.previews-title {
  flex: 0 0 100%;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: -4px;
}
.spv, .doc-wrap .spv { display: block; color: inherit; text-decoration: none; }
.spv:hover, .doc-wrap .spv:hover { text-decoration: none; }
.spv .frame {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.spv .frame iframe {
  border: 0;
  position: absolute;
  top: 0; left: 0;
  transform-origin: top left;
  pointer-events: none;
}
.spv.phone .frame { width: 180px; height: 377px; }
.spv.phone .frame iframe { width: 420px; height: 880px; transform: scale(.4286); }
.spv.desk .frame { width: 320px; height: 200px; }
.spv.desk .frame iframe { width: 1440px; height: 900px; transform: scale(.2222); }
.spv:hover .frame { border-color: var(--sage); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.spv .cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.35;
}
.spv .cap .nm { font-weight: 600; }
.spv .cap .go { font-family: var(--mono); font-size: 10px; color: var(--sage); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.spv:hover .cap .go { opacity: 1; }

@media (max-width: 1130px) {
  .previews { margin-left: 0; margin-right: 0; }
}

.doc-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(251,248,243,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ============================================================
   Появление
   ============================================================ */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .4s cubic-bezier(.2,.7,.3,1) both; }
.rise-1 { animation-delay: .05s; }
.rise-2 { animation-delay: .1s; }
.rise-3 { animation-delay: .15s; }
.rise-4 { animation-delay: .2s; }
