/* AI chat modal ("AI-диспетчер"). Namespace: .aic-*
 *
 * Loaded from base.html after style.css. The home page's hero form keeps its
 * own .ai-chat-* classes in style.css; nothing here touches them. */

/* One accent ramp, one gradient, no one-off hex values below this block.
 * The gradient starts at --aic-accent rather than the home hero's #667eea so
 * that the header, the bot avatar, the user bubble and every primary button
 * are the same purple - and so the header title clears 4.5:1 on white, which
 * #667eea (3.7:1) did not. Green is reserved for WhatsApp and the
 * free-consultation pill: it is a brand mark and a status, never an action. */
.aic {
  --aic-ink: #101828;
  --aic-muted: #667085;
  --aic-line: #e6e8ef;
  --aic-line-strong: #d5d8e3;
  --aic-soft: #f4f5fa;
  --aic-accent: #5b5fe6;
  --aic-accent-hover: #4b4fd6;
  --aic-accent-ink: #ffffff;
  --aic-accent-soft: #eef0ff;
  --aic-accent-soft-hover: #e2e5ff;
  --aic-accent-line: #cfd3e6;
  --aic-accent-mute: #c9cbe0;
  --aic-gradient: linear-gradient(135deg, #5b5fe6 0%, #764ba2 100%);
  --aic-ok: #12855f;
  --aic-ok-soft: #e6f6ef;
  --aic-wa: #25d366;
  --aic-wa-hover: #1fb857;
  --aic-warn: #b54708;
  --aic-warn-soft: #fff4e5;
  --aic-warn-line: #ffe0b8;
  --aic-danger: #b42318;
  --aic-gold: #f5a524;
  --aic-gold-soft: #fbe7a1;
  --aic-gold-line: #f2d27a;
  --aic-gold-ink: #7a5a00;
  --aic-radius: 16px;
  --aic-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
  color: var(--aic-ink);
}

.aic-dialog {
  max-width: 860px;
}

.aic-content {
  border: 0;
  border-radius: var(--aic-radius);
  box-shadow: var(--aic-shadow);
  overflow: hidden;
  height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* ---- header --------------------------------------------------------- */

.aic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--aic-gradient);
  color: #fff;
}

.aic-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.aic-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.25rem;
  flex: 0 0 auto;
}

.aic-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.aic-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aic-header-actions {
  display: flex;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.aic-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: background 0.15s ease;
}

.aic-icon-btn:hover,
.aic-icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  outline: none;
}

/* ---- body ----------------------------------------------------------- */

.aic-body {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.1rem 1.1rem 0.5rem;
  background: var(--aic-soft);
  scroll-behavior: smooth;
}

.aic-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aic-turn {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: aic-in 0.22s ease-out;
}

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

.aic-msg {
  display: flex;
  gap: 0.6rem;
  max-width: 100%;
}

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

.aic-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--aic-gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  flex: 0 0 auto;
  margin-top: 2px;
}

.aic-bubble {
  padding: 0.7rem 0.95rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: min(78%, 620px);
  overflow-wrap: anywhere;
}

.aic-bubble p {
  margin: 0;
}

.aic-bubble p + p {
  margin-top: 0.4rem;
}

.aic-msg-bot .aic-bubble {
  background: #fff;
  border: 1px solid var(--aic-line);
  border-top-left-radius: 6px;
}

.aic-msg-user .aic-bubble {
  background: var(--aic-accent);
  color: var(--aic-accent-ink);
  border-top-right-radius: 6px;
}

.aic-msg-system .aic-bubble {
  background: var(--aic-warn-soft);
  color: var(--aic-warn);
  border: 1px solid var(--aic-warn-line);
  font-size: 0.88rem;
}

.aic-typing {
  display: inline-flex;
  gap: 5px;
  padding: 0.75rem 0.9rem;
  margin: 0.75rem 0 0.5rem 2.4rem;
  border-radius: 16px;
  border-top-left-radius: 6px;
  background: #fff;
  border: 1px solid var(--aic-line);
}

.aic-typing[hidden] {
  display: none;
}

.aic-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--aic-muted);
  animation: aic-blink 1.2s infinite ease-in-out;
}

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

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

@keyframes aic-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---- lawyer cards --------------------------------------------------- */

.aic-section {
  margin-left: 2.4rem;
}

