/* Lock-экран для не-Premium юзеров */
.as-lock {
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fff 100%);
  border: 2px dashed #f59e0b;
  border-radius: 14px;
  text-align: center;
  margin: 1.5rem 0;
}
.as-lock__icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.as-lock__title {
  color: #92400e;
  margin: 0 0 0.7rem;
  font-size: 1.3rem;
}
.as-lock__desc {
  color: #78350f;
  margin: 0 auto 1.2rem;
  max-width: 420px;
  line-height: 1.5;
}
.as-lock__btn {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  background: #eab308;
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}
.as-lock__btn:hover {
  background: #ca8a04;
  transform: translateY(-1px);
}

/* Затенённая заблокированная превьюшка чата */
.as-lock-fade {
  opacity: 0.4;
  pointer-events: none;
  filter: saturate(0.5);
}
.as-log--locked {
  min-height: 12rem;
}
.as-form--disabled {
  opacity: 0.7;
}
.as-form--disabled textarea,
.as-form--disabled button {
  cursor: not-allowed;
}

/* Ассистент — чат */

/* Панель «Дневной / Дополнительные» под чатом */
.as-quota {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.9rem;
  margin: 0.8rem 0 0.5rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
@media (max-width: 500px) {
  .as-quota { flex-direction: column; align-items: stretch; gap: 0.5rem; }
}
.as-quota__side {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.as-quota__side--extra {
  gap: 0.5rem;
}
.as-quota__label {
  color: #6b7280;
  font-size: 0.92rem;
}
.as-quota__value {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  color: #166534;
  display: inline-block;
  transition: transform 0.3s ease;
}
.as-quota__side--extra .as-quota__value { color: #6d28d9; }
.as-quota__value--updated { transform: scale(1.35); }
.as-quota__den {
  color: #9ca3af;
  font-size: 1.05rem;
  font-weight: 600;
}
.as-quota__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: #8b5cf6;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  margin-left: 0.3rem;
}
.as-quota__plus:hover { background: #7c3aed; }

.as-banner {
  background: #eef4ff;
  border: 1px solid #6a8ec0;
  color: #084298;
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  margin: 0.8rem 0 1.2rem;
  font-size: 0.95rem;
}
.as-banner--soft {
  background: #fff6e6;
  border-color: #d4a852;
  color: #7a5500;
}
.as-banner p { margin: 0 0 0.4rem; }
.as-banner p:last-child { margin-bottom: 0; }
.as-banner__small { font-size: 0.85rem; color: #555; }

.as-log {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 40vh;
  max-height: 65vh;
  overflow-y: auto;
  padding: 0.6rem;
  margin: 1rem 0;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid #ececec;
}

.as-empty {
  text-align: center;
  color: #666;
  padding: 2rem 1rem;
}
.as-empty p { margin: 0.3rem 0; }
.as-empty__hint { font-size: 0.85rem; color: #888; }

/* Suggested questions ─────────────────────────────────────────── */
.as-suggestions {
  margin-top: 1.8rem;
  text-align: left;
}
.as-suggestions__title {
  font-size: 0.85rem;
  color: #888;
  text-align: center;
  margin-bottom: 0.9rem;
  letter-spacing: 0.02em;
}
.as-suggestions__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.6rem;
}
.as-suggestion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.95rem;
  background: rgba(127, 90, 240, 0.06);
  border: 1px solid rgba(127, 90, 240, 0.18);
  border-radius: 10px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.35;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  font-family: inherit;
}
.as-suggestion:hover {
  background: rgba(127, 90, 240, 0.13);
  border-color: rgba(127, 90, 240, 0.4);
}
.as-suggestion:active {
  transform: scale(0.98);
}
/* На пробном/велкоме шаблоны неактивны — серые, не кликаются (пусть впишет своё) */
.as-suggestion--locked,
.as-suggestion:disabled {
  opacity: 0.4;
  filter: grayscale(0.8);
  cursor: not-allowed;
  pointer-events: none;
}
.as-suggestion--locked:hover {
  background: rgba(127, 90, 240, 0.06);
  border-color: rgba(127, 90, 240, 0.18);
}
/* Инлайн-апселл сразу после исчерпания пробного доступа (тёплый момент) */
.as-upsell {
  margin: 1.2rem 0 0.4rem;
  padding: 1.1rem 1.3rem;
  background: linear-gradient(135deg, rgba(234,179,8,0.10), rgba(127,90,240,0.10));
  border: 1px solid rgba(234, 179, 8, 0.45);
  border-radius: 14px;
  text-align: center;
  animation: as-upsell-in 280ms ease;
}
@keyframes as-upsell-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.as-upsell__title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; }
.as-upsell__text { font-size: 0.93rem; line-height: 1.45; opacity: 0.9; margin-bottom: 0.9rem; }
.as-upsell__btn {
  display: inline-block;
  padding: 0.75rem 1.7rem;
  background: #eab308;
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}
.as-upsell__btn:hover { background: #ca8a04; transform: translateY(-1px); }
.as-suggestion__emoji {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.as-suggestion__text {
  flex: 1;
}
@media (max-width: 520px) {
  .as-suggestions__grid { grid-template-columns: 1fr; }
}

/* Дерево всех тем (под сеткой подсказок) ──────────────────────── */
.as-tree {
  margin-top: 1rem;
  border: 1px solid rgba(127, 90, 240, 0.18);
  border-radius: 12px;
  background: rgba(127, 90, 240, 0.04);
  overflow: hidden;
}
.as-tree[open] {
  background: rgba(127, 90, 240, 0.06);
}
.as-tree__toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
  color: #1a1a1a;
  font-weight: 600;
  user-select: none;
  transition: background 120ms ease;
}
.as-tree__toggle::-webkit-details-marker { display: none; }
.as-tree__toggle:hover {
  background: rgba(127, 90, 240, 0.1);
}
.as-tree__toggle::after {
  content: '▾';
  margin-left: auto;
  font-size: 0.9rem;
  color: #333;
  transition: transform 160ms ease;
}
.as-tree[open] > .as-tree__toggle::after {
  transform: rotate(180deg);
}
.as-tree__emoji { font-size: 1.15rem; }
.as-tree__label { flex: 1; font-weight: 500; }
.as-tree__count {
  font-size: 0.75rem;
  background: rgba(127, 90, 240, 0.25);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  color: #fff;
  margin-right: 0.4rem;
}
.as-tree__body {
  padding: 0.4rem 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.as-tree__cat {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}
.as-tree__cat[open] {
  background: rgba(127, 90, 240, 0.05);
  border-color: rgba(127, 90, 240, 0.2);
}
.as-tree__cat-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  color: #1a1a1a;
  font-weight: 600;
  user-select: none;
}
.as-tree__cat-toggle::-webkit-details-marker { display: none; }
.as-tree__cat-toggle:hover { color: #000; }
.as-tree__cat-toggle::after {
  content: '▸';
  margin-left: auto;
  font-size: 0.8rem;
  color: #444;
  transition: transform 140ms ease;
}
.as-tree__cat[open] > .as-tree__cat-toggle::after {
  transform: rotate(90deg);
}
.as-tree__cat-emoji { font-size: 1.05rem; }
.as-tree__cat-label { flex: 1; }
.as-tree__cat-count {
  font-size: 0.75rem;
  color: #555;
  font-weight: 600;
  margin-right: 0.35rem;
}
.as-tree__cat-items {
  padding: 0.25rem 0.5rem 0.55rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.4rem;
}
.as-suggestion--tree {
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
}
@media (max-width: 520px) {
  .as-tree__cat-items { grid-template-columns: 1fr; }
}

/* Follow-up подсказки под каждым ответом ассистента ─────────── */
.as-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
  padding-left: 0;
}
.as-followup {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  background: rgba(127, 90, 240, 0.06);
  border: 1px solid rgba(127, 90, 240, 0.22);
  border-radius: 999px;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1.25;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.as-followup:hover {
  background: rgba(127, 90, 240, 0.14);
  border-color: rgba(127, 90, 240, 0.45);
}
.as-followup:active {
  transform: scale(0.97);
}
.as-followup__emoji {
  font-size: 1rem;
  line-height: 1;
}
.as-followup__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22ch;
}
@media (max-width: 520px) {
  .as-followup__text { max-width: 18ch; }
}

/* Готовые вопросы — дерево preset-ов под ответом ассистента ── */
.as-presets {
  margin-top: 0.7rem;
}
.as-presets__top {
  border: 1px solid rgba(127, 90, 240, 0.22);
  border-radius: 12px;
  background: rgba(127, 90, 240, 0.04);
}
.as-presets__top > summary,
.as-presets__top-sum {
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  list-style: none;
  user-select: none;
}
.as-presets__top > summary::-webkit-details-marker { display: none; }
.as-presets__top > summary::before {
  content: '▸ ';
  display: inline-block;
  margin-right: 0.3rem;
  transition: transform 120ms ease;
}
.as-presets__top[open] > summary::before {
  transform: rotate(90deg);
}
.as-presets__inner {
  padding: 0.2rem 0.85rem 0.6rem;
}
.as-presets__cat {
  margin: 0.2rem 0;
}
.as-presets__cat > summary {
  padding: 0.35rem 0;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  list-style: none;
}
.as-presets__cat > summary::-webkit-details-marker { display: none; }
.as-presets__cat > summary::before {
  content: '▸ ';
  display: inline-block;
  margin-right: 0.3rem;
  transition: transform 120ms ease;
  color: rgba(127, 90, 240, 0.7);
}
.as-presets__cat[open] > summary::before {
  transform: rotate(90deg);
}
.as-presets__list {
  list-style: none;
  margin: 0.1rem 0 0.4rem 1rem;
  padding: 0;
}
.as-presets__leaf {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}
.as-presets__leaf:last-child {
  border-bottom: none;
}
.as-presets__leaf-title {
  flex: 1 1 60%;
  font-size: 0.88rem;
  line-height: 1.3;
}
.as-presets__ask {
  padding: 0.32rem 0.72rem;
  background: rgba(127, 90, 240, 0.12);
  border: 1px solid rgba(127, 90, 240, 0.4);
  border-radius: 999px;
  color: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease;
  white-space: nowrap;
}
.as-presets__ask:hover {
  background: rgba(127, 90, 240, 0.22);
}

.as-msg {
  display: flex;
  max-width: 85%;
}
.as-msg--user {
  align-self: flex-end;
  justify-content: flex-end;
}

/* Восстановленные сообщения из истории (клик «📜 Последняя история»).
   Слегка приглушены чтобы юзер видел: «это не свежее, это из прошлого». */
.as-msg--restored .as-msg__bubble {
  opacity: 0.85;
  border-left: 3px solid #cbd5e1;
}
.as-restored-sep {
  align-self: center;
  width: 100%;
  text-align: center;
  margin: 14px 0 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: #64748b;
  background: linear-gradient(to right,
    transparent 0%, #f1f5f9 20%, #f1f5f9 80%, transparent 100%);
  border-radius: 999px;
  letter-spacing: 0.2px;
}
.as-msg--assistant {
  align-self: flex-start;
  flex-direction: column;
  align-items: stretch;
}

.as-msg__bubble {
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.as-msg--user .as-msg__bubble {
  white-space: pre-wrap;  /* user-text сохраняет переводы строк */
}

/* === Markdown-рендер ассистента === */
.as-msg--assistant .as-msg__bubble p {
  margin: 0 0 0.6rem 0;
}
.as-msg--assistant .as-msg__bubble p:last-child {
  margin-bottom: 0;
}
.as-msg--assistant .as-msg__bubble h1,
.as-msg--assistant .as-msg__bubble h2,
.as-msg--assistant .as-msg__bubble h3,
.as-msg--assistant .as-msg__bubble h4 {
  margin: 0.85rem 0 0.45rem 0;
  line-height: 1.25;
  color: #0f172a;
}
.as-msg--assistant .as-msg__bubble h1 { font-size: 1.25rem; }
.as-msg--assistant .as-msg__bubble h2 { font-size: 1.15rem; }
.as-msg--assistant .as-msg__bubble h3 { font-size: 1.05rem; }
.as-msg--assistant .as-msg__bubble h4 { font-size: 1.0rem; color: #334155; }
.as-msg--assistant .as-msg__bubble strong {
  color: #0f172a;
}
.as-msg--assistant .as-msg__bubble em {
  font-style: italic;
  color: #475569;
}
.as-msg--assistant .as-msg__bubble code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.05rem 0.32rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: #be123c;
}
.as-msg--assistant .as-msg__bubble ul,
.as-msg--assistant .as-msg__bubble ol {
  margin: 0.4rem 0 0.6rem 0;
  padding-left: 1.4rem;
}
.as-msg--assistant .as-msg__bubble li {
  margin: 0.2rem 0;
}
.as-msg--assistant .as-msg__bubble hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 0.9rem 0;
}
/* Ссылки — выделены, при наведении подчёркиваются */
.as-msg--assistant .as-msg__bubble a.as-link {
  color: #6366f1;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dashed #c7d2fe;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.as-msg--assistant .as-msg__bubble a.as-link:hover {
  color: #4338ca;
  border-bottom: 1px solid #6366f1;
  text-decoration: none;
}
.as-msg--assistant .as-msg__bubble a.as-link:visited {
  color: #7c3aed;
}
/* Markdown-таблицы */
.as-msg--assistant .as-msg__bubble table.as-table {
  border-collapse: collapse;
  margin: 0.7rem 0;
  width: 100%;
  font-size: 0.92rem;
  background: #fafafa;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.as-msg--assistant .as-msg__bubble table.as-table th {
  background: #eef2ff;
  color: #1e293b;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 2px solid #c7d2fe;
}
.as-msg--assistant .as-msg__bubble table.as-table td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid #e5e7eb;
}
.as-msg--assistant .as-msg__bubble table.as-table tbody tr:last-child td {
  border-bottom: none;
}
.as-msg--assistant .as-msg__bubble table.as-table tbody tr:hover {
  background: #f5f3ff;
}
@media (max-width: 600px) {
  .as-msg--assistant .as-msg__bubble table.as-table {
    font-size: 0.85rem;
  }
  .as-msg--assistant .as-msg__bubble table.as-table th,
  .as-msg--assistant .as-msg__bubble table.as-table td {
    padding: 0.35rem 0.45rem;
  }
}
.as-msg--user .as-msg__bubble {
  background: #dbeafe;
  color: #0a2540;
  border-bottom-right-radius: 4px;
}
.as-msg--assistant .as-msg__bubble {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}
.as-msg--loading .as-msg__bubble {
  color: #999;
  font-style: italic;
}
.as-msg--error .as-msg__bubble {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

.as-form {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}
.as-form textarea {
  flex: 1 1 auto;
  min-height: 112px;        /* ~5 строк */
  resize: vertical;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;        /* немного меньше — вмещается больше текста */
  line-height: 1.4;
}
.as-form textarea:focus {
  outline: none;
  border-color: #6a8ec0;
  box-shadow: 0 0 0 2px rgba(106,142,192,0.2);
}
.as-form button {
  flex: 0 0 auto;
  padding: 0 1.2rem;
  border: none;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}
.as-form button:hover:not(:disabled) { background: #1d4ed8; }
.as-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.as-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #e5e7eb;
  font-size: 0.88rem;
  color: #555;
}
.as-meta ul {
  list-style: none;
  padding: 0.4rem 0 0 0.3rem;
  margin: 0;
}
.as-meta li { padding: 0.12rem 0; }
.as-meta summary { cursor: pointer; }

.as-card {
  background: #fafafa;
  padding: 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid #eee;
}

/* Онбординг */
.as-onb { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.as-onb__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.as-onb__field span {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f2937;
}
.as-onb__field input,
.as-onb__field textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}
.as-onb__field input:focus,
.as-onb__field textarea:focus {
  outline: none;
  border-color: #6a8ec0;
  box-shadow: 0 0 0 2px rgba(106,142,192,0.2);
}
.as-onb__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.as-onb__actions button {
  padding: 0.7rem 1.4rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
}
.as-onb__actions button:hover:not(:disabled) { background: #1d4ed8; }
.as-onb__skip {
  color: #666;
  text-decoration: underline;
  font-size: 0.9rem;
}
.as-onb__note {
  font-size: 0.85rem;
  color: #666;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: #f9fafb;
  border-radius: 6px;
  border-left: 3px solid #6a8ec0;
}

/* Страница карточки */
.as-card-view {
  padding: 1rem;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid #ececec;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.95rem;
  line-height: 1.55;
}
.as-card-meta {
  font-size: 0.85rem;
  color: #666;
  margin: 0.5rem 0 1rem;
}
.as-card-actions {
  display: flex;
  gap: 0.7rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.as-card-actions a,
.as-card-actions button {
  padding: 0.6rem 1.1rem;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #1f2937;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
}
.as-card-actions a:hover,
.as-card-actions button:hover { background: #f3f4f6; }
.as-card-actions .as-btn--danger {
  color: #991b1b;
  border-color: #fca5a5;
}
.as-card-actions .as-btn--danger:hover { background: #fee2e2; }

/* ── Оценка ответа ассистента (1..10 + ?) + режим (справа) ── */
.as-rate {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  width: 100%;
  position: relative;
}
.as-rate__left {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  position: relative;
}
.as-mode {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.as-mode__btn {
  appearance: none;
  padding: 3px 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #52525b;
  border-radius: 10px;
  font: 500 11px/1.3 inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.as-mode__btn:hover { background: #f4f4f5; }
.as-mode__btn.is-active {
  background: #18181b;
  color: #fff;
  border-color: #18181b;
  font-weight: 600;
}

@media (max-width: 640px) {
  .as-mode__btn { padding: 2px 6px; font-size: 10px; }
}
.as-rate__btn,
.as-rate__help {
  appearance: none;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #52525b;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
}
.as-rate__btn { width: 36px; height: 32px; font-size: 19px; line-height: 1; }
@media (hover: hover) { .as-rate__btn:hover { transform: scale(1.12); } }
.as-rate__help { width: 22px; height: 22px; font: 500 11px/1 inherit; align-self: center; }
.as-rate__label { font-size: 12px; color: #71717a; margin-right: 5px; align-self: center; }
.as-rate__btn:hover,
.as-rate__help:hover {
  background: #f4f4f5;
  border-color: #a1a1aa;
}
.as-rate__btn[disabled],
.as-rate__help[disabled] { cursor: default; }
.as-rate__btn.is-selected {
  border-color: #2e7d32;
  background: #eaf6ec;
  box-shadow: inset 0 0 0 2px #2e7d32;
  transform: none;
}
.as-rate__btn[disabled]:not(.is-selected) { opacity: 0.45; }
.as-rate.is-stale .as-rate__btn:not(.is-selected) { opacity: 0.3; }
.as-rate.is-stale .as-rate__btn.is-selected { opacity: 0.7; }

.as-rate__help {
  font-weight: 600;
  color: #a1a1aa;
}
.as-rate__tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  max-width: 280px;
  padding: 8px 10px;
  background: #18181b;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.35;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 5;
}
.as-rate__help:hover + .as-rate__tooltip,
.as-rate__help:focus + .as-rate__tooltip {
  opacity: 1;
}

/* ── Счётчик символов в чате ── */
.as-form {
  position: relative;
}
.as-charcount {
  position: absolute;
  right: 78px;
  bottom: -18px;
  font-size: 0.75rem;
  color: #94a3b8;
  pointer-events: none;
}
.as-charcount--warn { color: #d97706; }
.as-charcount--over { color: #dc2626; font-weight: 600; }

/* ── Быстрые вопросы скрыты (по просьбе): «Готовые вопросы», чипы
   фоллоу-апов и стартовые подсказки. Убрать display:none чтобы вернуть. ── */
.as-presets, .as-followups, .as-suggestions { display: none !important; }

/* ── Confirm-панель (подтверждение перед отправкой готовой подсказки) ── */
.as-confirm {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  display: block;
}
.as-confirm[hidden] { display: none; }
.as-confirm__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #1e40af;
  margin-bottom: 4px;
}
.as-confirm__text {
  font-size: 0.95rem;
  color: #111827;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 10px;
  word-break: break-word;
}
.as-confirm__actions {
  display: flex;
  gap: 8px;
}
.as-confirm__cancel,
.as-confirm__ask {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.as-confirm__cancel {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}
.as-confirm__cancel:hover { background: #f9fafb; }
.as-confirm__ask {
  background: #2563eb;
  color: #ffffff;
}
.as-confirm__ask:hover { background: #1d4ed8; }
.as-confirm__cancel:disabled,
.as-confirm__ask:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Busy-overlay: блокировка UI на время запроса к ассистенту ── */
.is-locked {
  opacity: 0.55;
  cursor: not-allowed !important;
  pointer-events: none;
}
#chat-busy-overlay {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
}
#chat-busy-overlay.is-on { display: block; }
#chat-busy-overlay .chat-busy__inner {
  background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  color: #fff;
  padding: 14px 22px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(67, 56, 202, 0.35);
  text-align: center;
  min-width: 260px;
  max-width: 90vw;
}
#chat-busy-overlay .chat-busy__spin {
  font-size: 1.6rem;
  animation: chat-busy-spin 1.4s linear infinite;
  display: inline-block;
}
@keyframes chat-busy-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
#chat-busy-overlay .chat-busy__text { font-weight: 600; margin: 6px 0 4px; font-size: 0.96rem; }
#chat-busy-overlay .chat-busy__hint { font-size: 0.82rem; opacity: 0.85; }

/* ── Кнопка «📜 Последняя история» + раскрывающаяся панель ── */
.as-history-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.as-history-btn {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.as-history-btn:hover { background: #e0e7ff; }
.as-history-btn:active { transform: translateY(1px); }
.as-history-panel {
  margin: 8px 0 12px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #fafbff;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.06);
  overflow: hidden;
}
.as-history-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
}
.as-history-panel__title { font-weight: 700; color: #4338ca; font-size: 0.92rem; }
.as-history-panel__close {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: #6366f1;
  padding: 0 6px;
}
.as-history-panel__body { padding: 12px 14px; max-height: 480px; overflow-y: auto; }
.as-history-panel__loading,
.as-history-panel__empty { color: #6b7280; font-size: 0.9rem; text-align: center; padding: 16px; }
.as-history-item {
  border-bottom: 1px dashed #e0e7ff;
  padding: 10px 0;
}
.as-history-item:last-child { border-bottom: none; }
.as-history-item__num { font-size: 0.78rem; color: #6b7280; margin-bottom: 6px; }
.as-history-item__q,
.as-history-item__a {
  font-size: 0.9rem; line-height: 1.5; margin: 4px 0;
  color: #1f2937;
}
.as-history-item__q { background: #eef2ff; padding: 8px 10px; border-radius: 8px; }
.as-history-item__a { background: #fff; padding: 8px 10px; border-radius: 8px; border: 1px solid #e5e7eb; max-height: 240px; overflow-y: auto; }

/* Вопросы с полным разбором - свёрнутая раскрывашка внизу, карточки по темам (патч 610, выбор Игоря) ─────────── */
.as-ready {
  margin: 0.6rem 0 0.4rem;
  border: 1px solid rgba(127, 90, 240, 0.22);
  border-radius: 14px;
  background: rgba(127, 90, 240, 0.04);
}
.as-ready__sum {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.as-ready__sum::-webkit-details-marker { display: none; }
.as-ready__cnt {
  font-weight: 400;
  opacity: 0.6;
}
.as-ready__chev {
  margin-left: auto;
  opacity: 0.55;
  font-size: 0.8rem;
  transition: transform 120ms ease;
}
.as-ready[open] .as-ready__chev { transform: rotate(180deg); }
.as-ready__body {
  padding: 0 0.8rem 0.7rem;
}
.as-ready__card {
  border-top: 1px solid rgba(127, 90, 240, 0.16);
  padding: 0.6rem 0 0.2rem;
}
.as-ready__card:first-child { border-top: 0; }
.as-ready__h {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.as-ready__emoji { font-size: 1.05rem; }
.as-ready__d {
  font-size: 0.82rem;
  opacity: 0.75;
  line-height: 1.35;
  margin-bottom: 0.45rem;
}
.as-ready__two {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.as-ready__btn {
  text-align: left;
}
.as-ready__btn[aria-pressed="true"] {
  background: rgba(127, 90, 240, 0.2);
  border-color: rgba(127, 90, 240, 0.6);
}
.as-confirm__desc {
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.85;
  margin: 0.35rem 0 0.2rem;
}

/* Вопрос в переписке - ссылка (патч 603) ─────────── */
.as-qlink {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(127, 90, 240, 0.65);
  cursor: pointer;
}
.as-qlink:hover {
  border-bottom-color: rgba(127, 90, 240, 1);
  background: rgba(127, 90, 240, 0.08);
}
.as-msg--user .as-qlink {
  border-bottom-color: rgba(255, 255, 255, 0.55);
}
.as-msg--user .as-qlink:hover {
  border-bottom-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
}
.as-again {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  opacity: 0.9;
}
.as-again__btn {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(127, 90, 240, 0.35);
  background: rgba(127, 90, 240, 0.08);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.as-again__btn:hover {
  background: rgba(127, 90, 240, 0.18);
}

/* Панель готовых вопросов выросла до полусотни плиток - даём ей свою прокрутку (Игорь 22.09; патч 700) */
.as-ready__body { max-height: 54vh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.as-ready__srch { position: sticky; top: 0; z-index: 2; }
.as-ready__body::-webkit-scrollbar { width: 8px; }
.as-ready__body::-webkit-scrollbar-thumb { background: rgba(127, 90, 240, 0.28); border-radius: 8px; }
.as-ready__body::-webkit-scrollbar-track { background: transparent; }
