/* Макет мобильного пульта ассистента (PLB-026).
   Ноль зависимостей: только системные шрифты и инлайн-SVG из index.html. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --keyboard-inset: 0px;
}

:root[data-theme="dark"] {
  --bg: #101923;
  --bg-soft: #0c141d;
  --card: #182431;
  --card-2: #1e2c3a;
  --fg: #eaf3fb;
  --fg-2: #c6d4e1;
  --muted: #8a9bac;
  --faint: #617282;
  --border: rgba(255, 255, 255, 0.075);
  --border-2: rgba(255, 255, 255, 0.14);
  --accent: #2ea6ff;
  --accent-2: #6cc4ff;
  --accent-soft: rgba(46, 166, 255, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.15);
  --green: #3ddc97;
  --green-soft: rgba(61, 220, 151, 0.14);
  --amber: #ffc857;
  --amber-soft: rgba(255, 200, 87, 0.14);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  --user-bubble: linear-gradient(135deg, #2ea6ff, #4f8cff);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --tabbar: rgba(13, 21, 30, 0.9);
  --input: #1b2836;
  --sheet: #16222f;
  --auth-glow: rgba(46, 166, 255, 0.28);
  --chart: #2ea6ff;
  --chart-dim: rgba(46, 166, 255, 0.26);
}

:root[data-theme="light"] {
  --bg: #f3f6fa;
  --bg-soft: #e9eef5;
  --card: #ffffff;
  --card-2: #f7f9fc;
  --fg: #15212c;
  --fg-2: #3b4b5b;
  --muted: #68788a;
  --faint: #93a1b0;
  --border: rgba(18, 38, 58, 0.09);
  --border-2: rgba(18, 38, 58, 0.16);
  --accent: #1a7fe8;
  --accent-2: #2ea6ff;
  --accent-soft: rgba(26, 127, 232, 0.1);
  --violet: #7c5cf0;
  --violet-soft: rgba(124, 92, 240, 0.12);
  --green: #12a86f;
  --green-soft: rgba(18, 168, 111, 0.12);
  --amber: #a87300;
  --amber-soft: rgba(199, 138, 0, 0.14);
  --danger: #d93025;
  --danger-soft: rgba(217, 48, 37, 0.09);
  --user-bubble: linear-gradient(135deg, #2ea6ff, #3f7ef7);
  --shadow: 0 18px 40px rgba(20, 40, 70, 0.12);
  --tabbar: rgba(255, 255, 255, 0.92);
  --input: #eef3f9;
  --sheet: #ffffff;
  --auth-glow: rgba(46, 166, 255, 0.4);
  --chart: #1a7fe8;
  --chart-dim: rgba(26, 127, 232, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

input,
textarea {
  border: 0;
  outline: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg.ic {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--accent-soft);
}

/* ---------- Каркас ---------- */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  /* Старые мобильные браузеры (в том числе Яндекс) могут не знать 100dvh:
     сначала vh, затем dvh, затем высота из visualViewport, которую ставит JS. */
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

@media (min-width: 560px) and (min-height: 700px) {
  body {
    background:
      radial-gradient(900px 500px at 20% 0%, var(--accent-soft), transparent 70%),
      var(--bg-soft);
    display: grid;
    place-items: center;
    padding: 22px;
  }

  .app {
    width: 390px;
    max-width: 390px;
    height: min(844px, calc(100vh - 44px));
    height: min(844px, calc(100svh - 44px));
    height: min(844px, calc(100dvh - 44px));
    height: min(844px, calc(var(--app-height, 100dvh) - 44px));
    border: 1px solid var(--border-2);
    border-radius: 36px;
    box-shadow: var(--shadow);
  }
}

.statusbar {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(42px + var(--safe-top));
  padding: var(--safe-top) 22px 0;
  color: var(--fg);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

body[data-screen="auth"] .statusbar {
  color: #fff;
}

.statusbar-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.statusbar-icons svg {
  height: 12px;
  width: auto;
  fill: currentColor;
  stroke: none;
}

.viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.screen.is-active {
  animation: screen-in 0.22s ease;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar {
  display: none;
}

.screen-scroll {
  padding: 2px 16px 28px;
}

/* Нижний отступ под плавающую кнопку «+»: последняя карточка не прячется под ней. */
#plans-scroll {
  padding-bottom: 96px;
}

/* ---------- Верхние панели ---------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 10px;
  background: var(--bg);
  position: relative;
  z-index: 6;
}

.title-head {
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 6px;
}

.title-head h1 {
  font-size: 28px;
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
}

.sub-head {
  gap: 10px;
  padding-bottom: 8px;
}

.sub-head h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sub-head .sub {
  margin-top: 1px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--fg-2);
  background: var(--card);
  border: 1px solid var(--border);
  flex: 0 0 auto;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.accent {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px var(--accent-soft);
}

.icon-btn.sm {
  width: 34px;
  height: 34px;
  background: transparent;
  border-color: transparent;
}

.icon-btn.sm svg.ic {
  width: 20px;
  height: 20px;
}

/* ---------- Нижняя навигация ---------- */

.desktop-brand,
.desktop-profile,
.desktop-chats {
  display: none;
}

.tab-list {
  display: contents;
}

.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: var(--tabbar);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
}

body[data-screen="auth"] .tabbar {
  display: none;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 50px;
  border-radius: 14px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.18s ease;
}

.tab-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 27px;
  border-radius: 9px;
  transition: background 0.18s ease, color 0.18s ease;
}

.tab-ic svg.ic {
  width: 23px;
  height: 23px;
  stroke-width: 1.75;
}

.tab.is-active {
  color: var(--accent);
}

.tab.is-active .tab-ic {
  background: var(--accent-soft);
}

.tab:active .tab-ic {
  transform: scale(0.92);
}

/* ---------- Общие мелочи ---------- */

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 650;
  transition: transform 0.12s ease, filter 0.18s ease, background 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn svg.ic {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--user-bubble);
  color: #fff;
  box-shadow: 0 12px 26px var(--accent-soft);
}

.btn-ghost {
  background: var(--card);
  border: 1px solid var(--border-2);
  color: var(--fg);
}

.btn-danger-ghost {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 11px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 20px 2px 9px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.group-head:first-child {
  padding-top: 4px;
}

.group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
}

.hint {
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 14px 4px 0;
}

.hint.center {
  text-align: center;
}

/* ---------- Сегменты и чипы ---------- */

.segmented {
  display: flex;
  gap: 4px;
  margin: 2px 16px 8px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  flex: 0 0 auto;
}

