:root {
  --bg-0: #0b1220;
  --bg-1: #0e1628;
  --panel: rgba(20, 32, 54, 0.55);
  --panel-solid: #131f36;
  --stroke: rgba(148, 180, 220, 0.14);
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --text: #e5eef7;
  --text-dim: #8fa3bd;
  --danger: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 20% 0%, var(--bg-1), var(--bg-0));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden { display: none !important; }

.glass {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
}

/* ---------- экраны загрузки / входа ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: radial-gradient(1200px 800px at 20% 0%, var(--bg-1), var(--bg-0));
}

.loader-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .5; }
  50% { transform: scale(1.8); opacity: 1; }
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-title { font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 12.5px; color: var(--text-dim); }

.tabs {
  display: flex;
  gap: 6px;
  background: rgba(10, 18, 34, 0.6);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

form label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
  font-weight: 550;
}

input[type="text"], input[type="password"], input[type="date"], select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: rgba(9, 16, 30, 0.65);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}
textarea { resize: vertical; }

input[type="file"] {
  margin-top: 6px;
  width: 100%;
  color: var(--text-dim);
  font-size: 13px;
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
  cursor: pointer;
  transition: background .25s;
}
input[type="file"]::file-selector-button:hover { background: rgba(45, 212, 191, 0.25); }

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  color: #04211c;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: filter .25s, transform .15s;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: .55; cursor: default; }

.btn-ghost {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .25s, border-color .25s;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(148, 180, 220, 0.3); }

.form-error {
  min-height: 18px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

/* ---------- главный экран ---------- */

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(10, 18, 34, 0.55);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  pointer-events: none;
  white-space: nowrap;
}

/* бейджи над зонами */
#badges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.zone-badge {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  cursor: pointer;
  background: rgba(13, 24, 42, 0.85);
  border: 1px solid rgba(45, 212, 191, 0.45);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 650;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: background .2s, border-color .2s;
}
.zone-badge:hover { background: rgba(45, 212, 191, 0.2); }
.zone-badge.selected {
  background: var(--accent);
  color: #04211c;
  border-color: var(--accent);
}

/* правая панель */
.panel {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}
.user-name {
  font-weight: 650;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background .25s, border-color .25s, color .25s;
}
.chip:hover { border-color: rgba(45, 212, 191, 0.4); }
.chip.active {
  background: var(--accent-soft);
  border-color: rgba(45, 212, 191, 0.6);
  color: var(--accent);
}
.chip-count {
  background: rgba(45, 212, 191, 0.18);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  min-width: 20px;
  padding: 2px 6px;
  text-align: center;
}
.chip-count:empty { display: none; }

.panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}

.zone-title { font-size: 18px; font-weight: 650; margin-bottom: 4px; }
.zone-sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px; line-height: 1.45; }

.studies-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.empty-state {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px dashed var(--stroke);
  border-radius: var(--radius);
}

.study-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(9, 16, 30, 0.5);
  padding: 12px 14px;
  transition: border-color .25s;
}
.study-card:hover { border-color: rgba(148, 180, 220, 0.28); }

.study-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.kind-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.study-date { font-size: 12px; color: var(--text-dim); margin-left: auto; flex-shrink: 0; }

.study-title { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.study-note { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; margin-bottom: 6px; white-space: pre-wrap; }

.study-files { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.file-link {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity .2s;
}
.file-link:hover { opacity: .75; text-decoration: underline; }
.file-size { color: var(--text-dim); font-size: 11px; }

/* ---------- DICOM: кнопка просмотрщика и чипы статуса ---------- */

.study-dicom { margin-bottom: 8px; }

.btn-dicom {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  color: #04211c;
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(45, 212, 191, 0.25);
  transition: filter .25s, transform .15s;
}
.btn-dicom:hover { filter: brightness(1.12); }
.btn-dicom:active { transform: scale(0.985); }

.dicom-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
}
.dicom-chip.pending {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.35);
}
.dicom-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
.dicom-chip.failed {
  color: var(--text-dim);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--stroke);
}

.file-hint { margin: -6px 0 14px; }

