/* =====================================================================
 * Московское долголетие — таблица стилей SPA.
 * Дизайн-система унаследована из макета «Центр Московского долголетия».
 * ===================================================================*/
:root {
  --bg: #f3f7fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-muted: #edf3f7;
  --line: rgba(3, 63, 133, 0.12);
  --line-strong: rgba(0, 171, 170, 0.28);
  --teal: #00abaa;
  --teal-deep: #008b8a;
  --orange: #ef7b05;
  --orange-soft: #ffc27d;
  --navy: #033f85;
  --navy-deep: #142035;
  --ink: #243950;
  --muted: #61758f;
  --success: #2c9b5e;
  --warning: #d18800;
  --danger: #d84b3e;
  --shadow: 0 28px 80px rgba(5, 42, 83, 0.13);
  --shadow-soft: 0 18px 38px rgba(8, 48, 94, 0.1);
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --container-width: min(1240px, calc(100% - 32px));
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: "PT Sans", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(0, 171, 170, 0.12), transparent 30%),
    linear-gradient(180deg, #f8fbfe 0%, #eef4f8 100%);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; background: none; }
h1, h2, h3, h4 { font-family: "PT Sans Caption", "PT Sans", Helvetica, Arial, sans-serif; }

.container { width: var(--container-width); margin: 0 auto; }
.section { position: relative; padding: 32px 0 64px; }

.page-orb {
  position: fixed; width: 560px; height: 560px; border-radius: 50%;
  filter: blur(70px); pointer-events: none; z-index: -2; opacity: 0.5;
}
.orb-a { top: -180px; right: -160px; background: rgba(0, 171, 170, 0.22); }
.orb-b { left: -220px; bottom: -140px; background: rgba(3, 63, 133, 0.15); }
.page-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0, 171, 170, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 171, 170, 0.04) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 85%);
  pointer-events: none; z-index: -3;
}

