/* ═══ Навигатор жизни — оформление v4 ═══
   Перенос макета «Тихая приборная панель собственной жизни».
   Имена классов совпадают с прежними, чтобы работала вся логика. */

:root {
  --bg:        #08090C;
  --surface:   #0F1216;
  --panel:     #0C0F13;
  --card:      #12161C;
  --card-2:    #141820;
  --field:     #141920;
  --raised:    #171F26;

  --line:      #21262E;
  --line-2:    #262C35;
  --line-3:    #1F252D;
  --line-4:    #1A1F26;
  --line-in:   #2A313B;

  --tx:        #EDF0F4;
  --tx-1:      #E4E9EF;
  --tx-2:      #D6DCE4;
  --tx-3:      #B7C0CB;
  --tx-4:      #99A2AE;
  --tx-5:      #8B94A0;
  --tx-6:      #6B7481;
  --tx-7:      #57606C;

  --mint:      #7FD8CE;
  --mint-dim:  #5FBDB4;
  --mint-ink:  #08120F;
  --sand:      #E3B778;
  --sand-2:    #C69B5E;
  --lilac:     #A9A6F0;

  --r-sm: 10px; --r: 14px; --r-md: 18px; --r-lg: 22px; --r-xl: 26px;
  --shadow: 0 24px 50px rgba(0,0,0,.45);
}

/* ── основа ─────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font-family: Manrope, system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.5; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.serif, .font-head { font-family: Newsreader, Georgia, serif; font-weight: 400; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden], .nav-item[hidden] { display: none !important; }
::selection { background: rgba(127,216,206,.25); }

* { scrollbar-width: thin; scrollbar-color: #2A313B transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #232A33; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #2E3742; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── каркас ─────────────────────────────────────────── */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; height: 100dvh; background: var(--surface); }
.sidebar { background: var(--panel); border-right: 1px solid #1C2129; display: flex; flex-direction: column; padding: 22px 16px; gap: 22px; overflow: hidden; }
.main-col { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.active { display: flex; }
.view:not(.active) { display: none !important; }
.page { flex: 1; overflow: auto; padding: 30px 34px 56px; }

.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: 34px; line-height: 1.1; }
.head .sub { margin: 6px 0 0; font-size: 15px; color: var(--tx-5); max-width: 640px; line-height: 1.5; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--tx-6); }