.study-actions { display: flex; justify-content: flex-end; }
.btn-delete {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.btn-delete:hover { color: var(--danger); background: rgba(248, 113, 113, 0.1); }

.add-btn { margin-top: auto; }

.add-form {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
}
.form-row { display: flex; gap: 10px; margin-top: 4px; }
.form-row .btn-primary { flex: 1; }

.progress {
  position: relative;
  height: 26px;
  border-radius: 999px;
  background: rgba(9, 16, 30, 0.7);
  border: 1px solid var(--stroke);
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.5), var(--accent));
  transition: width .2s;
}
.progress-text {
  position: relative;
  text-align: center;
  line-height: 24px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
}

/* ---------- модалка ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 10, 20, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  width: min(520px, 100%);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.hint { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin-bottom: 14px; }

/* ---------- скроллбары ---------- */
.panel-body::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb {
  background: rgba(148, 180, 220, 0.18);
  border-radius: 999px;
}

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
  body { overflow: auto; }
  .app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .stage { height: 55vh; flex: none; }
  .panel {
    width: 100%;
    flex: 1;
  }
  .panel-body { overflow-y: visible; }
  .stage-hint {
    white-space: normal;
    max-width: calc(100% - 32px);
    text-align: center;
  }
}

/* Баннер бюджета хранилища */
.storage-banner {
  margin: 10px 14px 0;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: #fde68a;
}
.storage-banner.full {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

/* ---------- аватар в шапке ---------- */

.user-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  border: 1px solid rgba(45, 212, 191, 0.35);
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- модалка «Поделиться» ---------- */

.share-study-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin: -8px 0 14px;
}
.share-result {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 4px;
}
.share-result input {
  flex: 1;
  margin-top: 0;
  font-size: 12.5px;
  color: var(--accent);
}
.share-result .btn-ghost { flex-shrink: 0; white-space: nowrap; }
.share-links-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-dim);
  margin: 14px 0 8px;
}
.share-links { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.share-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(9, 16, 30, 0.5);
}
.share-link-main { flex: 1; min-width: 0; }
.share-link-url {
  font-size: 12px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-link-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.share-link-copy { padding: 5px 10px; font-size: 12px; flex-shrink: 0; }
.share-link-row .btn-delete { flex-shrink: 0; }
.share-link-row.dead { opacity: .55; }
.share-link-row.dead .share-link-url,
.share-link-row.dead .share-link-meta { text-decoration: line-through; color: var(--text-dim); }

.btn-share {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.btn-share:hover { color: var(--accent); background: var(--accent-soft); }
.study-actions { gap: 6px; }

/* подсветка карточки после перехода из архива */
.study-card.flash {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18);
}

/* ---------- полноэкранный архив ---------- */

.archive-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 10, 20, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  padding: 20px 16px;
  overflow: hidden;
}
.archive-inner {
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}
.archive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.archive-head h2 { font-size: 19px; font-weight: 650; }
.archive-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.archive-filters input[type="text"] { margin-top: 0; }
.archive-filters select { margin-top: 0; width: auto; align-self: flex-start; }
.archive-kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.mini { padding: 5px 11px; font-size: 12px; }
.archive-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}
.archive-list::-webkit-scrollbar { width: 8px; }
.archive-list::-webkit-scrollbar-thumb { background: rgba(148, 180, 220, 0.18); border-radius: 999px; }
.archive-group { margin-bottom: 12px; }
.archive-year {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  padding: 6px 2px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 6px;
  position: sticky;
  top: 0;
  background: rgba(9, 16, 30, 0.92);
  z-index: 1;
}
.archive-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 4px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: rgba(20, 32, 54, 0.45);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.archive-row:hover { border-color: rgba(45, 212, 191, 0.5); background: rgba(45, 212, 191, 0.06); }
.archive-row-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-row-zone {
  color: var(--text-dim);
  font-size: 12px;
  flex-shrink: 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-row-dicom { flex-shrink: 0; }
.archive-row-date { color: var(--text-dim); font-size: 12px; flex-shrink: 0; min-width: 86px; text-align: right; }

/* ---------- редактор аватара ---------- */

.avatar-editor {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: 380px;
  max-width: calc(100vw - 28px);
  z-index: 65;
  padding: 18px;
  overflow-y: auto;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.45);
}
.avatar-editor::-webkit-scrollbar { width: 8px; }
.avatar-editor::-webkit-scrollbar-thumb { background: rgba(148, 180, 220, 0.18); border-radius: 999px; }
.avatar-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar-editor-head h3 { font-size: 17px; }
.avatar-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.avatar-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 28px;
  font-weight: 700;
  overflow: hidden;
  border: 1px solid rgba(45, 212, 191, 0.35);
}
.avatar-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-photo-btn { display: inline-block; cursor: pointer; }
.range-val { color: var(--accent); font-weight: 700; }
.range-hint { color: var(--text-dim); font-weight: 400; font-size: 11.5px; }