.seg {
  flex: 1 1 0;
  min-height: 38px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.seg.is-active {
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.segmented.small {
  margin: 0;
  flex: 0 0 auto;
  width: 100%;
  margin-top: 10px;
  border-radius: 12px;
}

.segmented.small .seg {
  min-height: 32px;
  font-size: 12.5px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.chip svg.ic {
  width: 16px;
  height: 16px;
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.chip-row.small .chip {
  min-height: 32px;
  font-size: 12px;
  padding: 0 11px;
}

/* ---------- Поля ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 13px;
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 15px;
}

.input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

textarea.input {
  min-height: 78px;
  padding: 12px 14px;
  resize: none;
  line-height: 1.45;
}

/* ---------- Переключатель ---------- */

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch.is-on {
  background: var(--accent);
  border-color: transparent;
}

.switch.is-on::after {
  transform: translateX(20px);
  background: #fff;
}

/* ---------- Экран входа ---------- */

.screen-auth {
  background:
    radial-gradient(120% 70% at 50% -10%, #1d4a78 0%, transparent 60%),
    linear-gradient(180deg, #0e1a26 0%, #0a1119 100%);
  color: #fff;
  overflow-y: auto;
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.75;
}

.glow-1 {
  width: 260px;
  height: 260px;
  left: -70px;
  top: 40px;
  background: var(--auth-glow);
}

.glow-2 {
  width: 220px;
  height: 220px;
  right: -80px;
  top: 240px;
  background: rgba(124, 92, 240, 0.3);
}

.auth-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 12px 22px calc(24px + var(--safe-bottom));
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  border-radius: 22px;
  background: linear-gradient(145deg, #2ea6ff, #4f6dff 70%);
  box-shadow: 0 18px 40px rgba(46, 166, 255, 0.35);
}

.brand-mark svg.ic {
  width: 38px;
  height: 38px;
  stroke-width: 1.6;
  color: #fff;
}

.brand-name {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-title {
  margin: 34px 0 8px;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.auth-lead {
  color: rgba(255, 255, 255, 0.62);
  font-size: 14.5px;
  max-width: 320px;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0 26px;
}

.auth-features li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feat-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8ecbff;
}

.feat-ic svg.ic {
  width: 20px;
  height: 20px;
}

.auth-features b {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.auth-features span {
  display: block;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12.5px;
  margin-top: 1px;
}

.btn-tg {
  background: linear-gradient(135deg, #2ea6ff, #4f8cff);
  color: #fff;
  min-height: 52px;
  border-radius: 16px;
  font-size: 15.5px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-code {
  display: flex;
  gap: 8px;
}

.auth-code .input {
  flex: 1;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  letter-spacing: 0.2em;
}

.auth-code .input::placeholder {
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.4);
}

.auth-code .btn {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  min-height: 48px;
  border-radius: 13px;
  padding: 0 18px;
}

.auth-note {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 26px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11.5px;
  line-height: 1.5;
}

.auth-note svg.ic {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.5);
}

.auth-foot {
  margin-top: 14px;
  text-align: center;
  color: rgba(255, 255, 255, 0.28);
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ---------- Чат ---------- */

.chat-head {
  padding-top: 2px;
  gap: 10px;
}

.avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.avatar-bot {
  background: linear-gradient(145deg, #2ea6ff, #4f6dff);
  color: #fff;
  box-shadow: 0 8px 18px rgba(46, 166, 255, 0.25);
}

.avatar-bot svg.ic {
  width: 22px;
  height: 22px;
}

.avatar-user {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--fg);
  font-weight: 700;
  font-size: 16px;
}

.presence {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  border: 2.5px solid var(--bg);
}

.chat-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-head-name {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-head-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.chat-scroll {
  padding: 6px 14px 14px;
}

.day-chip {
  width: max-content;
  margin: 4px auto 14px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
  animation: msg-in 0.2s ease;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2ea6ff, #4f6dff);
  color: #fff;
  flex: 0 0 auto;
  margin-bottom: 2px;
}

.msg-avatar svg.ic {
  width: 15px;
  height: 15px;
}

.msg-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(84%, 330px);
}

.msg-user {
  justify-content: flex-end;
}

.bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.42;
  word-wrap: break-word;
}

.bubble-bot {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  color: var(--fg);
}

.bubble-user {
  background: var(--user-bubble);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 20px var(--accent-soft);
}

.digest-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.digest-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.digest-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber);
}

.digest-badge svg.ic {
  width: 18px;
  height: 18px;
}

.digest-head b {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.2;
}

.digest-head span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.digest-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding-top: 9px;
}

.digest-row + .digest-row {
  margin-top: 9px;
  border-top: 1px dashed var(--border);
}

.digest-row > svg.ic {
  width: 17px;
  height: 17px;
  color: var(--accent);
  margin-top: 3px;
}

.digest-row b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.digest-row span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 1px;
}

.result-card {
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: 0 0 auto;
}

.result-ic svg.ic {
  width: 19px;
  height: 19px;
}

.result-head b {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
}

.result-head span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.pill-btn {
  flex: 1;
  min-height: 36px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 600;
}

.pill-btn.danger {
  color: var(--danger);
}

.quick-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 4px 36px;
  scrollbar-width: none;
}

.quick-row::-webkit-scrollbar {
  display: none;
}

.quick-row .chip {
  min-height: 34px;
  font-size: 12.5px;
  padding: 0 12px;
  background: transparent;
  border-color: var(--border-2);
  color: var(--accent);
}

.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  margin: 2px 0 10px 36px;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 6px;
  background: var(--card);
  border: 1px solid var(--border);
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.1s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.composer-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg-2);
  flex: 0 0 auto;
}

.composer-add svg.ic {
  width: 21px;
  height: 21px;
}

.composer-field {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 6px 4px 15px;
  border-radius: 22px;
  background: var(--input);
  border: 1px solid var(--border);
}

.composer-field input,
.composer-field textarea {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  color: var(--fg);
  font-size: 14.5px;
  font-family: inherit;
}

.composer-field textarea {
  display: block;
  width: 100%;
  min-height: 34px;
  max-height: 120px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  line-height: 1.4;
  overflow-y: auto;
}

.composer-mic,
.composer-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
  color: var(--muted);
}

.composer-send {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px var(--accent-soft);
}

.composer-send svg.ic,
.composer-mic svg.ic {
  width: 19px;
  height: 19px;
}

.recorder {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.1s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.rec-time {
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

.rec-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1 1 auto;
  height: 26px;
  overflow: hidden;
}

.rec-wave i {
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.7;
  animation: wave 1s infinite ease-in-out;
}

@keyframes wave {
  0%,
  100% {
    height: 6px;
  }
  50% {
    height: 22px;
  }
}

.rec-cancel {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  min-height: 36px;
  padding: 0 4px;
}

.rec-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.rec-send svg.ic {
  width: 19px;
  height: 19px;
}

/* ---------- Планы ---------- */

.plan-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  text-align: left;
  transition: background 0.18s ease;
}

.plan-card:active {
  background: var(--card-2);
}

.plan-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex: 0 0 auto;
  background: var(--accent-soft);
  color: var(--accent);
}

.plan-ic.event {
  background: var(--violet-soft);
  color: var(--violet);
}

.plan-ic.done {
  background: var(--green-soft);
  color: var(--green);
}

