/* Юрист РБ — чат (/chat). Токены и общие классы — в theme.css (оба дизайна, светлая и тёмная схема).
   Здесь — раскладка как у ИИ-чатов: боковая панель со списком чатов, переписка по центру, поле ввода внизу.
   Отличия дизайнов — в конце файла (:root[data-design="classic"] / "modern"). */

/* ===================== Каркас ===================== */

.chat-page {
  --sb-w: 272px;
  --topbar-h: 56px;
  --thread-w: 760px;
  --avatar: 32px;
  /* переключатель дизайна (theme.js) — над полем ввода, чтобы не закрывал кнопки */
  --design-picker-bottom: calc(env(safe-area-inset-bottom) + 132px);
  --design-picker-left: max(12px, env(safe-area-inset-left));
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 900px) {
  .chat-page:not(.sb-collapsed) {
    --design-picker-left: calc(var(--sb-w) + 12px);
  }
}

.chat-page.drawer-open .design-picker {
  display: none;
}

.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  text-align: center;
}

.boot-logo {
  border-radius: 14px;
}

.boot-text {
  max-width: 440px;
  color: var(--text-muted);
}

.boot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.app {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sb-collapsed .app {
  grid-template-columns: minmax(0, 1fr);
}

.sb-collapsed .sidebar {
  display: none;
}

.only-narrow {
  display: none;
}

.topbar-menu,
.topbar-new {
  display: none;
}

.sb-collapsed .topbar-menu,
.sb-collapsed .topbar-new {
  display: inline-flex;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--overlay);
  animation: fade-in 0.2s var(--ease);
}

@media (max-width: 899px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .sb-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    width: min(320px, 86vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }

  .drawer-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.25s var(--ease);
  }

  .only-wide {
    display: none;
  }

  .only-narrow,
  .topbar-menu,
  .topbar-new {
    display: inline-flex;
  }
}

@media (min-width: 900px) {
  .scrim {
    display: none !important;
  }
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: 6px 8px 2px 14px;
}

.sb-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  text-decoration: none;
}

.sb-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
}

.sb-logo .icon {
  width: 18px;
  height: 18px;
}

.sb-actions {
  display: grid;
  gap: 8px;
  padding: 6px 10px 10px;
}