.avatar-editor input[type="range"] {
  display: block;
  width: 100%;
  margin-top: 8px;
  accent-color: var(--accent);
  cursor: pointer;
}
.figure-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.figure-label { font-size: 12.5px; color: var(--text-dim); font-weight: 550; }
.figure-tabs { flex: 0 0 140px; margin-bottom: 0; }

@media (max-width: 900px) {
  .avatar-editor {
    top: auto;
    left: 14px;
    height: 60vh;
  }
  .archive-row-zone { display: none; }
}

/* ============================================================
   ВИЗУАЛЬНЫЙ СЛОЙ «КЛИНИКА БУДУЩЕГО × SIMS»
   мастер создания аватара · шапка · «что если»
   ============================================================ */

:root {
  --warm: #f5a623;          /* энергичный акцент (зал) */
  --warm-soft: rgba(245, 166, 35, 0.16);
  --calm: #7d8ba3;          /* приглушённый (диван) */
  --glow: 0 0 0 3px rgba(45, 212, 191, 0.22), 0 14px 40px rgba(45, 212, 191, 0.16);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes popIn {
  0%   { opacity: 0; transform: scale(.96) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- полноэкранный мастер создания аватара ---------- */

.avatar-setup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  overflow-y: auto;
  background:
    radial-gradient(900px 640px at 78% 6%, rgba(45, 212, 191, 0.10), transparent 60%),
    radial-gradient(1000px 720px at 12% 96%, rgba(96, 132, 255, 0.10), transparent 60%),
    radial-gradient(1400px 900px at 20% 0%, var(--bg-1), var(--bg-0));
  animation: fadeIn .3s ease both;
}

.avatar-setup__inner,
.setup-inner {
  width: min(920px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* индикатор шагов */
.setup-dots {
  display: flex;
  gap: 10px;
  margin-bottom: 2px;
}
.setup-dot {
  width: 34px;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 180, 220, 0.18);
  transition: background .35s ease, width .35s ease, box-shadow .35s ease;
}
.setup-dot.active {
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  width: 48px;
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.5);
}

/* заголовки шага */
.setup-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.5px;
  text-align: center;
  line-height: 1.12;
  background: linear-gradient(180deg, #f4fbff, #b9d3e6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.setup-sub {
  font-size: 15px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
  max-width: 560px;
  margin-top: -8px;
}

/* шаг — контейнер, плавное появление */
.setup-step {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: fadeUp .4s cubic-bezier(.2, .7, .3, 1) both;
}

/* карточки пола */
.gender-grid,
.setup-step[data-step="gender"] .gender-wrap {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.gender-card {
  position: relative;
  width: 220px;
  max-width: 44vw;
  padding: 26px 20px 22px;
  border-radius: 20px;
  border: 1.5px solid var(--stroke);
  background:
    linear-gradient(180deg, rgba(30, 46, 74, 0.55), rgba(16, 26, 44, 0.55));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  text-align: center;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: transform .25s cubic-bezier(.2,.7,.3,1), border-color .25s, box-shadow .25s, background .25s;
}
.gender-card:hover {
  transform: translateY(-6px);
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
}
.gender-card.selected,
.gender-card.active,
.gender-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.14), rgba(16, 26, 44, 0.55));
  box-shadow: var(--glow);
  transform: translateY(-4px);
}
.gender-card__emoji,
.gender-card svg,
.gender-card img {
  font-size: 46px;
  line-height: 1;
}
/* фото-превью фигуры в карточке пола (контракт: .gender-card__img) */
.gender-card__img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: bottom center;
  border-radius: 14px;
  background:
    radial-gradient(120px 160px at 50% 40%, rgba(45, 212, 191, 0.10), transparent 70%),
    linear-gradient(180deg, rgba(36, 54, 86, 0.6), rgba(14, 22, 40, 0.6));
}
.gender-card.selected::after,
.gender-card.active::after,
.gender-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #04211c;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* блок ползунков роста/веса */
.setup-sliders {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 26px 30px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(16, 26, 44, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.setup-slider-row { display: flex; flex-direction: column; gap: 8px; }
.setup-slider-row > label,
.setup-slider-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-dim);
  font-weight: 550;
  margin: 0;
}
.setup-val {
  color: var(--accent);
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.5px;
}
.setup-val small,
.setup-unit { font-size: 14px; color: var(--text-dim); font-weight: 600; margin-left: 3px; }

