:root {
  /* Brand palette — рафинированная индиго-сине-белая гамма. */
  --brand-indigo: #2c3e6b;       /* deep indigo, primary текст и акценты */
  --brand-indigo-dark: #1e2a4a;  /* darkest для overlay/gradient end */
  --brand-blue: #4a6fa5;         /* mid-blue, для secondary акцентов */
  --brand-blue-light: #7a99c8;   /* light, для hint/border accent */
  --brand-blue-soft: #eef2fa;    /* soft background для chips */
  --brand-blue-ghost: #f7f9fd;   /* очень нежный для card background */
  --brand-accent: #c89b3c;       /* warm gold для highlights */
  --brand-red: #c54a4a;          /* muted red для SOS */
  --brand-red-dark: #9a3838;
  --brand-success: #4a7c59;      /* muted green */

  /* Background & surfaces */
  --bg: var(--tg-theme-bg-color, #f4f6fa);
  --section-bg: var(--tg-theme-section-bg-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #eef2fa);
  --surface-elev: #fcfdff;       /* лёгкая elevation для cards */

  /* Text hierarchy */
  --text: var(--tg-theme-text-color, #1a2238);
  --text-secondary: #4a5366;
  --hint: var(--tg-theme-hint-color, #7a849c);
  --border: var(--tg-theme-section-separator-color, #e5eaf2);
  --border-soft: #eef1f7;

  /* Aliases */
  --link: var(--brand-indigo);
  --button: var(--brand-indigo);
  --button-text: #ffffff;

  /* Shadows — multi-layer для depth */
  --shadow-sm: 0 1px 2px rgba(28, 38, 72, 0.04), 0 1px 1px rgba(28, 38, 72, 0.03);
  --shadow-md: 0 2px 4px rgba(28, 38, 72, 0.06), 0 4px 12px rgba(28, 38, 72, 0.05);
  --shadow-lg: 0 4px 8px rgba(28, 38, 72, 0.08), 0 8px 24px rgba(28, 38, 72, 0.08);
  --shadow-brand: 0 4px 12px rgba(44, 62, 107, 0.18), 0 8px 28px rgba(44, 62, 107, 0.14);
  --shadow-red: 0 4px 12px rgba(197, 74, 74, 0.22), 0 8px 24px rgba(197, 74, 74, 0.16);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Animation easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

#root {
  max-width: 720px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 600;
  flex: 1;
}

h2 {
  font-size: 17px;
  margin: 0 0 12px;
  font-weight: 600;
}

h3 {
  font-size: 14px;
  margin: 18px 0 8px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

ul { margin: 0 0 12px; padding-left: 20px; }
li { margin: 4px 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--secondary-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.muted { color: var(--hint); }

#refresh-btn {
  background: var(--secondary-bg);
  color: var(--text);
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

#refresh-btn:active { opacity: 0.6; }
#refresh-btn.spinning { pointer-events: none; opacity: 0.5; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 5px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  animation: fadeInUp 0.5s var(--ease-out) 0.15s both;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--hint);
  border: none;
  border-radius: 11px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s var(--ease-out);
  font-family: inherit;
  letter-spacing: 0.01em;
}

.tab.active {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  box-shadow:
    0 1px 2px rgba(28, 38, 72, 0.08),
    0 2px 8px rgba(44, 62, 107, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tab:not(.active):hover { color: var(--text); background: var(--brand-blue-ghost); }
.tab:not(.active):active { background: var(--brand-blue-soft); }

.status {
  color: var(--hint);
  font-size: 13px;
  margin-bottom: 14px;
  min-height: 1.2em;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* Tables (today + clients list) */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--section-bg);
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 11px 9px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

tr:last-child td { border-bottom: none; }

th {
  color: var(--hint);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--secondary-bg);
}

td.handle { font-weight: 500; }
td.status-completed { color: #2e7d32; }
td.status-skipped { color: var(--hint); }
td.status-missed { color: #c62828; font-weight: 500; }
td.status-paused { color: var(--hint); font-style: italic; }
td.mood-cell { font-variant-numeric: tabular-nums; }

/* Client list rows are clickable */
.client-row {
  cursor: pointer;
  transition: background 0.1s;
}
.client-row:active { background: var(--secondary-bg); }

/* Client detail */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.back-btn {
  background: var(--secondary-bg);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.detail-stats {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.detail-stats-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.detail-stats-row .label { color: var(--hint); }
.detail-stats-row .value { font-weight: 500; }

.checkin-card {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.checkin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 14px;
}

.checkin-card-header .date { font-weight: 600; }
.checkin-card-header .meta { color: var(--hint); font-size: 13px; }

.checkin-card .field {
  margin: 8px 0;
  font-size: 14px;
}

.checkin-card .field-label {
  display: inline-block;
  width: 90px;
  color: var(--hint);
  vertical-align: top;
}

/* AI evaluation block on completed check-in cards (Stage 22) */
.ai-eval {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--secondary-bg);
  border-radius: 8px;
  border-left: 3px solid var(--button);
}

.ai-eval-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.ai-eval-scores span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-eval-summary {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.4;
  font-style: italic;
}

.ai-concerns-low { color: #2e7d32; }
.ai-concerns-mid { color: #ed6c02; }
.ai-concerns-high { color: #c62828; font-weight: 500; }

/* Digest tab — weekly snapshots (Stage 21) */
.digest-card {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.digest-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 15px;
}

.digest-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.digest-table {
  margin-top: 4px;
}

.digest-table th, .digest-table td {
  padding: 8px 9px;
  font-size: 13px;
}

.trend-up { color: #2e7d32; font-weight: 600; }
.trend-down { color: #c62828; font-weight: 600; }
.trend-flat { color: var(--hint); }

/* ── Boot loader ──────────────────────────────── */
#boot {
  text-align: center;
  padding: 60px 20px;
}
.boot-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--button);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Client header — рафинированный gradient блок ───── */
.client-header {
  background:
    radial-gradient(ellipse at top right, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(122, 153, 200, 0.18) 0%, transparent 60%),
    linear-gradient(155deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 26px 20px 28px;
  margin-bottom: 16px;
  text-align: center;
  color: #ffffff;
  box-shadow: var(--shadow-brand);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s var(--ease-out);
}
/* Stage 63: компактный horizontal layout — меньше высоты */
.client-header-compact {
  padding: 16px 18px 14px;
  text-align: left;
}
.client-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.client-header-left {
  flex: 1 1 auto;
  min-width: 0;
}
.client-header-compact .client-header-handle {
  margin-bottom: 4px;
  font-size: 22px;
  font-weight: 700;
  opacity: 1;
}
.client-header-compact .client-streak-big {
  font-size: 44px;
  margin: 0;
  flex: 0 0 auto;
}
.client-header-compact .client-streak-flame {
  font-size: 34px;
}
.client-header-compact .client-streak-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  opacity: 0.7;
  margin-bottom: 0;
}
.client-header-compact .client-header-progress {
  margin-top: 10px;
  justify-content: flex-start;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.04em;
  opacity: 0.85;
}
.client-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(200, 155, 60, 0.08) 0%, transparent 40%);
  pointer-events: none;
}
.client-header-handle {
  font-size: 17px;
  font-weight: 500;
  opacity: 0.82;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
  position: relative;
  z-index: 1;
}
/* Stage 31: большая цифра на client header = streak (🔥 N отчётов).
   Метрика — consecutive completed check_ins в текущем цикле; заморозка не
   разрывает, миссы — разрывают. Слово «подряд» убрано (путает).
   Очки/XP больше не показываем клиенту — терминология сбивает. */
.client-streak-big {
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
  margin: 10px 0 2px;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.client-streak-flame {
  font-size: 56px;
  filter: drop-shadow(0 4px 18px rgba(255, 140, 50, 0.5));
}
#client-streak-num {
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.78) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.client-streak-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.85;
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
}
.client-header-progress {
  font-size: 11px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
  position: relative;
  z-index: 1;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.client-header-progress .dot { opacity: 0.5; }
/* Stage 62: баллы в header */
.client-points-display {
  font-weight: 600;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───────────────────────────────────────────────────────────
   Stage 96: геймификация-делайт — стрик-пламя по тирам, всплывающее
   «+N» баллов, конфетти на вехах. Только transform/opacity/filter
   (GPU), всё гасится при prefers-reduced-motion (см. конец блока).
   ─────────────────────────────────────────────────────────── */
@keyframes flameBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}
@keyframes flameGlow {
  0%, 100% { filter: drop-shadow(0 4px 14px rgba(255, 140, 50, 0.45)); }
  50% { filter: drop-shadow(0 7px 24px rgba(255, 160, 45, 0.8)); }
}
.client-streak-flame {
  transform-origin: center bottom;
  will-change: transform, filter;
}
/* Тир 0 — серии нет: пламя холодное, статичное */
.streak-tier-0 .client-streak-flame {
  filter: grayscale(0.85) brightness(0.9) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
  opacity: 0.6;
  animation: none;
}
/* Тир 1 — 1-6: лёгкое дыхание */
.streak-tier-1 .client-streak-flame {
  animation: flameBreathe 2.6s ease-in-out infinite;
}
/* Тир 2 — 7-29: дыхание + пульс свечения */
.streak-tier-2 .client-streak-flame {
  animation: flameBreathe 2s ease-in-out infinite, flameGlow 2s ease-in-out infinite;
}
/* Тир 3 — 30+: бодрее + сильное золотое свечение */
.streak-tier-3 .client-streak-flame {
  animation: flameBreathe 1.5s ease-in-out infinite, flameGlow 1.5s ease-in-out infinite;
}

/* Всплывающее «+N» у баллов */
.client-points-display { position: relative; }
.points-pop {
  position: absolute;
  left: 50%;
  top: -2px;
  color: #ffd34d;
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  white-space: nowrap;
  animation: pointsPop 1.5s ease-out forwards;
}
@keyframes pointsPop {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  22% { opacity: 1; transform: translate(-50%, -2px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -28px) scale(1); }
}

/* Тост действия появляется с мягким «pop» */
.action-result:not([hidden]) {
  animation: actionPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes actionPop {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Конфетти-оверлей (canvas рисуется в JS, без CDN — CSP) */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
  .client-streak-flame,
  .streak-tier-1 .client-streak-flame,
  .streak-tier-2 .client-streak-flame,
  .streak-tier-3 .client-streak-flame { animation: none; }
  .action-result:not([hidden]) { animation: none; }
  .points-pop { animation: none; opacity: 0; }
}

/* ── Top action row: SOS + Freeze side-by-side ─── */
.top-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
  animation: fadeInUp 0.5s var(--ease-out) 0.1s both;
}

.action-half {
  border: none;
  border-radius: var(--radius-lg);
  padding: 15px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s var(--ease-out), opacity 0.15s;
  position: relative;
  overflow: hidden;
}
.action-half::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 50%);
  pointer-events: none;
}
.action-half:active { transform: scale(0.96); }
.action-half:disabled { opacity: 0.5; cursor: default; transform: none; }

/* SOS banner — приглушённый красный */
.sos-banner {
  background: linear-gradient(155deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
  color: white;
  box-shadow: var(--shadow-red);
}

/* Freeze banner — тёмно-индиго в стиль header'а */
.freeze-banner {
  background: linear-gradient(155deg, var(--brand-blue) 0%, var(--brand-indigo) 100%);
  color: white;
  box-shadow: var(--shadow-brand);
}
.freeze-banner span {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Placeholder для client tabs ──────────────── */
.placeholder {
  background: var(--secondary-bg);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}

/* ── Profile/buddy UI (данные реальные) ── */
.emb-label {
  color: var(--hint);
  font-weight: 500;
  margin-right: 6px;
  display: inline-block;
  font-size: 13px;
}

.emb-buddy-card {
  background:
    linear-gradient(135deg, var(--brand-blue-soft) 0%, var(--surface-elev) 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  border: 1px solid rgba(122, 153, 200, 0.2);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.emb-buddy-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(44, 62, 107, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.buddy-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
}
.buddy-avatar {
  font-size: 32px;
  background: linear-gradient(155deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-brand);
}
.buddy-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--brand-indigo);
  letter-spacing: -0.01em;
}
.buddy-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.profile-section {
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
}
.profile-section h3 {
  margin: 0 0 12px;
  text-transform: none;
  font-size: 15px;
  color: var(--brand-indigo);
  letter-spacing: -0.01em;
  font-weight: 700;
}
.profile-value {
  margin: 4px 0;
  font-size: 14px;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.profile-row:last-of-type { border-bottom: none; }
.profile-row .emb-label {
  margin-right: 0;
}
.profile-value {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  margin: 4px 0 0;
}
.edit-btn {
  margin-top: 12px;
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border: none;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  box-shadow:
    0 1px 2px rgba(28, 38, 72, 0.1),
    0 2px 6px rgba(44, 62, 107, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s;
}
.edit-btn:hover { transform: translateY(-1px); }
.edit-btn:active { transform: scale(0.97); }

.action-btn {
  margin-top: 8px;
  background: var(--brand-blue-soft);
  color: var(--brand-indigo);
  border: 1px solid rgba(122, 153, 200, 0.2);
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s var(--ease-out), opacity 0.15s;
}
.action-btn:active { transform: scale(0.97); opacity: 0.8; }
.action-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.action-result {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}
.action-result.action-ok {
  background: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
  border-left: 3px solid #2e7d32;
}
.action-result.action-err {
  background: rgba(211, 47, 47, 0.1);
  color: #c62828;
  border-left: 3px solid #c62828;
}

/* ── Reports accordion ──────────────────────── */
.reports-accordion {
  margin-top: 8px;
}
.reports-accordion summary {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  user-select: none;
  margin-bottom: 8px;
  list-style: none;
}
.reports-accordion summary::-webkit-details-marker { display: none; }
.reports-accordion[open] summary { margin-bottom: 12px; }
.reports-accordion summary:hover { background: #cfe5fb; }

/* ── FAQ accordion (вкладка Инфо) ─────────── */
.faq-section { margin-bottom: 16px; }
.faq-section > summary {
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  list-style: none;
  user-select: none;
  position: relative;
  padding: 4px 32px 4px 0;
}
.faq-section > summary::-webkit-details-marker { display: none; }
.faq-section > summary::after {
  content: '+';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  line-height: 1;
  color: var(--text-secondary);
}
.faq-section[open] > summary::after { content: '−'; }
.faq-section[open] > summary { margin-bottom: 10px; }
.faq-item {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff;
}
.faq-item summary {
  cursor: pointer;
  padding: 12px 36px 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  list-style: none;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
}
.faq-item[open] summary::after { content: '−'; }
.faq-item summary:hover { color: var(--brand-blue-dark); }
.faq-item p {
  margin: 0;
  padding: 0 14px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ── Peer-buddy card (write button) ─────────── */
.peer-card {
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
}
.peer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.peer-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-indigo);
  letter-spacing: -0.01em;
}
.peer-handle {
  font-size: 13px;
  margin-top: 2px;
}

.message-btn {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  box-shadow:
    0 1px 2px rgba(28, 38, 72, 0.1),
    0 2px 6px rgba(44, 62, 107, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.15s var(--ease-out);
}
.message-btn:hover { transform: translateY(-1px); }
.message-btn:active { transform: scale(0.97); }

.curator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.curator-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-indigo);
  letter-spacing: -0.01em;
}
.curator-handle {
  font-size: 13px;
  margin-top: 2px;
}

/* ── Mentor view (Stage 30) ────────────────────── */

.mentor-header {
  background:
    radial-gradient(ellipse at top right, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
    linear-gradient(155deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 22px 22px 20px;
  margin-bottom: 12px;
  color: #ffffff;
  box-shadow: var(--shadow-brand);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s var(--ease-out);
}
/* Stage 63: «Куратор» сверху мелким текстом, имя — крупно */
.mentor-header-role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  opacity: 0.72;
  margin-bottom: 4px;
}
.mentor-header-handle {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.mentor-header-stats {
  font-size: 13px;
  opacity: 0.85;
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.mentor-header-stats strong {
  font-size: 18px;
  font-weight: 700;
  margin-right: 2px;
}
.mentor-header-stats .dot { opacity: 0.5; }

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--section-bg);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
.view-toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--hint);
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}
.view-toggle-btn.active {
  background: var(--brand-blue-soft);
  color: var(--brand-indigo);
}
.view-toggle-btn:not(.active):active {
  background: var(--brand-blue-ghost);
}

/* Алерт-баннер */
.alert-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  border-left: 4px solid;
  box-shadow: var(--shadow-md);
}
.alert-banner.alert-red {
  background: linear-gradient(135deg, #fef2f2 0%, #fee9e9 100%);
  border-color: var(--brand-red);
  color: #5a1f1f;
}
.alert-banner.alert-amber {
  background: linear-gradient(135deg, #fff8e8 0%, #fff2d4 100%);
  border-color: #d18a2c;
  color: #5a3d10;
}
.alert-icon {
  font-size: 24px;
  line-height: 1;
}
.alert-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.alert-sub {
  font-size: 12px;
  opacity: 0.85;
}

/* Top-line summary */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.summary-card {
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.summary-card-warn { border-color: rgba(197, 74, 74, 0.3); background: linear-gradient(135deg, #fff7f7, #ffffff); }
.summary-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand-indigo);
  line-height: 1;
  letter-spacing: -0.03em;
}
.summary-num-sub {
  font-size: 14px;
  color: var(--hint);
  font-weight: 500;
}
.summary-label {
  font-size: 11px;
  color: var(--hint);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-h {
  font-size: 12px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 14px 0 8px;
  font-weight: 600;
}

/* Client row */
.client-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s;
}
.client-row:active { transform: scale(0.99); }
.client-row-alert {
  border-color: rgba(197, 74, 74, 0.3);
  background: linear-gradient(135deg, #fff7f7 0%, #ffffff 80%);
}
.client-row-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-green { background: var(--brand-success); box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.15); }
.status-yellow { background: #d4a73b; box-shadow: 0 0 0 3px rgba(212, 167, 59, 0.15); }
.status-red { background: var(--brand-red); box-shadow: 0 0 0 3px rgba(197, 74, 74, 0.15); }
.client-row-body { flex: 1; min-width: 0; }
.client-row-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 2px;
}
.client-day {
  font-weight: 400;
  color: var(--hint);
  font-size: 13px;
}
.client-row-sub {
  font-size: 12px;
  color: var(--text-secondary);
}
.client-row-arrow {
  color: var(--hint);
  font-size: 20px;
  font-weight: 300;
}

/* Buddy pairs */
.pair-card {
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
}
.pair-handles {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-indigo);
  letter-spacing: -0.01em;
}
.pair-arrow {
  color: var(--brand-blue-light);
  font-size: 18px;
  font-weight: 300;
}
.pair-name { font-weight: 700; }
.pair-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.pair-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.suggestion-card {
  background: linear-gradient(135deg, var(--brand-blue-soft) 0%, var(--brand-blue-ghost) 100%);
  border: 1px solid rgba(122, 153, 200, 0.22);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 12px;
}
.suggestion-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-indigo);
  margin-bottom: 4px;
}
.suggestion-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Stage 72/75: metrics-grid, .metric-unit и period-селектор удалены —
   кураторская «Сегодня» теперь summary-grid из реальных данных. */

/* «Обновлено в HH:MM» — маленький приглушённый таймштамп вверху Сегодня */
.refresh-stamp {
  font-size: 11px;
  color: var(--hint);
  text-align: right;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* Pair-suggestion — раскрывающийся блок рекомендации под client-row в Пары */
.pair-suggestion {
  background: linear-gradient(135deg, var(--brand-blue-soft) 0%, var(--brand-blue-ghost) 100%);
  border: 1px solid rgba(122, 153, 200, 0.22);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: -4px 0 12px 22px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.3s var(--ease-out);
}
.pair-suggestion .suggestion-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-indigo);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pair-suggestion .match-score,
.pair-suggestion-card .match-score {
  font-size: 11px;
  font-weight: 600;
  background: var(--brand-indigo);
  color: #ffffff;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.pair-suggestion .suggestion-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.45;
}

/* Кнопки действий — в столбик для читаемости */
.suggestion-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.suggestion-actions .edit-btn,
.suggestion-actions .action-btn {
  margin-top: 0;
  text-align: center;
  width: 100%;
}

/* Альтернативный список кандидатов (раскрывается по «Выбрать другого») */
.suggestion-alternatives {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(122, 153, 200, 0.3);
}
.alt-list-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hint);
  margin-bottom: 8px;
}
.alt-candidate {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--section-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border-soft);
}
.alt-info { flex: 1; min-width: 0; }
.alt-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.alt-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(197, 74, 74, 0.1);
  color: var(--brand-red);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(197, 74, 74, 0.15);
}
.alt-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}
.alt-pick-btn {
  margin-top: 0 !important;
  font-size: 12px !important;
  padding: 7px 12px !important;
  flex-shrink: 0;
}

/* Stage 80: версия + место хранения данных — тонкая постоянная плашка внизу */
.version-notice {
  margin-top: 18px;
  padding: 10px 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--section-bg);
  border-top: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* ── Info tab — hero + blocks ──────────────── */
.info-hero {
  background:
    radial-gradient(ellipse at top right, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
    linear-gradient(155deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 26px 22px;
  margin-bottom: 14px;
  text-align: center;
  color: #ffffff;
  box-shadow: var(--shadow-brand);
  position: relative;
  overflow: hidden;
}
.info-hero::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(200, 155, 60, 0.1) 0%, transparent 70%);
  pointer-events: none;
}
.info-hero h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  position: relative;
}
.info-tagline {
  margin: 0;
  font-size: 14px;
  opacity: 0.82;
  letter-spacing: 0.01em;
  position: relative;
}

.info-block {
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
}
.info-block h3 {
  margin: 0 0 10px;
  text-transform: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-indigo);
  letter-spacing: -0.01em;
}
.info-block p, .info-block ul, .info-block ol {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.info-block strong {
  color: var(--brand-indigo);
  font-weight: 600;
}
/* Lapse banner — Today tab (Stage 24) */
.lapse-banner {
  background: #fff4e5;
  border-left: 4px solid #ed6c02;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  color: #5d3a00;
}

.lapse-banner-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.lapse-banner-list {
  font-size: 13px;
  color: #6b4500;
  line-height: 1.4;
}

.empty, .error {
  text-align: center;
  padding: 40px 16px;
  border-radius: 12px;
  background: var(--secondary-bg);
}

.empty { color: var(--hint); }
.error { color: #c62828; }

.error-detail {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.7;
}

/* Buddy tab — pair cards + collapsible help */
.buddy-card {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.buddy-pair-handles {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.buddy-pair-arrow {
  color: var(--hint);
  font-weight: 400;
  font-size: 14px;
}

.buddy-pair-meta {
  color: var(--hint);
  font-size: 13px;
}

.buddy-pair-status-active { color: #2e7d32; }
.buddy-pair-status-paused { color: var(--hint); font-style: italic; }

.buddy-help {
  margin-top: 24px;
  background: var(--secondary-bg);
  border-radius: 10px;
  padding: 12px 14px;
}

.buddy-help summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--hint);
  user-select: none;
}

.buddy-help summary:hover { color: var(--text); }

.buddy-help[open] summary {
  margin-bottom: 8px;
  color: var(--text);
}

.help-body h3 {
  margin-top: 12px;
}

.help-body pre {
  background: var(--bg);
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}

/* ── Stage 34: расширенный профиль («О себе» блок) ────────── */
.profile-field-value {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}
.profile-field-multiline {
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--brand-blue-ghost);
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  min-height: 40px;
}

/* ── Stage 34: search box в Сообществе ──────────────────── */
.community-search-wrap {
  margin-bottom: 12px;
}
.community-search-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--section-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.community-search-input:focus {
  border-color: var(--brand-indigo);
  box-shadow: 0 0 0 3px rgba(44, 62, 107, 0.12);
}
.community-search-meta {
  font-size: 12px;
  color: var(--hint);
  margin-top: 6px;
  min-height: 14px;
}

/* Хайлайт совпадения в имени */
.community-name mark,
.community-meta mark {
  background: rgba(200, 155, 60, 0.25);
  color: inherit;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}

/* ── Stage 34: buddy switcher + архив ──────────────────────── */
.buddy-switcher {
  margin-top: 24px;
}
.buddy-switcher-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.buddy-switcher-tab {
  background: var(--brand-blue-soft);
  color: var(--brand-indigo);
  border: 1px solid rgba(122, 153, 200, 0.2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s var(--ease-out);
}
.buddy-switcher-tab:hover { background: var(--brand-blue-soft); }
.buddy-switcher-tab.active {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border-color: var(--brand-indigo);
}

/* Stage 46: buddy reports внутри switcher */
.buddy-reports-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: var(--brand-blue-soft);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}
.buddy-reports-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
}
.buddy-reports-stat {
  color: var(--brand-indigo-dark);
}
.buddy-reports-cycle {
  font-size: 12px;
}
.buddy-reports-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.buddy-report-card {
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.buddy-report-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.buddy-report-date {
  font-weight: 600;
  color: var(--text);
}
.buddy-report-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-blue-soft);
  color: var(--brand-indigo-dark);
  font-weight: 600;
}
.buddy-report-badge-ok { background: rgba(46, 125, 50, 0.12); color: #2e7d32; }
.buddy-report-badge-skip { background: rgba(2, 136, 209, 0.12); color: #0277bd; }
.buddy-report-badge-miss { background: rgba(198, 40, 40, 0.10); color: #c62828; }
.buddy-report-mood {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}
.buddy-report-field {
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
  color: var(--text);
}
.buddy-report-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
}
.buddy-report-ai {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
}
.buddy-report-ai-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}
.buddy-report-ai-summary {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
}

.buddy-archive-toggle {
  margin-top: 18px;
  text-align: center;
}
.buddy-archive {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.buddy-archive-card {
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  opacity: 0.75;
}
.buddy-archive-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.buddy-archive-meta {
  font-size: 11px;
  color: var(--hint);
  margin-top: 3px;
  line-height: 1.4;
}

/* ── Stage 40: inactive community cards + accordion ─────────────── */
.community-card-inactive {
  opacity: 0.65;
  border-style: dashed;
}
.community-card-inactive .community-name { color: var(--text-secondary); }

.community-inactive-accordion {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.community-inactive-accordion summary {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--brand-blue-soft);
  color: var(--brand-indigo-dark);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  user-select: none;
  margin-bottom: 8px;
  list-style: none;
  border: 1px dashed rgba(122, 153, 200, 0.3);
}
.community-inactive-accordion summary::-webkit-details-marker { display: none; }
.community-inactive-accordion[open] summary { margin-bottom: 14px; }
.community-inactive-accordion summary:hover { background: #d8e4f5; }

/* ── Stage 36: invite modal ──────────────────────────────────── */
.invite-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 38, 72, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeInBackdrop 0.2s ease-out;
}
@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}
.invite-modal {
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.25s var(--ease-out);
}
.invite-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-indigo);
  margin-bottom: 6px;
}
.invite-modal-meta {
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 16px;
}
.invite-modal-url-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hint);
  margin-bottom: 6px;
}
.invite-modal-url {
  background: var(--brand-blue-soft);
  border: 1px solid rgba(122, 153, 200, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.4;
}
.invite-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.invite-modal-actions button {
  width: 100%;
  margin: 0;
}

/* ── Stage 99: постоянная ссылка-приглашение — карточка сверху вкладки ── */
.referral-card {
  background: linear-gradient(135deg, var(--brand-blue-soft) 0%, var(--surface-elev) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.referral-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-indigo);
  margin: 0 0 8px;
}
.referral-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 14px;
}
.referral-link {
  background: var(--section-bg);
  border: 1px solid rgba(122, 153, 200, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text);
  line-height: 1.4;
}
.referral-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.referral-actions button {
  flex: 1;
  margin: 0;
}
.referral-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 18px;
}
.referral-qr-img {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.referral-qr-hint {
  font-size: 11px;
  margin: 8px 0 0;
  text-align: center;
}
.referral-joined {
  margin-top: 18px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}
.referral-joined-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

/* ── Stage 44: floating action button (FAB) — invite — right-bottom ──── */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(155deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 12px rgba(28, 38, 72, 0.28),
    0 8px 24px rgba(44, 62, 107, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.2s;
  z-index: 100;
  padding: 0;
  /* учитываем safe-area для iOS */
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
}
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(0.94); }

/* ── Stage 44/45+: tabs-wrap — 6 отдельных белых карточек-кнопок в 2 ряда.
   Контейнер прозрачный (без общего фона), каждая кнопка — самостоятельная
   карточка с тенью. Активная — синий gradient как раньше. */
.tabs.tabs-wrap {
  flex-wrap: wrap;
  overflow-x: visible;
  background: transparent;
  padding: 0;
  box-shadow: none;
  border: none;
  gap: 6px;
}
.tabs.tabs-wrap .tab {
  flex: 1 1 calc(33.33% - 6px);
  min-width: 0;
  background: var(--section-bg);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 6px;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.tabs.tabs-wrap .tab:not(.active):hover {
  background: var(--brand-blue-ghost);
  border-color: rgba(122, 153, 200, 0.3);
}
.tabs.tabs-wrap .tab:not(.active):active {
  background: var(--brand-blue-soft);
}
/* Active state — высокая specificity, чтобы перекрыть .tabs-wrap .tab выше */
.tabs.tabs-wrap .tab.active {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border-color: var(--brand-indigo);
  box-shadow:
    0 1px 2px rgba(28, 38, 72, 0.08),
    0 2px 8px rgba(44, 62, 107, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ── Stage 35: danger zone в detail-карточке клиента (mentor) ──── */
.danger-zone {
  padding-top: 6px;
}
.danger-archive-btn {
  background: linear-gradient(180deg, #d18a2c 0%, #a96a1a 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
}
.danger-archive-btn:hover { opacity: 0.92; }
.danger-delete-btn {
  background: linear-gradient(180deg, var(--brand-red) 0%, var(--brand-red-dark) 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
}
.danger-delete-btn:hover { opacity: 0.92; }

/* ── Stage 32: Responsive для desktop Mini App ──────────────
   Telegram Mini App в web.telegram.org открывается в окне браузера. На
   мобиле — узкая колонка. На desktop / tablet — добавляем breakpoints:
   - tablet (>= 600px): контейнер шире, отступы крупнее
   - desktop (>= 900px): двухколоночный layout где имеет смысл
*/

@media (min-width: 600px) {
  body {
    padding: 24px;
    font-size: 16px;
  }
  #root {
    max-width: 760px;
  }
  .client-header,
  .mentor-header,
  .info-hero {
    padding: 32px 28px;
  }
  .client-streak-big {
    font-size: 88px;
  }
  .client-streak-flame {
    font-size: 68px;
  }
  h1 { font-size: 22px; }
  h2 { font-size: 19px; }
  .tabs {
    padding: 6px;
  }
  .tab {
    padding: 12px 10px;
    font-size: 14px;
  }
  .summary-grid {
    gap: 12px;
  }
}

@media (min-width: 900px) {
  #root {
    max-width: 900px;
  }
  body {
    padding: 32px;
  }
  /* Mentor view: список клиентов и список пар compact */
  .client-row {
    padding: 16px 18px;
  }
  .client-row-name {
    font-size: 16px;
  }
  .client-row-sub {
    font-size: 13px;
  }
  /* Detail карточка клиента шире на desktop */
  .community-detail-card {
    padding: 28px 26px;
  }
  /* Summary cards в Сегодня — увеличим size карточек */
  .summary-card {
    padding: 16px 14px;
  }
  .summary-num {
    font-size: 30px;
  }
}

@media (min-width: 1200px) {
  #root {
    max-width: 1080px;
  }
}

/* ── Сообщество (Stage 31) ──────────────────────── */
.community-header { margin-bottom: 14px; }
.community-sub {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}
.community-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s;
}

/* Stage 42: avatar circles удалены полностью по запросу Sergey. */
.community-card:active { transform: scale(0.99); }
.community-card.community-me {
  border-color: rgba(122, 153, 200, 0.4);
  background: linear-gradient(135deg, var(--brand-blue-soft) 0%, var(--surface-elev) 100%);
}
.community-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--hint);
  width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.community-rank.rank-gold { color: #c89b3c; font-size: 20px; }
.community-rank.rank-silver { color: #a0a4af; font-size: 20px; }
.community-rank.rank-bronze { color: #b07050; font-size: 20px; }
.community-body { flex: 1; min-width: 0; }
.community-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.community-name-me {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-indigo);
  background: var(--brand-blue-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  letter-spacing: 0.04em;
}
.community-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.community-meta .dot { opacity: 0.5; }
.community-stat-attendance {
  font-weight: 600;
  color: var(--brand-indigo);
}
.community-stat-streak {
  font-weight: 500;
}
/* Stage 74: platform/superadmin/impersonation CSS удалён — Buddying OS 2 уровня */


/* Stage 59: inactive account screen */
.inactive-account-screen {
  max-width: 480px;
  margin: 40px auto;
  padding: 24px;
  text-align: center;
}
.inactive-account-screen h2 {
  font-size: 22px;
  margin: 0 0 16px;
  color: var(--text);
}
.inactive-account-screen p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

/* Stage 55: mentor profile form */
.mentor-profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  resize: vertical;
}
.form-input:focus {
  outline: none;
  border-color: var(--brand-indigo);
  box-shadow: 0 0 0 3px rgba(44, 62, 107, 0.1);
}
.form-hint {
  font-size: 11px;
  color: var(--hint);
  margin-top: 2px;
}
.action-result-ok { color: #2e7d32; font-weight: 600; }
.action-result-error { color: #c62828; font-weight: 600; }

/* Stage 54: suggestion card — slightly highlighted vs active pairs */
.pair-suggestion-card {
  background: var(--brand-blue-soft);
  border-color: rgba(122, 153, 200, 0.3);
}

/* Stage 63: single-row + раскрывающаяся рекомендация */
.pair-single-row {
  background: var(--section-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.pair-single-row:hover {
  background: var(--brand-blue-soft);
}
.pair-single-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
/* Stage 64: имя single = кликабельная кнопка (открывает профиль) */
.pair-single-info {
  flex: 1 1 auto;
  min-width: 0;
}
.pair-single-name-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--brand-indigo);
  text-align: left;
  display: inline-block;
  text-decoration: none;
}
.pair-single-name-btn:hover {
  text-decoration: underline;
}
.pair-single-profile-hint {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 4px;
}
.pair-single-name-btn:hover .pair-single-profile-hint {
  color: var(--brand-indigo);
}
.pair-single-meta {
  font-size: 11px;
  margin-top: 2px;
}
.pair-single-arrow {
  color: var(--hint);
  font-size: 18px;
  font-weight: 600;
}
.pair-single-expand {
  padding: 0 14px 14px;
  cursor: default;
  border-top: 1px dashed var(--border-soft);
  padding-top: 14px;
  margin-top: 4px;
}
.pair-rec-card {
  background: var(--brand-blue-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.pair-rec-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-indigo-dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pair-rec-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
/* Stage 64: имя partner'а в AI-рекомендации — clickable button */
.pair-rec-name-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-indigo);
  text-align: left;
  display: block;
  margin-bottom: 4px;
}
.pair-rec-name-btn:hover {
  text-decoration: underline;
}
.pair-rec-meta {
  font-size: 11px;
  margin-bottom: 10px;
}
.pair-create-ai-btn,
.pair-create-manual-btn {
  width: 100%;
  font-size: 13px;
  padding: 10px 12px;
}
.pair-manual-block {
  margin-top: 6px;
}
.pair-manual-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.pair-manual-select {
  margin-bottom: 8px;
}

/* Stage 52: Danger zone — выход из проекта */
.profile-section.danger-zone {
  margin-top: 24px;
  border: 1px solid rgba(198, 40, 40, 0.25);
  background: rgba(198, 40, 40, 0.04);
}
.danger-quit-btn {
  width: 100%;
  background: linear-gradient(180deg, #c62828 0%, #a01818 100%);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s var(--ease-out);
}
.danger-quit-btn:hover { opacity: 0.9; }
.danger-quit-btn:active { transform: scale(0.98); }

/* Stage 50 v2: mentor detail tab-buttons (компактнее портянки) */
.mentor-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 4px;
  padding: 4px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding-top: 14px;
  padding-bottom: 14px;
}
.mentor-detail-tab {
  background: var(--brand-blue-soft);
  color: var(--brand-indigo);
  border: 1px solid rgba(122, 153, 200, 0.2);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s var(--ease-out);
  flex: 1 1 auto;
  white-space: nowrap;
}
.mentor-detail-tab:hover { opacity: 0.85; }
.mentor-detail-tab.active {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border-color: var(--brand-indigo);
}
.mentor-detail-section-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 14px 0 10px;
  font-weight: 500;
}

/* Stage 49 PR2: еженедельные саммари (история) */
.weekly-digests-accordion {
  margin-bottom: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--brand-blue-soft);
}
.weekly-digests-accordion > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--brand-indigo-dark);
  user-select: none;
  list-style: none;
}
.weekly-digests-accordion > summary::-webkit-details-marker { display: none; }
.weekly-digests-accordion > summary::after {
  content: '▾';
  margin-left: 6px;
  display: inline-block;
  transition: transform 0.15s var(--ease-out);
}
.weekly-digests-accordion[open] > summary::after { transform: rotate(180deg); }
.weekly-digests-count {
  font-weight: 500;
  color: var(--text-secondary);
}
.weekly-digests-list {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.weekly-digest-card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.weekly-digest-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 8px;
}
.weekly-digest-range {
  font-weight: 600;
  color: var(--text);
}
.weekly-digest-meta {
  color: var(--text-secondary);
}
.weekly-digest-sent {
  margin-left: auto;
  color: #2e7d32;
  font-size: 11px;
  font-weight: 500;
}
.weekly-digest-bullets {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.weekly-digest-bullets li {
  margin-bottom: 4px;
}
.weekly-digest-bullets strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Stage 48: privacy toggle для @username */
.share-tg-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.share-tg-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand-indigo);
}
.share-tg-label {
  color: var(--text);
  font-weight: 500;
}