.plan-ic svg.ic {
  width: 19px;
  height: 19px;
}

.plan-body {
  flex: 1 1 auto;
  min-width: 0;
}

.plan-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.plan-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.plan-meta .dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.plan-time {
  flex: 0 0 auto;
  align-self: flex-start;
  padding-top: 2px;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.plan-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  color: transparent;
  flex: 0 0 auto;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.plan-check svg.ic {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

.plan-card.is-done .plan-check {
  background: var(--green);
  border-color: transparent;
  color: #0b1a13;
}

.plan-card.is-done .plan-title {
  color: var(--muted);
  text-decoration: line-through;
}

.fab {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--user-bubble);
  color: #fff;
  box-shadow: 0 14px 30px rgba(46, 166, 255, 0.35);
  transition: transform 0.12s ease;
}

.fab:active {
  transform: scale(0.94);
}

.fab svg.ic {
  width: 25px;
  height: 25px;
  stroke-width: 2.2;
}

/* ---------- Календарь ---------- */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 12px;
}

.cal-head b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cal-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg-2);
}

.cal-nav svg.ic {
  width: 18px;
  height: 18px;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 0 4px;
}

.weekdays span {
  text-align: center;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 12px;
  color: var(--fg-2);
  font-size: 13.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.cal-day.out {
  color: var(--faint);
  opacity: 0.55;
}

.cal-day.today {
  color: var(--accent);
  font-weight: 750;
}

.cal-day.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px var(--accent-soft);
}

.cal-dots {
  position: absolute;
  bottom: 5px;
  display: flex;
  gap: 3px;
}

.cal-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-dots i.event {
  background: var(--violet);
}

.cal-day.is-selected .cal-dots i {
  background: #fff;
}

.cal-legend {
  display: flex;
  gap: 14px;
  padding: 12px 2px 2px;
  color: var(--faint);
  font-size: 11px;
}

.cal-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.legend-dot.event {
  background: var(--violet);
}

.empty-day {
  padding: 18px 12px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* ---------- Память ---------- */

.city-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--card);
  border: 1px solid var(--border-2);
  margin-top: 8px;
  text-align: left;
}

.city-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex: 0 0 auto;
}

.city-ic svg.ic {
  width: 20px;
  height: 20px;
}

.city-card b {
  display: block;
  font-size: 15px;
}

.city-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.city-card .link {
  margin-left: auto;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}

.fact-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.fact-body {
  flex: 1 1 auto;
  min-width: 0;
}

.fact-text {
  font-size: 14px;
  font-weight: 550;
  line-height: 1.35;
  word-break: break-word;
}

.fact-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 11px;
  margin-top: 5px;
}

.fact-meta svg.ic {
  width: 12px;
  height: 12px;
}

.search-row {
  flex: 0 0 auto;
  padding: 0 16px 8px;
}

.search-row .input {
  min-height: 42px;
  border-radius: 12px;
  font-size: 14px;
}

/* ---------- Агент ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.new-task {
  padding: 13px;
  margin-top: 8px;
}

.new-task label {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.new-task textarea {
  width: 100%;
  min-height: 54px;
  resize: none;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13.5px;
  line-height: 1.45;
}

.new-task textarea::placeholder {
  color: var(--faint);
}

.task-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.task-actions .chip-row {
  flex: 1 1 auto;
  min-width: 0;
}

.task-card {
  padding: 13px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.task-card.is-active {
  border-color: rgba(46, 166, 255, 0.35);
  background: linear-gradient(150deg, var(--accent-soft), transparent 55%), var(--card);
  box-shadow: 0 10px 26px rgba(46, 166, 255, 0.1);
}

.task-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex: 0 0 auto;
  background: var(--accent-soft);
  color: var(--accent);
}

.task-ic.done {
  background: var(--green-soft);
  color: var(--green);
}

.task-ic svg.ic {
  width: 19px;
  height: 19px;
}

.task-card.is-active .task-ic svg.ic {
  animation: soft-spin 3.2s linear infinite;
}

@keyframes soft-spin {
  to {
    transform: rotate(360deg);
  }
}

.task-head b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.task-head span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.progress {
  height: 5px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
  margin: 12px 0 0;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--user-bubble);
  transition: width 0.4s ease;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12.5px;
}

.steps i {
  position: relative;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  flex: 0 0 auto;
}

.steps li.done {
  color: var(--fg-2);
}

.steps li.done i {
  background: var(--green);
  border-color: transparent;
}

.steps li.done i::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.5px;
  width: 4px;
  height: 7px;
  border: solid #0b1a13;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}

.steps li.current {
  color: var(--accent);
  font-weight: 600;
}

.steps li.current i {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.task-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11.5px;
}

.task-foot .link {
  color: var(--danger);
  font-weight: 600;
}

.done-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.done-actions .pill-btn {
  flex: 1;
}

/* ---------- Секретарь ---------- */

.secretary-status {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secretary-connection {
  margin-bottom: 14px;
}

.secretary-chat-card {
  padding: 12px;
  margin-bottom: 14px;
}

.secretary-chat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.secretary-chat-head > span:last-child {
  min-width: 0;
}

.secretary-chat-head b,
.secretary-chat-head small {
  display: block;
}

.secretary-chat-head small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.secretary-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 1px 10px;
}

.secretary-chat-message {
  max-width: 88%;
  padding: 9px 11px;
  border-radius: 13px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.secretary-chat-message.is-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.secretary-chat-message.is-secretary {
  align-self: flex-start;
  background: var(--card-2);
  color: var(--fg-2);
  border-bottom-left-radius: 4px;
}

.secretary-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.secretary-chat-compose textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  max-height: 110px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}

.secretary-modes {
  margin-bottom: 8px;
}

.secretary-modes .seg {
  min-width: 0;
  padding-inline: 7px;
}

.secretary-mode-hint {
  min-height: 34px;
  margin: 0 2px 12px;
}

.secretary-settings-card {
  padding: 14px;
}

.secretary-settings-card .settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.secretary-settings-card .settings-row-text {
  flex: 1 1 auto;
  min-width: 0;
}

.secretary-settings-card .settings-row-text b,
.secretary-settings-card .settings-row-text span {
  display: block;
}

.secretary-settings-card .settings-row-text b {
  font-size: 14px;
}

.secretary-settings-card .settings-row-text span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 3px;
}

.secretary-field {
  display: block;
  margin-top: 12px;
}

.secretary-field > span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  margin-bottom: 6px;
}

.secretary-field .input {
  width: 100%;
}

.secretary-settings-card .btn {
  margin-top: 14px;
}

.secretary-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 2px;
}

.secretary-metric {
  padding: 11px 8px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--border);
  text-align: center;
}

.secretary-metric b,
.secretary-metric span {
  display: block;
}

.secretary-metric b {
  color: var(--accent);
  font-size: 20px;
}

.secretary-metric span {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}