.aic-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--aic-muted);
  margin: 0 0 0.45rem;
}

.aic-cards {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 8px;
  margin: 0 -2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--aic-line-strong) transparent;
}

.aic-cards::-webkit-scrollbar {
  height: 6px;
}

.aic-cards::-webkit-scrollbar-thumb {
  background: var(--aic-line-strong);
  border-radius: 6px;
}

.aic-card {
  flex: 0 0 min(78%, 300px);
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid var(--aic-line);
  border-radius: 14px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}

.aic-card-sponsored {
  border-color: var(--aic-gold-line);
  background: linear-gradient(180deg, #fffdf3 0%, #fff 60%);
}

.aic-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--aic-gold-soft);
  color: var(--aic-gold-ink);
}

.aic-card-head {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.aic-card-photo,
.aic-card-photo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex: 0 0 auto;
}

.aic-card-photo-placeholder {
  display: grid;
  place-items: center;
  background: var(--aic-accent-soft);
  color: var(--aic-accent);
  font-size: 1.4rem;
}

.aic-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--aic-ink);
  text-decoration: none;
  display: block;
  line-height: 1.25;
}

.aic-card-name:hover {
  color: var(--aic-accent);
}

.aic-card-kind {
  font-size: 0.8rem;
  color: var(--aic-muted);
  margin-top: 2px;
}

.aic-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.aic-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.76rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--aic-soft);
  color: var(--aic-ink);
}

.aic-pill i {
  font-size: 0.75rem;
  color: var(--aic-muted);
}

.aic-pill-rating i {
  color: var(--aic-gold);
}

.aic-pill-ok {
  background: var(--aic-ok-soft);
  color: var(--aic-ok);
}

.aic-card-spec {
  font-size: 0.8rem;
  color: var(--aic-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aic-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
}

.aic-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--aic-line);
  color: var(--aic-ink);
  background: #fff;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.aic-btn:hover {
  background: var(--aic-soft);
  color: var(--aic-ink);
}

.aic-btn-wa {
  background: var(--aic-wa);
  border-color: var(--aic-wa);
  color: #fff;
}

.aic-btn-wa:hover {
  background: var(--aic-wa-hover);
  color: #fff;
}

.aic-btn-call {
  background: var(--aic-accent-soft);
  border-color: var(--aic-accent-soft);
  color: var(--aic-accent);
}

.aic-btn-call:hover {
  background: var(--aic-accent-soft-hover);
  color: var(--aic-accent);
}

/* ---- law documents -------------------------------------------------- */

.aic-docs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aic-doc {
  background: #fff;
  border: 1px solid var(--aic-line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.aic-doc-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--aic-accent-soft);
  color: var(--aic-accent);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

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

.aic-doc-kind {
  font-size: 0.76rem;
  color: var(--aic-muted);
}

.aic-doc-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--aic-ink);
  text-decoration: none;
  display: block;
  line-height: 1.35;
}

.aic-doc-title:hover {
  color: var(--aic-accent);
}

.aic-doc-status {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--aic-ok-soft);
  color: var(--aic-ok);
}

.aic-doc-status-repealed,
.aic-doc-status-suspended {
  background: var(--aic-warn-soft);
  color: var(--aic-warn);
}

.aic-doc-open {
  flex: 0 0 auto;
  align-self: center;
}

.aic-link {
  font-size: 0.85rem;
  color: var(--aic-accent);
  text-decoration: none;
  font-weight: 600;
}

.aic-link:hover {
  text-decoration: underline;
}

/* ---- action cards (consent, contact form) --------------------------- */

.aic-action {
  background: #fff;
  border: 1px solid var(--aic-line);
  border-left: 4px solid var(--aic-accent);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.aic-action-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}

.aic-action-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--aic-muted);
}

.aic-action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.aic-btn-primary {
  flex: 0 0 auto;
  background: var(--aic-accent);
  border-color: var(--aic-accent);
  color: #fff;
  padding: 0.55rem 0.95rem;
}

.aic-btn-primary:hover {
  background: var(--aic-accent-hover);
  color: #fff;
}

.aic-btn-ghost {
  flex: 0 0 auto;
  padding: 0.55rem 0.95rem;
}