/* Stage 47: сильные стороны + кнопка «Написать» в карточке */
.community-strengths {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.community-strength-tag {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--brand-blue-soft);
  color: var(--brand-indigo-dark);
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.5;
}
.community-card-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}
.community-write-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s var(--ease-out);
}
.community-write-btn:hover { opacity: 0.9; }
.community-write-btn:active { transform: scale(0.97); }

/* Детальная карточка участника */
.community-back {
  margin-bottom: 14px;
}
.community-detail-card {
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
}
.community-detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-indigo);
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.community-detail-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.community-detail-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.community-detail-stats strong {
  color: var(--brand-indigo);
}
.community-strengths {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}
.strength-chip {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--brand-blue-soft);
  color: var(--brand-indigo-dark);
  border: 1px solid rgba(122, 153, 200, 0.18);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.community-history-list {
  margin-top: 6px;
}
.community-history-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.community-history-item:last-child { border-bottom: none; }
.community-history-meta {
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.community-history-rate { font-weight: 600; color: var(--brand-indigo); }

/* ── Pol selector + cycle profile blocks (Stage 31) ───── */
.gender-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.gender-btn {
  flex: 1 1 calc(33% - 6px);
  background: var(--brand-blue-soft);
  color: var(--text);
  border: 1px solid rgba(122, 153, 200, 0.2);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: all 0.2s var(--ease-out);
  min-width: 90px;
}
.gender-btn:active { transform: scale(0.97); }
.gender-btn.active {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color: #ffffff;
  border-color: var(--brand-indigo);
  box-shadow: 0 2px 8px rgba(44, 62, 107, 0.22);
}

.cycle-history-list { margin-top: 4px; }
.cycle-history-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.cycle-history-item:last-child { border-bottom: none; }
.cycle-history-num {
  font-weight: 600;
  color: var(--brand-indigo);
}
.cycle-history-rate {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--brand-indigo);
}
.cycle-history-period {
  font-size: 11px;
  color: var(--hint);
  flex: 1;
  text-align: center;
}