.secretary-incoming,
.secretary-reply {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.secretary-incoming {
  color: var(--muted);
  background: var(--card-2);
}

.secretary-reply {
  background: var(--accent-soft);
  color: var(--fg-2);
}

.secretary-draft-actions .secretary-ban {
  flex: 0 0 42px;
}

.secretary-excluded-row .file-body {
  flex: 1 1 auto;
  min-width: 0;
}

.secretary-export {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 10px;
}

/* ---------- Файлы ---------- */

.filters {
  padding: 4px 0 10px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  text-align: left;
}

.file-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
}

.file-badge.xlsx {
  background: linear-gradient(145deg, #1f9d63, #0f7a4a);
}

.file-badge.pdf {
  background: linear-gradient(145deg, #f05252, #c62f36);
}

.file-badge.docx {
  background: linear-gradient(145deg, #3b74d8, #2b579a);
}

.file-badge.csv {
  background: linear-gradient(145deg, #2ea6ff, #1876c9);
}

.file-badge.export {
  background: var(--accent-soft);
  border: 1px solid var(--border-2);
  color: var(--accent);
}

.file-badge.export svg.ic {
  width: 21px;
  height: 21px;
}

.file-body {
  flex: 1 1 auto;
  min-width: 0;
}

.file-body b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.file-body span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
}

.export-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  padding: 13px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--accent-soft), transparent 75%), var(--card);
  border: 1px dashed var(--border-2);
}

.export-card b {
  display: block;
  font-size: 13.5px;
}

.export-card span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.export-card .btn {
  margin-left: auto;
  flex: 0 0 auto;
}

/* ---------- Ещё ---------- */

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  margin-top: 6px;
  text-align: left;
}

.profile-card .avatar {
  width: 46px;
  height: 46px;
}

.profile-card b {
  display: block;
  font-size: 15.5px;
  font-weight: 650;
}

.profile-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.profile-card > svg.ic {
  margin-left: auto;
  color: var(--faint);
  width: 19px;
  height: 19px;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 13px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  text-align: left;
  min-height: 104px;
}

.tile-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  margin-bottom: 7px;
}

.tile-ic svg.ic {
  width: 18px;
  height: 18px;
}

.tile-ic.blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.tile-ic.green {
  background: var(--green-soft);
  color: var(--green);
}

.tile-ic.violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.tile-ic.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tile b {
  font-size: 13.5px;
  font-weight: 650;
}

.tile span {
  color: var(--muted);
  font-size: 11.5px;
}

.list-group {
  margin-top: 4px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  text-align: left;
}

.list-row b {
  font-size: 13.5px;
  font-weight: 600;
}

.list-row > span:not(.server-dot):not(.badge) {
  color: var(--muted);
  font-size: 11.5px;
  margin-left: auto;
  text-align: right;
}

.list-row > svg.ic {
  width: 17px;
  height: 17px;
  color: var(--faint);
  flex: 0 0 auto;
}

.list-row .row-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--card-2);
  color: var(--fg-2);
  flex: 0 0 auto;
}

.list-row .row-ic svg.ic {
  width: 18px;
  height: 18px;
}

.list-row .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

.server-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  flex: 0 0 auto;
}

.server-dot.warn {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

/* ---------- Настройки ---------- */

.settings-scroll {
  padding-bottom: 30px;
}

.settings-group {
  margin-bottom: 2px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  text-align: left;
}

.setting-row.column {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.setting-row.column > div:first-child {
  display: flex;
  flex-direction: column;
}

.setting-row b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.setting-row span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 1px;
}

.setting-row .row-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--card-2);
  color: var(--fg-2);
  flex: 0 0 auto;
}

.setting-row .row-ic svg.ic {
  width: 18px;
  height: 18px;
}