.aic-btn[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.aic-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.aic-form-grid .aic-field-full {
  grid-column: 1 / -1;
}

.aic-field label {
  display: block;
  font-size: 0.76rem;
  color: var(--aic-muted);
  margin-bottom: 0.2rem;
}

.aic-field input {
  width: 100%;
  border: 1px solid var(--aic-line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.92rem;
  background: #fff;
}

.aic-field input:focus {
  outline: none;
  border-color: var(--aic-accent);
  box-shadow: 0 0 0 3px var(--aic-accent-soft);
}

.aic-form-error {
  font-size: 0.82rem;
  color: var(--aic-danger);
  margin: 0;
}

/* ---- history panel ("Прошлые чаты") --------------------------------- */
/* A sibling of .aic-body, not an overlay inside it: the body is the scroll
 * container, so an absolutely positioned child would scroll away with the
 * transcript. Opening the panel hides the body and the footer instead. */

.aic-history {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--aic-soft);
  padding: 0.9rem 1.1rem 1.1rem;
}

.aic-history[hidden],
.aic-body[hidden],
.aic-footer[hidden] {
  display: none;
}

.aic-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.6rem;
}

.aic-history-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--aic-muted);
}

.aic-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aic-history-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid var(--aic-line);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aic-history-row:hover,
.aic-history-row:focus-within {
  border-color: var(--aic-accent-line);
  box-shadow: 0 1px 6px rgba(16, 24, 40, 0.06);
}

.aic-history-open {
  flex: 1 1 auto;
  min-width: 0;
  text-align: start;
  border: 0;
  background: none;
  padding: 0.7rem 0 0.7rem 0.85rem;
  color: inherit;
}

.aic-history-name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--aic-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aic-history-meta {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  color: var(--aic-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.aic-history-current {
  color: var(--aic-accent);
  font-weight: 600;
}

.aic-history-closed {
  color: var(--aic-warn);
}

.aic-history-remove {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0.55rem 0.5rem 0 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--aic-muted);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.aic-history-remove:hover,
.aic-history-remove:focus-visible {
  background: var(--aic-soft);
  color: var(--aic-danger);
  outline: none;
}

.aic-history-empty {
  margin: 0;
  padding: 1.4rem 0.25rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--aic-muted);
}

.aic-icon-btn.is-active {
  background: rgba(255, 255, 255, 0.34);
}

/* ---- footer ---------------------------------------------------------- */

.aic-footer {
  border-top: 1px solid var(--aic-line);
  padding: 0.6rem 1.1rem 0.7rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.aic-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.aic-chips::-webkit-scrollbar {
  display: none;
}

.aic-chips:empty {
  display: none;
}

.aic-chip {
  flex: 0 0 auto;
  border: 1px solid var(--aic-accent-line);
  background: #fff;
  color: var(--aic-accent);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.aic-chip:hover,
.aic-chip:focus-visible {
  background: var(--aic-accent-soft);
  outline: none;
}

.aic-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.aic-cta[hidden] {
  display: none;
}

.aic-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  background: var(--aic-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
}

.aic-cta-btn:hover {
  background: var(--aic-accent-hover);
}

.aic-cta-hint {
  font-size: 0.78rem;
  color: var(--aic-muted);
}

.aic-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  border: 1px solid var(--aic-line);
  border-radius: 14px;
  padding: 0.35rem 0.35rem 0.35rem 0.85rem;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.aic-input {
  flex: 1 1 auto;
  border: 0;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 0.45rem 0;
  max-height: 140px;
  background: transparent;
}

.aic-input:focus {
  outline: none;
}

.aic-input:disabled {
  color: var(--aic-muted);
}

.aic-send {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--aic-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex: 0 0 auto;
  transition: background 0.15s ease, transform 0.1s ease;
}

.aic-send:hover {
  background: var(--aic-accent-hover);
}

.aic-send:active {
  transform: scale(0.96);
}

.aic-send:disabled {
  background: var(--aic-accent-mute);
}

.aic-disclaimer {
  margin: 0;
  font-size: 0.72rem;
  color: var(--aic-muted);
  text-align: center;
}

.aic-disclaimer a {
  color: inherit;
}

/* ---- responsive ------------------------------------------------------ */

@media (max-width: 575.98px) {
  .aic-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
  }

  .aic-content {
    height: 100dvh;
    border-radius: 0;
  }

  .aic-body {
    padding: 0.85rem 0.75rem 0.4rem;
  }

  .aic-bubble {
    max-width: 88%;
  }

  .aic-section {
    margin-left: 0;
  }

  .aic-typing {
    margin-left: 0;
  }

  .aic-card {
    flex-basis: 84%;
  }

  .aic-form-grid {
    grid-template-columns: 1fr;
  }

  .aic-subtitle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aic-turn,
  .aic-typing span {
    animation: none;
  }

  .aic-body {
    scroll-behavior: auto;
  }
}

/* ---- refined editorial skin ----------------------------------------
 * A quiet legal-product palette keeps attention on the conversation. The
 * component remains fully namespaced so the site-wide hero chat is unchanged.
 */
.aic {
  --aic-ink: #172033;
  --aic-muted: #708096;
  --aic-line: #e2e7ee;
  --aic-line-strong: #cbd4df;
  --aic-soft: #f5f7fa;
  --aic-accent: #2f5bea;
  --aic-accent-hover: #2349c7;
  --aic-accent-soft: #edf2ff;
  --aic-accent-soft-hover: #e2eaff;
  --aic-accent-line: #cbd7fb;
  --aic-accent-mute: #aebce9;
  --aic-gradient: linear-gradient(135deg, #1d2d4f 0%, #315edc 100%);
  --aic-shadow: 0 24px 70px rgba(23, 32, 51, 0.22);
}

.aic.modal {
  --bs-modal-bg: transparent;
}

.aic .modal-dialog {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.aic-content {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  box-shadow: var(--aic-shadow);
  background: #fff;
}

.aic-header {
  min-height: 82px;
  padding: 1rem 1.25rem;
  background: var(--aic-gradient);
  position: relative;
}

.aic-header::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 80% -20%, rgba(255,255,255,.18), transparent 35%);
}

.aic-brand,
.aic-header-actions {
  position: relative;
  z-index: 1;
}

.aic-brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.aic-title {
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  color: #fff !important;
}

.aic-subtitle {
  margin-top: 0.22rem;
  font-size: 0.79rem;
  opacity: .78;
}

.aic-presence {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .28rem;
  font-size: .67rem;
  letter-spacing: .01em;
  color: rgba(255,255,255,.76);
}

.aic-presence i {
  color: #70e0ae;
  font-size: .43rem;
}

.aic-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255,255,255,.14);
}

