/* Концепция: спокойный графитовый инструмент для слушания. Одна яркая точка — живая запись (сфера и волна),
   всё остальное тихое: тонкие линии, белая типографика, фиолетово-синий только там, где что-то происходит. */
:root {
  --bg: #18191e;
  --surface: #1f2026;
  --raised: #272830;
  --line: #33343e;
  --line-soft: #2a2b33;
  --text: #f3f3f6;
  --muted: #a1a2b0;
  --faint: #6f707d;
  --violet: #9a86ff;
  --blue: #5b95ff;
  --grad: linear-gradient(135deg, #a08cff 0%, #5b95ff 100%);
  --ok: #5fd3a6;
  --warn: #f2b766;
  --danger: #ff7c7c;

  --font: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --display: 'Unbounded', 'Onest', 'Segoe UI', system-ui, sans-serif;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --rail: 232px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(154, 134, 255, .35); }

.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 16px; height: 16px; }

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 3.2vw, 32px); line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Каркас ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
#shell { min-height: 100%; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail);
  padding: max(24px, env(safe-area-inset-top)) 16px 20px max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 28px;
  border-right: 1px solid var(--line-soft);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 10px; }
.brand svg { width: 28px; height: 28px; fill: none; stroke: var(--violet); stroke-width: 2.6; stroke-linecap: round; }
.brand span { font: 600 17px/1 var(--display); letter-spacing: -.02em; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500; transition: color .15s, background .15s;
}
.rail-nav a:hover { color: var(--text); background: var(--surface); }
.rail-nav a.active { color: var(--text); background: var(--raised); }
.rail-nav a.active .i { stroke: var(--violet); }
.rail-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; text-decoration: none; }
.rail-user:hover, .rail-user.active { background: var(--surface); }
.rail-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.rail-user-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.rail-user-text small { color: var(--faint); font-size: 14px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--raised); border: 1px solid var(--line); font-weight: 600; font-size: 14px;
}

#view {
  margin-left: var(--rail);
  padding-block: 40px 80px;
  padding-left: max(40px, env(safe-area-inset-left, 0px));
  padding-right: max(40px, env(safe-area-inset-right, 0px));
  max-width: calc(var(--rail) + 1120px);
  outline: none;
}
.tabbar { display: none; }

