/* =====================================================================
   Yamir — «интеллектуальный тактильный минимализм».
   Спокойный «бумажный» (днём) или «графитовый» (вечером) фон, живая
   сфера ассистента вместо лица, ответы-карточки (Bento) прямо в чате.
   Шрифт Manrope и иконки Lucide лежат локально — внешних запросов нет.
   ===================================================================== */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/static/fonts/manrope-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/static/fonts/manrope-cyrillic-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/static/fonts/manrope-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/static/fonts/manrope-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- палитра: светлая тема (дневной фокус) ---------- */
:root {
  color-scheme: light;
  --bg: #F8F8F6;
  --surface: #FFFFFF;
  --border: #E5E5E0;
  --border-strong: #D6D6CF;
  --bubble: #EFECE6;
  --text: #18181B;
  --text-2: #52525B;
  --text-3: #8A8A93;
  --accent: #4F46E5;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --g1: #6366F1;
  --g2: #14B8A6;
  --ok: #059669;
  --warn: #B45309;
  --warn-soft: rgba(217, 119, 6, 0.10);
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.04), 0 4px 16px rgba(24, 24, 27, 0.04);
  --shadow-lift: 0 2px 4px rgba(24, 24, 27, 0.05), 0 12px 32px rgba(24, 24, 27, 0.08);
  --glow-alpha: 0.35;

  --font: "Manrope", -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 18px;
  --r-sm: 12px;
  --rail-w: 232px;
  --today-w: 320px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- тёмная тема (вечерний комфорт) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111113;
    --surface: #1A1A1E;
    --border: #2A2A30;
    --border-strong: #3A3A42;
    --bubble: #242429;
    --text: #F4F4F5;
    --text-2: #B4B4BC;
    --text-3: #7A7A85;
    --accent: #818CF8;
    --accent-ink: #111113;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --g1: #818CF8;
    --g2: #2DD4BF;
    --ok: #34D399;
    --warn: #FBBF24;
    --warn-soft: rgba(251, 191, 36, 0.10);
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.10);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.45);
    --glow-alpha: 0.45;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --surface: #1A1A1E;
  --border: #2A2A30;
  --border-strong: #3A3A42;
  --bubble: #242429;
  --text: #F4F4F5;
  --text-2: #B4B4BC;
  --text-3: #7A7A85;
  --accent: #818CF8;
  --accent-ink: #111113;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --g1: #818CF8;
  --g2: #2DD4BF;
  --ok: #34D399;
  --warn: #FBBF24;
  --warn-soft: rgba(251, 191, 36, 0.10);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.10);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.45);
  --glow-alpha: 0.45;
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: var(--app-h, 100%); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
button { font: inherit; color: inherit; }
.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- каркас: навигация | главное | сегодня ---------- */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--today-w);
}
.main { min-width: 0; min-height: 0; display: flex; }