.setting-value {
  margin-left: auto;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.setting-row > svg.ic {
  width: 17px;
  height: 17px;
  color: var(--faint);
  margin-left: 4px;
  flex: 0 0 auto;
}

.setting-row .switch,
.setting-row .segmented.small {
  margin-left: auto;
}

.setting-row.column > .segmented.small {
  margin-left: 0;
}

.settings-scroll > .btn {
  margin-top: 18px;
}

/* ---------- Статистика ---------- */

.stat-hero {
  padding: 18px;
  margin-top: 8px;
  background:
    radial-gradient(120% 100% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--card);
  border-radius: var(--radius-xl);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-value {
  font-size: 40px;
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.stat-split {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.stat-split b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-split span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}

.chart-card {
  padding: 14px;
  margin-top: 10px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-head b {
  font-size: 13.5px;
  font-weight: 650;
}

.card-head span {
  color: var(--muted);
  font-size: 11.5px;
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 118px;
  padding: 0 2px;
}

.bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 0;
}

.bar {
  width: 100%;
  max-width: 30px;
  border-radius: 7px 7px 4px 4px;
  background: var(--chart-dim);
  min-height: 8px;
}

.bar.today {
  background: var(--chart);
  box-shadow: 0 6px 16px var(--accent-soft);
}

.chart-labels {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chart-labels span {
  flex: 1;
  text-align: center;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
}

.chart-labels span.today {
  color: var(--accent);
}

.limit-card {
  padding: 14px;
  margin-top: 10px;
}

.limit-card .progress {
  margin-top: 10px;
}

.limit-card .progress > span {
  background: linear-gradient(90deg, var(--green), var(--accent));
}

.server-card {
  padding: 14px;
  margin-bottom: 8px;
}

.server-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.server-head b {
  font-size: 13.5px;
  font-weight: 650;
}

.server-head span {
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
}

.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.meter span {
  flex: 0 0 58px;
  color: var(--muted);
  font-size: 11.5px;
}

.meter .progress {
  flex: 1 1 auto;
  margin: 0;
  height: 6px;
}

.meter .progress > span {
  background: var(--accent);
}

.meter .progress > span.warn {
  background: var(--amber);
}

.meter b {
  flex: 0 0 36px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Шторка ---------- */

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(4, 9, 14, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sheet-backdrop.is-open {
  opacity: 1;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border-2);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.4);
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet.is-open {
  transform: translateY(0);
}

.sheet-grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-2);
  margin: 8px auto 0;
  flex: 0 0 auto;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 8px;
  flex: 0 0 auto;
}

.sheet-head h2 {
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.sheet-head .icon-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  background: var(--card);
}

.sheet-body {
  padding: 6px 16px calc(18px + var(--safe-bottom));
  overflow-y: auto;
  min-height: 0;
}

.sheet-body .input {
  background: var(--card);
}

.sheet-actions {
  margin-top: 6px;
}

.sheet-note {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
  margin-top: 10px;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  text-align: left;
}

.picker-row b {
  font-size: 14px;
  font-weight: 600;
}

.picker-row .check {
  margin-left: auto;
  color: transparent;
  width: 20px;
  height: 20px;
}

.picker-row.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.picker-row.is-active .check {
  color: var(--accent);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.switch-row b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.switch-row span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 1px;
}

.switch-row .switch {
  margin-left: auto;
}

/* ---------- Тост ---------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  z-index: 60;
  transform: translate(-50%, 12px);
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  color: var(--fg);
  font-size: 13px;
  font-weight: 550;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Крупный текст ---------- */

html.large-text .bubble,
html.large-text .plan-title,
html.large-text .fact-text,
html.large-text .setting-row b,
html.large-text .task-head b,
html.large-text .file-body b,
html.large-text .result-head b,
html.large-text .digest-row b {
  font-size: 16px;
}

html.large-text .plan-meta,
html.large-text .fact-meta,
html.large-text .file-body span,
html.large-text .setting-row span {
  font-size: 13px;
}

/* ---------- Доступность и движение ---------- */

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

/* ---------- Production: загрузка, вход, состояния ---------- */

.boot {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}

.boot .spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid var(--border-2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 107, 107, 0.28);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.45;
}

.login-error[hidden] {
  display: none;
}

.login-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}

.field-hint {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.45;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 260px;
  padding: 30px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chat-empty .chat-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.chat-empty b {
  color: var(--fg);
  font-size: 15px;
}

.cta-bar {
  flex: 0 0 auto;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cta-bar .btn {
  min-height: 46px;
}

.info-card {
  padding: 14px;
  margin-top: 8px;
}

.info-card > b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 4px;
}

.info-card p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.info-card .btn {
  margin-top: 12px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span {
  color: var(--muted);
}

.info-row b {
  margin-left: auto;
  font-weight: 600;
  text-align: right;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.badge-soft.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.settings-save {
  margin-top: 16px;
}

.setting-row select {
  flex: 0 0 auto;
  max-width: 150px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 12.5px;
}

.plan-card .plan-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.plan-card .plan-time small {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 500;
}

.loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.loading-inline .spinner {
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .boot .spinner,
  .login-spinner,
  .loading-inline .spinner {
    animation: none;
    border-top-color: var(--accent);
  }
}

/* Поля входа на тёмном фоне независимо от темы */
.screen-auth .field > span {
  color: rgba(255, 255, 255, 0.55);
}

.screen-auth .input {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.screen-auth .input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

/* На телефоне системная строка уже есть: макетную показываем только в рамке на десктопе */
@media (max-width: 559px) {
  .statusbar {
    display: none;
  }

  .topbar {
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }
}

.composer-send:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------- Агент: блоки шаблонов ---------- */

.agent-grid .tile {
  min-height: 112px;
}

.status-pill.is-off {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.is-off .dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.agent-free {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--accent-soft), transparent 75%), var(--card);
  border: 1px dashed var(--border-2);
  text-align: left;
}

.agent-free > span:nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
}

.agent-free b {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
}

.agent-free span span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 1px;
}

.agent-free > svg.ic {
  width: 18px;
  height: 18px;
  color: var(--faint);
}

.agent-preview {
  min-height: 110px;
  font-size: 13px;
}

.agent-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.agent-event .plan-ic {
  width: 34px;
  height: 34px;
}

.agent-event-body {
  flex: 1 1 auto;
  min-width: 0;
}

.agent-event-title {
  font-size: 13.5px;
  font-weight: 600;
  word-break: break-word;
}

.agent-event-meta {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
}

.agent-result {
  margin-top: 8px;
  padding: 13px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--green-soft), transparent 75%), var(--card);
  border: 1px solid var(--border-2);
  font-size: 13px;
  line-height: 1.5;
}


