/* ============================================================
   ИНТЕНСИВ «СИСТЕМА» — дизайн-система
   Цвета, типографика, компоненты, анимации
   ============================================================ */
:root {
  --bg: #0E1120;
  --bg-2: #151A2B;
  --card: #232A38;
  --card-2: #2B3346;
  --red: #FF413D;
  --red-dark: #8C1410;
  --blue: #6E8CC7;
  --cream: #F0EEEA;
  --cream-2: #FBF7F2;
  --muted: #9AA3BD;
  --dark-on-light: #2A0A08;
  --line: rgba(154,163,189,.18);
  --radius: 2px;
  --radius-lg: 4px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --maxw: 1180px;
  --font: 'Golos Text', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--cream);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
a { color: inherit; }
button { font-family: inherit; }

/* ---------- Глобальный фоновый слой (частицы + блобы) ---------- */
#fx-canvas, #fx-blobs {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
#fx-blobs .blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55;
  transform: translate(-50%, -50%);
}

.app-root { position: relative; z-index: 1; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; border-radius: var(--radius);
  padding: 13px 22px; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  color: #fff; background: var(--red);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(255,65,61,.35); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: var(--card); color: var(--cream); }
.btn-ghost:hover { background: var(--card-2); box-shadow: none; }
.btn-blue { background: var(--blue); }
.btn-blue:hover { box-shadow: 0 0 24px rgba(110,140,199,.35); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(255,65,61,.4); }
.btn-danger:hover { background: rgba(255,65,61,.1); box-shadow: none; }

/* ---------- Формы ---------- */
label.field-label { display: block; font-weight: 600; margin: 0 0 10px; font-size: 15.5px; color: var(--cream); }
input.inp, textarea.inp, select.inp {
  width: 100%; background: var(--bg-2); color: var(--cream);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 15px; font-family: inherit; transition: border .2s, box-shadow .2s;
}
input.inp:focus, textarea.inp:focus, select.inp:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,65,61,.12);
}
textarea.inp { resize: vertical; min-height: 120px; line-height: 1.6; }

/* ---------- Хедер ---------- */
.header {
  position: sticky; top: 0; z-index: 40; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; backdrop-filter: blur(12px);
  background: rgba(14,17,32,.72); border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 900; letter-spacing: .18em; font-size: 15px; color: var(--cream); display: flex; align-items: center; gap: 9px; }
.wordmark .tag { color: var(--red); }
.wordmark-img { height: 20px; width: auto; display: block; filter: brightness(0) invert(1); }
.auth-mark { text-align: center; margin-top: 20px; opacity: .8; }
.auth-mark img { height: 24px; width: auto; filter: brightness(0) invert(1); }
.header-right { display: flex; align-items: center; gap: 12px; }

/* Кольцо прогресса */
.ring { --p: 0; width: 38px; height: 38px; border-radius: 50%;
  background: conic-gradient(var(--red) calc(var(--p) * 1%), rgba(255,255,255,.12) 0);
  display: grid; place-items: center; }
.ring::after { content: attr(data-p); width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--cream); }

.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--line); color: var(--cream); cursor: pointer; transition: .2s; }
.icon-btn:hover { border-color: var(--red); color: var(--red); }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: 264px 1fr; gap: 26px; max-width: var(--maxw); margin: 0 auto; padding: 22px 16px 120px; }

/* Боковая навигация по разделам (десктоп) */
.sidenav { position: sticky; top: 78px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 4px; }
.sidenav-title { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 4px 8px 12px; }
.navlink { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; color: var(--muted); transition: .16s; margin-bottom: 3px; border: 1px solid transparent; }
.navlink:hover { background: var(--card); color: var(--cream); }
.navlink.active { background: var(--card); color: var(--cream); border-color: rgba(255,65,61,.4); }
.navlink .num { flex: none; width: 26px; height: 26px; border-radius: var(--radius); background: var(--bg-2);
  display: grid; place-items: center; font-weight: 800; font-size: 12px; color: var(--cream); }
.navlink.active .num, .navlink.done .num { background: var(--red); color: #fff; }
.navlink .lbl { font-size: 13.5px; line-height: 1.25; }
.navlink .chk { margin-left: auto; color: var(--red); opacity: 0; }
.navlink.done .chk { opacity: 1; }

/* ---------- Секция контента ---------- */
.section-head { margin-bottom: 22px; }
.section-kicker { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-badge { background: var(--red); color: #fff; font-weight: 900; border-radius: var(--radius);
  padding: 5px 11px; font-size: 15px; }
.section-title { font-weight: 900; text-transform: uppercase; letter-spacing: .01em; font-size: clamp(24px, 4.5vw, 38px); line-height: 1.06; margin: 0; }
.section-sub { color: var(--muted); margin-top: 10px; max-width: 720px; }

.block { margin-bottom: 26px; }
.block-heading { font-weight: 800; font-size: clamp(18px, 3vw, 23px); margin: 0 0 6px; }
.accent-rule { height: 4px; width: 100%; background: var(--red); border-radius: 3px; margin: 6px 0 16px; }
.block-text { color: var(--muted); margin: 0 0 14px; }

/* Карточка (для полей) */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; transition: transform .3s ease, box-shadow .3s ease;
  transform-style: preserve-3d; will-change: transform;
}
.card + .card { margin-top: 14px; }

/* Инфоблок / буллеты / термины */
.info-card { background: rgba(255,65,61,.06); border: 1px solid rgba(255,65,61,.16); border-radius: var(--radius-lg); padding: 20px; }
.bullets { list-style: none; margin: 6px 0 0; padding: 0; }
.bullets li { position: relative; padding-left: 26px; margin-bottom: 10px; color: var(--cream); }
.bullets li::before { content: ''; position: absolute; left: 0; top: 7px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 12px rgba(255,65,61,.5); }
.callout { display: flex; gap: 16px; align-items: center; background: rgba(255,65,61,.08);
  border-left: 4px solid var(--red); border-radius: var(--radius); padding: 18px 20px; margin-top: 10px; }
.callout .q { font-size: 42px; line-height: 1; color: var(--red); font-weight: 900; }
.callout p { margin: 0; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }

.terms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.term { background: rgba(255,65,61,.06); border: 1px solid rgba(255,65,61,.14); border-radius: var(--radius); padding: 14px; }
.term b { color: var(--cream); }
.term span { color: var(--muted); }

/* Textarea с микрофоном */
.ta-wrap { position: relative; }
.mic-btn { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--card-2); border: 1px solid var(--line); color: var(--cream); cursor: pointer;
  display: grid; place-items: center; transition: .18s; }