/* премиальный range (мастер + «что если») */
#setupHeight, #setupWeight, .whatif-weight {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(9, 16, 30, 0.85);
  outline: none;
  cursor: pointer;
  margin: 6px 0;
}
#setupHeight::-webkit-slider-runnable-track,
#setupWeight::-webkit-slider-runnable-track,
.whatif-weight::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
}
#setupHeight::-webkit-slider-thumb,
#setupWeight::-webkit-slider-thumb,
.whatif-weight::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  border: 3px solid #08131f;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18), 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform .12s ease, box-shadow .2s ease;
}
#setupHeight::-webkit-slider-thumb:hover,
#setupWeight::-webkit-slider-thumb:hover,
.whatif-weight::-webkit-slider-thumb:hover { transform: scale(1.12); }
#setupHeight:active::-webkit-slider-thumb,
#setupWeight:active::-webkit-slider-thumb,
.whatif-weight:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 7px rgba(45, 212, 191, 0.22), 0 4px 14px rgba(0, 0, 0, 0.5);
}
#setupHeight::-moz-range-track,
#setupWeight::-moz-range-track,
.whatif-weight::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(9, 16, 30, 0.85);
}
#setupHeight::-moz-range-progress,
#setupWeight::-moz-range-progress,
.whatif-weight::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.55), var(--accent));
}
#setupHeight::-moz-range-thumb,
#setupWeight::-moz-range-thumb,
.whatif-weight::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  border: 3px solid #08131f;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18);
  cursor: pointer;
}

/* ---------- предпросмотр морфов: панель сбоку, сцена видна и интерактивна ---------- */
.modal-overlay.preview-mode {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;               /* 3D-сцена под оверлеем остаётся кликабельной/вращаемой */
  justify-content: flex-end;
  padding: 20px;
}
.modal-overlay.preview-mode .avatar-setup {
  position: static;                   /* убираем fixed inset:0, панель не перекрывает сцену */
  inset: auto;
  width: min(440px, 100%);
  background: none;
  animation: none;
  padding: 0;
  overflow: visible;
  pointer-events: none;
}
.modal-overlay.preview-mode .setup-inner {
  width: 100%;
  margin: 0;
  pointer-events: auto;               /* панель ловит клики, остальное — сквозь на канвас */
  background: rgba(10, 18, 32, 0.86);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 22px 20px 24px;
  gap: 14px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.modal-overlay.preview-mode .setup-title { font-size: clamp(20px, 3vw, 26px); }
.modal-overlay.preview-mode .morph-sliders { width: 100%; padding: 16px 14px 18px; gap: 14px; }
@media (max-width: 900px) {
  .modal-overlay.preview-mode { justify-content: center; align-items: flex-end; }
  .modal-overlay.preview-mode .avatar-setup { width: 100%; }
}

/* ---------- редактор «Точная фигура» (морф-таргеты) ---------- */
.setup-hint-small {
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
  max-width: 520px;
  margin: -10px auto 0;
  line-height: 1.45;
  opacity: 0.85;
}
.morph-sliders {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 26px 26px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(16, 26, 44, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.morph-row { display: flex; flex-direction: column; gap: 4px; }
.morph-row > label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-dim);
  font-weight: 550;
  margin: 0;
}
.morph-label { color: var(--text); }
.morph-val {
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* ползунок морфа: центр = нейтраль, диапазон −1..+1 (бирюза) */
.morph-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(9, 16, 30, 0.85);
  outline: none;
  cursor: pointer;
  margin: 4px 0 2px;
  accent-color: var(--accent);
}
.morph-slider::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; }
.morph-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  border: 3px solid #08131f;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18), 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform .12s ease, box-shadow .2s ease;
}
.morph-slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.morph-slider:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 7px rgba(45, 212, 191, 0.22), 0 4px 12px rgba(0, 0, 0, 0.5);
}
.morph-slider::-moz-range-track { height: 8px; border-radius: 999px; background: rgba(9, 16, 30, 0.85); }
.morph-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  border: 3px solid #08131f;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18);
  cursor: pointer;
}
#morphResetBtn { flex: 0 0 auto; padding: 12px 18px; }