/* Нижняя панель не должна прятаться за системной навигацией мобильного браузера */
.tabbar {
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

@media (pointer: coarse) {
  .tabbar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}


/* iOS/WebKit (включая Яндекс.Браузер) зумит страницу, если поле ввода
   меньше 16px — из-за этого «съезжает» вся вёрстка при наборе. */
@media (max-width: 559px) {
  .input,
  .composer-field input,
  .composer-field textarea,
  .search-row .input,
  .new-task textarea,
  .setting-row select,
  .agent-preview {
    font-size: 16px;
  }

  /* Когда открыта клавиатура, нижние вкладки убираем: композер остаётся
     над клавиатурой, а не прыгает вместе с панелью. */
  body.is-keyboard[data-screen="chat"] .tabbar {
    display: none;
  }
}


/* Переключатель личного и общего чата */
.chat-switch {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  padding: 0 14px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-switch::-webkit-scrollbar {
  display: none;
}

.chat-switch .chip {
  min-height: 34px;
  font-size: 12.5px;
}

/* Автор чужого сообщения в общем чате: буква вместо искры ассистента */
.msg-initial {
  font-size: 13px;
  font-weight: 700;
  color: #dce8ff;
}


/* iOS Safari панорамирует страницу под клавиатуру; фиксируем body и держим
   высоту приложения, а поле ввода поднимаем над клавиатурой. */
@media (max-width: 559px) {
  html,
  body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.is-keyboard .chat-scroll {
    padding-bottom: calc(var(--keyboard-inset, 0px) + 8px);
  }

  body.is-keyboard .composer-wrap {
    transform: translateY(calc(-1 * var(--keyboard-inset, 0px)));
    z-index: 25;
    transition: transform 0.16s ease;
  }
}


/* ---------- Ответ на сообщение и копирование ---------- */

.composer-wrap {
  flex: 0 0 auto;
  background: var(--bg);
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px 6px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.reply-bar-ic {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex: 0 0 auto;
}

.reply-bar-body {
  min-width: 0;
  flex: 1 1 auto;
  border-left: 2px solid var(--accent);
  padding-left: 9px;
}

.reply-bar-body b {
  display: block;
  font-size: 12px;
  color: var(--accent);
  font-weight: 650;
}

.reply-bar-body span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
}

.reply-bar-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.reply-bar-close svg.ic {
  width: 16px;
  height: 16px;
}

.bubble {
  -webkit-user-select: text;
  user-select: text;
  touch-action: pan-y;
  will-change: transform;
}

.msg.is-swiping .bubble {
  transition: none;
}

/* Меню сообщения: как долгое нажатие в Telegram */
.message-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-menu-quote {
  padding: 10px 12px;
  border-radius: 12px;
  border-left: 2px solid var(--accent);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  max-height: 120px;
  overflow: hidden;
  white-space: pre-wrap;
}

.message-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.message-menu button svg.ic {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

.reply-quote {
  display: block;
  margin: -2px 0 7px;
  padding: 5px 8px;
  border-left: 2px solid currentColor;
  border-radius: 7px;
  background: rgba(127, 127, 127, 0.13);
  opacity: 0.85;
  white-space: normal;
}

.reply-quote b {
  display: block;
  font-size: 11px;
  font-weight: 650;
  margin-bottom: 1px;
}

.reply-quote span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  opacity: 0.9;
}

.bubble-user .reply-quote {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Возможности агента: то, что реально отдают агенты моста */
.agent-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.agent-cap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg-2);
  font-size: 11.5px;
  font-weight: 600;
}

.agent-cap svg.ic {
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.msg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ---------- Фото и видео как в Telegram ---------- */

.attach-preview {
  display: flex;
  gap: 7px;
  padding: 8px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.attach-preview::-webkit-scrollbar {
  display: none;
}

.attach-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
}

.attach-thumb img,
.attach-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attach-thumb .attach-kind {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.attach-thumb .attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: grid;
  place-items: center;
}

.attach-thumb .attach-remove svg.ic {
  width: 12px;
  height: 12px;
}

.bubble.has-media {
  padding: 5px;
}

.chat-media {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
}

.chat-media + .bubble-text {
  padding: 6px 7px 2px;
}

.bubble-text {
  white-space: pre-wrap;
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.media-viewer img,
.media-viewer video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.chat-media-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 320px;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 5px;
}

.msg-time {
  display: block;
  text-align: right;
  font-size: 10.5px;
  line-height: 1;
  opacity: 0.62;
  user-select: none;
}

/* ============================================================
   Десктоп: полноценное веб-приложение в стиле продуктов iOS.
   Мобильная вёрстка остаётся ниже 1024px без изменений.
   ============================================================ */
@media (min-width: 1024px) {
  html {
    position: static;
    height: auto;
    overflow: auto;
  }

  body {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 22px;
    overflow: hidden;
    background:
      radial-gradient(1200px 700px at 8% 0%, var(--accent-soft), transparent 62%),
      radial-gradient(900px 600px at 100% 100%, var(--violet-soft), transparent 62%),
      var(--bg-soft);
  }

  .app {
    width: min(1480px, 100%);
    max-width: 1480px;
    height: calc(100vh - 44px);
    min-height: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    border: 1px solid var(--border-2);
    border-radius: 26px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.32), 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
  }

  .statusbar {
    display: none;
  }

  .viewport {
    grid-column: 2;
    grid-row: 1;
    height: 100%;
    min-height: 0;
    background: var(--bg);
  }

  .screen {
    border-radius: 0;
  }

  /* ---------- Боковая панель ---------- */

  .tabbar {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    height: 100%;
    padding: 22px 14px 18px;
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
    backdrop-filter: blur(30px) saturate(1.25);
    -webkit-backdrop-filter: blur(30px) saturate(1.25);
  }

  body[data-screen="auth"] .app {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-screen="auth"] .viewport {
    grid-column: 1;
  }

  .desktop-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 2px 10px 22px;
    flex: 0 0 auto;
  }

  .desktop-logo {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, #40b4ff, #4f6dff);
    box-shadow: 0 8px 20px var(--accent-glow);
  }

  .desktop-logo svg.ic {
    width: 21px;
    height: 21px;
  }

  .desktop-brand b {
    display: block;
    font-size: 15px;
    font-weight: 720;
    letter-spacing: -0.01em;
  }

  .desktop-brand span span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 1px;
  }

  .desktop-chats {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 2px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
  }

  .desktop-chats-head {
    padding: 0 10px 7px;
    color: var(--faint);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .desktop-chat {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    padding: 6px 9px;
    border-radius: 11px;
    text-align: left;
    color: var(--fg-2);
  }

  .desktop-chat:hover {
    background: var(--border);
  }

  .desktop-chat.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .desktop-chat-avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--card-2);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
  }

  .desktop-chat-body {
    min-width: 0;
    flex: 1 1 auto;
  }

  .desktop-chat-body b,
  .desktop-chat-body span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-chat-body b {
    font-size: 12.5px;
    font-weight: 620;
  }

  .desktop-chat-body span {
    color: var(--muted);
    font-size: 11px;
    margin-top: 1px;
  }

  .desktop-chat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
  }

  .tab-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 13px;
    color: var(--fg-2);
    font-size: 13.5px;
    font-weight: 620;
    text-align: left;
    transition: background 0.16s ease, color 0.16s ease;
  }

  .tab:hover {
    background: var(--border);
  }

  .tab-ic {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: transparent;
  }

  .tab-ic svg.ic {
    width: 20px;
    height: 20px;
    stroke-width: 1.7;
  }

  .tab.is-active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .tab.is-active .tab-ic {
    background: transparent;
  }

  .desktop-profile {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    margin-top: auto;
    padding: 11px 10px;
    border-radius: 15px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--card) 72%, transparent);
    text-align: left;
  }

  .desktop-profile .avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .desktop-profile > span:nth-child(2) {
    min-width: 0;
    flex: 1 1 auto;
  }

  .desktop-profile b {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-profile span span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 1px;
  }

  .desktop-profile > svg.ic {
    width: 16px;
    height: 16px;
    color: var(--faint);
  }

  /* ---------- Контент ---------- */

  .screen {
    background: var(--bg);
  }

  .topbar {
    padding: 26px clamp(26px, 3.6vw, 52px) 14px;
    background: transparent;
  }

  .title-head h1 {
    font-size: 30px;
  }

  .sub {
    font-size: 13px;
  }

  .screen-scroll {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 2px clamp(26px, 3.6vw, 52px) 40px;
  }

  .scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
  }

  .scroll::-webkit-scrollbar {
    width: 8px;
    display: block;
  }

  .scroll::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 99px;
  }

  /* Чат: широкая колонка по центру */
  .chat-scroll {
    padding: 0;
  }

  #chat-messages {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: 0 24px;
  }

  .msg-stack {
    max-width: min(78%, 680px);
  }

  .msg-user .bubble {
    max-width: min(72%, 680px);
  }

  .bubble {
    font-size: 15px;
    padding: 11px 16px;
  }

  .chat-switch {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: 0 24px 12px;
  }

  .composer-wrap {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: 0 24px 16px;
    background: transparent;
  }

  .reply-bar {
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: var(--card);
  }

  .composer {
    padding: 8px;
    border: 1px solid var(--border-2);
    border-radius: 24px;
    background: color-mix(in srgb, var(--card) 86%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.12);
  }

  .composer-field {
    min-height: 42px;
    border: 0;
    background: var(--input);
  }

  .chat-empty {
    margin-top: 12vh;
  }

  /* Настройки и списки — книга, а не телефон */
  .settings-scroll {
    max-width: 780px;
  }

  .tile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .screen[data-screen="more"] .tile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .agent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tile {
    min-height: 120px;
  }

  /* Модалки как в macOS/iPadOS */
  .sheet-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(540px, calc(100% - 48px));
    max-height: min(720px, calc(100vh - 96px));
    border-radius: 24px;
    transform: translate(-50%, -50%);
    border: 1px solid var(--border-2);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4);
  }

  .sheet.is-open {
    transform: translate(-50%, -50%);
  }

  .sheet-grab {
    display: none;
  }

  .toast {
    bottom: 28px;
  }

  /* Авторизация по центру окна */
  body[data-screen="auth"] .auth-content {
    width: min(420px, 100%);
    margin: auto;
    padding-top: 40px;
    padding-bottom: 40px;
  }

  body[data-screen="auth"] .auth-bg {
    opacity: 0.8;
  }
}

