/* ЛК-2 · Ассистент (FR-441) — тёмная секция дизайн-системы.
   Локальные тёмные токены переопределяют светлые внутри .assistant-dark; акцент
   (золото) сохраняется. Полноэкранный чат на mobile. */
.assistant-dark {
  --a-bg: #221D17;
  --a-surface: #2B251E;
  --a-surface-2: #332C24;
  --a-ink: #F4EEE5;
  --a-muted: #A89A88;
  --a-line: rgba(244, 238, 229, 0.10);
  background: var(--a-bg);
  color: var(--a-ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

/* header */
.asst-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.asst-head h1 { font-size: 24px; letter-spacing: -.01em; color: var(--a-ink); }
.asst-head p { margin: 4px 0 0; font-size: 14px; color: var(--a-muted); }
.assistant-dark .muted { color: var(--a-muted); }
.asst-badge {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--a-surface-2); color: var(--a-ink); border: 1px solid var(--a-line);
}
.asst-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px rgba(63,125,90,.25); }

/* layout: chat + side panel */
.asst-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }

/* chat column */
.asst-chat { background: var(--a-surface); border: 1px solid var(--a-line); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; }
.asst-thread { min-height: 46vh; max-height: 58vh; overflow-y: auto; padding: 4px 6px 8px; display: flex; flex-direction: column; gap: 14px; }

.asst-welcome { margin: auto; text-align: center; padding: 24px; color: var(--a-muted); }
.asst-welcome-ic { font-size: 34px; color: var(--accent); }
.asst-welcome-title { font-size: 17px; font-weight: 600; color: var(--a-ink); margin-top: 8px; }
.asst-welcome-body { margin-top: 6px; max-width: 420px; }

/* messages */
.asst-msg { max-width: 82%; display: flex; flex-direction: column; gap: 4px; }
.asst-msg.user { align-self: flex-end; align-items: flex-end; }
.asst-msg.assistant { align-self: flex-start; }
.asst-msg-role { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--a-muted); }
.asst-msg-body { padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.asst-msg.user .asst-msg-body { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.asst-msg.assistant .asst-msg-body { background: var(--a-surface-2); color: var(--a-ink); border: 1px solid var(--a-line); border-bottom-left-radius: 4px; }
.asst-src { display: block; margin-top: 8px; font-size: 11px; color: var(--a-muted); opacity: .8; }

/* typing indicator */
.asst-typing { display: inline-flex; gap: 4px; }
.asst-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--a-muted); animation: asst-blink 1.2s infinite both; }
.asst-typing i:nth-child(2) { animation-delay: .2s; }
.asst-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes asst-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* scenario chips */
.asst-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 2px 10px; }
.asst-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--a-surface-2); color: var(--a-ink); border: 1px solid var(--a-line);
  transition: border-color .15s, background .15s;
}
.asst-chip:hover { border-color: var(--accent); background: #3a3128; }
.asst-chip-ic { font-size: 14px; }

/* input bar */
.asst-inputbar { display: flex; align-items: flex-end; gap: 8px; background: var(--a-surface-2); border: 1px solid var(--a-line); border-radius: 14px; padding: 7px 8px; }
.asst-input {
  flex: 1; resize: none; border: none; background: transparent; color: var(--a-ink);
  font-family: var(--body); font-size: 14.5px; line-height: 1.5; padding: 6px 6px; max-height: 140px; outline: none;
}
.asst-input::placeholder { color: var(--a-muted); }
.asst-mic, .asst-send {
  flex: none; width: 38px; height: 38px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
}
.asst-mic { background: transparent; color: var(--a-muted); border: 1px solid var(--a-line); }
.asst-mic:hover { color: var(--a-ink); border-color: var(--accent); }
.asst-mic.on { color: var(--neg); border-color: var(--neg); animation: asst-pulse 1s infinite; }
@keyframes asst-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(194,114,74,.4); } 50% { box-shadow: 0 0 0 5px rgba(194,114,74,0); } }
.asst-send { background: var(--accent); color: var(--accent-ink); }
.asst-send:hover { box-shadow: var(--shadow-soft); }
.asst-send:disabled { opacity: .5; cursor: not-allowed; }

/* disclaimer */
.asst-disclaimer { margin-top: 12px; font-size: 12px; color: var(--a-muted); line-height: 1.5; border-top: 1px solid var(--a-line); padding-top: 10px; }
.asst-disclaimer b { color: var(--accent); }

/* side panel — cards get dark treatment */
.asst-side { display: flex; flex-direction: column; gap: 16px; }
.assistant-dark .asst-side .card { background: var(--a-surface); border: 1px solid var(--a-line); color: var(--a-ink); }
.assistant-dark .asst-side .card-title { color: var(--a-ink); }

.asst-knows-lead { margin: -6px 0 12px; font-size: 12.5px; }
.asst-knows-list { display: flex; flex-direction: column; gap: 9px; }
.asst-know { display: flex; gap: 9px; font-size: 13px; line-height: 1.45; color: var(--a-ink); }
.asst-know-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 6px; }

/* history */
.asst-search { width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 9px 12px; border-radius: 10px; background: var(--a-surface-2); color: var(--a-ink); border: 1px solid var(--a-line); font-family: var(--body); font-size: 13px; outline: none; }
.asst-search::placeholder { color: var(--a-muted); }
.asst-hist-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.asst-hist-item { display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer; padding: 9px 11px; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--a-ink); }
.asst-hist-item:hover { background: var(--a-surface-2); }
.asst-hist-item.on { border-color: var(--accent); background: var(--a-surface-2); }
.asst-hist-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asst-hist-time { font-size: 11px; }
.asst-hist-empty { font-size: 13px; padding: 8px 2px; }
.asst-esc-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--a-line); }
.asst-esc-row .btn-line { color: var(--a-ink); border-color: var(--a-line); width: 100%; justify-content: center; }
.asst-esc-row .btn-line:hover { border-color: var(--accent); }

/* escalation modal (reuses overlay from app.css; fallback here for branch-only) */
.ov-backdrop { position: fixed; inset: 0; background: rgba(20,14,8,.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.ov-panel { width: 100%; max-width: 480px; }
.asst-modal { background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-pop); }
.asst-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.asst-modal-head h3 { font-size: 17px; }
.asst-esc-info { font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.asst-esc-reason { width: 100%; box-sizing: border-box; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font-family: var(--body); font-size: 14px; }
.asst-esc-result { margin: 12px 0; }
.asst-esc-ok { color: var(--pos); font-size: 14px; }
.asst-modal .btn { margin-top: 6px; }

/* mobile: fullscreen chat */
@media (max-width: 880px) {
  .assistant-dark { padding: 16px; border-radius: 14px; }
  .asst-layout { grid-template-columns: 1fr; }
  .asst-thread { min-height: 52vh; max-height: 60vh; }
  .asst-msg { max-width: 90%; }
  .asst-side { order: 2; }
}