/* сетка фигур */
.figure-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}
.figure-card {
  position: relative;
  border-radius: 18px;
  border: 1.5px solid var(--stroke);
  background: rgba(16, 26, 44, 0.5);
  padding: 12px 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.7,.3,1), border-color .25s, box-shadow .25s, background .25s;
  animation: popIn .4s ease both;
}
.figure-card:hover {
  transform: translateY(-6px);
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
}
.figure-card.selected,
.figure-card.active,
.figure-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.12), rgba(16, 26, 44, 0.5));
  box-shadow: var(--glow);
}
.figure-card__img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: bottom center;
  border-radius: 12px;
  background:
    radial-gradient(120px 160px at 50% 40%, rgba(45, 212, 191, 0.10), transparent 70%),
    linear-gradient(180deg, rgba(36, 54, 86, 0.6), rgba(14, 22, 40, 0.6));
  transition: transform .3s ease;
}
.figure-card:hover .figure-card__img { transform: scale(1.03); }
.figure-card__name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}
.figure-card__hint {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.35;
}
.figure-card.selected::after,
.figure-card.active::after,
.figure-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #04211c;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* фото пользователя внутри мастера */
.setup-photo {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* навигация мастера */
.setup-nav {
  display: flex;
  gap: 12px;
  width: min(520px, 100%);
  margin-top: 6px;
}
.setup-nav .btn-primary { flex: 1; }
.setup-nav .btn-ghost { flex: 0 0 auto; padding: 12px 22px; }

/* ---------- шапка панели: премиальная отделка ---------- */

.panel-head {
  align-items: center;
}
.user-avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.10);
  transition: box-shadow .25s, transform .2s;
}
.user-avatar:hover { transform: translateY(-1px); box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18); }

.btn-primary, .btn-ghost, .chip {
  transition: filter .2s, transform .12s, background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn-primary { box-shadow: 0 6px 18px rgba(45, 212, 191, 0.16); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(45, 212, 191, 0.24); }
.btn-primary:active { transform: translateY(0) scale(.985); box-shadow: 0 4px 12px rgba(45, 212, 191, 0.16); }
.btn-ghost:active { transform: scale(.985); }

/* ---------- панель «Что если» ---------- */

.whatif {
  position: fixed;
  inset: 0;
  z-index: 78;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .25s ease both;
}
.whatif__card,
.whatif-inner {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px 26px 24px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background:
    radial-gradient(700px 400px at 90% -10%, rgba(245, 166, 35, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(22, 34, 56, 0.92), rgba(13, 21, 38, 0.94));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: popIn .35s ease both;
}
.whatif__title,
.whatif h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.whatif__sub { font-size: 13.5px; color: var(--text-dim); margin-bottom: 18px; line-height: 1.5; }

/* переключатель режимов */
.whatif-modes {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}
.whatif-mode {
  flex: 1;
  padding: 16px 14px;
  border-radius: 15px;
  border: 1.5px solid var(--stroke);
  background: rgba(9, 16, 30, 0.5);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: transform .18s, border-color .2s, background .2s, box-shadow .2s, color .2s;
}
.whatif-mode:hover { transform: translateY(-3px); }
.whatif-mode__hint { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-dim); margin-top: 4px; }

/* режим «зал» — тёплый, энергичный */
.whatif-mode[data-mode="gym"]:hover { border-color: rgba(245, 166, 35, 0.5); }
.whatif-mode[data-mode="gym"].active,
.whatif-mode[data-mode="gym"].selected {
  border-color: var(--warm);
  background: linear-gradient(180deg, var(--warm-soft), rgba(9, 16, 30, 0.5));
  color: #ffd597;
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2), 0 12px 30px rgba(245, 166, 35, 0.14);
}
.whatif-mode[data-mode="gym"].active .whatif-mode__hint,
.whatif-mode[data-mode="gym"].selected .whatif-mode__hint { color: rgba(255, 213, 151, 0.8); }