.aic-icon-btn:hover,
.aic-icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

.aic-body {
  padding: 1.25rem 1.25rem .7rem;
  background: #f7f8fb;
}

.aic-messages { gap: .9rem; }

.aic-avatar {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background: var(--aic-accent-soft);
  color: var(--aic-accent);
  border: 1px solid var(--aic-accent-line);
}

.aic-bubble {
  padding: .8rem 1rem;
  border-radius: 17px;
  font-size: .93rem;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(23,32,51,.035);
}

.aic-msg-bot .aic-bubble {
  border-color: #e7ebf0;
  border-top-left-radius: 7px;
}

.aic-msg-user .aic-bubble {
  background: var(--aic-accent);
  border-top-right-radius: 7px;
  box-shadow: 0 5px 14px rgba(47,91,234,.18);
}

.aic-section { margin-left: 2.55rem; }

.aic-section-title {
  color: #718096;
  font-size: .7rem;
  letter-spacing: .08em;
}

.aic-card {
  border-radius: 17px;
  border-color: #e5e9ef;
  padding: .95rem;
  box-shadow: 0 4px 14px rgba(23,32,51,.035);
}

.aic-card-actions { gap: .45rem; }

.aic-btn {
  border-radius: 11px;
  padding: .55rem .65rem;
  font-size: .78rem;
  border-color: #e0e5ec;
}

.aic-btn-call {
  background: var(--aic-accent-soft);
  border-color: var(--aic-accent-soft);
  color: var(--aic-accent);
}

.aic-action {
  border: 1px solid #e1e7ef;
  border-left: 0;
  border-top: 3px solid var(--aic-accent);
  border-radius: 16px;
  padding: .95rem 1rem;
  box-shadow: 0 4px 14px rgba(23,32,51,.035);
}

.aic-footer {
  padding: .8rem 1.25rem .85rem;
  border-top-color: #e5e9ef;
  background: #fff;
  gap: .62rem;
}