/* ---- Кнопки ---- */
.button {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 700;
  transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, color .25s ease, border-color .25s ease;
}
.button.small { min-height: 38px; padding: 0 16px; font-size: .92rem; }
.button:hover, .button:focus-visible { transform: translateY(-2px); }
.button-primary {
  color: #fff; background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
  border: 2px solid rgba(255,255,255,.7); box-shadow: 0 18px 34px rgba(0,171,170,.2);
}
.button-primary:hover, .button-primary:focus-visible {
  background: linear-gradient(135deg, var(--orange) 0%, #f39b3f 100%);
  box-shadow: 0 20px 36px rgba(239,123,5,.22);
}
.button-secondary {
  color: var(--navy); background: rgba(255,255,255,.94);
  border: 2px solid rgba(0,171,170,.18); box-shadow: var(--shadow-soft);
}
.button-secondary:hover, .button-secondary:focus-visible { border-color: rgba(239,123,5,.35); color: var(--orange); }
.button-ghost { color: var(--navy); background: rgba(0,171,170,.08); border: 1px solid rgba(0,171,170,.14); }
.button-ghost:hover, .button-ghost:focus-visible { background: rgba(0,171,170,.14); }
.button.subtle { background: rgba(3,63,133,.06); color: var(--muted); border: 1px solid rgba(3,63,133,.08); }
.button.danger { color: var(--danger); background: rgba(216,75,62,.1); border: 1px solid rgba(216,75,62,.2); }
.button:disabled { cursor: not-allowed; opacity: .56; transform: none; box-shadow: none; }

.kicker, .section-kicker, .panel-label, .metric-label, .info-index {
  letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; font-weight: 700;
}

/* ---- Экран входа ---- */
.auth-screen {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr;
  gap: 0;
}
.auth-hero {
  position: relative; overflow: hidden; padding: 56px clamp(32px, 5vw, 76px);
  color: #fff; display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(circle at right top, rgba(255,255,255,.18), transparent 32%),
    linear-gradient(115deg, rgba(20,32,53,.98) 0%, rgba(3,63,133,.94) 46%, rgba(0,139,138,.92) 118%);
}
.auth-hero::after {
  content: ""; position: absolute; width: 420px; height: 420px; right: -120px; bottom: -140px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22) 0%, transparent 70%);
}
.auth-brand { display: inline-flex; align-items: center; gap: 16px; margin-bottom: 40px; }
.brand-mark {
  position: relative; width: 58px; height: 58px; border-radius: 18px; flex: none;
  background: linear-gradient(145deg, var(--teal) 0%, var(--navy) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34), 0 12px 28px rgba(0,171,170,.24);
}
.brand-mark span { position: absolute; border-radius: 999px; background: rgba(255,255,255,.95); }
.brand-mark span:nth-child(1) { width: 14px; height: 14px; top: 12px; left: 12px; }
.brand-mark span:nth-child(2) { width: 10px; height: 30px; top: 14px; right: 16px; }
.brand-mark span:nth-child(3) { width: 26px; height: 10px; bottom: 14px; left: 14px; }
.auth-brand strong { display: block; font-size: 1.2rem; }
.auth-brand small { color: rgba(255,255,255,.72); }
.auth-hero h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.02; max-width: 15ch; }
.auth-hero .lead { position: relative; z-index: 1; margin: 22px 0 0; max-width: 52ch; font-size: 1.1rem; line-height: 1.6; color: rgba(255,255,255,.85); }
.auth-highlights { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.auth-highlights span { padding: 9px 14px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); font-size: .92rem; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card {
  width: min(440px, 100%); background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(246,249,252,.98));
  border: 1px solid rgba(0,171,170,.12); border-top: 6px solid var(--teal);
  border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 38px;
}
.auth-card h2 { margin: 6px 0 0; color: var(--navy); font-size: 1.7rem; }
.auth-card p.sub { margin: 8px 0 24px; color: var(--muted); }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 8px; font-weight: 700; color: var(--navy); font-size: .95rem; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid rgba(3,63,133,.16); background: #fff; color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,171,170,.12);
}
.auth-error { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(216,75,62,.1); color: var(--danger); font-weight: 700; font-size: .95rem; }
.auth-demo { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.auth-demo strong { display: block; color: var(--navy); font-size: .9rem; margin-bottom: 10px; }
.demo-chip {
  display: inline-flex; flex-direction: column; gap: 2px; margin: 0 8px 8px 0; padding: 8px 12px;
  border-radius: 12px; background: rgba(0,171,170,.08); border: 1px solid rgba(0,171,170,.16);
  cursor: pointer; text-align: left; transition: background-color .2s ease;
}
.demo-chip:hover { background: rgba(0,171,170,.16); }
.demo-chip b { color: var(--navy); font-size: .9rem; }
.demo-chip small { color: var(--muted); font-size: .8rem; }

/* ---- Каркас приложения ---- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px);
  background: rgba(255,255,255,.92); border-bottom: 1px solid rgba(3,63,133,.08);
}
.app-header-inner { width: var(--container-width); margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 14px 0; }
.app-brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.app-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
.app-brand .brand-mark span:nth-child(1) { width: 11px; height: 11px; top: 9px; left: 9px; }
.app-brand .brand-mark span:nth-child(2) { width: 8px; height: 24px; top: 11px; right: 12px; }
.app-brand .brand-mark span:nth-child(3) { width: 20px; height: 8px; bottom: 11px; left: 11px; }
.app-brand strong { display: block; color: var(--navy); font-family: "PT Sans Caption"; line-height: 1.05; }
.app-brand small { color: var(--muted); font-size: .82rem; }
.app-header-spacer { flex: 1; }
.role-badge {
  padding: 8px 14px; border-radius: 999px; background: rgba(0,171,170,.1);
  color: var(--teal-deep); font-weight: 700; font-size: .82rem; letter-spacing: .04em;
}
.user-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-chip b { color: var(--navy); font-size: .95rem; }
.user-chip small { color: var(--muted); font-size: .8rem; }

.app-nav { border-bottom: 1px solid rgba(3,63,133,.08); background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(242,246,250,.9)); }
.app-nav-inner { width: var(--container-width); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; }
.nav-tab {
  position: relative; padding: 10px 18px; border-radius: 999px; font-weight: 700; color: var(--muted);
  transition: color .2s ease, background-color .2s ease;
}
.nav-tab:hover { color: var(--navy); background: rgba(0,171,170,.07); }
.nav-tab.is-active { color: #fff; background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%); box-shadow: 0 12px 24px rgba(0,171,170,.2); }

.app-main { flex: 1; }
.view-head { margin-bottom: 26px; max-width: 860px; }
.view-head .section-kicker { color: var(--teal-deep); display: inline-block; margin-bottom: 10px; }
.view-head h2 { margin: 0; color: var(--navy); font-size: clamp(1.8rem, 3.4vw, 2.7rem); line-height: 1.08; }
.view-head p { margin: 12px 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

/* ---- Карточки / сетки ---- */
.card {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98));
  border: 1px solid rgba(0,171,170,.12); box-shadow: var(--shadow-soft); padding: 26px;
}
.card.accent-top { border-top: 5px solid var(--teal); }
.card.accent-orange { border-top: 5px solid var(--orange); }
.card.accent-navy { border-top: 5px solid var(--navy); }
.card h3 { margin: 0 0 6px; color: var(--navy); font-size: 1.3rem; }
.card > p { color: var(--muted); line-height: 1.6; }