/* 4b.3 — лидерский read-only обзор: ветки → кураторы → активные участники */
.leader-branch {
  background: var(--brand-blue-ghost);
  border: 1px solid var(--brand-blue-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.leader-branch-name {
  font-weight: 600;
  color: var(--brand-indigo);
  margin-bottom: 8px;
}
.leader-curator { margin: 6px 0; }
.leader-curator-row { display: flex; gap: 6px; align-items: stretch; }
.leader-curator-head {
  display: block;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: #fff;
  border: 1px solid var(--brand-blue-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--brand-indigo);
  cursor: pointer;
}
.leader-demote-btn {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #e3b3b3;
  color: #b03030;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.leader-demote-btn:active { background: #fbeaea; }
.leader-contact-btn {
  display: block;
  width: 100%;
  background: var(--brand-indigo);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
}
.leader-contact-btn:active { opacity: 0.9; }
.leader-assign-hint { font-size: 12px; color: var(--muted, #888); margin: 4px 0 8px; }
.leader-participants {
  padding: 6px 0 2px 14px;
}
.leader-participant {
  font-size: 13px;
  color: var(--brand-blue);
  padding: 3px 0;
}

/* 4b.5 — строки вкладок Участники/Пары лидерского вида */
.leader-row {
  background: #fff;
  border: 1px solid var(--brand-blue-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
  font-size: 14px;
  color: var(--brand-indigo);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}
.leader-row-main { font-weight: 500; }
.leader-row-sub { font-size: 12px; color: var(--brand-blue); }

/* 4b.6 — свитчер на 4 уровня: админ-блок (Супер-админ/Лидер) над рабочим (Куратор/Участник).
   Контейнер .view-toggle по умолчанию flex-row → переопределяем в колонку, чтобы группы шли
   СТРОКАМИ одна над другой (иначе блоки разъезжаются вбок). */
.view-toggle {
  flex-direction: column;
  gap: 6px;
}
.view-toggle-group {
  display: flex;
  gap: 6px;
  margin: 0;
}
/* кнопки-роли: явный «кнопочный» вид у неактивных (фон + рамка), активная — бренд-цвет */
.view-toggle-group .view-toggle-btn {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
/* активная роль — насыщенный индиго + белый текст (как активная вкладка), чтобы сразу было
   видно, в каком уровне находишься. Специфичность (0,3,0) перебивает базовый .active. */
.view-toggle-group .view-toggle-btn.active {
  background: var(--brand-indigo);
  color: #fff;
  border-color: var(--brand-indigo);
  box-shadow: var(--shadow-brand);
}
.view-toggle-admin {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--brand-blue-light);
}
/* лидер ветки (уровень над кураторами) в супер-админ обзоре */
.leader-branch-leader {
  font-size: 13px;
  color: var(--brand-accent);
  margin: 0 0 8px;
}

/* 4b.7 — карточка участника (read-only) + кликабельные строки/чипы лидерского вида */
.leader-row-click, .leader-participant[data-participant], .leader-pair-member { cursor: pointer; }
.leader-pair-member {
  text-decoration: underline;
  text-decoration-style: dotted;
  color: var(--brand-blue);
}
.leader-pair-head { font-size: 16px; font-weight: 600; color: var(--brand-indigo); margin-bottom: 10px; }
.leader-card {
  background: var(--brand-blue-ghost);
  border: 1px solid var(--brand-blue-soft);
  border-radius: 12px;
  padding: 14px;
}
.leader-card + .leader-card { margin-top: 10px; }
.leader-card-name { font-size: 17px; font-weight: 600; color: var(--brand-indigo); }
.leader-card-sub { font-size: 13px; color: var(--brand-blue); margin-top: 2px; }
.leader-card-meta { font-size: 13px; color: var(--brand-indigo); margin-top: 8px; }
.leader-card-goal { font-size: 13px; color: var(--brand-accent); margin-top: 6px; }
.leader-card-h { font-weight: 600; color: var(--brand-indigo); margin: 12px 0 6px; }
.leader-card-checkin {
  font-size: 13px;
  color: var(--brand-indigo);
  padding: 4px 0;
  border-top: 1px solid var(--brand-blue-soft);
}

/* 4b.8 — подпись под цифрами в шапке лидера/супер-админа */
.leader-header-sub {
  opacity: 0.7;
  margin-top: 6px;
  font-size: 12px;
}

/* Фаза B.3 — панель «Назначить роль» (супер-админ) */
.leader-assign {
  background: var(--brand-blue-ghost);
  border: 1px solid var(--brand-blue-soft);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.leader-assign > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-indigo);
}
.leader-assign-input {
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
.leader-assign-results { margin-top: 8px; }
.leader-assign-row {
  background: #fff;
  border: 1px solid var(--brand-blue-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
}
.leader-assign-name { font-size: 14px; color: var(--brand-indigo); margin-bottom: 6px; }
.leader-assign-pays {
  background: var(--brand-accent);
  color: #fff;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
}
.leader-assign-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.leader-assign-branch, .leader-assign-team {
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
}
.leader-assign-btn {
  background: var(--brand-indigo);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