.mic-btn:hover { border-color: var(--red); color: var(--red); }
.mic-btn.recording { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 1.2s infinite; }
.mic-btn.busy { opacity: .6; cursor: wait; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,65,61,.5);} 50%{ box-shadow: 0 0 0 10px rgba(255,65,61,0);} }
.save-dot { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 16px; transition: .2s; }
.save-dot.saved { color: var(--blue); }

/* Таблицы (rating / text-table / choice-table) */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 0 10px 12px; border-bottom: 2px solid var(--cream); }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .rowlabel { font-weight: 600; color: var(--cream); min-width: 120px; }
.tbl-scroll { overflow-x: auto; }

.scale { display: inline-flex; gap: 6px; }
.scale button { width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--cream); cursor: pointer; font-weight: 700; transition: .15s; }
.scale button:hover { border-color: var(--red); }
.scale button.on { background: var(--red); border-color: var(--red); color: #fff; }

.choice { display: inline-flex; gap: 8px; }
.choice button { padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; transition: .15s; }
.choice button.on { color: #fff; border-color: var(--red); background: var(--red); }
.choice button.on.no { background: var(--card-2); border-color: var(--muted); }
.cell-inp { width: 100%; min-width: 140px; background: var(--bg-2); border: 1px solid var(--line); color: var(--cream);
  border-radius: var(--radius); padding: 8px 10px; font-family: inherit; font-size: 14px; resize: vertical; min-height: 42px; }
.cell-inp:focus { outline: none; border-color: var(--red); }

/* Пагинация низа секции */
.section-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }

/* Прогресс-подсказки промптов */
.prompts { margin: 0 0 14px; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); }
.prompts li { color: var(--muted); margin-bottom: 6px; font-size: 14.5px; }

/* ---------- Голосовые заметки ---------- */
.fab { position: fixed; right: 18px; bottom: 84px; z-index: 45; width: 58px; height: 58px; border-radius: 50%;
  background: var(--red); color: #fff; border: none; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 8px 30px rgba(255,65,61,.45); transition: transform .2s; }
.fab:hover { transform: scale(1.06); }

.drawer-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 92vw); z-index: 61;
  background: var(--bg-2); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .3s ease;
  display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }

.recorder { text-align: center; padding: 16px; background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--line); margin-bottom: 18px; }
.rec-circle { width: 76px; height: 76px; border-radius: 50%; margin: 6px auto 12px; border: none; cursor: pointer;
  background: var(--red); color: #fff; display: grid; place-items: center; transition: .2s; }
.rec-circle.on { animation: pulse 1.2s infinite; }
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.rec-hint { color: var(--muted); font-size: 13px; }

.note { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 12px; }
.note h4 { margin: 0 0 4px; font-size: 15px; }
.note .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.note .summary { font-size: 14px; white-space: pre-wrap; }
.note .summary b { color: var(--cream); }
.note .actions { display: flex; gap: 8px; margin-top: 10px; }
.note details { margin-top: 8px; }
.note summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.note .transcript { color: var(--muted); font-size: 13px; margin-top: 6px; white-space: pre-wrap; }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: rgba(110,140,199,.15); color: var(--blue); }

/* ---------- Мобильная нижняя навигация ---------- */
.mobile-nav { display: none; }

/* ---------- Экран авторизации ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow); }
.auth-logo { font-weight: 900; text-transform: uppercase; font-size: 30px; line-height: 1; letter-spacing: .01em; }
.auth-logo .q { color: var(--red); }
.auth-sub { color: var(--muted); margin: 8px 0 22px; }
.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 4px; border-radius: var(--radius); margin-bottom: 20px; }
.tabs button { flex: 1; padding: 9px; border: none; background: transparent; color: var(--muted); cursor: pointer;
  border-radius: var(--radius); font-weight: 600; font-size: 14px; transition: .15s; }
.tabs button.on { background: var(--red); color: #fff; }
.form-row { margin-bottom: 14px; }
.err { color: var(--red); font-size: 13.5px; margin: 4px 0 0; min-height: 18px; }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--card-2); color: var(--cream); border: 1px solid var(--line); border-left: 3px solid var(--red);
  padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; animation: toastIn .25s ease; max-width: 90vw; }
.toast.ok { border-left-color: var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none; } }

/* Reveal-анимация */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

.hidden { display: none !important; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { min-height: 60vh; display: grid; place-items: center; }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 16px 14px 96px; }
  .sidenav { display: none; }
  .terms-grid { grid-template-columns: 1fr; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 44; height: 64px;
    background: rgba(21,26,43,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    align-items: center; justify-content: space-between; padding: 0 12px; gap: 10px; }
  .mobile-nav .mn-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-nav .mn-btn { flex: none; }
  .fab { bottom: 76px; }
}
@media (max-width: 420px) {
  .scale button { width: 30px; height: 30px; }
  .auth-card { padding: 22px; }
}

/* Уважать reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .card { transition: none; }
}