.sb-new {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.sb-new:hover {
  background: var(--surface-2);
}

.sb-new-icon {
  display: inline-flex;
}

.sb-new-icon .icon {
  width: 19px;
  height: 19px;
}

.sb-new-label {
  flex: 1;
}

.sb-kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

@media (pointer: coarse) {
  .sb-kbd {
    display: none;
  }
}

.sb-search {
  position: relative;
}

.sb-search-icon {
  position: absolute;
  top: 50%;
  left: 11px;
  display: inline-flex;
  color: var(--text-faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.sb-search-icon .icon {
  width: 18px;
  height: 18px;
}

.sb-search-input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px 8px 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* меньше — iOS увеличивает страницу при фокусе */
  line-height: 1.3;
}

.sb-search-input::placeholder {
  color: var(--text-faint);
}

.sb-search-input:focus {
  outline: none;
  border-color: var(--focus-ring);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sb-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 8px 12px;
  -webkit-overflow-scrolling: touch;
}

.sb-group + .sb-group {
  margin-top: 14px;
}

.sb-group-title {
  padding: 6px 10px 4px;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sb-items {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* длинное название не растягивает список — обрезается многоточием */
  gap: 1px;
  list-style: none;
}

.sb-item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s var(--ease);
}

.sb-item:hover,
.sb-item:focus-within {
  background: var(--surface-2);
}

.sb-item.is-current {
  background: var(--accent-soft);
}

.sb-link {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 4px 8px 10px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.3;
  text-align: left;
}

.sb-item.is-current .sb-link {
  font-weight: 600;
}

.sb-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-busy {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.sb-more {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 4px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.12s var(--ease), background-color 0.12s var(--ease);
}

.sb-item:hover .sb-more,
.sb-item:focus-within .sb-more,
.sb-item.is-current .sb-more,
.sb-more[aria-expanded="true"] {
  opacity: 1;
}

.sb-more:hover {
  background: var(--border);
  color: var(--text);
}

.sb-more .icon {
  width: 18px;
  height: 18px;
}

@media (hover: none) {
  .sb-more {
    opacity: 1;
  }
}

@media (pointer: coarse) {
  .sb-link {
    min-height: 44px;
  }

  .sb-more {
    width: 40px;
    height: 40px;
    margin-right: 2px;
  }
}

.sb-rename {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  margin: 2px;
  padding: 6px 10px;
  border: 1px solid var(--focus-ring);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sb-rename:focus {
  outline: none;
}

.sb-empty {
  padding: 12px 10px;
  color: var(--text-faint);
  font-size: 14px;
}

.sb-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 9px 4px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.35;
}

.sb-note-icon {
  display: inline-flex;
}

.sb-note .icon {
  width: 16px;
  height: 16px;
}

.sb-note.is-warn {
  color: var(--warning);
}

.sb-account {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 4px 10px calc(10px + env(safe-area-inset-bottom));
}

.sb-quota {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.sb-quota:hover {
  border-color: var(--border-strong);
}

.sb-quota-icon,
.sb-quota-chev {
  display: inline-flex;
}

.sb-quota-icon {
  color: var(--accent);
}

.sb-quota-icon .icon {
  width: 19px;
  height: 19px;
}

.sb-quota-lines {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.sb-quota-text {
  min-width: 0;
}

/* вторая строка: остаток разборов фото */
.sb-quota-sub {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

.sb-quota-sub.is-out {
  color: var(--danger);
}

.sb-quota-chev {
  color: var(--text-faint);
}

.sb-quota-chev .icon {
  width: 16px;
  height: 16px;
}

.sb-quota.is-low .sb-quota-icon {
  color: var(--warning);
}

.sb-quota.is-out {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.sb-quota.is-out .sb-quota-icon {
  color: var(--danger);
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 0 2px;
}

.sb-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 15px;
  font-weight: 700;
}

.sb-user-text {
  display: grid;
  flex: 1;
  justify-items: start;
  gap: 3px;
  min-width: 0;
}

.sb-email {
  max-width: 100%;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aud-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 8px 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.aud-badge:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.aud-icon,
.aud-chev {
  display: inline-flex;
}

.aud-badge .icon {
  width: 14px;
  height: 14px;
}

@media (pointer: coarse) {
  .aud-badge {
    min-height: 36px;
    padding-inline: 10px;
  }
}

/* ===================== Основная часть ===================== */

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--bg);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tier-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  margin-right: 4px;
  padding: 3px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.tier-badge:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

@media (max-width: 400px) {
  .tier-badge {
    display: none;
  }
}

.banner {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--warning-soft);
  font-size: 14px;
  line-height: 1.45;
}

.banner-icon {
  display: inline-flex;
  color: var(--warning);
}

.banner-text {
  flex: 1 1 240px;
}

.scroller {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.thread {
  max-width: calc(var(--thread-w) + 32px);
  margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-right)) 28px max(16px, env(safe-area-inset-left));
}

.scroller.is-empty .thread {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

/* ===================== Пустой чат ===================== */

.empty {
  padding: 8px 0;
  text-align: center;
  animation: fade-up 0.35s var(--ease);
}

.empty-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-mark .icon {
  width: 30px;
  height: 30px;
}

.empty-title {
  margin-bottom: 8px;
  font-size: clamp(26px, 4.2vw, 34px);
}

.empty-lead {
  max-width: 560px;
  margin: 0 auto 26px;
  color: var(--text-muted);
  font-size: 15.5px;
}

.empty-label {
  margin-bottom: 10px;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chips {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  list-style: none;
  text-align: left;
}

.chips > li {
  display: flex;
}

@media (min-width: 640px) {
  .chips {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

/* на телефоне — четыре примера, чтобы приветствие и примеры помещались на экран */
@media (max-width: 599px) {
  .chips > li:nth-child(n + 5) {
    display: none;
  }

  .empty-mark {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .empty-lead {
    margin-bottom: 18px;
    font-size: 15px;
  }

  .chip {
    min-height: 52px;
    padding: 10px 12px;
  }
}

.chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.4;
  text-align: left;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease),
    transform 0.15s var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}

.chip:active {
  transform: translateY(1px);
}

.chip-icon {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--accent);
}

.empty-hint {
  max-width: 520px;
  margin: 16px auto 0;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
}

/* ===================== Сообщения ===================== */

.messages {
  display: flex;
  flex-direction: column;
  gap: 24px;
  list-style: none;
}

.messages:empty {
  display: none;
}

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

.msg-user .bubble {
  max-width: min(85%, 620px);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-assistant {
  display: grid;
  grid-template-columns: var(--avatar) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar);
  height: var(--avatar);
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
}

.avatar .icon {
  width: 18px;
  height: 18px;
}

.msg-col {
  min-width: 0;
  padding-top: 2px;
}

.answer {
  outline: none;
}

.answer:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 6px;
  border-radius: var(--radius-sm);
}

.answer-content {
  background: var(--bubble-assistant-bg);
}

.answer-content.is-revealing {
  animation: fade-up 0.3s var(--ease);
}

.answer-text {
  font-size: 16px;
  line-height: 1.7;
}

/* подвал ответа (источники, дата, остаток) — сервер сам отделяет его чертой */
.answer-footer {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 8px 0 0 -10px;
}

.answer-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}

.answer-action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.answer-action .icon {
  width: 16px;
  height: 16px;
}

@media (pointer: coarse) {
  .answer-action {
    min-height: 44px;
  }
}

/* «Думаю»: текущий шаг, время, раскрывающийся список шагов */
.thinking {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.thinking-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.35;
  text-align: left;
}

.thinking-head:disabled {
  cursor: default;
}

.thinking-spin {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.thinking-text {
  flex: 1;
  min-width: 0;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .is-thinking .thinking-text {
    background: linear-gradient(90deg, var(--text-muted) 0%, var(--text) 40%, var(--text-muted) 80%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 2.2s linear infinite;
  }
}

.thinking-time {
  color: var(--text-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.thinking-chev {
  display: inline-flex;
  color: var(--text-faint);
}

.thinking-chev .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease);
}

.thinking.is-open .thinking-chev .icon {
  transform: rotate(180deg);
}

.thinking-steps {
  display: grid;
  gap: 6px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  list-style: none;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.4;
}

.step-icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

.step.is-done .step-icon {
  color: var(--success);
}

.step.is-active {
  color: var(--text);
}

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

.thinking.is-done {
  margin-bottom: 8px;
  border-color: transparent;
  background: transparent;
}

.thinking.is-done.is-open {
  border-color: var(--border);
}

.thinking.is-done .thinking-head {
  min-height: 34px;
  padding: 4px 10px 4px 8px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.thinking.is-done:not(.is-open) .thinking-head {
  margin-left: -8px;
}

.thinking.is-done .thinking-head:hover:not(:disabled) {
  color: var(--text);
}

.thinking-ok {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--success);
}

.thinking.no-steps .thinking-chev {
  display: none;
}

@media (pointer: coarse) {
  .thinking-head,
  .thinking.is-done .thinking-head {
    min-height: 44px;
  }
}

/* Уведомления: отказ, ошибка, остановлено; заметка «бот не помнит начало» */
.msg-notice {
  display: flex;
  padding-left: calc(var(--avatar) + 14px);
}

.notice {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 14.5px;
  line-height: 1.5;
  outline: none;
}

.notice:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.notice-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.notice-main {
  flex: 1;
  min-width: 0;
}

.notice-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.notice-denied {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.notice-denied .notice-icon {
  color: var(--warning);
}

.notice-error {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.notice-error .notice-icon {
  color: var(--danger);
}

.notice-cancelled {
  border-left-color: var(--border-strong);
  background: transparent;
  color: var(--text-muted);
}

.msg-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-left: calc(var(--avatar) + 14px);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.45;
}

.msg-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

@media (max-width: 599px) {
  .chat-page {
    --avatar: 26px;
  }

  .msg-assistant {
    gap: 10px;
  }

  .msg-notice,
  .msg-note {
    padding-left: 0;
  }

  .msg-user .bubble {
    max-width: 88%;
  }
}

/* ===================== Поле ввода ===================== */

.composer {
  position: relative;
  z-index: 10;
  flex: none;
  padding: 0 max(12px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--bg);
}

.composer-box {
  display: flex;
  flex-wrap: wrap; /* полоса прикреплённых фото — отдельной строкой над полем */
  align-items: flex-end;
  gap: 2px 6px;
  max-width: var(--thread-w);
  margin: 0 auto;
  padding: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.composer-box:focus-within {
  border-color: var(--focus-ring);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-soft);
}

/* Автовысота поля: невидимая копия текста в ::after задаёт высоту ячейки сетки (без JS-стилей) */
.grow {
  display: grid;
  flex: 1;
  min-width: 0;
}

.grow::after {
  content: attr(data-value) " ";
  visibility: hidden;
  overflow: hidden;
  white-space: pre-wrap;
}

.grow::after,
.grow > textarea {
  grid-area: 1 / 1 / 2 / 2;
  max-height: calc(8 * 1.5em + 14px);
  padding: 7px 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.grow > textarea {
  width: 100%;
  min-height: calc(1.5em + 14px);
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow-y: auto;
  resize: none;
}

.grow > textarea:focus,
.grow > textarea:focus-visible {
  outline: none;
}

.grow > textarea::placeholder {
  color: var(--text-faint);
}

.composer-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.counter {
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.counter.is-limit {
  color: var(--danger);
  font-weight: 600;
}

.send-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.send-btn:disabled {
  background: var(--surface-2);
  color: var(--text-faint);
}

.send-icon,
.stop-icon {
  display: inline-flex;
}

.send-btn .icon {
  width: 20px;
  height: 20px;
}

.stop-icon,
.composer-box.is-busy .send-icon {
  display: none;
}

.composer-box.is-busy .stop-icon {
  display: inline-flex;
}

.composer-box.is-busy .send-btn:not(:disabled) {
  background: var(--text);
  color: var(--bg);
}

@media (pointer: coarse) {
  .send-btn {
    width: 44px;
    height: 44px;
  }
}

.composer-note {
  max-width: var(--thread-w);
  margin: 6px auto 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.to-bottom {
  position: absolute;
  top: -54px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  animation: fade-in 0.2s var(--ease);
}

.to-bottom:hover {
  background: var(--surface-2);
}

.to-bottom .icon {
  width: 20px;
  height: 20px;
}

@media (pointer: coarse) {
  .to-bottom {
    top: -58px;
    width: 44px;
    height: 44px;
  }
}

/* ===================== Фото к вопросу ===================== */

/* Скрепка слева в поле ввода */
.attach-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.attach-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.attach-btn .icon {
  width: 21px;
  height: 21px;
}

.has-attach .attach-btn {
  color: var(--accent);
}

@media (pointer: coarse) {
  .attach-btn {
    width: 44px;
    height: 44px;
  }
}

/* Полоса миниатюр над полем: занимает всю строку */
.attach-strip {
  flex: 0 0 100%;
  min-width: 0;
  margin-bottom: 4px;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
}

.attach-list {
  display: flex;
  gap: 14px;
  padding: 9px 9px 6px 2px; /* место для кнопки «Убрать», которая выступает за угол миниатюры */
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}

.attach-item {
  position: relative;
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  animation: fade-up 0.2s var(--ease);
}

.attach-thumb {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: inherit;
  background: var(--surface-2);
  cursor: zoom-in;
}

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

.attach-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: inherit;
  background: var(--surface-2);
  color: var(--accent);
}

.attach-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

/* видимый кружок маленький, а нажимать удобно: область касания 44 px */
.attach-remove::after {
  content: "";
  position: absolute;
  inset: -10px;
}

.attach-remove:hover {
  background: var(--danger);
  color: #fff;
}

.attach-remove .icon {
  width: 13px;
  height: 13px;
}

.attach-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 0 2px;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.4;
}

.attach-count {
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Перетаскивание файлов: подсветка всей области переписки */
.drop-zone {
  position: absolute;
  inset: 8px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: none; /* события перетаскивания ловит .main — зона только показывает, куда бросать */
  animation: fade-in 0.15s var(--ease);
}

.drop-zone-inner {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: min(400px, calc(100% - 32px));
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-weight: 600;
  text-align: center;
}

.drop-zone-icon {
  display: inline-flex;
  color: var(--accent);
}

.drop-zone-icon .icon {
  width: 36px;
  height: 36px;
}

/* Подсказка в пустом чате */
.empty-photo-hint {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  text-align: left;
}

.empty-photo-icon {
  display: inline-flex;
  margin-top: 2px;
  color: var(--accent);
}

.empty-photo-icon .icon {
  width: 16px;
  height: 16px;
}

/* Сообщение с фото: миниатюры над текстом вопроса */
.msg-user.has-photos {
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.msg-photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: min(85%, 420px);
  list-style: none;
}

.msg-photo-item {
  display: flex;
}

.msg-photo {
  display: block;
  width: 104px;
  height: 104px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-faint);
  cursor: zoom-in;
  transition: box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
}

.msg-photo:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* одно фото — крупнее и в своих пропорциях (размер известен заранее: лента не прыгает) */
.msg-photos.is-single .msg-photo {
  width: auto;
  height: auto;
  max-width: 100%;
}

.msg-photos.is-single .msg-photo img {
  width: 280px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.msg-photos.is-single.is-tall .msg-photo img {
  width: auto;
  height: 280px;
}

.msg-photo.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  cursor: default;
}

.msg-photo.is-missing .icon {
  width: 28px;
  height: 28px;
}

@media (max-width: 599px) {
  .attach-item {
    width: 58px;
    height: 58px;
  }

  .msg-photo,
  .msg-photo.is-missing {
    width: 84px;
    height: 84px;
  }

  .msg-photos.is-single .msg-photo img {
    width: 220px;
  }

  .msg-photos.is-single.is-tall .msg-photo img {
    height: 240px;
  }
}

/* Над полосой фото — подсказки не должны её закрывать */
.chat-page.has-attach {
  --design-picker-bottom: calc(env(safe-area-inset-bottom) + 236px);
}

.has-attach .toast {
  bottom: calc(222px + env(safe-area-inset-bottom));
}

/* Просмотр фото */
.viewer {
  width: min(980px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.viewer[open] {
  display: flex;
  flex-direction: column;
  animation: modal-in 0.2s var(--ease);
}

.viewer::backdrop {
  background: var(--overlay);
}

.viewer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 18px;
  border-bottom: 1px solid var(--border);
}

.viewer-heading {
  flex: 1;
  min-width: 0;
}

.viewer-title {
  font-size: 16px;
}

.viewer-name {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-name:empty {
  display: none;
}

.viewer-stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  overflow: hidden;
  background: #111114; /* фото смотрится на нейтральном тёмном фоне в любой теме */
}

.viewer-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  object-fit: contain;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  transform: translateY(-50%);
  transition: background-color 0.15s var(--ease);
}

.viewer-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}

.viewer-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.viewer-nav .icon {
  width: 22px;
  height: 22px;
}

.viewer-prev {
  left: 10px;
}

.viewer-next {
  right: 10px;
}

.viewer-note {
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.4;
}

@media (max-width: 599px) {
  .viewer {
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .viewer-head {
    padding-top: calc(6px + env(safe-area-inset-top));
  }

  .viewer-img {
    max-height: calc(100dvh - 140px);
  }
}

/* ===================== Меню ===================== */

.menu {
  position: absolute;
  z-index: 70;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: menu-in 0.14s var(--ease);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
}

.menu-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

.menu-item .icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.menu-label {
  flex: 1;
}

.menu-item.is-danger,
.menu-item.is-danger .icon {
  color: var(--danger);
}

.menu-item .menu-check {
  color: var(--accent);
}

.menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}

@media (pointer: coarse) {
  .menu-item {
    min-height: 44px;
  }
}

.menu-more {
  top: calc(100% - 4px);
  right: max(8px, env(safe-area-inset-right));
}

.menu-audience {
  bottom: calc(100% - 2px);
  left: 10px;
}

.menu-chat {
  top: calc(100% - 2px);
  right: 2px;
  min-width: 190px;
}

.menu-chat.is-up {
  top: auto;
  bottom: calc(100% - 2px);
}

/* ===================== Диалоги ===================== */

.confirm {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.confirm[open] {
  animation: modal-in 0.2s var(--ease);
}

.confirm::backdrop {
  background: var(--overlay);
}

.confirm-inner {
  padding: 22px 22px 18px;
}

.confirm-title {
  margin-bottom: 8px;
  font-size: 19px;
}

.confirm-text {
  color: var(--text-muted);
  font-size: 15px;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.confirm-actions.is-stacked {
  flex-direction: column;
}

.confirm-actions.is-stacked .btn {
  width: 100%;
}

@media (max-width: 479px) {
  .confirm-actions {
    flex-direction: column;
  }

  .confirm-actions .btn {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .chat-page .btn-danger {
    color: #1a0707;
  }
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.form-error {
  margin-bottom: 12px;
  color: var(--danger);
}

.legal-body {
  font-size: 14.5px;
  line-height: 1.6;
}

/* Лимиты и тарифы */
.limits-section + .limits-section {
  margin-top: 24px;
}

.limits-h {
  margin-bottom: 10px;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tier-line {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: var(--heading-weight);
  line-height: 1.3;
}

.blocked {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.stat + .stat {
  margin-top: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14.5px;
}

.stat-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bar {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.bar::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-2);
}

.bar::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.bar::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.stat-note {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.plans {
  display: grid;
  gap: 10px;
}

@media (min-width: 560px) {
  .plans {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

.plan {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

.plan.is-current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
}

.plan-title {
  font-weight: 700;
}

.plan-tag {
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.plan-tagline {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.plan-features {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.45;
}

.soon {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.45;
}

.soon .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--accent);
}

/* ===================== Всплывающие строки ===================== */

.toast {
  position: fixed;
  bottom: calc(118px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 1000;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: toast-in 0.2s var(--ease);
}

.offline-pill {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 1000;
  padding: 6px 14px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
}

/* ===================== Анимации ===================== */

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -120% 0;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

/* ===================== «Современный»: мягкие градиенты, крупные скругления ===================== */

:root:not([data-design="classic"]) .sb-logo,
:root:not([data-design="classic"]) .empty-mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

:root:not([data-design="classic"]) .empty-mark {
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}

:root:not([data-design="classic"]) .sb-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
}

:root:not([data-design="classic"]) .sb-new {
  border-color: var(--border);
}

:root:not([data-design="classic"]) .avatar {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

:root:not([data-design="classic"]) .send-btn:not(:disabled) {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
}

/* ===================== «Классика»: бумага, тонкие линейки, золото ===================== */

:root[data-design="classic"] .sidebar {
  border-right-color: var(--border-strong);
}

:root[data-design="classic"] .sb-logo {
  border: 1px solid var(--accent-2);
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
}

:root[data-design="classic"] .sb-new {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

:root[data-design="classic"] .sb-new:hover {
  background: var(--accent-soft);
}

:root[data-design="classic"] .sb-group-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
}

:root[data-design="classic"] .sb-item.is-current {
  background: var(--surface);
  box-shadow: inset 2px 0 0 var(--accent-2);
}

:root[data-design="classic"] .sb-avatar {
  border: 1px solid var(--accent-2);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-display);
}

:root[data-design="classic"] .aud-badge,
:root[data-design="classic"] .tier-badge {
  border-radius: var(--radius-sm);
}

:root[data-design="classic"] .tier-badge {
  border-color: var(--accent-2);
  color: var(--accent-3);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

:root[data-design="classic"] .topbar {
  border-bottom-color: var(--border-strong);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

:root[data-design="classic"] .topbar-title {
  font-family: var(--font-display);
  font-size: 17px;
}

:root[data-design="classic"] .empty-mark {
  border: 1px solid var(--accent-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
}

:root[data-design="classic"] .empty-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin: 14px auto 0;
  background: var(--accent-2);
}

:root[data-design="classic"] .empty-lead {
  margin-top: 14px;
}

:root[data-design="classic"] .empty-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

:root[data-design="classic"] .chip {
  border-radius: var(--radius-md);
}

:root[data-design="classic"] .chip:hover {
  border-color: var(--accent-2);
  box-shadow: none;
}

:root[data-design="classic"] .chip-icon {
  color: var(--accent-3);
}

:root[data-design="classic"] .msg-user .bubble {
  border-radius: var(--radius-lg) var(--radius-lg) 2px var(--radius-lg);
}

:root[data-design="classic"] .avatar {
  border-color: var(--accent-2);
  color: var(--accent);
}

:root[data-design="classic"] .answer-content {
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

:root[data-design="classic"] .answer-actions {
  margin-left: -4px;
}

:root[data-design="classic"] .thinking,
:root[data-design="classic"] .notice {
  border-radius: var(--radius-md);
}

:root[data-design="classic"] .composer-box {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

:root[data-design="classic"] .send-btn {
  border-radius: var(--radius-md);
}

:root[data-design="classic"] .confirm {
  border-top: 3px solid var(--accent-2);
}

:root[data-design="classic"] .plan.is-current {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-2);
}

:root[data-design="classic"] .plan-tag {
  color: var(--accent-3);
}

/* фото: рамка «как отпечаток», золотая черта у просмотра */
:root[data-design="classic"] .msg-photo {
  padding: 3px;
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

:root[data-design="classic"] .msg-photo img {
  border-radius: 2px;
}

:root[data-design="classic"] .msg-photo:hover {
  border-color: var(--accent-2);
}

:root[data-design="classic"] .attach-btn {
  border-radius: var(--radius-md);
}

:root[data-design="classic"] .attach-thumb {
  border-color: var(--border-strong);
}

:root[data-design="classic"] .attach-count {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
}

:root[data-design="classic"] .drop-zone {
  border-color: var(--accent-2);
  border-radius: var(--radius-md);
}

:root[data-design="classic"] .drop-zone-icon {
  color: var(--accent-3);
}

:root[data-design="classic"] .viewer {
  border-top: 3px solid var(--accent-2);
}

:root[data-design="classic"] .viewer-title {
  font-size: 17px;
}

/* «Современный»: миниатюры с крупными скруглениями, скрепка с акцентом при наведении */
:root:not([data-design="classic"]) .attach-btn:hover {
  color: var(--accent);
}

:root:not([data-design="classic"]) .msg-photo {
  border-radius: 14px;
}

@media (max-width: 599px) {
  :root[data-design="classic"] .answer-content {
    padding: 14px 14px;
  }
}

@media (prefers-color-scheme: dark) {
  :root[data-design="classic"] .tier-badge {
    color: var(--accent);
  }
}