/* режим «диван» — приглушённый */
.whatif-mode[data-mode="couch"]:hover { border-color: rgba(125, 139, 163, 0.5); }
.whatif-mode[data-mode="couch"].active,
.whatif-mode[data-mode="couch"].selected {
  border-color: var(--calm);
  background: linear-gradient(180deg, rgba(125, 139, 163, 0.14), rgba(9, 16, 30, 0.5));
  color: #c4cede;
  box-shadow: inset 0 0 0 1px rgba(125, 139, 163, 0.2);
}

/* блок выбора веса */
.whatif-weight-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 14px;
}
.whatif-weight-row > label,
.whatif-weight-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-dim);
  font-weight: 550;
  margin: 0;
}
.whatif-weight-val { color: var(--accent); font-weight: 800; font-size: 26px; line-height: 1; }

/* область сравнения */
.whatif-compare {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin: 8px 0 16px;
}
.whatif-figure {
  flex: 1;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background:
    radial-gradient(160px 200px at 50% 35%, rgba(45, 212, 191, 0.08), transparent 70%),
    linear-gradient(180deg, rgba(36, 54, 86, 0.5), rgba(14, 22, 40, 0.5));
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.whatif-figure img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: bottom center;
  transition: opacity .25s ease;
}
.whatif-figure__label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.whatif-arrow { align-self: center; flex: 0 0 auto; color: var(--text-dim); font-size: 26px; }

/* дисклеймер */
.whatif-note {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 10px 13px;
  border-radius: 12px;
  background: rgba(148, 180, 220, 0.06);
  border: 1px solid var(--stroke);
  margin-top: 6px;
}
.whatif-note::before { content: "ⓘ "; color: var(--accent); font-weight: 700; }

.whatif-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.whatif-actions .btn-primary { flex: 1; }

/* ---------- адаптив мастера и «что если» ---------- */

@media (max-width: 900px) {
  .avatar-setup { padding: 24px 14px; }
  .figure-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .gender-card { width: 46vw; max-width: 46vw; }
  .setup-title { font-size: 26px; }
  .whatif__card, .whatif-inner { padding: 20px 16px; }
  .whatif-modes { flex-direction: column; }
  .whatif-compare { flex-direction: column; }
}

@media (max-width: 560px) {
  .figure-grid { grid-template-columns: 1fr 1fr; }
  .setup-nav { flex-direction: column-reverse; }
  .setup-nav .btn-ghost { width: 100%; }
}

/* ============================================================
   ШАПКА ПАНЕЛИ · МЕНЮ ДЕЙСТВИЙ · ВКЛАДКА ПРОФИЛЬ (редизайн)
   тёплая премиальность, воздух, мягкие тени — эталон Oura/Whoop
   ============================================================ */

/* --- тёплое стекло шапки (убираем «серость») --- */
.panel-head {
  position: relative;
  gap: 12px;
  padding: 12px 14px;
  background:
    radial-gradient(420px 180px at 100% -40%, rgba(245, 166, 35, 0.10), transparent 70%),
    linear-gradient(180deg, rgba(30, 44, 70, 0.62), rgba(18, 28, 48, 0.55));
  border: 1px solid rgba(148, 180, 220, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.user-head { flex: 1 1 auto; min-width: 0; }
.user-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.user-name { font-size: 15px; line-height: 1.2; }
.user-role {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: .2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- kebab «⋯» и выпадающее меню (не наезжает на фото ни при какой ширине) --- */
.head-actions { position: relative; display: flex; flex-shrink: 0; }
.head-more {
  width: 40px;
  height: 40px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .12s;
}
.head-more span {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background .2s;
}
.head-more:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(45, 212, 191, 0.4); }
.head-more:hover span { background: var(--accent); }
.head-more:active { transform: scale(.96); }
.head-actions.open .head-more { background: var(--accent-soft); border-color: rgba(45, 212, 191, 0.5); }
.head-actions.open .head-more span { background: var(--accent); }

.head-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(26, 39, 62, 0.98), rgba(16, 25, 44, 0.98));
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-6px) scale(.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.head-actions.open .head-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.head-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.head-menu-item:hover { background: rgba(45, 212, 191, 0.12); color: var(--accent); }
.head-menu-item .hmi-ico { font-size: 15px; width: 20px; text-align: center; filter: saturate(1.1); }
.head-menu-item--muted { color: var(--text-dim); }
.head-menu-item--muted:hover { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.head-menu-sep { height: 1px; margin: 4px 6px; background: var(--stroke); }

/* --- аватар шапки крупнее и «живее» --- */
.panel-head .user-avatar {
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12), 0 6px 16px rgba(0, 0, 0, 0.35);
}

/* ============================================================
   ВКЛАДКА ПРОФИЛЬ — структурированные карточки
   ============================================================ */

.profile-modal {
  width: min(560px, 100%);
  position: relative;
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, rgba(24, 37, 60, 0.96), rgba(15, 23, 42, 0.97));
}
.modal-x {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  z-index: 2;
}
.modal-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 40px;
}
.profile-avatar {
  width: 56px; height: 56px;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12), 0 8px 22px rgba(0, 0, 0, 0.4);
}
.profile-head-text h3 { font-size: 20px; margin: 0 0 2px; letter-spacing: -0.2px; }
.profile-head-sub { font-size: 13px; color: var(--text-dim); }