.system-text {
  margin: 0;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Command palette (Cmd+K) ---------- */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(18vh, 160px);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cmdk-panel {
  width: min(560px, calc(100% - 32px));
  border-radius: 20px;
  border: 1px solid var(--border-2);
  background: color-mix(in srgb, var(--sheet) 92%, transparent);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.cmdk-input {
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  border: 0;
  border-bottom: 1px solid var(--border);
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 17px;
}

.cmdk-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  color: var(--fg-2);
  text-align: left;
  font-size: 14px;
}

.cmdk-item svg.ic {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.cmdk-item.is-active,
.cmdk-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.cmdk-foot {
  display: flex;
  gap: 14px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 46vh;
  overflow-y: auto;
}

.search-results .plan-card {
  cursor: default;
}

.chat-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-left: 5px;
  vertical-align: middle;
}

/* ---------- Голосовые сообщения ---------- */
.recorder-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 12px 8px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: var(--card);
}

.recorder-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: rec-pulse 1s ease-in-out infinite;
}

@keyframes rec-pulse {
  50% { opacity: 0.25; }
}

.recorder-time {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--danger);
}

.recorder-hint {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 12px;
}

.recorder-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.recorder-btn svg.ic {
  width: 17px;
  height: 17px;
}

.chat-audio {
  width: 100%;
  min-width: 230px;
  max-width: 340px;
  height: 40px;
}

.msg.reaction {
  margin-bottom: 20px;
}

.msg-reaction {
  position: absolute;
  bottom: -11px;
  z-index: 3;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border-2);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.msg-user .msg-reaction {
  right: 8px;
}

.msg-bot .msg-reaction {
  left: 8px;
}

.msg.has-reaction {
  margin-bottom: 22px;
}

.msg-reactions {
  display: flex;
  gap: 6px;
  padding: 4px 0 8px;
}

.msg-reaction-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 18px;
  display: grid;
  place-items: center;
}

.msg-reaction-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.chat-scroll.is-drag {
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
  border-radius: 16px;
  background: var(--accent-soft);
}

/* Подсказка о drag&drop появляется только при перетаскивании */
.chat-scroll.is-drag::after {
  content: 'Отпустите файл, чтобы прикрепить';
  position: sticky;
  bottom: 12px;
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.agent-cancel {
  margin-top: 7px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
  width: fit-content;
}

/* Подсказка @упоминания в общем чате */
.composer-wrap {
  position: relative;
}

.mention-list {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 64px;
  z-index: 30;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: var(--sheet);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--fg);
  text-align: left;
  font-size: 13px;
}

.mention-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.mention-item span {
  color: var(--muted);
  font-size: 11.5px;
}

.cal-export {
  display: inline-flex;
  margin: 10px 0 4px;
  text-decoration: none;
}

.cal-view-seg {
  margin: 2px 0 10px;
}

.cal-week {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-week-day {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
}

.cal-week-day.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cal-week-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.cal-week-head b {
  font-size: 13px;
}

.cal-week-head span {
  color: var(--muted);
  font-size: 11.5px;
}

.cal-week-item {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 12.5px;
  color: var(--fg-2);
}

.cal-week-item span:first-child {
  color: var(--muted);
  min-width: 42px;
}

.weekdays[hidden],
.cal-grid[hidden] {
  display: none;
}

.inbox-check {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  border-radius: 7px;
  border: 1.5px solid var(--border-2);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.inbox-check.is-done {
  background: var(--accent);
  border-color: var(--accent);
}

.inbox-remove {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}

.plan-card.is-done .plan-body b {
  text-decoration: line-through;
  color: var(--muted);
}

.file-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.pill-btn.danger {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}

.pill-btn.danger:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.totp-secret {
  display: block;
  padding: 9px 11px;
  margin: 7px 0;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.cal-export-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
}

.cal-export-row .cal-export {
  margin: 0;
  display: inline-flex;
}

.msg-status {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--muted);
  line-height: 1;
  opacity: 1;
}

.msg-status.is-read {
  color: var(--accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent);
}

.msg-status.is-read {
  color: var(--accent);
}

/* ---------- Артефакт рядом с чатом ---------- */
.artifact {
  position: fixed;
  z-index: 90;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid var(--border-2);
  background: var(--sheet);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.artifact-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--border);
}

.artifact-title {
  min-width: 0;
  flex: 1 1 auto;
}

.artifact-title b,
.artifact-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-title b {
  font-size: 13.5px;
}

.artifact-title span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.artifact-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px;
  background: var(--bg);
}

.artifact-body img,
.artifact-body video {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  border-radius: 12px;
}

.artifact-body iframe {
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.artifact-body pre {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  line-height: 1.5;
}

.artifact-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .artifact {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    border-radius: 0;
    border: 0;
  }
}

/* На синем пузыре свои галочки должны быть светлыми, иначе теряются. */
.msg-user .msg-status {
  color: rgba(255, 255, 255, 0.72);
}

.msg-user .msg-status.is-read {
  color: #ffffff;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.45);
}

.automation-days {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.automation-day {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 11.5px;
}

.mail-text {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  line-height: 1.5;
}

.duplicate-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.fact-meta .pill-btn {
  margin-left: auto;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
}

.quiz-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.quiz-number {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.quiz-head b {
  font-size: 13.5px;
  line-height: 1.4;
}

.quiz-card.is-done {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.composer-stop {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--danger);
  color: #fff;
}

.composer-stop svg.ic {
  width: 16px;
  height: 16px;
}

.composer-stop {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--danger);
  color: #fff;
}

.composer-stop svg.ic {
  width: 16px;
  height: 16px;
}

.youtube-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.youtube-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
}

.youtube-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--card-2);
}

.youtube-body {
  padding: 9px 10px 11px;
}

.youtube-body b {
  display: block;
  font-size: 12.5px;
  line-height: 1.35;
  margin-bottom: 4px;
}

.youtube-body span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.youtube-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  background: #000;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.dashboard-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 12px;
}

.dashboard-stat b {
  font-size: 23px;
}

.dashboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
}