/* ── логотип и меню ─────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; color: var(--tx); text-decoration: none; font-size: 16px; font-weight: 700; }
.brand .mark { width: 26px; height: 26px; border-radius: 9px; flex: none; background: conic-gradient(from 210deg, #7FD8CE, #A9A6F0, #E3B778, #7FD8CE); opacity: .9; }

.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.menu li { display: block; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px;
  border-radius: 12px; color: var(--tx-4); font-size: 15px; text-decoration: none;
  cursor: pointer; position: relative; background: none; border: 0; width: 100%;
  transition: background .15s, color .15s;
}
.nav-item .dot { width: 7px; height: 7px; border-radius: 50%; background: #39414C; flex: none; transition: background .15s, box-shadow .15s; }
.nav-item .num { margin-left: auto; font-size: 13px; color: var(--tx-6); font-variant-numeric: tabular-nums; }
.nav-item:hover { background: rgba(255,255,255,.035); color: var(--tx-2); }
.nav-item.active { background: var(--raised); color: var(--tx); font-weight: 600; }
.nav-item.active .dot { background: var(--mint); box-shadow: 0 0 12px rgba(127,216,206,.6); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--mint); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 12px; border: 1px solid #1C2129; border-radius: var(--r-md); background: #101419; }
.side-foot .who { display: flex; align-items: center; gap: 10px; }
.side-foot .ava { width: 30px; height: 30px; border-radius: 50%; background: #1E2630; border: 1px solid #2C3540; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--tx-2); flex: none; }
.side-foot .nm { font-size: 14px; font-weight: 600; }
.side-foot .rl { font-size: 12px; color: var(--tx-6); }
.side-foot .st { font-size: 12px; color: var(--tx-5); font-variant-numeric: tabular-nums; }
.side-links { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--tx-6); }

/* ── кнопки ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r); border: 1px solid var(--line-in);
  background: none; color: var(--tx-2); font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover { background: rgba(255,255,255,.04); border-color: #333C48; color: var(--tx); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: default; transform: none; }
.btn:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.btn-primary { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); font-weight: 700; box-shadow: 0 8px 24px rgba(127,216,206,.22); }
.btn-primary:hover { background: #96E2D9; border-color: #96E2D9; color: var(--mint-ink); }
.btn-ghost { background: none; border-color: transparent; color: var(--tx-5); box-shadow: none; }
.btn-ghost:hover { background: rgba(255,255,255,.055); border-color: transparent; color: var(--tx); }
.btn-outline { background: none; }
.btn-error, .btn-error.btn-outline, .btn.text-error { color: var(--sand); border-color: #3A2C1E; background: none; }
.btn-error:hover, .btn.text-error:hover { background: #1E1811; border-color: #4A3826; color: var(--sand); }
.btn-ghost.text-error { border-color: transparent; }
.btn-warning { background: var(--sand); border-color: var(--sand); color: #151009; }
.btn-sm { height: 36px; padding: 0 15px; font-size: 14px; border-radius: 11px; }
.btn-xs { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-square { padding: 0; width: 44px; }
.btn-sm.btn-square, .btn-sm.btn-circle { width: 36px; }
.btn-xs.btn-square, .btn-xs.btn-circle { width: 30px; }
.btn-circle { padding: 0; width: 44px; border-radius: 50%; }
.btn.w-full, .btn-block { width: 100%; }
.btn.rec { background: var(--sand); border-color: var(--sand); color: #151009; }

/* ── поля ───────────────────────────────────────────── */
.input, .select, .textarea,
input[type=text], input[type=password], input[type=number], input[type=month], input[type=search], select, textarea {
  width: 100%; height: 46px; padding: 0 15px; border-radius: var(--r);
  border: 1px solid var(--line-in); background: var(--field); color: var(--tx-1);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea, .textarea { height: auto; padding: 12px 15px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--mint); box-shadow: 0 0 0 3px rgba(127,216,206,.12);
}
.input::placeholder, .textarea::placeholder, input::placeholder, textarea::placeholder { color: var(--tx-7); }
.input-sm, .select-sm, input.input-sm, select.select-sm { height: 40px; font-size: 14px; border-radius: 12px; }
.select, select { appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #6B7481 50%), linear-gradient(135deg, #6B7481 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.select option, select option { background: #12161C; color: var(--tx-1); }
input[type=checkbox], .checkbox { width: 20px; height: 20px; flex: none; accent-color: var(--mint); cursor: pointer; }
input[type=month]::-webkit-calendar-picker-indicator { filter: invert(.6); cursor: pointer; }
.form-control { display: flex; flex-direction: column; }
.label-text { font-size: 12px; color: var(--tx-6); margin-bottom: 6px; display: block; }
.chat-input { min-height: 44px; max-height: 190px; resize: none; border: 0; background: none; padding: 9px 0; }
.chat-input:focus { border: 0; box-shadow: none; }

/* ── карточки ───────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line-3); border-radius: var(--r-lg); }
.card-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.card-title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.bg-base-100 { background: var(--surface); }
.bg-base-200 { background: var(--card); }
.bg-base-300 { background: #1B2129; }

/* ── метки ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 10px;
  border-radius: 999px; background: #1B2129; color: var(--tx-3);
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 0;
}
.badge-sm { height: 22px; padding: 0 9px; }
.badge-xs { height: 19px; padding: 0 8px; font-size: 11px; }
.badge-info    { background: #1B2129; color: var(--tx-3); }
.badge-success { background: #16241F; color: var(--mint); }
.badge-error   { background: #241E16; color: var(--sand); }
.badge-warning { background: #241E16; color: var(--sand); }
.badge-accent  { background: #1F1B29; color: var(--lilac); }
.badge-neutral { background: #1B2129; color: var(--tx-3); }
.badge-ghost   { background: rgba(255,255,255,.05); color: var(--tx-5); }

.chip {
  flex: none; white-space: nowrap; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: #141A20; color: var(--tx-3);
  font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { background: #1A222B; border-color: #333C48; color: var(--tx); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

/* ── тексты ─────────────────────────────────────────── */
.md { font-size: 16px; line-height: 1.7; color: var(--tx-1); }
.md h2, .md h3, .md h4 { margin: 18px 0 8px; font-size: 15px; font-weight: 700; color: var(--tx); letter-spacing: 0; }
.md h2:first-child, .md h3:first-child, .md h4:first-child { margin-top: 0; }
.md p { margin: 8px 0; text-wrap: pretty; }
.md ul, .md ol { margin: 8px 0; padding-left: 20px; }
.md li { margin: 4px 0; }
.md code { background: rgba(0,0,0,.4); padding: 1px 6px; border-radius: 5px; font-size: 13.5px; font-family: ui-monospace, monospace; }
.md strong { color: #fff; font-weight: 700; }
.md em { color: var(--tx-2); }
.md blockquote { margin: 10px 0; padding: 2px 0 2px 18px; border-left: 2px solid #2C3540; color: var(--tx-4); }
.md a { color: var(--mint); text-decoration: none; border-bottom: 1px solid rgba(127,216,206,.35); }
.md a:hover { color: #A6E7E0; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }

.doc .md { font-family: Newsreader, Georgia, serif; font-size: 18px; line-height: 1.75; color: #E7ECF2; }
.doc .md h2, .doc .md h3, .doc .md h4 { font-family: Manrope, sans-serif; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--tx-6); margin: 24px 0 8px; font-weight: 600; }
.doc .md li { margin: 6px 0; }

.link { color: var(--mint); text-decoration: none; }
.link:hover { color: #A6E7E0; }
.link-hover { color: inherit; text-decoration: none; cursor: pointer; }
.link-hover:hover { color: var(--mint); }
.divider { display: flex; align-items: center; gap: 14px; margin: 30px 0 14px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--tx-6); }
.divider::after { content: ""; flex: 1; height: 1px; background: var(--line-4); }
.muted { color: var(--tx-5); }

/* ── чат ────────────────────────────────────────────── */
.chat-top { height: 64px; flex: none; border-bottom: 1px solid var(--line-4); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(15,18,22,.72); backdrop-filter: blur(14px); }

/* AI-аватар в сайдбаре */
.ai-avatar-wrap {
  position: relative; flex: none; width: 38px; height: 38px;
  border-radius: 50%; overflow: visible;
}
.ai-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; display: block;
  border: 2px solid rgba(127,216,206,.35);
  box-shadow: 0 0 12px rgba(127,216,206,.25), 0 0 30px rgba(127,216,206,.08);
  transition: box-shadow .4s ease, border-color .4s ease;
}
.ai-avatar-glow {
  position: absolute; inset: -4px; border-radius: 50%;
  background: radial-gradient(circle, rgba(127,216,206,.18) 0%, transparent 70%);
  animation: aiPulse 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes aiPulse {
  0%, 100% { opacity: .5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}
/* Когда ИИ думает — аватар ярче */
.brand.thinking .ai-avatar {
  border-color: rgba(169,166,240,.7);
  box-shadow: 0 0 16px rgba(169,166,240,.45), 0 0 40px rgba(169,166,240,.15);
}
.brand.thinking .ai-avatar-glow {
  background: radial-gradient(circle, rgba(169,166,240,.3) 0%, transparent 70%);
  animation: aiPulse 1.6s ease-in-out infinite;
}

/* Фоновое видео в чате */
.chat-bg-video {
  position: absolute;
  top: 50%; left: 50%;
  width: 340px; height: 340px;
  transform: translate(-50%, -50%);
  object-fit: cover;
  border-radius: 50%;
  opacity: .07;
  filter: blur(2px) saturate(1.3);
  pointer-events: none;
  z-index: 0;
  animation: bgFloat 8s ease-in-out infinite;
}
/* Фоновое видео на экране входа */
.login-bg-video {
  position: absolute;
  top: 50%; left: 50%;
  width: 880px; height: 880px;
  transform: translate(-50%, -50%);
  object-fit: cover;
  border-radius: 50%;
  opacity: .09;
  filter: blur(2px) saturate(1.3);
  pointer-events: none;
  z-index: 0;
  animation: bgFloat 8s ease-in-out infinite;
}
@keyframes bgFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .07; }
  50% { transform: translate(-50%, -50%) scale(1.08); opacity: .11; }
}
.drawer-content { position: relative; }
.drawer-content > :not(.chat-bg-video) { position: relative; z-index: 1; }
.msgs { flex: 1; overflow: auto; padding: 28px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.msgs > * { width: min(820px, calc(100% - 48px)); }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.user .chat-bubble {
  max-width: 600px; background: #1B242C; border: 1px solid #29323C;
  border-radius: 20px 20px 6px 20px; padding: 15px 19px;
  font-size: 16px; line-height: 1.6; color: var(--tx-1);
}
.msg.bot { gap: 16px; }
.msg.bot::before {
  content: ""; flex: none; width: 30px; height: 30px; border-radius: 50%; margin-top: 4px;
  background: radial-gradient(circle at 35% 30%, #A9A6F0, #4C4A78);
  animation: breathe 5.5s ease-in-out infinite;
}
.msg.bot .chat-bubble { flex: 1; min-width: 0; background: none; border: 0; padding: 0; }
.msg.bot .chat-bubble .md { font-size: 17px; line-height: 1.7; }
.chat-bubble img { border-radius: 12px; max-width: 240px; margin-bottom: 8px; display: block; }
.chat-footer { font-size: 12px; color: var(--tx-7); margin-top: 8px; }
.msg.user .chat-footer { display: none; }
.msg.bot .chat-footer { padding-left: 46px; margin-top: 6px; }
.msg { flex-wrap: wrap; }
.chat-composer { flex: none; padding: 14px 0 20px; display: flex; justify-content: center; background: linear-gradient(to top, var(--surface) 58%, rgba(15,18,22,0)); }
.chat-composer > div { width: min(820px, calc(100% - 48px)); }
.composer-box { border: 1px solid var(--line-in); background: var(--field); border-radius: var(--r-lg); padding: 8px 8px 8px 20px; display: flex; align-items: flex-end; gap: 10px; transition: border-color .15s; }
.composer-box:focus-within { border-color: #3A4552; }
.composer-hint { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--tx-7); padding: 8px 6px 0; }
#typing { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 13px; color: var(--tx-5); padding: 0 24px 6px; }
#typing canvas { max-height: 42px; }

.welcome { display: flex; flex-direction: column; gap: 16px; margin: auto 0; padding: 20px 0; }
.welcome h2 { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: 34px; line-height: 1.15; letter-spacing: normal; }
.welcome p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--tx-5); max-width: 620px; }
.welcome .seed { align-self: flex-start; padding: 10px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: #141A20; font-size: 15px; color: var(--tx-3); cursor: pointer; text-align: left; }
.welcome .seed:hover { border-color: #3A4552; color: var(--tx); }

.conv { display: flex; gap: 10px; align-items: center; padding: 10px 11px; border-radius: 12px; cursor: pointer; color: var(--tx-5); text-decoration: none; }
.conv:hover { background: #141A20; color: var(--tx-2); }
.conv.active { background: #141A20; color: var(--tx-1); }

/* панель диалогов */
.drawer-toggle { display: none; }
.drawer-side { position: fixed; inset: 0; z-index: 70; display: none; }
.drawer-toggle:checked ~ .drawer-side { display: block; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(4,5,8,.6); backdrop-filter: blur(2px); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 300px; max-width: 86vw; background: var(--panel); border-left: 1px solid var(--line-3); display: flex; flex-direction: column; animation: slideIn .22s ease-out; }
.drawer { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.drawer-content { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* ── факты ──────────────────────────────────────────── */
.fact { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line-4); }
.fact:first-child { border-top: 0; padding-top: 2px; }
.fact .body { flex: 1; min-width: 0; }
.fact .body > div:first-child { font-size: 15px; line-height: 1.5; color: var(--tx-1); }
.fact .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--tx-6); }
.acts { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.fact:hover .acts, .acts:focus-within { opacity: 1; }
@media (pointer: coarse) { .acts { opacity: .55; } }

/* ── деньги ─────────────────────────────────────────── */
.money-hero { display: flex; gap: 20px; align-items: stretch; flex-wrap: wrap; margin-bottom: 16px; }
.free-card {
  flex: 1 1 0; min-width: 290px; background: linear-gradient(160deg, #131A1E, #101418);
  border: 1px solid #223033; border-radius: var(--r-lg); padding: 26px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.free-card .cap { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--tx-5); }
.free-card .cap > span:last-child { font-size: 13px; }
.free-num { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.free-num b { font-size: clamp(38px, 5.4vw, 64px); line-height: .95; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--mint); }
.free-num .sh { font-size: 14px; color: var(--tx-5); padding-bottom: 10px; }
.split { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #171B21; }
.split i { display: block; transition: width .7s cubic-bezier(.22,.9,.3,1); }
.split .pay { background: linear-gradient(90deg, var(--sand-2), var(--sand)); }
.split .free { background: linear-gradient(90deg, var(--mint-dim), var(--mint)); }
.split-legend { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--tx-3); }
.free-note { font-size: 15px; line-height: 1.55; color: var(--tx-4); border-top: 1px solid #1C2129; padding-top: 14px; }
.sq { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.side-tiles { width: 300px; flex: 0 0 300px; display: flex; flex-direction: column; gap: 14px; }
/* крупные плитки правой колонки оформлены иначе, чем мелкие в ряду 2 */
.side-tiles .stat { background: var(--card-2); border-color: var(--line-2); border-radius: 20px; padding: 20px; }
.side-tiles .stat-title { font-size: 14px; }
.side-tiles .stat-desc { font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line-3); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-title { font-size: 13px; color: var(--tx-5); line-height: 1.3; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-value.big { font-size: 34px; }
.stat-desc { font-size: 12px; color: var(--tx-6); line-height: 1.35; }
.stat.dashed { border-style: dashed; border-color: var(--line-in); }
.stat.dashed .link { color: var(--lilac); }
.text-success { color: var(--mint); }
.text-error   { color: var(--sand); }
.text-warning { color: var(--sand); }
.text-info    { color: var(--lilac); }
.text-primary { color: var(--mint); }
.debt-bar { display: flex; gap: 3px; height: 8px; margin-top: auto; }
.debt-bar i { border-radius: 2px; display: block; }

.chart { width: 100%; height: 230px; display: block; }
.chart text { fill: var(--tx-7); font-size: 11px; font-family: Manrope, sans-serif; }

/* ── таблица ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-6); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line-3); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-4); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.hover:hover td { background: rgba(255,255,255,.02); }
.uava { width: 32px; height: 32px; border-radius: 50%; background: #1E2630; border: 1px solid #2C3540; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--tx-2); flex: none; }

/* ── модалка ────────────────────────────────────────── */
.modal { border: 0; padding: 0; background: none; max-width: 100vw; max-height: 100dvh; width: 100%; height: 100%; color: var(--tx); overflow: hidden; }
.modal::backdrop { background: rgba(4,5,8,.72); backdrop-filter: blur(3px); }
.modal[open] { display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-box {
  background: var(--card); border: 1px solid var(--line-in); border-radius: 20px;
  padding: 24px; width: 100%; max-width: 640px; max-height: calc(100dvh - 48px);
  overflow: auto; position: relative; box-shadow: 0 30px 70px rgba(0,0,0,.55);
  animation: driftUp .22s ease-out;
}
.modal-box.max-w-2xl { max-width: 700px; }
#m-title { font-size: 20px; font-weight: 700; padding-right: 40px; }
#m-close { position: absolute; right: 14px; top: 14px; }
.modal-backdrop { position: fixed; inset: 0; z-index: -1; }
.modal-backdrop button { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: default; border: 0; background: none; }
.mf { display: flex; flex-direction: column; gap: 14px; }

/* ── тосты ──────────────────────────────────────────── */
#toasts { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.alert {
  background: #151C21; border: 1px solid #2A3A3B; border-radius: var(--r-md);
  padding: 14px 16px; font-size: 14px; color: var(--tx-2);
  box-shadow: var(--shadow); display: flex; gap: 11px; align-items: flex-start;
  animation: driftUp .32s ease-out; transition: opacity .3s;
}
.alert b { font-size: 15px; font-weight: 600; color: var(--tx); display: block; }
.alert > div { color: var(--tx-4); line-height: 1.5; }
.alert-error, .alert-warning { border-color: #34281F; background: #161311; }
.alert-info { border-color: var(--line-2); background: var(--card); }

/* ── ожидание ───────────────────────────────────────── */
.loading, .spinner {
  display: inline-block; width: 15px; height: 15px; flex: none;
  border: 2px solid rgba(255,255,255,.18); border-top-color: var(--mint);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px;
}
.loading-xs { width: 12px; height: 12px; }
.loading-sm { width: 16px; height: 16px; }
.skel { border-radius: 8px; background: linear-gradient(90deg, #171B21, #212832, #171B21); background-size: 280px 100%; animation: shimmer 1.6s linear infinite; }

/* ── разбор рассказа ────────────────────────────────── */
.riv-wrap { border: 1px solid var(--line-3); background: var(--card); border-radius: var(--r-lg); padding: 14px; display: none; flex-direction: column; align-items: center; gap: 10px; }
.riv-wrap.on { display: flex; animation: driftUp .3s ease-out; }
.riv-wrap canvas { border-radius: 14px; filter: saturate(.72) brightness(.82) contrast(1.04); }
.riv-wrap canvas { width: 100%; max-width: 430px; height: auto; aspect-ratio: 43 / 25; }
#riv-think { width: 92px; height: auto; aspect-ratio: 46 / 17; }
.riv-cap { font-size: 13px; color: var(--tx-6); text-align: center; }
.progress-line { position: relative; height: 3px; border-radius: 2px; background: #1C2129; overflow: hidden; }
.progress-line i { position: absolute; inset: 0 auto 0 0; width: 30%; background: linear-gradient(90deg, rgba(169,166,240,0), var(--lilac), rgba(169,166,240,0)); animation: sweep 2.6s ease-in-out infinite; }
.steps { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.steps > div { display: flex; align-items: center; gap: 11px; color: var(--tx-5); }
.steps .mk { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #39414C; flex: none; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.steps .done { color: var(--tx-5); }
.steps .done .mk { border-color: var(--mint); color: var(--mint); }
.steps .now { color: var(--tx); }
.steps .now .mk { border-color: var(--lilac); background: var(--lilac); }
.steps .now .dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.steps .dots { display: none; }
.steps .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--lilac); animation: dot 1.3s ease-in-out infinite; }
.steps .dots i:nth-child(2) { animation-delay: .18s; }
.steps .dots i:nth-child(3) { animation-delay: .36s; }
.tell-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; align-items: start; }
@media (max-width: 1279px) { .tell-grid { grid-template-columns: 1fr; } }

/* ── вход ───────────────────────────────────────────── */
#login-view { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; background: var(--bg); }
#login-view::before { content: ""; position: absolute; top: -170px; right: -130px; width: 540px; height: 540px; border-radius: 50%; background: radial-gradient(circle, rgba(127,216,206,.15), rgba(127,216,206,0) 70%); pointer-events: none; }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; position: relative; z-index: 1; }
.login-card .ttl { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: 27px; line-height: 1.2; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
#login-err { font-size: 14px; font-weight: 600; color: var(--tx); }
#login-err:empty { display: none; }
#login-err:not(:empty) { border: 1px solid var(--line-2); background: var(--card);
  border-radius: 18px; padding: 16px; }

/* ── нижнее меню (телефон) ──────────────────────────── */
.bottomnav { display: none; }
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sidebar { display: none; }
  .page { padding: 20px 16px 30px; }
  .head { margin-bottom: 18px; }
  .head h1 { font-size: 27px; }
  .head .sub { font-size: 14px; }
  .msgs { padding: 18px 0 6px; gap: 20px; }
  .msgs > *, .chat-composer > div { width: calc(100% - 28px); }
  .chat-top { height: 54px; padding: 0 14px; }
  .chat-composer { padding: 8px 0 10px; }
  .composer-hint { display: none; }
  /* во время записи строка нужна: в ней живёт волна голоса */
  .composer-hint.on { display: flex; justify-content: center; padding: 6px 6px 2px; }
  .composer-hint.on > span:not(#mic-status) { display: none; }
  .wave { height: 22px; }
  .wave i { width: 3px; }
  .msg.user .chat-bubble { font-size: 15px; padding: 12px 15px; }
  .msg.bot .chat-bubble .md { font-size: 16px; }
  .bottomnav {
    display: flex; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-4); background: rgba(12,15,19,.94); backdrop-filter: blur(16px);
  }
  .bottomnav .nav-item {
    flex: 1; flex-direction: column; gap: 4px; height: 50px; padding: 0;
    font-size: 11px; border-radius: 12px; justify-content: center; text-align: center;
  }
  .bottomnav .nav-item::before { display: none; }
  .bottomnav .nav-item .dot { width: 6px; height: 6px; }
  .modal[open] { padding: 0; align-items: flex-end; }
  .modal-box { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 92dvh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  #toasts { right: 12px; left: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; }
  .free-card { padding: 20px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); }
  .stat { padding: 14px; }
  .stat-value { font-size: 19px; }
  .side-tiles { width: 100%; }
  .table th:nth-child(3), .table td:nth-child(3), .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .divider { margin: 24px 0 12px; }
}

/* ── движение ───────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .45; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes shimmer { 0% { background-position: -220px 0; } 100% { background-position: 420px 0; } }
@keyframes driftUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.appear { animation: driftUp .35s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ── утилиты (взамен Tailwind) ──────────────────────── */
.flex { display: flex; } .flex-col { flex-direction: column; } .flex-1 { flex: 1; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; } .flex-nowrap { flex-wrap: nowrap; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; } .mt-auto { margin-top: auto; }
.p-2 { padding: 8px; } .p-4 { padding: 16px; }
.w-full { width: 100%; } .min-w-0 { min-width: 0; }
.text-xs { font-size: 12px; } .text-sm { font-size: 14px; } .text-base { font-size: 15px; }
.text-lg { font-size: 18px; } .text-xl { font-size: 21px; } .text-2xl { font-size: 26px; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .font-mono { font-family: ui-monospace, monospace; font-size: 13px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; } .whitespace-nowrap { white-space: nowrap; }
.opacity-40 { opacity: .4; } .opacity-50 { opacity: .5; } .opacity-60 { opacity: .6; } .opacity-70 { opacity: .7; }
.overflow-auto { overflow: auto; } .overflow-x-auto { overflow-x: auto; } .overflow-hidden { overflow: hidden; }
.relative { position: relative; } .absolute { position: absolute; }
.tabnum { font-variant-numeric: tabular-nums; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.grid { display: grid; }

/* превью прикреплённых фото */
.thumb { position: relative; }
.thumb img { height: 62px; width: auto; border-radius: 12px; border: 1px solid var(--line-2); display: block; }
.thumb button { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #3A2C1E; background: #241E16; color: var(--sand); font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.thumb button:hover { background: #30271B; }
.cursor-pointer { cursor: pointer; }
.rounded-lg { border-radius: 12px; }

/* ── блок ожидания в чате ───────────────────────────── */
.think {
  display: flex; gap: 24px; align-items: flex-start;
  border: 1px solid var(--line-3); background: var(--card);
  border-radius: var(--r-lg); padding: 24px 26px; animation: driftUp .3s ease-out;
}
.think .orb {
  flex: none; width: 84px; height: 84px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(169,166,240,0) 0deg, rgba(169,166,240,.16) 180deg, var(--lilac) 340deg, rgba(169,166,240,0) 360deg);
  animation: spinSlow 3.4s linear infinite;
  display: flex; align-items: center; justify-content: center;
}
.think .orb i {
  width: 62px; height: 62px; border-radius: 50%; background: var(--card);
  display: flex; align-items: center; justify-content: center;
}
.think .orb i::before {
  content: ""; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--lilac), #3C3A63);
  animation: breathe 4s ease-in-out infinite;
}
.think .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 15px; }
.think .ttl { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.think .ttl b { font-family: Newsreader, Georgia, serif; font-weight: 400; font-size: 27px; line-height: 1.1; letter-spacing: -.01em; }
.think .cnt { font-size: 14px; color: var(--lilac); font-variant-numeric: tabular-nums; }
.think .note { font-size: 14px; color: var(--tx-6); }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .think { gap: 16px; padding: 18px; }
  .think .orb { width: 60px; height: 60px; }
  .think .orb i { width: 44px; height: 44px; }
  .think .orb i::before { width: 22px; height: 22px; }
  .think .ttl b { font-size: 21px; }
  .think .note { font-size: 13px; }
}
/* пока показан блок ожидания, аватар модели не нужен — круг уже внутри блока */
.msg.bot:has(.think)::before { display: none; }
.msg.bot:has(.think) .chat-bubble { margin-left: 0; }

/* ── экран денег: шапка-строка и раскладка макета ───── */
.page-top {
  height: 64px; flex: none; border-bottom: 1px solid var(--line-4);
  display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: rgba(15,18,22,.72); backdrop-filter: blur(14px);
}
.page-top b { font-size: 16px; font-weight: 600; }
.page-top .sub { font-size: 13px; color: var(--tx-6); }
.money-page { padding: 26px 32px 48px; display: flex; flex-direction: column; gap: 22px; }
.money-page .divider { margin: 8px 0 0; }
.money-page .money-hero, .money-page .stats { margin: 0; }
.money-bottom { display: flex; gap: 20px; align-items: stretch; }
.money-bottom .chart-card { flex: 1.35; min-width: 0; }
.money-bottom .debts-card { flex: 1; min-width: 0; }
.money-bottom .card-body { height: 100%; }

/* строка долга или платежа — как в макете */
.dl { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-4); }
.dl:last-child { border-bottom: 0; }
.dl .nm { flex: 1; min-width: 0; font-size: 15px; color: var(--tx-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl .per { font-size: 13px; color: var(--tx-5); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl .sum { font-size: 15px; font-weight: 600; color: var(--sand); font-variant-numeric: tabular-nums; width: 104px; text-align: right; white-space: nowrap; }
.dl.life .nm { color: var(--tx-3); }
.dl.life .sum { color: var(--sand-2); }
.dl-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 12px; border-top: 1px solid var(--line-4); font-size: 13px; color: var(--tx-6); }
.dl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dl-head b { font-size: 15px; font-weight: 600; }
@media (max-width: 1100px) { .money-bottom { flex-direction: column; } }
@media (max-width: 1023px) {
  .page-top { height: auto; min-height: 54px; padding: 8px 14px; gap: 8px; flex-wrap: wrap; }
  .page-top .sub { display: none; }
  .money-page { padding: 18px 16px 30px; gap: 16px; }
  .dl .sum { width: auto; }
}


/* ── чат: детали макета ─────────────────────────────── */
.chat-top .btn-square { color: var(--tx-6); font-size: 17px; }
#conv-meta { flex: none; }

/* разделитель дат в ленте */
.daysep { display: flex; justify-content: center; font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--tx-7); }

/* курсор, пока модель печатает */
.caret { display: inline-block; width: 8px; height: 19px; margin-left: 3px; vertical-align: -3px;
  background: var(--mint); animation: caret 1.05s step-end infinite; }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* выноска с суммами внутри ответа модели */
.md .sums { border-left: 2px solid #2C3540; padding-left: 18px; margin: 14px 0;
  display: flex; flex-direction: column; gap: 11px; }
.md .sums .cap { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--tx-6); }
.md .sums .row { display: flex; justify-content: space-between; gap: 20px; font-size: 16px; line-height: 1.5; }
.md .sums .row .k { color: var(--tx-2); }
.md .sums .row .v { color: var(--sand); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* полоски памяти в сайдбаре */
.mem-bars { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
.mem-bars i { flex: 1; border-radius: 1px; display: block; min-height: 1px; }

/* список диалогов: в покое только название, действия — при наведении */
.conv .meta { display: none; }
.conv .btn { opacity: 0; transition: opacity .15s; }
.conv:hover .btn, .conv.active .btn { opacity: .6; }
.conv .btn:hover { opacity: 1; }
@media (pointer: coarse) { .conv .btn { opacity: .5; } }

/* уведомление «Запомнил N фактов» — справа под шапкой, как в макете */
#toasts { top: 84px; bottom: auto; right: 24px; max-width: 340px; }
#toasts .alert { width: 320px; }
#toasts .alert b { font-size: 15px; }
#toasts .alert .close { margin-left: auto; color: var(--tx-7); cursor: pointer; font-size: 16px; line-height: 1; }
#toasts .alert .lines { display: flex; flex-direction: column; gap: 7px; margin-top: 9px;
  font-size: 14px; line-height: 1.45; color: var(--tx-4); }
#toasts .alert .lines > span { display: flex; gap: 8px; }
#toasts .alert .lines .dot { color: var(--tx-7); }
#toasts .alert .lines em { font-style: normal; color: var(--tx-6); }
@media (max-width: 1023px) {
  #toasts { top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: none; }
  #toasts .alert { width: auto; }
}


/* ── правки по итогам сверки с макетом ──────────────── */
/* карточки нижнего ряда: радиус и отступы как в макете */
.money-bottom .card { border-radius: 20px; }
.money-bottom .card-body { padding: 20px 22px; }
.money-bottom .card-body > .flex b, .dl-head b { font-weight: 600; }
.money-bottom .card-body > .flex .text-xs { font-size: 13px; }
.dl-head .link { font-size: 13px; }
.dl-foot { font-variant-numeric: tabular-nums; }

/* кнопки в шапке раздела — 34px, «Экспорт» без заливки */
.page-top .btn { height: 34px; border-radius: 10px; font-size: 14px; padding: 0 14px; }
.page-top .btn:not(.btn-primary) { background: none; color: var(--tx-4); }
.page-top .btn:not(.btn-primary):hover { background: rgba(255,255,255,.04); color: var(--tx-2); }
.page-top .btn-primary { box-shadow: none; padding: 0 16px; }
.page-top .btn-square { width: 34px; padding: 0; }

/* строки списка долгов — видно, что их можно открыть */
.dl { border-radius: 8px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; cursor: pointer;
  transition: background .15s; }
.dl:hover { background: rgba(255,255,255,.03); }
.dl:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }

/* пустое состояние полосы «свободно / платежи» */
.split.empty { background: #171B21; }
.split.empty i { display: none; }

/* заглушка на время загрузки раздела */
.money-skel { display: flex; flex-direction: column; gap: 20px; }
.money-skel .a { height: 214px; border-radius: 22px; }
.money-skel .b { height: 96px; border-radius: 16px; }
.money-skel .row { display: flex; gap: 20px; }
.money-skel .row > * { flex: 1; }

@media (max-width: 1023px) {
  /* месяц и число записей не прячем — переносим */
  .page-top { height: auto; min-height: 54px; padding: 10px 14px; flex-wrap: wrap; }
  .page-top .sub { display: block; width: 100%; order: 3; }
  .side-tiles { width: 100%; flex: 1 1 100%; }
}
/* время под ответом в макете не показано — открываем его при наведении */
.msg.bot .chat-footer { opacity: 0; transition: opacity .15s; }
.msg.bot:hover .chat-footer, .msg.bot:focus-within .chat-footer { opacity: 1; }
@media (pointer: coarse) { .msg.bot .chat-footer { opacity: .5; } }

/* модель не ответила — состояние из макета */
.failcard { display: flex; gap: 14px; align-items: flex-start; border: 1px solid #34281F;
  background: #161311; border-radius: var(--r-md); padding: 18px 20px; animation: driftUp .3s ease-out; }
.failcard .sq { width: 8px; height: 8px; border-radius: 50%; background: var(--sand); margin-top: 8px; }
.failcard b { font-size: 15px; font-weight: 600; display: block; }
.failcard .tx { font-size: 14px; line-height: 1.5; color: var(--tx-4); margin: 6px 0 8px; }
.failcard .link { font-size: 14px; cursor: pointer; }


/* ── экран «Рассказать» по макету ───────────────────── */
.mic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sand); flex: none; }
.tell-grid { gap: 0; }
.tell-grid > :first-child { padding-right: 40px; border-right: 1px solid var(--line-4); }
.tell-grid > :last-child { padding: 30px 34px 40px 36px; background: #0D1014;
  margin: -30px -34px -56px 0; min-height: calc(100dvh - 64px); }
.tell-empty { display: flex; flex-direction: column; gap: 10px; color: var(--tx-7); font-size: 14px;
  line-height: 1.55; padding-top: 6px; }
.tell-empty b { color: var(--tx-5); font-size: 15px; font-weight: 600; }

/* фоновое видео «Рассказать» — как в чате */
.view[data-view="tell"] { position: relative; }
.view[data-view="tell"] > :not(.chat-bg-video) { position: relative; z-index: 1; }
@media (min-width: 1280px) {
  /* правая колонка непрозрачная — центр круга смещаем в зону левой колонки */
  .view[data-view="tell"] .chat-bg-video { left: 27%; }
}

/* кольцо «идёт разбор» */
.ring { width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, rgba(127,216,206,0) 0deg, rgba(127,216,206,.2) 200deg, var(--mint) 350deg, rgba(127,216,206,0) 360deg);
  animation: spinSlow 3.4s linear infinite; display: flex; align-items: center; justify-content: center; }
.ring i { width: 32px; height: 32px; border-radius: 50%; background: var(--card); display: block; }

/* факт карточкой, как в макете */
.fcard { border: 1px solid var(--line-3); background: var(--card); border-radius: 16px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.fcard .tx { font-size: 15px; line-height: 1.5; color: var(--tx-1); }
.fcard .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fcard .acts { margin-left: auto; display: flex; gap: 8px; font-size: 13px; color: var(--tx-7); opacity: 1; }
.fcard .acts button { background: none; border: 0; padding: 0; color: var(--tx-7); cursor: pointer; font-size: 13px; }
.fcard .acts button:hover { color: var(--tx-3); }
.fcards { display: flex; flex-direction: column; gap: 10px; }
.more-line { display: flex; align-items: center; gap: 12px; padding: 4px 2px; font-size: 14px; color: var(--tx-7); }
.more-line::before, .more-line::after { content: ""; flex: 1; height: 1px; background: var(--line-4); }

/* прошлые рассказы в боковой панели */
.story-side { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px; cursor: default; }
.story-side:hover { background: #141A20; }
.story-side.on { background: #141A20; }
.story-side .t { font-size: 13px; line-height: 1.35; color: var(--tx-5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-side .m { font-size: 11px; color: var(--tx-7); }
.story-side:hover .t { color: var(--tx-3); }
/* «Очистить всё» у списка прошлых рассказов — тихая ссылка, как «Очистить память» в панели */
.stories-clear { color: #8B6F5E; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 12px;
  flex: none; white-space: nowrap; }
.stories-clear:hover { color: var(--sand); }

@media (max-width: 1279px) {
  .tell-grid > :first-child { padding-right: 0; border-right: 0; }
  .tell-grid > :last-child { padding: 20px 0 0; background: none; margin: 0; min-height: 0; }
}


/* ── окно «Запись о деньгах» по макету ──────────────── */
.mform { display: flex; flex-direction: column; gap: 16px; }
.mform .kinds { display: flex; gap: 8px; flex-wrap: wrap; }
.mform .kinds button {
  height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line-2);
  background: none; color: var(--tx-4); font-size: 14px; cursor: pointer; transition: all .15s;
}
.mform .kinds button:hover { border-color: #333C48; color: var(--tx-2); }
.mform .kinds button.on { background: #16241F; border-color: #16241F; color: var(--mint); font-weight: 600; }
.mform .kinds button.on[data-k=debt], .mform .kinds button.on[data-k=payment] { background: #241E16; border-color: #241E16; color: var(--sand); }
.mform .kinds button.on[data-k=goal] { background: #1F1B29; border-color: #1F1B29; color: var(--lilac); }
.mform .fields { display: flex; flex-direction: column; gap: 10px; }
.mform .row2 { display: flex; gap: 10px; }
.mform .row2 > * { flex: 1; min-width: 0; }
.mform .amt { position: relative; display: flex; }
.mform .amt input { padding-right: 52px; }
.mform .amt select {
  position: absolute; right: 4px; top: 4px; bottom: 4px; width: 44px; height: auto;
  border: 0; background: none; padding: 0 0 0 6px; font-size: 15px; color: var(--tx-4);
  background-image: none; text-align: center; cursor: pointer;
}
.mform .amt select:focus { box-shadow: none; }
.mform .more { font-size: 13px; color: var(--tx-6); cursor: pointer; align-self: flex-start; }
.mform .more:hover { color: var(--mint); }
.mform .foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.mform .foot .del { margin-right: auto; background: none; border: 0; color: var(--tx-7); font-size: 14px; cursor: pointer; padding: 0; }
.mform .foot .del:hover { color: var(--sand); }
.mform .hint { font-size: 13px; line-height: 1.5; color: var(--tx-7); }
#m-title { font-size: 19px; font-weight: 700; }
#m-close { color: var(--tx-7); font-size: 17px; }


/* ── карточка факта (общая для всех разделов) ───────── */
.fcard.old { opacity: .72; }
.fcard.old .tx { text-decoration: line-through; text-decoration-color: #3A424D; color: var(--tx-3); }
.fcard .when { font-size: 12px; color: var(--tx-6); }
.fcards.tight { gap: 8px; }

/* ── карточка темы ──────────────────────────────────── */
.bcard { border: 1px solid #263038; background: var(--card); border-radius: 18px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.bcard:hover { border-color: #33414B; background: #141920; }
.bcard.empty { border-style: dashed; border-color: var(--line-in); }
.bcard .top { display: flex; align-items: center; gap: 10px; }
.bcard .ttl { font-size: 17px; font-weight: 600; color: var(--tx); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard.empty .ttl { color: var(--tx-5); }
.bcard .pin { font-size: 12px; color: var(--mint); border: 1px solid #24413E; border-radius: 999px; padding: 2px 8px; flex: none; }
.bcard .n { margin-left: auto; font-size: 15px; font-weight: 700; color: var(--mint); font-variant-numeric: tabular-nums; }
.bcard.empty .n { color: var(--tx-7); }
.bcard .sum { font-size: 14px; line-height: 1.55; color: var(--tx-4); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 66px; }
.bcard.empty .sum { color: var(--tx-6); }
.bcard .bars { display: flex; gap: 2px; height: 6px; }
.bcard .bars i { flex: 1; border-radius: 2px; display: block; }
.bcard .upd { font-size: 12px; color: var(--tx-7); }
.bcard.hot { border-color: var(--mint); }

/* ── уведомления по смыслу ──────────────────────────── */
#toasts .alert.ok .sq { background: var(--mint); box-shadow: 0 0 12px var(--mint); }
#toasts .alert.info { border-color: #2A2A3B; }
#toasts .alert.info .sq { background: var(--lilac); box-shadow: 0 0 12px rgba(169,166,240,.6); }
#toasts .alert.bad { border-color: #34281F; background: #161311; }
#toasts .alert.bad .sq { background: var(--sand); box-shadow: none; }

/* переключатель из макета: 64×46, бегунок 38×38 */
input[type=checkbox].toggle { appearance: none; -webkit-appearance: none; width: 64px; height: 46px; flex: none;
  border: 0; border-radius: 14px; background: #1B2129; padding: 4px; display: inline-flex;
  align-items: center; cursor: pointer; transition: background .18s; }
input[type=checkbox].toggle::after { content: ""; width: 38px; height: 38px; border-radius: 11px; background: #39414C;
  transition: background .18s, margin .18s cubic-bezier(.3,.9,.3,1); }
input[type=checkbox].toggle:checked { background: #16241F; }
input[type=checkbox].toggle:checked::after { background: var(--mint); margin-left: auto; }
input[type=checkbox].toggle:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; color: var(--tx-3); }


/* ── карта жизни по макету ──────────────────────────── */
.map-shell { display: flex; flex: 1; min-height: 0; }
.map-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.map-doc { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; padding: 40px 40px 60px; }
.doc-col { width: 680px; max-width: 100%; display: flex; flex-direction: column; gap: 26px; }

/* портрет как документ */
.p-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--tx-6); }
.p-title { font-family: Newsreader, Georgia, serif; font-size: 46px; line-height: 1.08; letter-spacing: -.01em; color: var(--tx); }
.p-sec { display: flex; flex-direction: column; gap: 10px; }
.p-sec > .cap { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mint); }
.p-sec .body { font-family: Newsreader, Georgia, serif; font-size: 20px; line-height: 1.72; color: var(--tx-2); text-wrap: pretty; }
.p-sec .body p { margin: 0 0 12px; }
.p-sec .body p:last-child { margin-bottom: 0; }
.p-sec .body ul { margin: 8px 0; padding-left: 22px; }
.p-sec .body li { margin: 4px 0; }
.p-sec .body strong { color: #fff; font-weight: 600; }
.p-sec.dim { opacity: .55; }
.p-money { display: flex; gap: 12px; padding: 14px 0 2px; flex-wrap: wrap; }
.p-money > div { flex: 1; min-width: 120px; border-top: 1px solid var(--line-3); padding-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.p-money .k { font-size: 13px; color: var(--tx-5); }
.p-money .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* правая колонка */
.map-side { width: 400px; flex: none; background: #0D1014; border-left: 1px solid var(--line-4);
  display: flex; flex-direction: column; padding: 26px 28px; gap: 22px; overflow: hidden; }
.ipick { height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: none;
  display: flex; align-items: center; padding: 0 16px; gap: 12px; cursor: pointer; width: 100%;
  color: var(--tx-3); font-size: 15px; transition: border-color .15s, background .15s; }
.ipick:hover { border-color: #333C48; color: var(--tx); }
.ipick .dot { width: 8px; height: 8px; border-radius: 50%; background: #39414C; flex: none; }
.ipick .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ipick .k { margin-left: auto; font-size: 13px; color: var(--tx-7); }
.ipick.on { background: #152020; border-color: #24413E; color: var(--tx-1); font-weight: 600; }
.ipick.on .dot { background: var(--mint); box-shadow: 0 0 12px var(--mint); }
.ipick:disabled { opacity: .5; cursor: default; }

/* разборы */
.ins { border: 1px solid #263038; background: var(--card); border-radius: 18px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; }
.ins .top { display: flex; align-items: center; gap: 10px; }
.ins .top b { font-size: 15px; font-weight: 600; }
.ins .new { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: #16241F; color: var(--mint); }
.ins .when { margin-left: auto; font-size: 12px; color: var(--tx-7); }
.ins .body { font-family: Newsreader, Georgia, serif; font-size: 16px; line-height: 1.65; color: var(--tx-3); text-wrap: pretty; }
.ins .body p { margin: 0 0 10px; }
.ins .body p:last-child { margin-bottom: 0; }
.ins .body h3, .ins .body h4 { font-family: Manrope, sans-serif; font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--tx-6); margin: 14px 0 6px; font-weight: 600; }
.ins .steps-list { display: flex; flex-direction: column; gap: 7px; padding-top: 10px;
  border-top: 1px solid var(--line-4); font-size: 14px; line-height: 1.5; color: var(--tx-4); }
.ins .steps-list > div { display: flex; gap: 9px; }
.ins .steps-list .num { color: var(--mint); flex: none; }
.ins .acts { display: flex; gap: 14px; font-size: 13px; color: var(--tx-7); }
.ins .acts button { background: none; border: 0; padding: 0; color: inherit; font-size: 13px; cursor: pointer; }
.ins .acts button:hover { color: var(--tx-3); }
.ins-row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-top: 1px solid var(--line-4); cursor: pointer; }
.ins-row .dot { width: 6px; height: 6px; border-radius: 50%; background: #39414C; flex: none; }
.ins-row .nm { flex: 1; min-width: 0; font-size: 14px; color: var(--tx-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-row .when { font-size: 12px; color: var(--tx-7); }
.ins-row:hover .nm { color: var(--tx); }

/* сборка разбора */
.ins-run { display: flex; gap: 18px; align-items: flex-start; border: 1px solid var(--line-3);
  background: var(--card); border-radius: 18px; padding: 18px; }
.ins-run .ring { width: 56px; height: 56px; background: conic-gradient(from 0deg, rgba(169,166,240,0) 0deg, rgba(169,166,240,.18) 190deg, var(--lilac) 345deg, rgba(169,166,240,0) 360deg); }
.ins-run .ring i { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.ins-run .ring i::before { content: ""; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--lilac), #3C3A63); animation: breathe 4s ease-in-out infinite; }
.ins-run .ttl { font-family: Newsreader, Georgia, serif; font-size: 22px; line-height: 1.2; }

/* оглавление портрета в боковой панели */
.toc { display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.toc a { padding: 7px 10px; border-radius: 9px; color: var(--tx-5); cursor: pointer;
  border-left: 2px solid transparent; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc a:hover { color: var(--tx-2); }
.toc a.on { background: #141A20; color: var(--tx-1); border-left-color: var(--mint); }
.data-box { margin-top: 4px; display: flex; flex-direction: column; gap: 8px; padding: 14px 12px;
  border: 1px solid #1C2129; border-radius: 16px; background: #101419; font-size: 14px; }
.data-box .link { font-size: 14px; }
.data-box .danger { color: #8B6F5E; cursor: pointer; }
.data-box .danger:hover { color: var(--sand); }

/* пустой портрет и очистка памяти */
.p-empty { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.p-empty .big { font-family: Newsreader, Georgia, serif; font-size: 23px; line-height: 1.25; }
.p-empty .bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #171B21; }
.p-empty .bar i { background: var(--mint); display: block; }
.wipe .big { font-family: Newsreader, Georgia, serif; font-size: 23px; line-height: 1.25; }
.wipe .btn-danger { background: #241E16; border-color: #40301E; color: #B08D66; font-weight: 700; }
.wipe .btn-danger:hover { background: #2E2519; border-color: #4E3B25; color: #C79E72; }
.wipe .err { font-size: 13.5px; color: var(--sand); margin-top: 10px; }

@media (max-width: 1279px) {
  /* на узком экране карта — один сплошной поток с одной прокруткой:
     иначе колонка портрета сжималась до полоски, а боковая уезжала за экран */
  .map-shell { flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .map-main { flex: none; overflow: visible; }
  .map-doc { flex: none; min-height: 0; overflow: visible; padding: 24px 16px 24px; }
  .map-side { width: auto; flex: none; overflow: visible; border-left: 0;
    border-top: 1px solid var(--line-4); padding: 20px 16px 40px; }
  .ins-list { overflow: visible; }
  .p-title { font-size: 32px; }
  .p-sec .body { font-size: 18px; line-height: 1.65; }
}


/* ── раздел «Блоки» по макету ───────────────────────── */
.blocks-top { gap: 24px; padding: 0 32px; }
.search-box { flex: 1; max-width: 520px; height: 38px; border: 1px solid var(--line-in);
  background: var(--field); border-radius: 12px; display: flex; align-items: center; padding: 0 14px;
  gap: 11px; cursor: text; transition: border-color .15s; }
.search-box:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(127,216,206,.1); }
.search-box .ico { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--tx-7); }
.search-box input { flex: 1; min-width: 0; height: auto; border: 0; background: none; padding: 0;
  font-size: 15px; color: var(--tx-3); }
.search-box input:focus { border: 0; box-shadow: none; }
.search-box .hint { flex: none; font-size: 12px; color: var(--tx-7); white-space: nowrap; }
.blocks-page { padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 18px; }
.blocks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.found-line { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--tx-6); }
.found-line .ln { flex: 1; height: 1px; background: var(--line-4); }
.found-line .tail { color: var(--tx-7); white-space: nowrap; }

.bcard { background: var(--card); border: 1px solid var(--line-3); border-radius: 20px; padding: 20px;
  display: flex; flex-direction: column; gap: 12px; cursor: pointer; position: relative; overflow: hidden;
  min-height: 168px; transition: border-color .15s, background .15s; }
.bcard:hover { border-color: #33414B; background: #141920; }
.bcard.found { border-color: #263038; }
.bcard.found::before { content: ""; position: absolute; left: 0; top: 20px; bottom: 20px; width: 2px;
  border-radius: 2px; background: var(--mint); }
.bcard.empty { background: none; border-style: dashed; border-color: var(--line-in); min-height: 0; }
.bcard .top { display: flex; align-items: center; gap: 10px; }
.bcard .ttl { font-size: 17px; font-weight: 600; color: var(--tx); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard.empty .ttl { color: var(--tx-5); }
.bcard .tag { flex: none; font-size: 11px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.bcard .tag.pin { border: 1px solid #24413E; color: var(--mint); }
.bcard .tag.new { background: #1F1B29; color: var(--lilac); }
.bcard .n { margin-left: auto; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--tx); }
.bcard.hot .n { color: var(--mint); }
.bcard.empty .n { color: #3F4854; font-weight: 400; }
.bcard .sum { font-size: 14px; line-height: 1.55; color: var(--tx-4); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bcard.empty .sum { color: var(--tx-5); -webkit-line-clamp: 3; }
.bcard .bars { display: flex; gap: 2px; height: 5px; margin-top: auto; }
.bcard .bars i { flex: 1; border-radius: 2px; display: block; }
.bcard .upd { font-size: 12px; color: var(--tx-7); }
.bcard.add { align-items: flex-start; justify-content: center; gap: 10px; }
.bcard.add .plus { width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--line-in);
  display: flex; align-items: center; justify-content: center; color: var(--mint); font-size: 18px; }
.bcard.add .t { font-size: 15px; font-weight: 600; color: var(--tx-3); }
.bcard.add .d { font-size: 13px; line-height: 1.5; color: var(--tx-6); }

/* окно темы */
.modal-box.theme { max-width: 820px; padding: 0; background: #101419; border-radius: 24px;
  max-height: min(820px, calc(100dvh - 48px)); display: flex; flex-direction: column; overflow: hidden; }
.th-head { flex: none; padding: 26px 30px 20px; display: flex; flex-direction: column; gap: 18px;
  border-bottom: 1px solid var(--line-4); }
.th-head .row1 { display: flex; align-items: flex-start; gap: 16px; }
.th-head .name { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.th-head .meta { font-size: 14px; color: var(--tx-5); }
.th-head .x { flex: none; width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line-3);
  background: none; color: var(--tx-5); font-size: 19px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.th-head .x:hover { color: var(--tx); border-color: var(--line-2); }
.th-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-acts .btn { height: 38px; border-radius: 12px; font-size: 14px; padding: 0 13px; }
.th-acts { gap: 7px; }
.th-acts .btn-primary { padding: 0 16px; }
.th-acts .btn .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lilac); flex: none; }
.th-acts .danger { margin-left: auto; border-color: #34281F; color: #B08D66; }
.th-acts .danger:hover { background: #1E1811; border-color: #4A3826; color: var(--sand); }
.th-acts select { height: 38px; width: 150px; flex: none; border-radius: 12px; font-size: 14px; padding: 0 28px 0 13px;
  text-overflow: ellipsis; }
.th-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.th-sum { flex: 1; min-width: 0; padding: 26px 30px; display: flex; flex-direction: column; gap: 22px; overflow: auto; }
.th-sum .sec { display: flex; flex-direction: column; gap: 10px; }
.th-sum .cap { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mint); }
.th-sum .cap.q { color: var(--lilac); }
.th-sum .text { font-family: Newsreader, Georgia, serif; font-size: 19px; line-height: 1.7; color: var(--tx-2); text-wrap: pretty; }
.th-sum .list { display: flex; flex-direction: column; gap: 9px; font-size: 16px; line-height: 1.55; color: var(--tx-2); }
.th-sum .list > div { display: flex; gap: 12px; }
.th-sum .list .b { color: var(--tx-7); flex: none; }
.th-sum .list b { font-weight: 700; }
.th-facts { width: 320px; flex: none; border-left: 1px solid var(--line-4); background: #0D1014;
  display: flex; flex-direction: column; overflow: hidden; }
.th-facts .head { flex: none; height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--line-4); }
.th-facts .head b { font-size: 14px; font-weight: 600; }
.th-facts .head span { font-size: 13px; color: var(--tx-6); font-variant-numeric: tabular-nums; }
.th-facts .list { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.tf { border: 1px solid var(--line-3); background: var(--card); border-radius: 14px; padding: 12px 13px;
  display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.tf:hover { border-color: #2E3945; }
.tf .tx { font-size: 14px; line-height: 1.45; color: var(--tx-1); }
.tf .badge { align-self: flex-start; font-size: 11px; padding: 3px 8px; height: auto; }
.tf.old { background: #101318; opacity: .7; }
.tf.old .tx { color: var(--tx-3); text-decoration: line-through; text-decoration-color: #3A424D; }

@media (max-width: 1100px) { .blocks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023px) {
  .blocks-top { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .search-box { max-width: none; flex: 1 1 100%; order: 3; }
  .search-box .hint { display: none; }
  .blocks-page { padding: 16px 14px 28px; }
  .blocks-grid { grid-template-columns: 1fr; }
  .modal-box.theme { max-width: 100%; border-radius: 20px 20px 0 0; }
  .th-body { flex-direction: column; }
  .th-facts { width: auto; border-left: 0; border-top: 1px solid var(--line-4); max-height: 40dvh; }
  .th-sum { padding: 20px; }
  .th-head { padding: 20px 20px 16px; }
}


/* ── вход и состояния по макету ─────────────────────── */
.login-card .input { height: 48px; }
.login-card .btn { height: 48px; }
.failcard .row { display: flex; gap: 8px; margin-top: 2px; }
.failcard .btn-retry { height: 38px; padding: 0 14px; border-radius: 12px; border: 0;
  background: var(--sand); color: #151009; font-size: 14px; font-weight: 700; cursor: pointer; }
.failcard .btn-retry:hover { background: #EDC689; }
.failcard .btn-later { height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: none; color: var(--tx-4); font-size: 14px; cursor: pointer; }
.failcard .btn-later:hover { color: var(--tx-2); border-color: #333C48; }

/* скелеты разделов: повторяют будущую сетку, чтобы ничего не прыгало */
.sk-blocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sk-blocks span { height: 168px; border-radius: 20px; display: block; }
.sk-map { display: flex; flex-direction: column; gap: 22px; width: 680px; max-width: 100%; }
.sk-map .l { height: 14px; border-radius: 7px; display: block; }
.sk-map .t { height: 46px; border-radius: 10px; display: block; }
@media (max-width: 1100px) { .sk-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023px) { .sk-blocks { grid-template-columns: 1fr; } }


/* ── точные значения из файла макета ────────────────── */
/* вход: карточка, отступы и зазор как в макете */
.login-card { gap: 26px; }
#login-view .login-card { max-width: 390px; }
.login-card .brand .mark { width: 22px; height: 22px; border-radius: 8px; }
.login-card .brand span:last-child { font-size: 15px; font-weight: 700; }
.login-card form { gap: 10px; }
.login-card .input { border-radius: 14px; padding: 0 16px; font-size: 15px; }
.login-card .btn-primary { border-radius: 14px; font-size: 16px; font-weight: 700; }
.login-card > .text-xs { font-size: 13px; line-height: 1.5; color: var(--tx-7); }
/* световое пятно: 260×260, смещение как в макете */
#login-view::before { top: -90px; right: -70px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(127,216,206,.16), rgba(127,216,206,0) 70%); }

/* карточка ошибки: точка по центру строки заголовка, отступы по макету */
.failcard { gap: 0; padding: 18px; border-radius: 18px; align-items: stretch; }
.failcard > .sq { display: none; }
.failcard b { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.failcard b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sand); flex: none; }
.failcard .tx { font-size: 14px; line-height: 1.55; color: var(--tx-4); margin: 10px 0 0; }
.failcard .row { gap: 8px; margin-top: 14px; }

/* пустой чат: зазор блока 20px, как в макете */
.welcome { gap: 20px; }
.welcome .seed { font-size: 15px; }


/* ── по итогам сверки с файлом макета ───────────────── */
/* 1 — блик скелета идёт волной, как в эталоне */
.sk-map .l:nth-of-type(2) { animation-delay: .1s; }
.sk-map .l:nth-of-type(3) { animation-delay: .2s; }
.sk-map .l:nth-of-type(4) { animation-delay: .3s; }
.sk-blocks span:nth-child(2) { animation-delay: .15s; }
.sk-blocks span:nth-child(3) { animation-delay: .3s; }
.sk-blocks span:nth-child(4) { animation-delay: .45s; }
.sk-blocks span:nth-child(5) { animation-delay: .6s; }
.sk-blocks span:nth-child(6) { animation-delay: .75s; }
.money-skel .row > *:nth-child(2) { animation-delay: .15s; }

/* 5 — у плиток свой, более тёмный градиент */
.sk-blocks span, .money-skel .a, .money-skel .b {
  background: linear-gradient(90deg, #12161C, #1B2129, #12161C);
  background-size: 280px 100%;
}

/* 6 — зазор между полосами 14px */
.sk-map { gap: 14px; }
.sk-map .t { margin-bottom: 8px; }

/* 9 — подсказка в полях входа светлее */
.login-card .input::placeholder { color: var(--tx-6); }

/* 12 — фон первого экрана */
#login-view { background: #0B0D11; }

/* 13, 14 — значок: зазор 10px и без притушения */
.login-card .brand { gap: 10px; }
.login-card .brand .mark { opacity: 1; }

/* 15 — зазор логотип → заголовок */
.login-card > .flex-col { gap: 10px; }

/* 16, 17 — кнопка «Войти»: без лишнего отступа и без свечения */
.login-card .btn-primary { margin-top: 0; box-shadow: none; }


/* ── запись голоса ──────────────────────────────────── */
.btn.rec { background: var(--sand); border-color: var(--sand); color: #151009; }
.rec-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--tx-5); }
.rec-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sand);
  animation: recpulse 1.4s ease-in-out infinite; flex: none; }
.rec-line .time { font-variant-numeric: tabular-nums; color: var(--tx-3); }
@keyframes recpulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }


/* распознавание по ходу записи */
.rec-line .said { color: var(--mint); font-variant-numeric: tabular-nums; }


/* ── живая волна голоса ─────────────────────────────── */
.wave { display: inline-flex; align-items: center; gap: 2px; height: 20px; flex: none; }
.wave i {
  width: 3px; height: 3px; border-radius: 2px; background: var(--mint);
  transform-origin: center; transition: height .08s linear, opacity .2s;
  will-change: height;
}
.wave.idle i { animation: waveIdle 1.4s ease-in-out infinite; }
.wave.idle i:nth-child(2) { animation-delay: .1s; }
.wave.idle i:nth-child(3) { animation-delay: .2s; }
.wave.idle i:nth-child(4) { animation-delay: .3s; }
.wave.idle i:nth-child(5) { animation-delay: .4s; }
.wave.idle i:nth-child(6) { animation-delay: .5s; }
.wave.idle i:nth-child(7) { animation-delay: .6s; }
.wave.idle i:nth-child(8) { animation-delay: .7s; }
.wave.idle i:nth-child(9) { animation-delay: .8s; }
.wave.idle i:nth-child(10) { animation-delay: .9s; }
.wave.idle i:nth-child(11) { animation-delay: 1s; }
.wave.idle i:nth-child(12) { animation-delay: 1.1s; }
.wave.idle i:nth-child(13) { animation-delay: 1.2s; }
.wave.idle i:nth-child(14) { animation-delay: 1.3s; }
@keyframes waveIdle { 0%, 100% { height: 3px; opacity: .45; } 50% { height: 13px; opacity: 1; } }

/* пока идёт разбор — волна гаснет и по ней бежит мягкий пульс */
.wave.thinking i { background: var(--lilac); animation: waveThink 1.6s ease-in-out infinite; }
.wave.thinking i:nth-child(2n) { animation-delay: .12s; }
.wave.thinking i:nth-child(3n) { animation-delay: .26s; }
.wave.thinking i:nth-child(5n) { animation-delay: .4s; }
@keyframes waveThink { 0%, 100% { height: 4px; opacity: .3; } 50% { height: 10px; opacity: .9; } }

/* кнопка записи дышит, пока идёт запись */
.btn.rec { position: relative; }
.btn.rec::after {
  content: ""; position: absolute; inset: -4px; border-radius: inherit;
  border: 1px solid var(--sand); opacity: .5; animation: recRing 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes recRing {
  0% { transform: scale(.92); opacity: .6; }
  70% { transform: scale(1.14); opacity: 0; }
  100% { transform: scale(1.14); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wave i, .btn.rec::after { animation: none !important; }
}


/* ── кнопка микрофона ───────────────────────────────── */
.mic-btn { gap: 9px; }
.mic-btn .ic { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; flex: none; }
.mic-btn .ic svg { width: 17px; height: 17px; display: block; }
.mic-btn.rec .ic svg { width: 13px; height: 13px; }
.mic-btn .lbl { white-space: nowrap; }
.btn-square.mic-btn { width: 44px; }
.btn-sm.mic-btn, .btn-square.mic-btn .lbl { }


/* прошлые рассказы на телефоне — там, где нет боковой панели */
#stories-mobile { display: none; }
@media (max-width: 1023px) {
  #stories-mobile { display: block; }
  #stories-mobile .story-side { border: 1px solid var(--line-3); background: var(--card);
    border-radius: 14px; padding: 12px 13px; }
  #stories-mobile .story-side + .story-side { margin-top: 8px; }
  #stories-mobile .story-side .t { color: var(--tx-2); }
}


/* ── ответ модели: во всю ширину ────────────────────── */
.msg .chat-footer { flex-basis: 100%; }   /* подпись уходит под текст, а не съедает ширину */
.msg.bot .chat-bubble { flex: 1 1 100%; min-width: 0; }



/* ── оформление ответа модели (по макету чата) ──────── */
.md .a-cap { font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--lilac); margin: 4px 0 -4px; display: block; }
.md .a-obs { display: flex; flex-direction: column; gap: 11px; margin: 12px 0; }
.md .obs { display: flex; gap: 16px; padding: 15px 18px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line-3); }
.md .obs .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #1B2129;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--lilac); }
.md .obs .b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.md .obs .t { font-size: 16px; line-height: 1.5; color: var(--tx-1); }
.md .obs .d { font-size: 14px; line-height: 1.5; color: var(--tx-5); }

.md .loop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; border-radius: 16px; background: #101419; border: 1px solid var(--line-3);
  margin: 12px 0; }
.md .loop .cap { font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--tx-6); white-space: nowrap; }
.md .loop .p { font-size: 15px; padding: 6px 12px; border-radius: 999px;
  background: #1B2129; color: var(--tx-3); white-space: nowrap; }
.md .loop .p.first { background: #1F1B29; color: var(--lilac); }
.md .loop .ar { color: #4E5661; flex: none; }

.md .step { display: flex; gap: 16px; padding: 18px 22px; border-radius: 18px;
  background: #131A1E; border: 1px solid #223033; margin: 14px 0 4px; }
.md .step .bar { flex: none; width: 3px; border-radius: 2px; background: var(--mint); }
.md .step .b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.md .step .cap { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mint-dim); }
.md .step .t { font-family: Newsreader, Georgia, serif; font-size: 20px; line-height: 1.55;
  color: var(--tx); text-wrap: pretty; }
@media (max-width: 1023px) {
  .md .obs { padding: 13px 14px; gap: 12px; }
  .md .step { padding: 16px 16px; gap: 12px; }
  .md .step .t { font-size: 18px; }
  .md .loop { padding: 12px 14px; gap: 8px; }
  .md .loop .p { font-size: 14px; padding: 5px 10px; }
}

/* ── озвучка ответов ─────────────────────────────────── */
.speak-toggle .ic { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; }
.speak-toggle .ic svg { width: 17px; height: 17px; display: block; }
.speak-toggle.on { color: var(--mint); border-color: #2C4744; background: rgba(127,216,206,.08); }
.speak-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px;
  background: none; border: 0; padding: 0; font-size: 12px; color: var(--tx-6); cursor: pointer; }
.speak-btn:hover { color: var(--tx-2); }
.speak-btn .ic { display: inline-flex; width: 14px; height: 14px; }
.speak-btn .ic svg { width: 14px; height: 14px; display: block; }
.speak-btn.playing { color: var(--mint); }
.speak-btn.playing .ic { animation: speakPulse 1.1s ease-in-out infinite; }
@keyframes speakPulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
input[type=range] { cursor: pointer; }
@media (pointer: coarse) { .speak-btn { font-size: 13px; } }

/* ── быстрый переключатель голоса в шапке чата ───────── */
.voice-quick { flex: none; height: 30px; max-width: 104px; padding: 0 4px 0 8px;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.03);
  color: var(--tx-6); font-family: inherit; font-size: 12px; cursor: pointer; }
.voice-quick:hover { color: var(--tx-2); border-color: #2C4744; }
.voice-quick:focus { outline: none; border-color: #2C4744; }
.voice-quick[data-engine="silero"] { color: var(--mint); }
.voice-quick option { background: #14181D; color: var(--tx-2); }
@media (max-width: 1023px) { .voice-quick { max-width: 82px; height: 28px; font-size: 11px; padding: 0 2px 0 6px; } }

/* шапка телефона: «Новый диалог» значком, чтобы имя диалога читалось целиком */
@media (max-width: 1023px) {
  #new-conv { width: 36px; padding: 0; font-size: 0; }
  #new-conv::after { content: "＋"; font-size: 18px; line-height: 1; }
}