.profile-card {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(9, 16, 30, 0.42);
  padding: 16px;
  margin-bottom: 14px;
  animation: fadeUp .35s cubic-bezier(.2, .7, .3, 1) both;
}
.profile-card:nth-of-type(2) { animation-delay: .04s; }
.profile-card:nth-of-type(3) { animation-delay: .08s; }
.profile-card:nth-of-type(4) { animation-delay: .12s; }
.profile-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: .1px;
  margin-bottom: 12px;
}
.profile-card-ico {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 15px;
  flex-shrink: 0;
}
.profile-card-note {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 12px;
}
.profile-card textarea {
  margin-top: 0;
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

/* карточка «О себе» — факты */
.profile-facts { display: flex; flex-direction: column; gap: 2px; }
.fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(148, 180, 220, 0.08);
}
.fact:last-child { border-bottom: none; }
.fact-key { font-size: 12.5px; color: var(--text-dim); flex-shrink: 0; }
.fact-val {
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fact-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(148, 180, 220, 0.05);
  border: 1px dashed var(--stroke);
}

/* карточка «Медпаспорт» — список анализов / пустое состояние */
.labs-empty {
  text-align: center;
  padding: 22px 12px 18px;
  border: 1px dashed var(--stroke);
  border-radius: 13px;
  background: rgba(148, 180, 220, 0.04);
}
.labs-empty-ico { font-size: 30px; margin-bottom: 8px; opacity: .9; }
.labs-empty-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.labs-empty-sub { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; max-width: 400px; margin: 0 auto; }

.labs-list { display: flex; flex-direction: column; gap: 8px; }
.lab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(9, 16, 30, 0.5);
  transition: border-color .2s;
}
.lab-item:hover { border-color: rgba(244, 114, 182, 0.35); }
.lab-date {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 650;
  color: #f9a8d4;
  width: 84px;
  line-height: 1.3;
}
.lab-main { flex: 1; min-width: 0; }
.lab-title { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.lab-note {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lab-files { flex-shrink: 0; font-size: 11px; color: var(--text-dim); }
.labs-foot {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}
.profile-actions { margin-top: 6px; }

/* адаптив вкладки Профиль и меню */
@media (max-width: 560px) {
  .profile-modal { padding: 18px 16px 16px; }
  .profile-avatar { width: 48px; height: 48px; font-size: 19px; }
  .lab-item { flex-wrap: wrap; }
  .lab-date { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-card { animation: none; }
  .head-menu { transition: opacity .12s ease; transform: none; }
  .head-actions.open .head-menu { transform: none; }
}

/* Палитра цвета волос в редакторе фигуры */
.hair-row { display: block; }
.hair-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hair-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18); cursor: pointer; padding: 0;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.hair-swatch:hover { transform: scale(1.12); }
.hair-swatch.active { border-color: #2dd4bf; box-shadow: 0 0 0 2px rgba(45,212,191,0.35); }
.hair-swatch.hair-reset {
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary, #9fb0c0); font-size: 13px;
}