.dashboard-row svg.ic {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.bubble-text strong,
.bubble-text b {
  font-weight: 700;
}

.bubble-text em {
  font-style: italic;
}

.bubble-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.bubble-text code.md-inline {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(127, 127, 127, 0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

.bubble-text pre.md-code {
  margin: 6px 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.28);
  overflow-x: auto;
  white-space: pre;
  font-size: 12px;
  line-height: 1.45;
}

.bubble-text blockquote {
  margin: 5px 0;
  padding: 3px 0 3px 10px;
  border-left: 3px solid var(--accent);
  color: var(--fg-2);
}

.bubble-text ul,
.bubble-text ol {
  margin: 4px 0;
  padding-left: 20px;
}

.bubble-text .md-heading {
  font-weight: 700;
  margin: 4px 0;
}

/* ===== Красочный главный экран в стиле iOS ===== */
#dashboard-scroll {
  background:
    radial-gradient(circle at 8% 0%, rgba(88, 132, 255, 0.22), transparent 34%),
    radial-gradient(circle at 95% 12%, rgba(186, 104, 255, 0.18), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(64, 210, 190, 0.12), transparent 42%);
}

.dash-hero {
  position: relative;
  overflow: hidden;
  padding: 20px;
  margin-bottom: 14px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(145deg, #4f7cff 0%, #7a5cff 48%, #b05cff 100%);
  box-shadow: 0 18px 44px rgba(70, 90, 255, 0.32);
}

.dash-hero::before,
.dash-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.dash-hero::before {
  width: 160px;
  height: 160px;
  right: -50px;
  top: -60px;
  background: rgba(255, 255, 255, 0.22);
}

.dash-hero::after {
  width: 120px;
  height: 120px;
  left: -40px;
  bottom: -60px;
  background: rgba(255, 255, 255, 0.12);
}

.dash-hero-top {
  position: relative;
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 14px;
}

.dash-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 11px;
  font-weight: 650;
  backdrop-filter: blur(8px);
}

.dash-pill-soft {
  background: rgba(255, 255, 255, 0.12);
}

.dash-greeting {
  position: relative;
  margin: 0 0 4px;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.dash-sub {
  position: relative;
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12.5px;
}

.dash-quick {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
}

.dash-quick-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  border-radius: 12px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
}

.dash-quick-item:active {
  background: rgba(255, 255, 255, 0.16);
}

.dash-quick-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
}

.dash-quick-icon svg.ic {
  width: 17px;
  height: 17px;
}

.dash-section {
  padding: 15px 16px;
  margin-bottom: 12px;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.10);
}

.dash-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.dash-section-head b {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.dash-section-head span {
  color: var(--muted);
  font-size: 11px;
}

.dash-timeline-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
}

.dash-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ff9f0a;
  box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.15);
}

.dash-dot.is-event {
  background: #5e8bff;
  box-shadow: 0 0 0 4px rgba(94, 139, 255, 0.15);
}

.dash-timeline-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.dash-timeline-body b {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.dash-timeline-body span {
  font-size: 12.5px;
  line-height: 1.35;
}

.dash-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 0;
}

.dash-empty svg.ic {
  width: 19px;
  height: 19px;
  color: #ffb340;
}

.dash-widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dash-widget {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 116px;
  padding: 14px;
  border-radius: 22px;
  border: 0;
  text-align: left;
  color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.dash-widget-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 650;
  opacity: 0.9;
  margin-bottom: auto;
}

.dash-widget-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
}

.dash-widget-icon svg.ic {
  width: 15px;
  height: 15px;
}

.dash-widget b {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-top: 8px;
}

.dash-widget-hint {
  font-size: 10.5px;
  line-height: 1.3;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tone-mint {
  background: linear-gradient(145deg, #19c6a2, #0f9f9a);
}

.tone-violet {
  background: linear-gradient(145deg, #9b6bff, #6a4cff);
}

.tone-orange {
  background: linear-gradient(145deg, #ff9f43, #ff6b6b);
}

.tone-blue {
  background: linear-gradient(145deg, #4f9dff, #3a68f5);
}

.dash-server {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, #30d158 28%, var(--border));
  background: color-mix(in srgb, #30d158 8%, var(--card));
  color: var(--fg);
  text-align: left;
}

.dash-server-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 650;
  color: #2bbf55;
}

.dash-server-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #30d158;
  box-shadow: 0 0 0 4px rgba(48, 209, 88, 0.16);
}

.dash-server-name {
  color: var(--muted);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}

.agent-event.is-clickable {
  cursor: pointer;
}

.agent-event.is-clickable:hover {
  border-color: var(--accent);
}

.agent-task-result {
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
}

.agent-task-result p {
  margin: 5px 0 0;
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--fg-2);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  aspect-ratio: 1 / 1;
  padding: 0;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-card span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 7px;
  color: #fff;
  font-size: 10.5px;
  line-height: 1.25;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-full {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: var(--card);
}

/* Кнопка «Открыть чат» живёт вне карточки настроек — те же правила типографики. */
.secretary-open-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 0 14px;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.secretary-open-chat > .ic {
  flex: 0 0 auto;
}

.secretary-open-chat .settings-row-text {
  flex: 1 1 auto;
  min-width: 0;
}

.secretary-open-chat .settings-row-text b,
.secretary-open-chat .settings-row-text span {
  display: block;
}

.secretary-open-chat .settings-row-text b {
  font-size: 14px;
}

.secretary-open-chat .settings-row-text span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 3px;
}


/* Чат ближе к Telegram: без имени ассистента, больше воздуха под текст. */
.chat-head-name:empty {
  display: none;
}

.chat-head {
  min-height: 62px;
}

.chat-scroll {
  background:
    radial-gradient(circle at 12% 4%, rgba(79, 157, 255, 0.06), transparent 30%),
    radial-gradient(circle at 92% 70%, rgba(186, 104, 255, 0.05), transparent 32%);
}

/* Пункты дайджеста */
.digest-point {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--card);
  text-align: left;
  color: var(--fg);
}

.digest-point.is-off {
  opacity: 0.55;
}

.digest-point-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.digest-point-body b {
  font-size: 13.5px;
}

.digest-point-body span {
  color: var(--muted);
  font-size: 11px;
}

.digest-point-body small {
  color: var(--accent);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.digest-point-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.digest-point-state .ic {
  width: 15px;
  height: 15px;
}


/* Появление нового сообщения — мягко, как в Telegram. */
@keyframes msg-enter {
  from { opacity: 0; transform: translateY(7px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg.msg-enter {
  animation: msg-enter 160ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .msg.msg-enter { animation: none; }
}

/* Telegram-подобная группировка и даты */
.chat-day-divider {
  width: max-content;
  margin: 12px auto 10px;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  backdrop-filter: blur(10px);
}

.msg-grouped .msg-avatar {
  opacity: 0;
}

.msg.msg-grouped {
  margin-top: -4px;
}

.msg.msg-grouped .bubble {
  border-top-left-radius: 8px;
}

.msg.msg-has-next .msg-meta {
  opacity: 0.55;
}

.digest-point-body {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  color: var(--fg);
  flex: 1 1 auto;
}

.digest-point-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.digest-move {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.digest-move:disabled {
  opacity: 0.25;
}

.digest-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.agent-group {
  margin-bottom: 12px;
}

.agent-group .group-head {
  margin: 4px 2px 7px;
}

.msg-highlight .bubble {
  box-shadow: 0 0 0 2px var(--accent), 0 8px 22px var(--accent-soft);
}

.more-group {
  margin-bottom: 14px;
}

.more-group > .group-head {
  margin: 10px 2px 8px;
}

.agent-groups {
  display: block;
}