.aic-chips {
  gap: .45rem;
  flex-wrap: wrap;
  overflow-x: visible;
}

/* Quick-reply/survey prompts are intentionally disabled. The composer is the
 * primary next step and remains available for free-form legal questions. */
.aic-chips {
  display: none !important;
}

/* The landing-page version uses separate legacy class names. Keep its canned
 * scenario buttons out of the primary composer too. (The close-time feedback
 * poll is gone from index.html; 👍/👎 lives under each bot turn now.) */
.ai-chat-scenarios-container {
  display: none !important;
}

.aic-chip {
  border: 1px solid #d5def7;
  background: #f8faff;
  color: #2f5bea;
  border-radius: 11px;
  padding: .48rem .72rem;
  font-size: .78rem;
  font-weight: 600;
}

.aic-chip::before {
  content: '↗';
  margin-right: .35rem;
  font-size: .72rem;
  opacity: .65;
}

.aic-chip:hover,
.aic-chip:focus-visible {
  background: var(--aic-accent-soft-hover);
  border-color: #b9c9f6;
}

.aic-cta {
  padding: .15rem 0;
}

.aic-cta-btn {
  border-radius: 11px;
  background: var(--aic-accent);
  padding: .62rem .9rem;
  font-size: .8rem;
  box-shadow: 0 5px 12px rgba(47,91,234,.16);
}

.aic-cta-btn:hover { background: var(--aic-accent-hover); }

.aic-cta-hint { font-size: .74rem; }

/* The request action now lives beside the relevant assistant answer. */
.aic-footer .aic-cta { display: none !important; }

.aic-composer {
  border-radius: 16px;
  padding: .42rem .42rem .42rem .95rem;
  border-color: #dce3ec;
  box-shadow: 0 2px 8px rgba(23,32,51,.025);
}

.aic-composer:focus-within {
  border-color: #9fb5f7;
  box-shadow: 0 0 0 3px rgba(47,91,234,.11);
}

.aic-input { font-size: .9rem; }

.aic-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--aic-accent);
}

.aic-disclaimer { font-size: .68rem; color: #8793a5; }

@media (max-width: 575.98px) {
  .aic-header { min-height: 72px; padding: .85rem .9rem; }
  .aic-presence { display: none; }
  .aic-body { padding: .9rem .75rem .45rem; }
  .aic-footer { padding: .7rem .75rem .8rem; }
  .aic-section { margin-left: 0; }
  /* 16px: anything smaller makes iOS Safari zoom the page on focus, and inside
   * the full-screen sheet that crops the header and the cards. */
  .aic-input { font-size: 16px; }
  .aic-field input { font-size: 16px; }
}

/* ---- waiting, failing, dictating (2026-09-09) ----------------------- */

/* The status row lives inside #aiChatMessages so aria-live announces it. */
.aic-msg-status .aic-bubble {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--aic-muted);
  font-size: .88rem;
}

.aic-status-dots {
  display: inline-flex;
  gap: 4px;
}

.aic-status-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aic-muted);
  animation: aic-blink 1.2s infinite ease-in-out;
}

.aic-status-dots span:nth-child(2) { animation-delay: .15s; }
.aic-status-dots span:nth-child(3) { animation-delay: .3s; }

/* A failure is a notice with a way out, never an answer. */
.aic-msg-failure .aic-bubble {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.aic-retry-row {
  display: flex;
  gap: .4rem;
}

.aic-retry {
  border: 1px solid var(--aic-warn-line);
  background: #fff;
  color: var(--aic-warn);
  border-radius: 999px;
  padding: .3rem .8rem;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease;
}

.aic-retry:hover:not(:disabled),
.aic-retry:focus-visible {
  background: var(--aic-warn-soft);
  outline: none;
}

.aic-retry:disabled {
  opacity: .65;
  cursor: default;
}

/* The mic sits between the textarea and the send button; hidden unless the
 * browser can actually dictate (the script decides). */
.aic-mic {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--aic-muted);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex: 0 0 auto;
  transition: background .15s ease, color .15s ease;
}

.aic-mic:hover,
.aic-mic:focus-visible {
  background: var(--aic-soft);
  color: var(--aic-ink);
  outline: none;
}

.aic-mic.is-listening {
  background: var(--aic-accent-soft);
  color: var(--aic-accent);
  animation: aic-mic-pulse 1.4s infinite ease-in-out;
}