/* ---------- навигация ---------- */
.rail {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;   /* окно не развёрнуто — панель слева прокручивается */
}
.rail > * { flex-shrink: 0; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 2px; width: 100%; margin: 0; color: inherit; font: inherit; text-align: left; }
.rail-brand .orb[data-to-bm] { cursor: pointer; flex: none; -webkit-tap-highlight-color: transparent; transition: transform .18s; }
.rail-brand .orb[data-to-bm]:hover { transform: scale(1.12); }
.rail-brand .orb[data-to-bm]:focus-visible { outline: 2px solid var(--accent, #5b5bd6); outline-offset: 3px; border-radius: 50%; }
.rail-hint { padding: 0 10px 14px 48px; font-size: 11.5px; line-height: 1.3; color: var(--text-3); }
.rail-name { flex: 1; background: none; border: 0; padding: 4px 0; margin: 0; color: inherit; font: inherit; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; text-align: left; cursor: pointer; border-radius: 8px; }
.rail-name:hover { opacity: .75; }
.rail-name:focus-visible { outline: 2px solid var(--accent, #5b5bd6); outline-offset: 2px; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tab {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2);
  font-weight: 600; font-size: 14.5px; text-align: left; cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.tab:hover { background: var(--bubble); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 11px; font: 700 12px/22px var(--font); text-align: center;
  background: var(--accent); color: var(--accent-ink);
}
.badge.danger { background: var(--danger); color: #fff; }
.badge:empty { display: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.chip-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-3); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.chip-btn:hover { background: var(--bubble); color: var(--text); }

/* ---------- разделы ---------- */
.view { display: none; flex: 1; min-width: 0; min-height: 0; flex-direction: column; padding: 28px 32px 24px; }
.view.active { display: flex; animation: fade-up 0.32s var(--ease); }
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.view-head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
/* «Назад» в шапке настроек: в правом верхнем углу — там же, где на телефоне кнопка настроек; шапка не прокручивается */
.view-head-back { position: sticky; top: 0; z-index: 3; }
.view-back { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.view-back:hover { background: var(--bubble); }
.view-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.lead { color: var(--text-2); margin: 0 0 18px; max-width: 68ch; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 2px 16px; -webkit-overflow-scrolling: touch; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- чат ---------- */
#view-chat { padding: 0; align-items: center; }
#view-chat > * { width: 100%; max-width: 780px; padding-left: 28px; padding-right: 28px; }

.presence { display: flex; align-items: center; gap: 16px; padding-top: 22px; padding-bottom: 14px; }
.presence-name { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.presence-status { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.presence-tools { margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.down { background: var(--danger); }

.log { flex: 1; min-height: 0; overflow-y: auto; padding-top: 8px; padding-bottom: 12px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

.msg { margin: 0 0 18px; animation: msg-in 0.36s var(--ease) both; }
.msg-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .msg-body {
  max-width: 82%;
  background: var(--bubble); color: var(--text);
  padding: 10px 15px; border-radius: var(--r) var(--r) 6px var(--r);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.assistant { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 12px; }
.msg.assistant .orb { grid-row: span 2; margin-top: 2px; }
.msg.assistant .msg-body { font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.system { text-align: center; color: var(--text-3); font-size: 13px; }
.msg.system .msg-body { display: inline-block; max-width: 520px; }
.msg.error .msg-body { color: var(--warn); }
.msg.error .msg-body::before { content: "⚠ "; }

/* «думает» */
.thinking-row { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.dots { display: inline-flex; gap: 5px; }
.dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  animation: dot 1.2s var(--ease) infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
.thinking-time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.thinking-note { color: var(--text-3); font-size: 13px; margin-top: 6px; }

/* ответ пишется: мягкий мигающий курсор в конце */
.msg-body.streaming::after {
  content: ""; display: inline-block; width: 8px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em;
  border-radius: 2px; background: linear-gradient(180deg, var(--g1), var(--g2)); animation: blink 0.9s infinite;
}

/* плавное «проявление» ответа */
.reveal { animation: reveal 0.6s var(--ease) both; }

/* ---------- Bento-карточки (в чате и в разделах) ---------- */
.card, .bento-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.bento-card { padding: 14px 16px; margin: 4px 0 0; animation: card-in 0.42s var(--ease) both; white-space: normal; }
.msg-body.cards { white-space: normal; display: flex; flex-direction: column; }
.card-top .row-sub { margin-top: 2px; }
.msg .bento-card + .bento-card { margin-top: 10px; }
.card { padding: 16px 18px; }
.card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip-ic {
  width: 34px; height: 34px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.chip-ic .ic { width: 18px; height: 18px; }
.chip-ic.warn { background: var(--warn-soft); color: var(--warn); }
.chip-ic.danger { background: var(--danger-soft); color: var(--danger); }
.chip-ic.ok { background: rgba(5, 150, 105, 0.1); color: var(--ok); }
.card-titles { min-width: 0; flex: 1; }
.card-kicker { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.card-name { font-weight: 700; font-size: 15.5px; overflow-wrap: anywhere; }
.card-time { font-size: 12px; color: var(--text-3); margin-left: auto; white-space: nowrap; }
.card-body { margin-top: 10px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.card-body.quiet { color: var(--text-2); }
.card textarea, .bento-card textarea {
  width: 100%; min-height: 110px; margin-top: 10px; resize: vertical;
  font: 15px/1.55 var(--font); color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px;
}
.card textarea:focus, .bento-card textarea:focus { outline: none; border-color: var(--accent); }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.card-title .ic { color: var(--accent); }
.card.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.done-note { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--ok); font-weight: 600; font-size: 14px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.08s var(--ease);
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bubble); color: var(--text); }
.btn.danger { color: var(--danger); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bubble); color: var(--text); }

/* ---------- строка ввода ---------- */
.composer {
  display: flex; align-items: center; gap: 10px;
  padding-top: 10px; padding-bottom: 6px;
}
.field { position: relative; flex: 1; min-width: 0; display: flex; }
.field input {
  flex: 1; min-width: 0; width: 0; height: 54px;
  padding: 0 20px; border-radius: 27px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 500 16px var(--font);
  box-shadow: var(--shadow);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.round {
  flex: none; width: 54px; height: 54px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer;
  transition: transform 0.12s var(--ease), filter 0.16s var(--ease), background-color 0.2s var(--ease), opacity 0.2s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.round .ic { width: 22px; height: 22px; stroke-width: 2; }
.round:active { transform: scale(0.94); }
.mic { position: relative; background: var(--accent); color: var(--accent-ink); }
.mic::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, var(--g1), var(--g2), var(--g1));
  opacity: 0; filter: blur(6px); transition: opacity 0.3s var(--ease);
}
.mic .ico-stop { display: none; }
.mic.recording::before { opacity: 0.85; animation: spin 2.4s linear infinite; }
.mic.recording { background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; transform: scale(1.04); }
.mic.recording .ico-mic { display: none; }
.mic.recording .ico-stop { display: block; fill: currentColor; stroke: none; }
.mic.busy { opacity: 0.6; cursor: progress; }
.mic.warming { background: var(--bubble); color: var(--text-3); }
.mic.warming::after {
  content: ""; position: absolute; top: 9px; right: 11px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn); animation: blink 1s infinite;
}
.mic.failed { background: var(--bubble); color: var(--warn); }
.send { background: var(--bubble); color: var(--text-3); }
.composer.has-text .send { background: var(--accent); color: var(--accent-ink); }
.send:disabled { cursor: default; }
.send.busy .ic { animation: blink 1s infinite; }

.rec {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 0 8px 0 20px; border-radius: 27px;
  background: var(--surface); border: 1px solid transparent;
  background-image: linear-gradient(var(--surface), var(--surface)), linear-gradient(90deg, var(--g1), var(--g2));
  background-origin: border-box; background-clip: padding-box, border-box;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; animation: blink 1s infinite; }
.rec-time { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; flex: none; }
.rec-wave { flex: 1; min-width: 0; height: 30px; }
.rec-label { font-size: 13px; font-weight: 600; color: var(--text-2); flex: none; }
.rec-cancel { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--bubble); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.rec.transcribing .rec-dot { background: var(--accent); }
.rec.transcribing .rec-wave { opacity: 0.35; }

.hint-line { min-height: 22px; padding-bottom: 10px; font-size: 12.5px; color: var(--text-3); text-align: center; transition: opacity 0.3s; }

/* ---------- живая сфера ---------- */
.orb { position: relative; flex: none; width: var(--s, 56px); height: var(--s, 56px); border-radius: 50%;
  transform: scale(calc(1 + var(--lvl, 0) * 0.22)); transition: transform 0.09s linear, filter 0.4s var(--ease), opacity 0.4s var(--ease); }
.orb-lg { --s: 64px; }
.orb-xs { --s: 28px; }
.orb > i { position: absolute; border-radius: 50%; display: block; }
.orb-core {
  inset: 0;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 38%),
    conic-gradient(from 0deg, var(--g1), var(--g2), #A78BFA, var(--g1));
  animation: spin 16s linear infinite;
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, 0.12);
}
.orb-glow {
  inset: -38%;
  background: radial-gradient(closest-side, var(--g1), transparent 72%);
  opacity: var(--glow-alpha); filter: blur(10px);
  animation: breathe 6s ease-in-out infinite;
}
.orb-grain {
  inset: 0; opacity: 0.32; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 1.1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 120px 120px;
}
.orb[data-state="listening"] .orb-core { animation-duration: 4s; }
.orb[data-state="listening"] .orb-glow { opacity: 0.7; animation-duration: 1.6s; }
.orb[data-state="thinking"] .orb-core { animation-duration: 1.8s; }
.orb[data-state="thinking"] .orb-glow { opacity: 0.6; animation: breathe 1.1s ease-in-out infinite; }
.orb[data-state="speaking"] { animation: speak 0.7s var(--ease) 3; }
.orb[data-state="speaking"] .orb-glow { opacity: 0.75; }
.orb[data-state="offline"] { filter: grayscale(1); opacity: 0.45; }
.orb[data-state="offline"] .orb-core, .orb[data-state="offline"] .orb-glow { animation: none; }
.msg .orb { --s: 28px; }
.msg .orb .orb-core { animation-duration: 24s; }

/* ---------- «Сегодня»: Bento-плитки ---------- */
.today {
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;   /* прокручивается только тело, подвал с архивом закреплён */
}
.today-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 22px 16px; scrollbar-width: thin; }
.today-foot { flex: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 14px 12px; border-top: 1px solid var(--border); background: var(--bg); }
.today-foot .chip-btn { flex: 1 1 auto; }
.today-foot .badge, .rail-foot .badge { margin-left: auto; }
.today-head { margin-bottom: 18px; }
.today-date { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.today-greet { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.bento { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 108px; padding: 14px 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tile.w2 { grid-column: span 2; }
.tile-k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tile-k .ic { width: 17px; height: 17px; color: var(--accent); }
.tile-v { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-top: auto; font-variant-numeric: tabular-nums; }
.tile-line { font-size: 15px; font-weight: 600; margin-top: auto; overflow-wrap: anywhere; }
.tile-s { font-size: 12.5px; color: var(--text-3); }
.tile.hot { border-color: transparent; background-image: linear-gradient(var(--surface), var(--surface)), linear-gradient(135deg, var(--g1), var(--g2)); background-origin: border-box; background-clip: padding-box, border-box; }
.tile.hot .tile-v { background: linear-gradient(135deg, var(--g1), var(--g2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- списки в «Делах» и «Защите» ---------- */
.bento-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; overflow-wrap: anywhere; }
.row-sub.overdue { color: var(--danger); font-weight: 600; }
.check {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 8px;
  border: 1.5px solid var(--border-strong); background: transparent; cursor: pointer;
  display: grid; place-items: center; color: transparent;
}
.check .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.check:hover { border-color: var(--accent); color: var(--accent); }
.check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.prio { color: var(--danger); }
.star { color: var(--warn); }
.empty { color: var(--text-3); font-size: 14px; padding: 10px 0; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 6px 0 10px; }
.logline { font: 12.5px/1.55 var(--mono); color: var(--text-2); padding: 6px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.logline .t { color: var(--text-3); }
.logline .r { color: var(--accent); }
.o-blocked, .o-denied, .o-failed { color: var(--danger); }
.o-approved, .o-executed, .o-finished, .o-safe { color: var(--ok); }

/* ---------- всплывающее сообщение ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lift);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  max-width: min(92vw, 520px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.has-action { pointer-events: auto; }
.toast-undo { margin-left: 10px; background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* выполненные дела: можно вернуть */
.done-list details { margin-top: 10px; }
.done-list summary { cursor: pointer; color: var(--text-2); font-size: 14px; font-weight: 600; }
.done-list .done-row { opacity: 0.8; }
.done-list .done-row .row-title { text-decoration: line-through; }
.done-note .undo-link { margin-left: 4px; min-height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------- прокрутка ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- анимации ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { transform: scale(0.94); } 50% { transform: scale(1.06); } }
@keyframes speak { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.12); } }
@keyframes dot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.45; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .orb { transform: none !important; }
}

/* ---------- узкий компьютер: без колонки «Сегодня» ---------- */
@media (max-width: 1240px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .today { display: none; }
}
/* ---------- планшет: навигация только иконками ---------- */
@media (max-width: 1000px) and (min-width: 761px) {
  :root { --rail-w: 76px; }
  .rail { padding: 18px 10px; align-items: center; }
  .rail-brand { padding: 4px 0 16px; justify-content: center; }
  .rail-hint { display: none; }
  .rail-name, .tab span, .chip-btn span { display: none; }
  .tab { justify-content: center; padding: 12px; }
  .badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; }
  .chip-btn { justify-content: center; }
}

/* =====================================================================
   ТЕЛЕФОН (до 760 px): сфера и имя сверху, переписка, строка ввода,
   внизу — панель разделов. Учитываются вырез экрана и полоска «Домой»,
   клавиатура поджимает окно (--app-h) и прячет панель.
   ===================================================================== */
@media (max-width: 760px) {
  :root { --tab-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); }
  body { overscroll-behavior: none; font-size: 15px; }
  .app { display: block; height: 100%; padding-bottom: calc(var(--tab-h) + var(--safe-b)); }
  .main { height: 100%; }
  .today { display: none; }

  .rail {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    flex-direction: row; padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + var(--safe-b)) max(8px, env(safe-area-inset-right, 0px));
    border-right: 0; border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  }
  .rail-brand, .rail-hint, .rail-foot { display: none; }
  .tabs { flex-direction: row; flex: 1; gap: 2px; }
  .tab {
    flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 3px;
    height: 50px; padding: 0 2px; border-radius: 14px;
    font-size: 10.5px; font-weight: 600; text-align: center;
  }
  .tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tab .ic { width: 22px; height: 22px; }
  .tab.active { background: transparent; }
  .tab.active .ic { stroke-width: 2.2; }
  .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 17px; height: 17px; padding: 0 5px; font-size: 10.5px; line-height: 17px; border-radius: 9px; }

  .view { padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 10px; }
  .view-head h1 { font-size: 24px; }
  .view-actions { margin-left: 0; width: 100%; }
  .view-actions .btn { flex: 1; }
  .lead { font-size: 14px; margin-bottom: 14px; }

  #view-chat > * { padding-left: 14px; padding-right: 14px; }
  .presence { gap: 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .orb-lg { --s: 42px; }
  .presence-name { font-size: 17px; }
  .presence-status { font-size: 12.5px; }
  .msg { margin-bottom: 14px; }
  .msg.user .msg-body { max-width: 88%; }
  .msg.assistant { grid-template-columns: 24px minmax(0, 1fr); column-gap: 10px; }
  .msg .orb { --s: 24px; }
  .msg.assistant .msg-body { font-size: 15.5px; }
  .composer { gap: 8px; padding-top: 8px; padding-bottom: 4px; }
  .field input { height: 50px; border-radius: 25px; padding: 0 16px; }
  .round { width: 50px; height: 50px; }
  .rec { border-radius: 25px; padding-left: 14px; gap: 8px; }
  .rec-label { display: none; }
  .hint-line { min-height: 18px; padding-bottom: 6px; font-size: 12px; }

  .card { padding: 14px; }
  .actions .btn { flex: 1 1 40%; min-height: 46px; }
  .bento-grid { grid-template-columns: 1fr; }
  .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 14px); }

  body.kbd .app { padding-bottom: 0; }
  body.kbd .rail { display: none; }
  body.kbd .presence { display: none; }
}
@media (min-width: 761px) { .only-phone { display: none; } }
@media (max-width: 360px) {
  /* узкий телефон: «Знакомство» — в «Настройках», в шапке место для «Стиля» и «Темы» */
  .presence-tools [data-intro] { display: none; }
  .tab { font-size: 9.5px; }
  .tab .ic { width: 20px; height: 20px; }
}
@media (display-mode: standalone) {
  body { -webkit-user-select: none; user-select: none; }
  .msg-body, .card-body, input, textarea { -webkit-user-select: text; user-select: text; }
}
@media (max-width: 380px) { .actions .btn { flex-basis: 100%; } }

/* компаньон: приветствие и подсказки */
.card-text { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-2, inherit); white-space: normal; }
.welcome-card .card-text b { font-weight: 600; color: var(--text); }

/* «Стоп» вместо отправки, пока Yamir думает */
.send.stop, .composer.has-text .send.stop { background: var(--text); color: var(--bg, #fff); cursor: pointer; }
.send.stop .ic { animation: none; width: 14px; height: 14px; fill: currentColor; }
.send.stop:disabled { opacity: 0.5; cursor: progress; }
.msg.stopped .msg-body { color: var(--text-2); }

/* ---------------------------------------------------------- «Настройки» */
.set-card { margin-bottom: 14px; max-width: 760px; }
.set-card .row-sub { margin-top: 6px; line-height: 1.5; }
.set-card .card-title .row-sub { margin: 0 0 0 6px; font-weight: 500; }
.seg { display: inline-flex; gap: 4px; padding: 4px; margin-top: 12px; border-radius: 14px; background: var(--bubble); flex-wrap: wrap; }
.seg.small { margin-top: 0; }
.seg-btn { border: 0; background: transparent; color: var(--text-2); font: 600 14px/1 inherit; padding: 10px 16px; border-radius: 10px; cursor: pointer; }
.seg.small .seg-btn { padding: 8px 12px; font-size: 13px; }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.voice-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1; min-width: 0; }
.voice-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.voice-row-label { width: 76px; flex: none; font-weight: 600; font-size: 14px; color: var(--text-2); }
.wake-form { display: flex; gap: 8px; margin-top: 12px; }
.wake-input { flex: 1; min-width: 0; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 14px; font: 16px/1 inherit; }
.wake-input:focus { outline: none; border-color: var(--accent); }
.wake-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wake-chip { border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; background: var(--surface); width: auto; }
.wake-chip.on { color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .voice-row { flex-direction: column; align-items: stretch; gap: 6px; } .voice-row-label { width: auto; } }

/* Кнопка «Одна кнопка» слева вверху полного пульта */
.to-bm { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 600 13px/1 inherit; cursor: pointer; white-space: nowrap; }
.to-bm:hover { border-color: var(--accent); color: var(--accent); }
.to-bm .ic { width: 15px; height: 15px; color: var(--accent); }
.rail-top { display: flex; padding: 0 10px 12px; }
.to-bm-float { display: none; }
body.ui-button .to-bm-float { display: none !important; }
@media (max-width: 1000px) and (min-width: 761px) { .rail-top { padding: 0 0 12px; justify-content: center; } .to-bm span { display: none; } .to-bm { width: 40px; padding: 0; justify-content: center; } }
@media (max-width: 760px) {
  .rail-top { display: none; }
  /* Заглянули в полный вид из «Одной кнопки» — вернуться можно с любого раздела: кнопка слева вверху */
  body.bm-peek .to-bm-float { display: inline-flex; position: fixed; z-index: 40; top: calc(8px + env(safe-area-inset-top, 0px)); left: 12px;
    box-shadow: 0 6px 20px rgba(30, 20, 80, .18); }
  body.bm-peek .presence .to-bm { display: none; }
  body.bm-peek #view-chat .presence { padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  body.bm-peek .view:not(#view-chat) { padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
}
@media (min-width: 761px) { .presence .to-bm { display: none; } }
.presence .to-bm { width: 40px; height: 40px; padding: 0; justify-content: center; flex: none; }
.presence .to-bm span { display: none; }
.presence .to-bm .ic { width: 18px; height: 18px; }
.presence-tools { display: flex; flex-wrap: nowrap; align-items: center; }
.voice { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 4px 4px 0; }
.voice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.voice-pick { flex: 1; display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text); font: 600 14px/1 inherit; padding: 10px 12px; cursor: pointer; text-align: left; }
.voice-pick .ic { width: 16px; height: 16px; color: var(--accent); }
.voice-play .ic { width: 16px; height: 16px; }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.set-line > .row-sub { margin: 0; }
.set-radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; line-height: 1.45; }
.set-radio input { margin-top: 4px; accent-color: var(--accent); }
.set-row { padding: 10px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; }
.meter { height: 6px; border-radius: 4px; background: var(--bubble); margin-top: 6px; overflow: hidden; max-width: 320px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter i.hot { background: var(--warn); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.stat-grid div { background: var(--bubble); border-radius: var(--r-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-grid b { font-size: 20px; }
.stat-grid span { font-size: 12px; color: var(--text-3); }
@media (max-width: 760px) { .tab-settings { display: none !important; } }

/* «Аккаунт»: кто видит данные и действия с ними */
.acc-privacy { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.acc-privacy .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--ok); }
.acc-data { margin-top: 4px; }

/* «Назад в Я-Мир» — всплывает на месте нажатой «Все дела» */
.back-here { position: fixed; z-index: 1200; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent, #4f46e5); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.28); animation: back-here-in .15s ease-out; }
.back-here:hover { filter: brightness(1.08); }
@keyframes back-here-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

/* ---------- чаты: список под вкладкой «Чаты» (как у Claude слева) ---------- */
.chats { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px 12px; padding-left: 8px; border-left: 1px solid var(--border); max-height: 38vh; overflow-y: auto; scrollbar-width: thin; }
.chat-new { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; text-align: left; }
.chat-new:hover { background: var(--accent-soft); }
.chat-item { display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 10px; border-radius: var(--r-sm); color: var(--text-2);
  font-size: 13.5px; cursor: pointer; }
.chat-item:hover { background: var(--bubble); color: var(--text); }
.chat-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chat-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-del { display: none; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; }
.chat-item:hover .chat-del, .chat-item:focus-within .chat-del { display: inline-flex; align-items: center; justify-content: center; }
.chat-del:hover { color: var(--danger); background: var(--bubble); }
.chat-del .ic { width: 15px; height: 15px; }
/* узкая панель или телефон: список в шапке чата вместо левой панели */
.chatbar { display: none; gap: 8px; padding: 8px 12px 0; }
.chatbar select { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bubble); color: var(--text); font: inherit; }
.chatbar button { flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
@media (max-width: 1000px) {
  .chats { display: none; }
  .chatbar { display: flex; }
}
@media (max-width: 760px) { .rail { overflow: visible; } }
.chat-archive { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.chat-archive summary { cursor: pointer; padding: 6px 10px; color: var(--text-3); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.chat-archive summary b { margin-left: 4px; font-weight: 600; opacity: .8; }
.chat-archive .chat-item { opacity: .8; }

/* ---------- «Агенты» ---------- */
.soon-chip { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.agent-head { display: flex; align-items: center; gap: 12px; }
.agent-head > div { flex: 1; min-width: 0; }
.agent-ava { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 20px; background: var(--accent); color: var(--accent-ink); }
.agent-feats { margin: 12px 0 10px; padding-left: 20px; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.wish-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.wish-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.wish-chip:hover { background: var(--bubble); }
.wish-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#wishText { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.wish-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.wish-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wish-count { padding: 4px 10px; border-radius: 999px; background: var(--bubble); font-size: 13px; }

/* Проекты, значки чатов, меню «⋯» */
.ava { flex: none; width: 24px; height: 24px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; object-fit: cover;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; line-height: 1;
  /* спокойный оттенок + цвета текущего скина: на светлых и тёмных темах читается одинаково */
  background: color-mix(in srgb, hsl(var(--h, 240) 42% 56%) 24%, var(--surface, #fff));
  color: color-mix(in srgb, hsl(var(--h, 240) 45% 46%) 78%, var(--text, #222)); }
img.ava { background: var(--bubble); padding: 0; }
.chat-top { display: flex; flex-wrap: wrap; gap: 2px; }
.chat-more { display: none; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; }
.chat-item:hover .chat-more, .chat-item:focus-within .chat-more, .proj-head:hover .chat-more, .proj-head:focus-within .chat-more { display: inline-flex; align-items: center; justify-content: center; }
.chat-more:hover { color: var(--text); background: var(--bubble); }
.chat-more .ic { width: 15px; height: 15px; }
.proj { display: flex; flex-direction: column; }
.proj-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 4px; border-radius: var(--r-sm); color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.proj-head:hover { background: var(--bubble); }
.proj-chev { flex: none; width: 14px; height: 14px; color: var(--text-3); transition: transform .16s var(--ease, ease); }
.proj.open .proj-chev { transform: rotate(90deg); }
.proj-body { display: flex; flex-direction: column; gap: 1px; margin-left: 14px; padding-left: 6px; border-left: 1px solid var(--border); }
.proj-empty { padding: 5px 10px; color: var(--text-3); font-size: 12.5px; }
:root[data-skin="team"] .rail .proj-head { color: var(--rail-fg); } :root[data-skin="team"] .rail .proj-head:hover { background: var(--rail-hover); }
:root[data-skin="team"] .rail .proj-body { border-left-color: var(--rail-hover); }
/* на телефоне: значок текущего чата слева от выбора */
.chatbar-ava .ava { width: 40px; height: 40px; border-radius: 12px; font-size: 13px; }
.chatbar-ava:empty { display: none; }
#chatMoreTop { background: var(--bubble); color: var(--text); border: 1px solid var(--border); }
.pop-menu { position: fixed; z-index: 60; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; padding: 6px; border-radius: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(0, 0, 0, .22); }
.pop-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--bubble); outline: none; }
.pop-menu button.danger { color: var(--danger); }
.pop-menu .ic { flex: none; width: 17px; height: 17px; }
.pop-head { padding: 8px 10px 4px; color: var(--text-3); font-size: 12px; font-weight: 700; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Обратная связь в настройках */
.fb-form { display: grid; gap: 10px; margin-top: 10px; }
.fb-form select, .fb-form textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.fb-form textarea { resize: vertical; min-height: 96px; }
.adm-feedback { margin-top: 10px; }

/* разметка в ответах ассистента */
.msg.assistant .msg-body code { padding: 1px 6px; border-radius: 6px; background: var(--bubble); border: 1px solid var(--border); font-size: .92em; }
.msg.assistant .msg-body .md-pre { margin: 6px 0; padding: 10px 12px; border-radius: 10px; background: var(--bubble); border: 1px solid var(--border); overflow-x: auto; white-space: pre; font-size: .9em; }
.msg.assistant .msg-body strong { font-weight: 700; }

#orb[data-to-bm] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#orb[data-to-bm]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 50%; }

/* ====== Левая панель: три блока (без рамок), строки на всю ширину, «⋯» у каждого пункта ====== */
.rail-block { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.rail-block[data-block="chats"] .chats { margin: 0; padding: 0; border-left: 0; max-height: 38vh; }
.rail-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); font: inherit; font-weight: 600; font-size: 14.5px; text-align: left; cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease); }
.rail-row .ic { width: 20px; height: 20px; flex: none; }
.rail-row:hover { background: var(--bubble); color: var(--text); }
body[data-view="dashboard"] .rail .to-dash, body[data-view="knowledge"] .rail .to-kn { background: var(--accent-soft) !important; color: var(--accent) !important; }
.rail .to-dash .ic, .rail .to-kn .ic { color: var(--accent); }
.rail .to-rec .ic { color: var(--danger); }
body[data-view="recordings"] .rail .to-rec { background: var(--danger-soft) !important; color: var(--danger) !important; }
:root[data-skin] .rail .rail-row { color: var(--rail-fg2, var(--text-2)); }
:root[data-skin] .rail .rail-row:hover { background: var(--rail-hover, var(--bubble)); color: var(--rail-fg, var(--text)); }
/* пока открыт не чат — подсветку «Основного чата» (и любого выбранного) убираем: она отвлекает от открытого раздела */
body:not([data-view="chat"]) .rail .chat-item.active { background: transparent !important; color: var(--text-2) !important; font-weight: inherit !important; }
body:not([data-view="chat"]) .rail .chat-item.active:hover { background: var(--bubble) !important; }
.row-more { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 6px; color: var(--text-3); cursor: pointer; align-items: center; justify-content: center; }
.row-more .ic { width: 15px; height: 15px; }
.row-more:hover { color: var(--text); background: var(--bubble); }
@media (min-width: 1001px) {
  .rail-top { display: flex; flex-direction: column; gap: 1px; padding: 0; }
  .tab:hover .row-more, .rail-row:hover .row-more { display: inline-flex; }
  .tab:hover .badge { margin-right: 26px; }
  .chat-top { flex-direction: column; gap: 1px; }
  .chat-new { width: 100%; padding: 7px 12px; }
  .chat-item { padding: 7px 8px 7px 12px; }
  .proj-head { padding: 6px 8px; }
  .proj-body { margin: 0; padding: 0; border-left: 0; }
  .proj-body .chat-item { padding-left: 32px; }
  .chat-archive summary { padding-left: 12px; }
  .chat-item .chat-more, .proj-head .chat-more { margin-left: auto; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .rail-row { justify-content: center; padding: 12px; } .rail-row span { display: none; }
  .rail-top { flex-direction: column; align-items: center; padding: 0; }
}
@media (max-width: 760px) { .rail-block { display: contents; } }
/* перетаскивание чатов */
.chat-item.dragging { opacity: .4; }
.chat-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.chat-item.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }

/* ====== Голосовой ввод в любом поле ====== */
.vi-wrap { position: relative; }
.vi-wrap.vi-block { display: block; width: 100%; }
.vi-wrap.vi-inline { display: inline-block; max-width: 100%; vertical-align: middle; }
.vi-has { padding-right: 40px !important; box-sizing: border-box; }
.vi-wrap.vi-block > .vi-has { width: 100%; }
.vi-mic { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
textarea.vi-has + .vi-mic { top: 18px; transform: translateY(-50%); }
.vi-mic .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vi-mic:hover { color: var(--accent); background: var(--bubble); }
.vi-mic.vi-rec { color: #fff; background: var(--danger, #d33); animation: vi-pulse 1.2s ease-in-out infinite; }
.vi-mic.vi-busy { opacity: .6; cursor: progress; }
.vi-mic.vi-rec { width: 26px; height: 26px; right: 8px; left: auto; inset-inline-end: 8px; }   /* имя класса своё: «.rec» занято полосой записи чата */
.vi-mic .spin { animation: vi-spin 1s linear infinite; }
@keyframes vi-spin { to { transform: rotate(360deg); } }
.vi-mic { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.vi-send { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.vi-send[hidden] { display: none; }
.vi-send .ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
textarea.vi-has ~ .vi-send { top: 18px; }
.vi-wrap.vi-sendable > .vi-has { padding-right: 76px !important; }
@keyframes vi-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,50,50,.45); } 50% { box-shadow: 0 0 0 7px rgba(220,50,50,0); } }

/* Подпись над значками «Коворк» и «Люди» в шапке основного экрана */
.presence-tools .pp-desk { position: relative; }
.presence-tools .pp-cap { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 10px; line-height: 1; font-weight: 600;
  color: var(--text-2); white-space: nowrap; pointer-events: none; letter-spacing: .02em; }
.pp-head .btn.danger { color: var(--danger); }
/* Допуски: правила агента */
.pol-h { font: 700 16px/1.3 inherit; margin: 0 0 6px; }
.pol-card .row-sub { margin: 0 0 10px; }
.pol-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.pol-row:first-of-type { border-top: 0; }
.pol-name { font-weight: 600; }
.pol-locked .seg-btn { opacity: .7; cursor: default; }
.pol-sw.on { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.08); color: var(--text); }
/* Виджеты в чате */
.wd { margin: 8px 0; padding: 14px 16px; border-radius: 16px; background: linear-gradient(160deg, var(--surface), var(--bubble)); border: 1px solid var(--border); max-width: 360px; }
.wd-title { font-weight: 700; margin-bottom: 6px; }
.wd-big { font: 700 34px/1.1 inherit; }
.wd-sub { color: var(--text-2); margin-top: 2px; }
.wd-note { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.wd-weather { background: linear-gradient(160deg, #3b82f6, #1d4ed8); color: #fff; border: 0; }
.wd-weather .wd-sub, .wd-weather .wd-note { color: rgba(255,255,255,.85); }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.wd-stat { display: flex; flex-direction: column; } .wd-stat b { font-size: 22px; } .wd-stat span { color: var(--text-2); font-size: 13px; } .wd-stat small { color: var(--text-2); font-size: 11px; }
.wd-li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; } .wd-li input:checked + span { text-decoration: line-through; opacity: .6; }
.wd-scroll { overflow-x: auto; } .wd-table table { border-collapse: collapse; font-size: 13px; width: 100%; } .wd-table th, .wd-table td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); }
.wd-timer .btn { margin-top: 10px; }

/* Панель виджетов справа и архив меню слева */
/* низ слева (архив меню, стиль, тема, звук) не закреплён: идёт сразу за меню и прокручивается вместе с чатами и меню, одной лентой */
.rail-foot { position: static; margin-top: 12px; }
.rail-block[data-block="chats"] .chats { max-height: none; overflow: visible; }
.tile { position: relative; }
.tile-more { position: absolute; top: 8px; right: 8px; display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-3); opacity: 0; cursor: pointer; transition: opacity .15s; }
.tile:hover .tile-more, .tile:focus-within .tile-more, .tile-more:focus-visible { opacity: 1; }
.tile-more:hover { background: var(--bubble); color: var(--text); }
@media (hover: none) { .tile-more { opacity: .7; } }
.tile-more .ic { width: 16px; height: 16px; }
.tile.tw-gone { display: none; }
.tile.tw-over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.tile.tw-drag { opacity: .45; }
.tile-custom { cursor: default; } .tile-custom:hover { transform: none; }
.tw-note { width: 100%; flex: 1; min-height: 70px; resize: vertical; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; padding: 0; outline: none; }
.tw-list { width: 100%; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.tw-li { display: flex; align-items: center; gap: 8px; } .tw-li span { flex: 1; overflow-wrap: anywhere; } .tw-li input:checked + span { text-decoration: line-through; opacity: .55; }
.tw-li button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 0 4px; }
.tw-add { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: 14px; padding: 4px 0; outline: none; margin-top: 4px; }
.tw-count { display: flex; align-items: center; gap: 14px; margin-top: auto; } .tw-count b { font-size: 34px; font-variant-numeric: tabular-nums; min-width: 48px; text-align: center; }
.tw-count button, .tw-timer button { border: 1px solid var(--border); background: var(--bubble); color: var(--text); border-radius: 10px; font: 600 16px/1 inherit; padding: 8px 14px; cursor: pointer; }
.tw-timer { display: flex; align-items: center; gap: 12px; margin-top: auto; } .tw-timer b { font-size: 30px; font-variant-numeric: tabular-nums; }
.tab .tab-more { margin-left: 4px; display: none; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-3); }
.tab:hover .tab-more, .tab:focus-within .tab-more { display: inline-flex; } .tab:hover .badge:not(:empty) + .tab-more { margin-left: 4px; }
.tab-more:hover { background: var(--surface); color: var(--text); } .tab-more .ic { width: 15px; height: 15px; }
@media (min-width: 761px) { .tab.tab-arch { display: none; } }
@media (max-width: 760px) { .tab .tab-more, #railArchive { display: none !important; } }