.grid { display: grid; gap: 22px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.metric-card { padding: 24px; border-top: 5px solid var(--teal); }
.metric-card.accent { border-top-color: var(--orange); }
.metric-card.navy { border-top-color: var(--navy); }
.metric-label { color: var(--teal-deep); }
.metric-value { display: block; margin-top: 10px; font-family: "PT Sans Caption"; font-size: 2.4rem; color: var(--navy); line-height: 1; }
.metric-card p { margin: 10px 0 0; color: var(--muted); line-height: 1.5; font-size: .95rem; }

/* ---- Таблицы ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--line); background: #fff; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: .95rem; vertical-align: middle; }
table.data th { background: rgba(3,63,133,.04); color: var(--navy); font-weight: 700; letter-spacing: .02em; position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color .18s ease; }
table.data tbody tr:hover { background: rgba(0,171,170,.05); }
table.data td .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-hidden { opacity: .5; }
.row-erroneous td:first-child { position: relative; }

/* ---- Значки зон ---- */
.zone-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.zone-pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.zone-green { background: rgba(44,155,94,.12); color: var(--success); }
.zone-orange { background: rgba(209,136,0,.14); color: var(--warning); }
.zone-red { background: rgba(216,75,62,.12); color: var(--danger); }
.zone-neutral { background: rgba(3,63,133,.08); color: var(--navy); }
.status-pill { display: inline-flex; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.status-assigned { background: rgba(3,63,133,.08); color: var(--navy); }
.status-started { background: rgba(0,171,170,.12); color: var(--teal-deep); }
.status-completed { background: rgba(44,155,94,.12); color: var(--success); }
.status-revoked { background: rgba(97,117,143,.14); color: var(--muted); }

/* ---- Панель инструментов ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar .search input { width: 100%; min-height: 46px; padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(3,63,133,.16); background: #fff; }
.toolbar .search input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,171,170,.12); }
.toolbar select { min-height: 46px; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(3,63,133,.16); background: #fff; }
.spread { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }

/* ---- Карточка пациента ---- */
.patient-head { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start; }
.patient-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; color: var(--muted); font-size: .95rem; }
.patient-meta b { color: var(--ink); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border-radius: 999px; background: rgba(0,171,170,.08); color: var(--teal-deep); font-weight: 700; font-size: .85rem; }

.credential-box { margin-top: 14px; padding: 16px 18px; border-radius: var(--radius-sm); background: rgba(239,123,5,.08); border: 1px solid rgba(239,123,5,.2); }
.credential-box code { font-size: 1.05rem; color: var(--navy); font-weight: 700; background: #fff; padding: 3px 9px; border-radius: 8px; margin: 0 4px; }

/* ---- Формы прохождения теста (наследие макета) ---- */
.questionnaire-layout { display: grid; grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.survey-panel {
  position: sticky; top: 96px; padding: 26px; border-radius: var(--radius-xl); border-top: 5px solid var(--teal);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98));
  border-left: 1px solid rgba(0,171,170,.12); border-right: 1px solid rgba(0,171,170,.12); border-bottom: 1px solid rgba(0,171,170,.12);
  box-shadow: var(--shadow);
}
.panel-label { color: var(--teal-deep); }
.survey-panel h3 { margin: 6px 0 0; color: var(--navy); font-size: 1.3rem; }
.survey-panel .intro { margin: 14px 0 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.progress-circle {
  --progress: 0%; position: relative; width: 168px; height: 168px; margin: 24px auto; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(from -90deg, var(--teal) 0 var(--progress), rgba(0,171,170,.13) var(--progress) 100%);
  box-shadow: inset 0 0 0 1px rgba(0,171,170,.12); transition: background .4s ease;
}
.progress-circle::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: linear-gradient(180deg,#fff,#eef4f7); box-shadow: inset 0 0 0 1px rgba(3,63,133,.06); }
.progress-circle-core { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.progress-circle-core span { font-family: "PT Sans Caption"; font-size: 1.9rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.progress-circle-core small { color: var(--muted); }
.question-dots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.question-dot { min-height: 44px; border-radius: 14px; background: rgba(3,63,133,.06); color: var(--navy); border: 1px solid rgba(3,63,133,.08); font-weight: 700; font-size: .85rem; transition: transform .2s ease, background-color .2s ease, color .2s ease; }
.question-dot:hover { transform: translateY(-2px); border-color: rgba(0,171,170,.34); }
.question-dot.is-current { color: #fff; background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%); border-color: transparent; }
.question-dot.is-answered:not(.is-current) { background: rgba(0,171,170,.12); border-color: rgba(0,171,170,.2); }

.question-card { padding: 32px; border-radius: var(--radius-xl); border-top: 6px solid var(--teal); background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98)); border-left: 1px solid rgba(0,171,170,.12); border-right: 1px solid rgba(0,171,170,.12); border-bottom: 1px solid rgba(0,171,170,.12); box-shadow: var(--shadow); }
.question-topline { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.question-label { color: var(--teal-deep); letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; font-weight: 700; }
.question-subline { color: var(--muted); font-weight: 700; }
.progress-track { height: 8px; margin-top: 16px; border-radius: 999px; background: rgba(3,63,133,.08); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal) 0%, var(--orange) 100%); transition: width .35s ease; }
.question-card h3 { margin: 20px 0 0; color: var(--navy); font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.15; }
.question-description { margin: 12px 0 0; max-width: 64ch; color: var(--muted); line-height: 1.6; }

/* ---- Пошаговая навигация (одна карточка за раз) ---- */
.q-dots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.q-dot {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; font-weight: 700; font-size: .82rem;
  color: var(--muted); background: rgba(3,63,133,.06); border: 1px solid rgba(3,63,133,.1);
  transition: transform .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
}
.q-dot:hover { transform: translateY(-2px); border-color: rgba(0,171,170,.32); }
.q-dot.is-done { color: var(--teal-deep); background: rgba(0,171,170,.12); border-color: rgba(0,171,170,.3); }
.q-dot.is-current { color: #fff; background: linear-gradient(135deg, var(--teal), var(--teal-deep)); border-color: transparent; box-shadow: 0 10px 20px rgba(0,171,170,.24); }
.q-step { animation: view-fade .32s cubic-bezier(.2,.8,.2,1); }
.q-step-section { display: inline-block; color: var(--teal-deep); letter-spacing: .06em; text-transform: uppercase; font-size: .74rem; font-weight: 700; }
.q-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(3,63,133,.08); }
.q-nav-pos { color: var(--muted); font-weight: 700; font-size: .92rem; }

.answer-grid { display: grid; gap: 12px; margin-top: 24px; }
.answer-option {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  min-height: 72px; padding: 16px 20px; border-radius: 22px; background: rgba(255,255,255,.92);
  border: 1px solid rgba(3,63,133,.1); box-shadow: 0 12px 24px rgba(11,45,82,.06); text-align: left;
  transition: transform .22s ease, border-color .22s ease, background-color .22s ease, box-shadow .22s ease;
}
.answer-option:hover { transform: translateY(-2px); border-color: rgba(0,171,170,.28); }
.answer-option.is-selected { background: linear-gradient(135deg, rgba(0,171,170,.14), rgba(255,194,125,.12)); border-color: rgba(0,171,170,.42); box-shadow: 0 22px 36px rgba(0,171,170,.12); }
.answer-index { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: var(--navy); background: rgba(3,63,133,.06); font-weight: 700; }
.answer-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.answer-copy strong { display: block; font-size: 1.02rem; color: var(--navy); line-height: 1.3; }
.answer-copy small { display: block; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.answer-check { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(3,63,133,.18); transition: border-color .3s ease, box-shadow .35s ease; }
.answer-check::before { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--teal); opacity: 0; transform: scale(.4); pointer-events: none; }
.answer-check::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #2fd0cf, var(--teal) 70%); transform: scale(0); transition: transform .42s cubic-bezier(.34,1.56,.64,1); }
.answer-option.is-selected .answer-check { border-color: rgba(0,171,170,.6); box-shadow: 0 0 0 6px rgba(0,171,170,.1); }
.answer-option.is-selected .answer-check::after { transform: scale(1); }
.answer-option.is-selected .answer-check::before { animation: check-ripple .55s ease-out; }
@keyframes check-ripple { 0% { opacity: .6; transform: scale(.5); } 100% { opacity: 0; transform: scale(1.7); } }

.card-actions { display: flex; justify-content: space-between; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.card-actions-group { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---- САН в стиле дневника настроения ---- */
.san-intro-note { margin: 22px 0 0; padding: 14px 18px; border-radius: var(--radius-sm); background: rgba(0,171,170,.08); color: var(--teal-deep); font-weight: 700; }
.mood-diary { display: grid; gap: 16px; margin-top: 24px; }
.mood-row {
  padding: 20px 22px; border-radius: 24px; background: rgba(255,255,255,.94);
  border: 1px solid rgba(3,63,133,.1); box-shadow: 0 12px 24px rgba(11,45,82,.05);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.mood-row.is-answered { border-color: rgba(0,171,170,.34); box-shadow: 0 16px 30px rgba(0,171,170,.1); }
.mood-poles { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; font-weight: 700; color: var(--navy); }
.mood-poles .pole-left { color: var(--teal-deep); }
.mood-poles .pole-right { color: var(--orange); text-align: right; }
.mood-scale { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.mood-dot {
  position: relative; overflow: hidden; aspect-ratio: 1; min-height: 42px; border-radius: 50%; border: 2px solid rgba(3,63,133,.14);
  color: var(--muted); font-weight: 700; display: grid; place-items: center;
  background-color: rgba(255,255,255,.9);
  background-image: radial-gradient(circle at center, #2fd0cf 0%, var(--teal) 55%, var(--navy) 100%);
  background-repeat: no-repeat; background-position: center; background-size: 0% 0%;
  transition: background-size .45s cubic-bezier(.34,1.56,.64,1), transform .35s cubic-bezier(.34,1.56,.64,1), border-color .25s ease, color .3s ease, box-shadow .35s ease;
}
.mood-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(0,171,170,.4); opacity: 0;
}
.mood-dot:hover { transform: scale(1.08); border-color: rgba(0,171,170,.4); }
.mood-dot.is-selected { color: #fff; border-color: transparent; box-shadow: 0 10px 22px rgba(0,171,170,.24); transform: scale(1.08); background-size: 170% 170%; }
.mood-dot.is-selected::after { animation: dot-ripple .6s ease-out; }
@keyframes dot-ripple { 0% { opacity: .7; box-shadow: 0 0 0 0 rgba(0,171,170,.45); } 100% { opacity: 0; box-shadow: 0 0 0 16px rgba(0,171,170,0); } }
/* центральная точка «нейтрально» тонирована оранжевым при выборе */
.mood-dot.is-neutral { background-image: radial-gradient(circle at center, #f7a14a 0%, var(--orange) 60%, #d96b04 100%); }
.mood-scale-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: .78rem; color: var(--muted); }

/* ---- Результат ---- */
.result-shell { padding: 32px; border-radius: var(--radius-xl); border-top: 6px solid var(--orange); background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98)); border-left: 1px solid rgba(0,171,170,.12); border-right: 1px solid rgba(0,171,170,.12); border-bottom: 1px solid rgba(0,171,170,.12); box-shadow: var(--shadow); }
.result-main { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 30px; align-items: center; }
.result-copy h3 { margin: 10px 0 0; color: var(--navy); font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.12; }
.result-copy p { margin: 12px 0 0; color: var(--muted); line-height: 1.6; max-width: 60ch; }
.score-gauge {
  position: relative; width: 220px; height: 220px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(from -90deg, var(--orange) 0 var(--score-angle, 0deg), rgba(3,63,133,.08) var(--score-angle, 0deg) 360deg);
  box-shadow: 0 24px 48px rgba(5,42,83,.12);
}
.score-gauge.zone-green-g { background: conic-gradient(from -90deg, var(--success) 0 var(--score-angle,0deg), rgba(3,63,133,.08) var(--score-angle,0deg) 360deg); }
.score-gauge.zone-red-g { background: conic-gradient(from -90deg, var(--danger) 0 var(--score-angle,0deg), rgba(3,63,133,.08) var(--score-angle,0deg) 360deg); }
.score-gauge::after { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: linear-gradient(180deg,#fff,#edf3f7); box-shadow: inset 0 0 0 1px rgba(3,63,133,.08); }
.score-gauge-core { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.score-gauge-core strong { font-family: "PT Sans Caption"; font-size: 3rem; line-height: 1; color: var(--navy); }
.score-gauge-core span { margin-top: 6px; color: var(--muted); font-weight: 700; font-size: .9rem; }
.breakdown-list { display: grid; gap: 10px; margin-top: 24px; }
.breakdown-item { display: flex; justify-content: space-between; gap: 14px; padding: 14px 18px; border-radius: var(--radius-sm); background: rgba(3,63,133,.04); }
.breakdown-item b { color: var(--navy); }
.breakdown-item .v { color: var(--ink); font-weight: 700; }
.result-disclaimer { margin: 20px 0 0; font-size: .9rem; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---- Пустые состояния ---- */
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: rgba(255,255,255,.6); }
.empty strong { display: block; color: var(--navy); font-size: 1.1rem; margin-bottom: 8px; }

/* ---- Тосты ---- */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { padding: 14px 18px; border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow); border-left: 4px solid var(--teal); color: var(--ink); font-weight: 700; animation: toast-in .3s ease; }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Модальные окна ---- */
.modal-host { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(20,32,53,.44); backdrop-filter: blur(4px); }
.modal-host[hidden] { display: none; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; background: #fff; border-radius: var(--radius-xl); border-top: 6px solid var(--teal); box-shadow: var(--shadow); padding: 30px; }
.modal h3 { margin: 0 0 6px; color: var(--navy); font-size: 1.5rem; }
.modal p.sub { margin: 0 0 20px; color: var(--muted); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.cred-mode { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(0,171,170,.06); border: 1px solid rgba(0,171,170,.16); }
.check-inline { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); cursor: pointer; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }
.cred-mode #np-cred-fields { margin-top: 12px; }

/* ---- Аналитика ---- */
.bar-chart { display: grid; gap: 12px; margin-top: 10px; }
.bar-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 14px; align-items: center; }
.bar-track { height: 22px; border-radius: 999px; background: rgba(3,63,133,.07); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--orange)); transition: width .5s ease; }
.bar-row b { color: var(--navy); }
.zone-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.zone-bar { display: flex; height: 30px; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.zone-bar span { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .82rem; min-width: 2px; }
.zone-bar .g { background: var(--success); }
.zone-bar .o { background: var(--warning); }
.zone-bar .r { background: var(--danger); }
.zone-bar .n { background: var(--muted); }

.log-list { display: grid; gap: 8px; }
.log-item { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 12px 16px; border-radius: var(--radius-sm); background: rgba(3,63,133,.04); font-size: .92rem; }
.log-item time { color: var(--muted); }
.log-item b { color: var(--navy); }
.log-item .who { color: var(--teal-deep); font-weight: 700; }

.pill-tabs { display: inline-flex; gap: 6px; padding: 5px; border-radius: 999px; background: rgba(3,63,133,.06); margin-bottom: 20px; }
.pill-tab { padding: 8px 16px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.pill-tab.is-active { background: #fff; color: var(--navy); box-shadow: var(--shadow-soft); }

/* ---- Панель разработчика: системный мониторинг ---- */
.kv-list { display: grid; gap: 2px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 11px 14px; border-radius: 12px; background: rgba(3,63,133,.04); font-size: .94rem; }
.kv:nth-child(odd) { background: rgba(3,63,133,.06); }
.kv span { color: var(--muted); }
.kv b { color: var(--navy); font-variant-numeric: tabular-nums; text-align: right; }
.load-row { margin-top: 16px; }
.load-row:first-child { margin-top: 6px; }
.load-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.load-top span { color: var(--muted); font-weight: 700; font-size: .92rem; }
.load-top b { color: var(--navy); font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.load-track { height: 14px; border-radius: 999px; background: rgba(3,63,133,.08); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(3,63,133,.05); }
.load-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--teal-deep)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.load-fill.warm { background: linear-gradient(90deg, var(--teal), var(--orange)); }
.load-fill.hot { background: linear-gradient(90deg, var(--orange), var(--danger)); }
.load-row small { display: block; margin-top: 6px; color: var(--muted); font-size: .84rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

.site-footer { padding: 22px 0 40px; border-top: 1px solid rgba(3,63,133,.08); margin-top: 20px; }
.footer-inner { width: var(--container-width); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.footer-inner p { margin: 0; color: var(--muted); font-size: .92rem; }
.footer-inner strong { color: var(--navy); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---- Анимации представлений ---- */
#view-root { animation: view-fade .45s cubic-bezier(.2,.8,.2,1); }
@keyframes view-fade { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.card, .metric-card, .result-shell, .question-card, .survey-panel { position: relative; overflow: hidden; }
.card::before, .metric-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(260px circle at var(--px, 50%) var(--py, 50%), rgba(0,171,170,.16), transparent 60%);
  transition: opacity .3s ease;
}
.card:hover::before, .metric-card:hover::before { opacity: 1; }

/* анимированная рамка hero на экране входа */
.auth-hero-frame { position: absolute; inset: 22px; border-radius: 28px; pointer-events: none; z-index: 0; }
.auth-hero-frame span { position: absolute; display: block; border-radius: 999px; opacity: .9; }
.auth-hero-frame span:nth-child(1), .auth-hero-frame span:nth-child(2) {
  left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), var(--teal), rgba(255,255,255,.2), transparent);
  background-size: 240% 100%; animation: slide-x 7s linear infinite;
}
.auth-hero-frame span:nth-child(1) { top: 0; }
.auth-hero-frame span:nth-child(2) { bottom: 0; animation-direction: reverse; }
.auth-hero-frame span:nth-child(3), .auth-hero-frame span:nth-child(4) {
  top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, transparent, rgba(255,255,255,.28), var(--orange), rgba(255,255,255,.2), transparent);
  background-size: 100% 240%; animation: slide-y 7s linear infinite;
}
.auth-hero-frame span:nth-child(3) { left: 0; }
.auth-hero-frame span:nth-child(4) { right: 0; animation-direction: reverse; }
@keyframes slide-x { 0% { background-position: 200% 0; } 100% { background-position: -40% 0; } }
@keyframes slide-y { 0% { background-position: 0 200%; } 100% { background-position: 0 -40%; } }

/* ---- Компоненты макета (лендинг-стиль на дашбордах) ---- */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 24px; align-items: stretch; }
.hero-panel {
  position: relative; overflow: hidden; border-radius: var(--radius-xl); box-shadow: var(--shadow);
  padding: 42px; color: #fff; min-height: 360px; display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(circle at right top, rgba(255,255,255,.22), transparent 30%),
    linear-gradient(105deg, rgba(20,32,53,.98) 0%, rgba(3,63,133,.92) 42%, rgba(0,139,138,.94) 122%);
}
.hero-panel::after {
  content: ""; position: absolute; width: 380px; height: 380px; right: -90px; bottom: -120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.25) 0%, rgba(255,255,255,.02) 68%, transparent 72%); pointer-events: none;
}
.hero-frame { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero-frame span { position: absolute; display: block; border-radius: 999px; opacity: .94; background: linear-gradient(90deg, transparent, rgba(255,255,255,.24), var(--teal), rgba(255,255,255,.18), transparent); }
.hero-frame span:nth-child(1), .hero-frame span:nth-child(2) { left: 30px; right: 30px; height: 2px; background-size: 240% 100%; animation: slide-x 7s linear infinite; }
.hero-frame span:nth-child(1) { top: 18px; }
.hero-frame span:nth-child(2) { bottom: 18px; animation-direction: reverse; }
.hero-frame span:nth-child(3), .hero-frame span:nth-child(4) { top: 30px; bottom: 30px; width: 2px; background: linear-gradient(180deg, transparent, rgba(255,255,255,.24), var(--orange), rgba(255,255,255,.18), transparent); background-size: 100% 240%; animation: slide-y 7s linear infinite; }
.hero-frame span:nth-child(3) { left: 18px; }
.hero-frame span:nth-child(4) { right: 18px; animation-direction: reverse; }
.hero-copy { position: relative; z-index: 1; max-width: 640px; }
.hero-copy .kicker { display: inline-block; margin: 0 0 16px; color: rgba(255,255,255,.74); }
.hero-copy h1 { margin: 0; font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.02; }
.hero-copy .lead { margin: 20px 0 0; max-width: 56ch; color: rgba(255,255,255,.84); font-size: 1.1rem; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.hero-highlights { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-highlights span { padding: 10px 14px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.92); font-weight: 700; font-size: .92rem; }
.hero-side { display: grid; gap: 18px; align-content: start; }
.hero-stat-card {
  position: relative; overflow: hidden; padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98)); border: 1px solid rgba(0,171,170,.12); border-top: 5px solid var(--teal);
}
.hero-stat-card.accent { border-top-color: var(--orange); }
.hero-stat-card.navy { border-top-color: var(--navy); }
.hero-stat-card strong { display: block; font-family: "PT Sans Caption"; font-size: 1.7rem; color: var(--navy); }
.hero-stat-card span { display: block; margin-top: 6px; font-weight: 700; color: var(--teal-deep); font-size: .92rem; }
.hero-stat-card p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; font-size: .95rem; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 24px; }
.info-card {
  position: relative; overflow: hidden; padding: 28px; min-height: 220px; border-radius: var(--radius-xl); box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98)); border: 1px solid rgba(0,171,170,.12); border-top: 5px solid var(--teal);
}
.info-card .info-index { color: var(--orange); }
.info-card h3 { margin: 12px 0 0; color: var(--navy); font-size: 1.3rem; }
.info-card p { margin: 12px 0 0; color: var(--muted); line-height: 1.6; }
.preview-card {
  position: relative; overflow: hidden; padding: 28px; border-radius: var(--radius-xl); box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,249,252,.98)); border: 1px solid rgba(0,171,170,.12);
}
.preview-head span { color: var(--teal-deep); font-weight: 700; }
.preview-head strong { display: block; margin-top: 8px; font-size: 1.3rem; color: var(--navy); }
.preview-list { margin: 16px 0 0; padding-left: 18px; display: grid; gap: 10px; color: var(--muted); line-height: 1.5; }

/* ---- Адаптив ---- */
@media (max-width: 1080px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-hero { min-height: auto; padding: 44px 28px; }
  .questionnaire-layout { grid-template-columns: 1fr; }
  .survey-panel { position: relative; top: 0; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .result-main { grid-template-columns: 1fr; }
  .score-gauge { margin: 0 auto; }
  .two-col { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .hero-panel { padding: 30px 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .patient-head { grid-template-columns: 1fr; }
  .app-header-inner { flex-wrap: wrap; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .log-item { grid-template-columns: 1fr; gap: 4px; }
  .mood-dot { min-height: 36px; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .app-header, .app-nav, .site-footer, .result-actions, .toolbar, .toast-host,
  #res-back, #run-back, .page-orb, .page-grid, .survey-panel, .q-nav, .q-dots { display: none !important; }
  body { background: #fff; }
  .app-main, .section, .container { padding: 0 !important; margin: 0 !important; }
  .card, .result-shell { box-shadow: none !important; border: 1px solid #d8e3eb; break-inside: avoid; }
  .score-gauge { background: none !important; }
  .result-disclaimer { color: #555 !important; }
}