.aic-mic[hidden] {
  display: none;
}

@keyframes aic-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 91, 234, .35); }
  50% { box-shadow: 0 0 0 6px rgba(47, 91, 234, 0); }
}

.aic-mic-note {
  margin: .2rem 0 0;
  font-size: .68rem;
  color: #8793a5;
  text-align: center;
}

.aic-mic-note[hidden] {
  display: none;
}

/* The header launcher (templates/core/base.html). navbar.css owns the rest
 * of the header; this one control belongs to the chat and is styled here. */
.site-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: var(--nav-radius, 10px);
  color: var(--nav-on-band, #fff);
  font-size: .875rem;
  font-weight: 500;
  padding: .5rem .75rem;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color .15s ease;
}

.site-chat-launcher:hover,
.site-chat-launcher:focus-visible {
  background: rgba(255, 255, 255, .22);
  outline: none;
}

.site-chat-launcher .bi {
  font-size: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .aic-status-dots span,
  .aic-mic.is-listening {
    animation: none;
  }
}

/* ---- cards that answer «will this lawyer talk to me…» (2026-09-09) ------
 * «Написать» is the first action and takes its own row; the three contact
 * buttons share the second. The language / fee pills reuse .aic-pill. */
.aic-card-actions {
  flex-wrap: wrap;
}

.aic-btn-chat {
  flex: 1 1 100%;
  background: var(--aic-accent);
  border-color: var(--aic-accent);
  color: var(--aic-accent-ink);
}

.aic-btn-chat:hover,
.aic-btn-chat:focus-visible {
  background: var(--aic-accent-hover);
  color: var(--aic-accent-ink);
}

.aic-pill-kk {
  background: var(--aic-accent-soft);
  color: var(--aic-accent);
}

.aic-pill-kk i {
  color: var(--aic-accent);
}

.aic-pill-fee i {
  color: var(--aic-ok);
}

.aic-cards-more {
  display: inline-block;
  margin-top: .2rem;
}

/* ---- «Нормы» ------------------------------------------------------------ */
.aic-citation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.aic-citation {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem .5rem;
  align-items: baseline;
  font-size: .85rem;
  line-height: 1.35;
}

.aic-citation-label {
  font-weight: 700;
  color: var(--aic-accent);
  text-decoration: none;
  white-space: nowrap;
}

a.aic-citation-label:hover,
a.aic-citation-label:focus-visible {
  text-decoration: underline;
}

.aic-citation-title {
  color: var(--aic-muted);
  min-width: 0;
}

/* ---- «Что сделать сейчас / Подготовьте» --------------------------------- */
.aic-plan {
  background: #fff;
  border: 1px solid var(--aic-line);
  border-radius: 12px;
  padding: .75rem .95rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.aic-plan-heading {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--aic-muted);
}

.aic-plan-heading + .aic-plan-list {
  margin-top: .1rem;
}

.aic-plan-list {
  margin: 0 0 .45rem;
  padding-left: 1.25rem;
  font-size: .88rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.aic-plan-list:last-child {
  margin-bottom: 0;
}

/* ---- «Что дальше» ------------------------------------------------------- */
.aic-action-next {
  border-left-color: var(--aic-ok);
}

/* ---- 👍/👎 under a bot turn --------------------------------------------- */
.aic-feedback {
  margin-left: 2.4rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .76rem;
  color: var(--aic-muted);
}

.aic-feedback-q {
  margin-right: .15rem;
}

.aic-feedback-btn {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--aic-muted);
  display: inline-grid;
  place-items: center;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.aic-feedback-btn:hover,
.aic-feedback-btn:focus-visible {
  background: var(--aic-soft);
  color: var(--aic-ink);
  outline: none;
}

.aic-feedback-btn.is-selected,
.aic-feedback-btn[aria-pressed="true"] {
  background: var(--aic-accent-soft);
  border-color: var(--aic-accent-line);
  color: var(--aic-accent);
}

.aic-feedback.is-done .aic-feedback-btn:not(.is-selected) {
  opacity: .45;
  pointer-events: none;
}

.aic-feedback.is-busy .aic-feedback-btn {
  pointer-events: none;
  opacity: .6;
}

@media (max-width: 575.98px) {
  .aic-feedback { margin-left: 0; }
}
