/* assistant.css — помощник «Капля» (П1, 2026-10-19m). Цвета — переменные темы; style.css не трогается.
   z-index: капля и окно 1800 — выше плашек заявок (900) и ниже окон программы (2000+) и меню групп (1900). */
.asst-drop { position: fixed; z-index: 1800; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; filter: drop-shadow(0 4px 8px rgba(16, 24, 40, .28)); border-radius: 50% 50% 50% 50%; transition: left .18s, top .18s; min-height: 0; }
.asst-drop.dragging { cursor: grabbing; transition: none; }
/* Г0 (29.10.2026): Капля — без кружка и подложки и в тёмной теме (общее правило тёмной темы для кнопок давало ей тёмный квадрат) */
html[data-theme="dark"] .asst-drop, html[data-theme="dark"] .asst-drop:hover { background: none; border: 0; box-shadow: none; }
.asst-drop img { width: 100%; height: 100%; display: block; pointer-events: none; }
.asst-drop:focus-visible { outline: 3px solid var(--primary, #1769aa); outline-offset: 3px; }
.asst-bounce { animation: asst-bounce .4s ease-out; }
@keyframes asst-bounce { 0% { transform: translateY(0); } 40% { transform: translateY(-10px); } 70% { transform: translateY(0); } 85% { transform: translateY(-3px); } 100% { transform: translateY(0); } }

.asst-win { position: fixed; z-index: 1800; display: flex; flex-direction: column; background: var(--surface, #fff); color: var(--text, #1f2430); border: 1px solid var(--border, #e2e5ea); border-radius: 14px; box-shadow: 0 16px 40px rgba(16, 24, 40, .25); overflow: hidden; max-width: calc(100vw - 24px); }
.asst-win[hidden] { display: none; }
.asst-win.asst-full { inset: 0; width: auto !important; height: auto !important; max-width: none; border-radius: 0; }
.asst-in { animation: asst-in .22s ease-out; }
.asst-out { animation: asst-out .2s ease-in forwards; }
@keyframes asst-in { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes asst-out { from { transform: scale(1); opacity: 1; } to { transform: scale(.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .asst-in, .asst-out, .asst-bounce { animation: none; } .asst-drop { transition: none; } }

.asst-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border, #e2e5ea); background: var(--bg, #f4f6f9); }
.asst-head-av { width: 28px; height: 35px; }
.asst-head-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.asst-sub { font-size: 12px; color: var(--muted, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asst-head .ghost.small { min-width: 36px; padding: 4px 8px; }
.asst-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.asst-q-row { display: flex; justify-content: flex-end; }
.asst-a-row { display: flex; gap: 8px; align-items: flex-start; }
.asst-av { width: 30px; height: 38px; flex: none; }
.asst-bubble { padding: 8px 11px; border-radius: 12px; font-size: 14px; line-height: 1.45; max-width: 100%; overflow-wrap: anywhere; }
.asst-mine { background: var(--primary, #1769aa); color: #fff; border-bottom-right-radius: 4px; max-width: 85%; white-space: pre-wrap; }
.asst-ans { background: var(--bg, #f4f6f9); border: 1px solid var(--border, #e2e5ea); border-top-left-radius: 4px; flex: 1; min-width: 0; }
.asst-wait { color: var(--muted, #6b7280); font-style: italic; }
.asst-k-blocked, .asst-k-limit, .asst-k-off { border-color: #8A9BA8; }
.asst-ref { font-size: 10px; font-weight: 700; color: var(--primary, #1769aa); margin-left: 1px; }
.asst-src { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed var(--border, #e2e5ea); padding-top: 6px; }
.asst-src-i { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; }
.asst-src-n { flex: none; min-width: 16px; height: 16px; border-radius: 8px; background: var(--primary, #1769aa); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.asst-src-t { flex: 1; min-width: 0; color: var(--muted, #6b7280); }
.asst-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.asst-acts { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.asst-acts .ghost.small { padding: 2px 8px; min-height: 28px; }
.asst-acts .on { background: rgba(23, 105, 170, .12); border-color: var(--primary, #1769aa); }
.asst-note { margin-top: 6px; font-size: 12.5px; color: var(--muted, #6b7280); }
.asst-fb { margin-top: 6px; display: flex; gap: 6px; }
.asst-fb input { flex: 1; min-width: 0; }
.asst-intro { background: rgba(23, 105, 170, .08); border: 1px solid rgba(23, 105, 170, .3); border-radius: 10px; padding: 10px; font-size: 13px; }
.asst-intro p { margin: 0 0 8px; }
.asst-foot { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border, #e2e5ea); }
.asst-foot textarea { flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 140px; font: inherit; padding: 8px 10px; border-radius: 10px; }
.asst-foot .primary { min-width: 44px; border-radius: 10px; }
.asst-notes { display: flex; flex-direction: column; gap: 8px; }
.asst-notes-h { display: flex; justify-content: space-between; align-items: center; }
.asst-mine-q { font-weight: 600; margin-bottom: 4px; }
@media (max-width: 600px) { .asst-head .ghost.small, .asst-acts .ghost.small, .asst-opts .ghost.small { min-height: 40px; } .asst-bubble { font-size: 15px; } }

/* ⚙ Настройки → «Помощник» */
.asst-tabs { margin-bottom: 12px; }
.asst-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 14px; margin: 10px 0; }
.asst-grid label, .asst-wide { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.asst-wide textarea { width: 100%; box-sizing: border-box; }
.asst-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.asst-row input[type=text] { flex: 1; min-width: 160px; }
.asst-table { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
.asst-table th, .asst-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border, #e2e5ea); vertical-align: top; }
.asst-table tr.asst-cancel td { opacity: .55; text-decoration: line-through; }
.asst-card { border: 1px solid var(--border, #e2e5ea); border-radius: 10px; padding: 10px; margin: 8px 0; background: var(--surface, #fff); }
.asst-card textarea { width: 100%; box-sizing: border-box; margin: 6px 0; }
.asst-card-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.asst-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; margin: 3px; border: 1px solid var(--border, #e2e5ea); border-radius: 12px; font-size: 13px; }
.asst-det { margin: 8px 0; }
html[data-theme="dark"] .asst-ans { background: #1f2937; border-color: #374151; }
html[data-theme="dark"] .asst-head { background: #111827; }
html[data-theme="dark"] .asst-intro { background: rgba(96, 165, 250, .12); border-color: rgba(96, 165, 250, .35); }
/* 22i: «Мои вопросы», ⚙ «Вопросы без ответа», «Ход работы» */
#asst-my { position: relative; }
.asst-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #d14343; color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.asst-badge[hidden] { display: none; }
.asst-myq { margin: 8px 0; }
.asst-myq-st { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.asst-fresh { border-color: var(--primary, #1769aa); box-shadow: 0 0 0 2px rgba(23, 105, 170, .15); }
.asst-st-done { background: #e7f6ec; border-color: #9fd6b0; color: #1d6b37; }
.asst-st-wait { background: #eef4fb; border-color: #b9d2ec; color: #1f4f7a; }
.asst-st-late { background: #fff4e0; border-color: #f0c987; color: #7a4a00; }
.asst-st-bad { background: #fdecec; border-color: #f0b4b4; color: #8f1d1d; }
.asst-st-closed { background: var(--bg, #f4f6f9); color: var(--muted, #6b7280); }
.asst-gap-sum { margin: 6px 0; }
.asst-gap-f { flex-wrap: wrap; }
.asst-gap-f .on { background: rgba(23, 105, 170, .12); border-color: var(--primary, #1769aa); }
.asst-gap-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted, #6b7280); margin: 4px 0; }
.asst-gap-acts { flex-wrap: wrap; }
.asst-gap-form textarea, .asst-gap-form input[type=text] { width: 100%; box-sizing: border-box; margin: 6px 0; }
.asst-gap-form select { max-width: 100%; }
.asst-ov { position: fixed; inset: 0; z-index: 2100; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.asst-ov-box { background: var(--surface, #fff); color: var(--text, #1f2430); border-radius: 12px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 14px; box-sizing: border-box; }
.asst-log { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border, #e2e5ea); }
.asst-log li { position: relative; margin: 0 0 12px; padding-left: 6px; }
.asst-log li::before { content: ''; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 5px; background: var(--primary, #1769aa); }
.asst-log-n { margin-top: 4px; padding: 6px 8px; background: var(--bg, #f4f6f9); border-radius: 8px; font-size: 13px; white-space: pre-wrap; }
@media (max-width: 600px) { .asst-gap-acts .ghost.small { min-height: 40px; } .asst-ov { padding: 8px; align-items: stretch; } .asst-ov-box { max-height: none; } }

/* 26.10: черновики и ответы целиком — свёрнуто до 3 строк, «Показать полностью» */
.asst-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.asst-draft { margin-top: 6px; padding: 8px 10px; border-left: 3px solid var(--accent, #2b7); background: var(--bg-soft, rgba(0,0,0,.03)); border-radius: 4px; }
.asst-edit-t { width: 100%; box-sizing: border-box; min-height: 160px; resize: vertical; font: inherit; }
.asst-log-n, .asst-text { white-space: normal; overflow-wrap: anywhere; }

/* 27.10.2026: окно Капли двигается за заголовок и меняет размер за края (public/assistant.js, winGeometry) */
.asst-head { cursor: move; }
.asst-rs { position: absolute; z-index: 3; touch-action: none; }
.asst-rs-n, .asst-rs-s { left: 12px; right: 12px; height: 7px; cursor: ns-resize; }
.asst-rs-n { top: 0; } .asst-rs-s { bottom: 0; }
.asst-rs-e, .asst-rs-w { top: 12px; bottom: 12px; width: 7px; cursor: ew-resize; }
.asst-rs-e { right: 0; } .asst-rs-w { left: 0; }
.asst-rs-ne, .asst-rs-nw, .asst-rs-se, .asst-rs-sw { width: 14px; height: 14px; }
.asst-rs-ne { top: 0; right: 0; cursor: nesw-resize; } .asst-rs-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.asst-rs-nw { top: 0; left: 0; cursor: nwse-resize; } .asst-rs-se { bottom: 0; right: 0; cursor: nwse-resize; }
.asst-rs-se::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-right: 2px solid rgba(100, 110, 125, .5); border-bottom: 2px solid rgba(100, 110, 125, .5); }
.asst-win.asst-full .asst-rs { display: none; }
body.asst-moving { user-select: none; }
body.asst-moving iframe { pointer-events: none; }

/* 09.11.2026, №261109-КИ-4: своё сообщение в Капле — белый текст на светло-синем был 3,2 (светлая) и 2,5 (тёмная);
   фон темнее, контраст ≥ 4,5 в обеих темах. */
.asst-bubble.asst-mine, html[data-theme="dark"] .asst-bubble.asst-mine { background: #1565c0; color: #fff; }