@media (max-width: 880px) {
  .rail { display: none; }
  #view {
    margin-left: 0;
    padding-block: 24px calc(104px + env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: rgba(24, 25, 30, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-soft);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
    color: var(--faint); text-decoration: none; font-size: 14px; font-weight: 500;
  }
  .tabbar a.active { color: var(--text); }
  .tabbar a.active .i { stroke: var(--violet); }
  .tabbar .tab-rec {
    width: 52px; height: 52px; margin: -18px auto 0; border-radius: 50%; justify-content: center;
    background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(91, 149, 255, .35);
  }
  .tabbar .tab-rec .i { stroke: #fff !important; width: 22px; height: 22px; }
}

.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.view-head .sub { margin-top: 6px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 32px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title a, .link { color: var(--muted); text-decoration: none; font-size: 14px; }
.section-title a:hover, .link:hover { color: var(--text); }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { color: var(--danger); border-color: rgba(255, 124, 124, .35); background: transparent; }
.btn.danger:hover { background: rgba(255, 124, 124, .08); }
.btn.solid-danger { background: var(--danger); color: #1b1012; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.lg { min-height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--raised); }
.icon-btn.on { color: var(--warn); }
.icon-btn.on .i { fill: currentColor; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(154, 134, 255, .18); }
textarea.input { resize: vertical; min-height: 88px; line-height: 1.5; }
input[type="date"].input { min-height: 40px; padding: 6px 10px; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; line-height: 1.45; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.box {
  width: 22px; height: 22px; flex: none; margin-top: 1px; border-radius: 7px; border: 1.5px solid var(--faint);
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.box .i { width: 14px; height: 14px; stroke-width: 2.6; stroke: #fff; opacity: 0; }
.check input:checked + .box { background: var(--grad); border-color: transparent; }
.check input:checked + .box .i { opacity: 1; }
.check input:focus-visible + .box { outline: 2px solid var(--violet); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-soft); gap: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; font-size: 14px;
}
.segmented button.active { background: var(--raised); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px;
  cursor: pointer; font-size: 14px; transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--violet); animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 24px; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r);
  background: rgba(242, 183, 102, .08); border: 1px solid rgba(242, 183, 102, .25); color: #f3d6a8; font-size: 14px;
}
.notice.info { background: rgba(91, 149, 255, .08); border-color: rgba(91, 149, 255, .25); color: #c6d8ff; }
.notice.err { background: rgba(255, 124, 124, .08); border-color: rgba(255, 124, 124, .3); color: #ffc4c4; }
.notice .grow { flex: 1; min-width: 0; }
.empty { padding: 36px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- Авторизация ---------- */
#auth { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--line-soft);
}
.auth-side canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.auth-side > * { position: relative; }
.auth-claim { max-width: 460px; }
.auth-claim h1 { font: 600 clamp(28px, 3.4vw, 42px)/1.15 var(--display); letter-spacing: -.03em; }
.auth-claim p { margin-top: 16px; color: var(--muted); font-size: 16px; max-width: 40ch; }
.auth-main { display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }
.auth-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h2 { font-size: 24px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 1.2em; }
@media (max-width: 880px) {
  #auth { grid-template-columns: 1fr; }
  .auth-side { min-height: 280px; padding: 28px 20px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
}

/* ---------- Главная ---------- */
.hero-rec {
  position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 40px;
  padding: 36px 40px; border-radius: 28px; background: var(--surface); border: 1px solid var(--line-soft); overflow: hidden;
}
.hero-rec::before {
  content: ""; position: absolute; width: 520px; height: 520px; left: -160px; top: 50%; transform: translateY(-50%);
  background: radial-gradient(closest-side, rgba(154, 134, 255, .22), rgba(91, 149, 255, .08) 55%, transparent 75%);
  pointer-events: none;
}
.hero-rec > * { position: relative; }
.hero-rec h2 { font: 600 clamp(22px, 2.6vw, 28px)/1.2 var(--display); letter-spacing: -.02em; }
.hero-rec p { margin-top: 10px; color: var(--muted); max-width: 46ch; }
.hero-rec .row { margin-top: 22px; }

.orb {
  --s: 148px;
  position: relative; width: var(--s); height: var(--s); border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: var(--grad); text-decoration: none;
  box-shadow: 0 18px 50px rgba(91, 149, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.orb::after {
  content: ""; position: absolute; inset: -14px; border-radius: 50%;
  border: 1px solid rgba(154, 134, 255, .35);
  animation: breathe 3.6s var(--ease) infinite;
}
.orb:hover { transform: scale(1.03); box-shadow: 0 22px 60px rgba(91, 149, 255, .4), inset 0 1px 0 rgba(255, 255, 255, .25); }
.orb .i { width: 46px; height: 46px; stroke-width: 1.6; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: .3; } }

.figures {
  display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden;
}
.figure { padding: 22px 24px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; transition: background .15s; }
.figure + .figure { border-left: 1px solid var(--line-soft); }
.figure:hover { background: var(--surface); }
.figure b { font: 600 34px/1.1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.figure span { color: var(--muted); font-size: 14px; }
.figure small { color: var(--violet); font-size: 14px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.activity svg { width: 100%; height: auto; display: block; }
.activity .bar { fill: var(--raised); }
.activity .bar.has { fill: url(#actgrad); }
.activity text { fill: var(--faint); font-size: 14px; font-family: var(--font); }

.rec-list { display: flex; flex-direction: column; }
.rec-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 4px; border-bottom: 1px solid var(--line-soft);
  text-decoration: none; transition: background .15s;
}
.rec-row:first-child { border-top: 1px solid var(--line-soft); }
.rec-row:hover { background: var(--surface); }
.rec-row h3 { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; }
.rec-row .side { color: var(--faint); font-size: 14px; text-align: right; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--blue); }
.status-pill.err { color: var(--danger); }

@media (max-width: 880px) {
  .hero-rec { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 32px 20px; gap: 24px; }
  .hero-rec::before { left: 50%; top: 0; transform: translate(-50%, -30%); }
  .hero-rec p { margin-inline: auto; }
  .hero-rec .row { justify-content: center; }
  .orb { --s: 124px; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .figures { grid-template-columns: 1fr; }
  .figure + .figure { border-left: 0; border-top: 1px solid var(--line-soft); }
  .figure { flex-direction: row; align-items: baseline; gap: 12px; padding: 16px 18px; }
  .figure b { font-size: 26px; min-width: 56px; }
}

/* ---------- Запись ---------- */
.rec-stage { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.consent { display: flex; flex-direction: column; gap: 18px; }
.consent ul { margin: 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.rec-live { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rec-title-input { text-align: center; font-size: 18px; font-weight: 500; background: transparent; border-color: transparent; max-width: 520px; }
.rec-title-input:hover { border-color: var(--line); }
.timer { font: 500 clamp(52px, 10vw, 84px)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.rec-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 124, 124, .15); animation: pulse 1.4s ease-in-out infinite; }
.dot.paused { background: var(--warn); box-shadow: 0 0 0 4px rgba(242, 183, 102, .15); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.wave { width: 100%; height: 150px; display: block; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); }
.rec-controls { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.round {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .1s;
}
.round:hover { background: var(--raised); }
.round:active { transform: scale(.96); }
.round.stop { width: 80px; height: 80px; background: var(--grad); border: 0; color: #fff; box-shadow: 0 12px 34px rgba(91, 149, 255, .35); }
.round.stop .i { width: 26px; height: 26px; }
.control-label { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.autosave { font-size: 14px; color: var(--faint); }

#recbar {
  position: fixed; z-index: 45; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-size: 14px;
}

/* ---------- Карточка разговора ---------- */
.conv-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.conv-title { display: flex; align-items: flex-start; gap: 8px; }
.conv-title h1 { cursor: text; border-radius: 8px; }
.conv-title h1:hover { background: var(--surface); }
.conv-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.conv-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.player {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 14px;
  padding: 10px 16px 10px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-soft);
  position: sticky; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 20; margin-bottom: 26px;
}
.player .play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: grid; place-items: center; cursor: pointer; }
.player .play .i { stroke: var(--bg); }
.player .time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 92px; }
.seek { position: relative; height: 28px; cursor: pointer; display: flex; align-items: center; }
.seek-track { position: relative; width: 100%; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.seek-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--grad); }
.seek-marks { position: absolute; inset: 0; pointer-events: none; }
.seek-marks i { position: absolute; top: 4px; width: 2px; height: 6px; border-radius: 1px; background: var(--violet); opacity: .8; }
.speed { border: 0; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .player { grid-template-columns: auto 1fr auto; }
  .player .time { grid-column: 1 / -1; order: 5; min-width: 0; }
}

.summary { font-size: 17px; line-height: 1.65; max-width: 68ch; color: #e4e4ea; }
.legend { font-size: 14px; color: var(--faint); margin-top: 12px; }
.kind-block { padding-top: 22px; border-top: 1px solid var(--line-soft); }
.kind-block > h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; margin-bottom: 12px; }
.kind-block > h2 .count { color: var(--faint); font-weight: 400; font-size: 14px; }
.kdot { width: 8px; height: 8px; border-radius: 50%; background: var(--k, var(--violet)); flex: none; }
.items { display: flex; flex-direction: column; gap: 4px; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 10px 8px 12px; border-radius: 12px; align-items: start; }
.item:hover { background: var(--surface); }
.item.no-check { grid-template-columns: 1fr auto; }
.item .txt { font-size: 15.5px; }
.item.done .txt { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.item .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 14px; color: var(--muted); }
.item q { display: block; margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 14px; quotes: '«' '»'; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; font-size: 14px; background: var(--raised); color: var(--muted); }
.tag.ai { color: #c9bdff; background: rgba(154, 134, 255, .12); }
.tag.due { color: #cfe0ff; background: rgba(91, 149, 255, .12); }
.tag.late { color: #ffc9c9; background: rgba(255, 124, 124, .12); }
.tc {
  border: 0; background: transparent; padding: 0; color: var(--blue); font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.tc:hover { text-decoration: underline; }
.item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.transcript { display: flex; flex-direction: column; }
.seg { display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 14px; padding: 10px 8px; border-radius: 12px; }
.seg:hover { background: var(--surface); }
.seg.flash { background: rgba(154, 134, 255, .14); transition: background 1.2s; }
.seg.current .seg-text { color: var(--text); }
.seg .seg-text { color: #d7d7de; line-height: 1.6; }
.seg .speaker { display: block; font-size: 12.5px; font-weight: 600; color: var(--violet); margin-bottom: 2px; }
.seg .orig { display: block; margin-top: 4px; font-size: 14px; color: var(--faint); }
.seg .tc { padding-top: 3px; align-self: start; }

/* ---------- Цели ---------- */
.goal-list { display: flex; flex-direction: column; gap: 16px; }
.goal { padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 14px; }
.goal.done { opacity: .7; }
.goal-top { display: flex; align-items: flex-start; gap: 12px; }
.goal-top h3 { flex: 1; min-width: 0; font-size: 17px; }
.goal-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.progress { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.progress-track { flex: 1; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 6px; transition: width .5s var(--ease); }
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: flex-start; gap: 4px; padding: 6px 4px; border-radius: 10px; }
.step:hover { background: var(--raised); }
.step .check { flex: 1; min-width: 0; }
.step.done .step-text { color: var(--faint); text-decoration: line-through; }
.step .icon-btn { opacity: 0; width: 30px; height: 30px; }
.step:hover .icon-btn, .step .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .step .icon-btn { opacity: 1; } }
.add-step { display: flex; gap: 8px; }
.add-step .input { min-height: 38px; }
.suggest { padding: 16px 18px; border-radius: var(--r); border: 1px solid rgba(154, 134, 255, .3); background: rgba(154, 134, 255, .06); display: flex; flex-direction: column; gap: 8px; }
.goal-form { display: grid; grid-template-columns: 1fr 170px auto; gap: 10px; }
@media (max-width: 640px) {
  .goal-form { grid-template-columns: 1fr; }
  .goal { padding: 18px; }
  .goal-top { flex-direction: column; gap: 10px; }
}
.menu-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Чат ---------- */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 220px); max-width: 820px; }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-bottom: 20px; }
.msg { max-width: 92%; line-height: 1.6; }
.msg.user { align-self: flex-end; background: var(--raised); padding: 10px 16px; border-radius: 18px 18px 6px 18px; }
.msg.assistant { align-self: flex-start; }
.msg.assistant p + p, .msg.assistant p + ul, .msg.assistant ul + p { margin-top: 10px; }
.msg.assistant ul, .msg.assistant ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.cite {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 2px; padding: 0 7px; border-radius: 6px; vertical-align: baseline;
  font-size: 12.5px; background: rgba(91, 149, 255, .14); color: #cfe0ff; text-decoration: none; white-space: nowrap;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.cite:hover { background: rgba(91, 149, 255, .26); }
.composer {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: flex-end;
  padding: 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
}
@media (max-width: 880px) { .composer { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; min-height: 44px; max-height: 180px; padding: 11px 10px; outline: none; line-height: 1.5; }
.composer .btn { min-height: 44px; width: 44px; padding: 0; border-radius: 12px; }
.prompts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.prompt { text-align: left; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line-soft); background: var(--surface); cursor: pointer; color: var(--text); transition: border-color .15s; }
.prompt:hover { border-color: var(--violet); }
@media (max-width: 560px) { .prompts { grid-template-columns: 1fr; } }
.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }

/* ---------- История ---------- */
.search-box { position: relative; }
.search-box .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box .input { padding-left: 42px; min-height: 50px; font-size: 16px; border-radius: 14px; }
.result { display: block; padding: 12px 8px; border-bottom: 1px solid var(--line-soft); text-decoration: none; border-radius: 0; }
.result:hover { background: var(--surface); }
.result .src { font-size: 14px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.result mark { background: rgba(154, 134, 255, .3); color: var(--text); border-radius: 3px; padding: 0 2px; }
.month-label { font-size: 14px; color: var(--muted); margin: 22px 0 8px; }
.month-label:first-child { margin-top: 0; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h2 { text-transform: capitalize; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar .dow { text-align: center; font-size: 14px; color: var(--faint); padding-bottom: 4px; }
.day {
  aspect-ratio: 1 / 1; max-width: 100%; border-radius: 12px; border: 1px solid var(--line-soft); background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: default; font-variant-numeric: tabular-nums;
}
.day.out { opacity: 0; pointer-events: none; }
.day.has { cursor: pointer; color: var(--text); background: var(--surface); }
.day.has:hover { border-color: var(--violet); }
.day.sel { border-color: var(--violet); background: rgba(154, 134, 255, .12); }
.day.today { box-shadow: inset 0 0 0 1px var(--faint); }
.day .dots { display: flex; gap: 3px; height: 5px; }
.day .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--grad); }

/* ---------- Настройки ---------- */
.settings { max-width: 640px; display: flex; flex-direction: column; gap: 20px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.status-ok { color: var(--ok); }
.status-bad { color: var(--warn); }

/* ---------- Модальные окна и уведомления ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(10, 10, 14, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .18s ease;
}
.modal {
  width: 100%; max-width: 480px; max-height: 100%; overflow: auto; padding: 26px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 16px; animation: rise .22s var(--ease);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.uploadbar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.uploadbar div { height: 100%; width: 0; background: var(--grad); transition: width .2s; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

#toasts {
  position: fixed; z-index: 70; right: max(20px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px;
  background: var(--raised); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); font-size: 14px;
  animation: rise .22s var(--ease);
}
.toast.err { border-color: rgba(255, 124, 124, .45); }
.toast.ok { border-color: rgba(95, 211, 166, .4); }
@media (max-width: 880px) {
  #toasts { left: 16px; right: 16px; align-items: stretch; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Этапы обработки ---------- */
.pipeline { display: flex; flex-direction: column; gap: 0; max-width: 460px; }
.pstep { display: grid; grid-template-columns: 28px 1fr; gap: 14px; align-items: start; padding: 10px 0; color: var(--faint); }
.pstep .mark { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; }
.pstep.done { color: var(--muted); }
.pstep.done .mark { background: var(--raised); border-color: var(--raised); }
.pstep.done .mark .i { stroke: var(--ok); width: 16px; height: 16px; stroke-width: 2.4; }
.pstep.now { color: var(--text); }
.pstep.now .mark { border-color: transparent; }
.pstep small { display: block; color: var(--faint); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Офлайн и очередь отправки ---------- */
#netbar {
  position: fixed; z-index: 44; left: 50%; transform: translateX(-50%);
  top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  background: var(--raised); border: 1px solid rgba(242, 183, 102, .35); color: #f3d6a8; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
#recbar:not([hidden]) ~ #netbar { top: calc(64px + env(safe-area-inset-top, 0px)); }
.queue { display: flex; flex-direction: column; }
.queue-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line-soft); }
.queue-row:last-child { border-bottom: 1px solid var(--line-soft); }
.queue-row .grow { flex: 1; min-width: 0; }
.queue-row b { font-weight: 500; }
.dot { flex: none; }
.queue .section-title { flex-wrap: wrap; gap: 2px 12px; }
.queue .section-title h2 { white-space: nowrap; }

.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; color: var(--muted); }
.contact-row b { color: var(--text); font-weight: 500; }

/* Clearly marked browser-only demo. */
.demo-banner{position:relative;z-index:30;padding:12px 24px;background:#29263b;color:#e2dbff;border-bottom:1px solid #615784;font:14px/1.5 system-ui,sans-serif;text-align:center}
.rail{top:66px!important;height:calc(100dvh - 66px)!important}
#view{padding-top:36px}
[hidden]{display:none!important}
@media(max-width:760px){.demo-banner{padding:12px 18px;text-align:left}#view{padding-top:24px}.goal-top,.goal-meta{flex-wrap:wrap}.goal-form{grid-template-columns:1fr!important}.goal-form .input{min-width:0;width:100%}.set-row{flex-wrap:wrap;gap:12px}.conv-title h1{overflow-wrap:anywhere}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

:root{--faint:#a1a2b0}body{font-size:16px}.btn.primary{color:#14151b;font-weight:600}.input::placeholder{color:#a1a2b0}.btn,.icon-btn,.chip{min-height:44px}
