/* ============================================================
   Екатерина — AI-консультант tamakko.ru
   Дизайн «Графит» (Claude Design): индустриальный B2B-премиум.
   Сталь/графит + точечный оранжевый, Golos Text + JetBrains Mono.
   Префикс классов: .tmk-ek-   Шрифты подключаются в загрузчике.
   ============================================================ */

.tmk-ek-scope, .tmk-ek-scope *, .tmk-ek-scope *::before, .tmk-ek-scope *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}
.tmk-ek-scope {
  --ek-ink:    #1B1E24;   /* графит / текст на оранжевом */
  --ek-user:   #23272F;   /* пузырь пользователя */
  --ek-h1:     #262B34;   /* шапка градиент (верх) */
  --ek-h2:     #181B21;   /* шапка градиент (низ) */
  --ek-steel:  #6E7682;
  --ek-orange: #FFA500;   /* акцент / CTA */
  --ek-orange-h:#F59800;  /* hover */
  --ek-orange-l:#FFD9A0;
  --ek-teal:   #55C0B1;   /* кольцо аватара / акцент */
  --ek-link:   #2E8B7E;   /* ссылки */
  --ek-online: #36B89C;
  --ek-text:   #2C313B;
  --ek-dim:    #9AA1AB;
  --ek-line:   #E6E9ED;
  --ek-line2:  #D7DCE2;
  --ek-canvas: #F5F7F9;
  --ek-paper:  #FFFFFF;
  --ek-shadow: 0 26px 64px -22px rgba(20,24,31,.5), 0 0 0 1px rgba(20,24,31,.06);
  --ek-sans: 'Golos Text','Segoe UI',system-ui,Arial,sans-serif;
  --ek-mono: 'JetBrains Mono','SFMono-Regular',Consolas,monospace;
  font-family: var(--ek-sans); line-height: 1.5; font-size: 14px; color: var(--ek-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Launcher ---------- */
.tmk-ek-launcher {
  position: fixed; bottom: 24px; right: 24px; z-index: 2147483600;
  width: 60px; height: 60px; border-radius: 16px; border: none; padding: 0; cursor: pointer;
  background: linear-gradient(160deg, #eef1f4, #cfd6de); overflow: visible;
  box-shadow: 0 10px 24px -6px rgba(20,24,31,.5), 0 0 0 1px rgba(20,24,31,.08);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s ease;
}
.tmk-ek-launcher img { width: 100%; height: 100%; border-radius: 16px; object-fit: cover; object-position: center top; display: block; }
.tmk-ek-launcher::before { /* бирюзовый пульс-кольцо */
  content: ''; position: absolute; inset: 0; border-radius: 16px; border: 1.5px solid var(--ek-teal);
  pointer-events: none; animation: tmk-ek-pulse 2.6s ease-out infinite;
}
@keyframes tmk-ek-pulse { 0% { transform: scale(1); opacity: .55; } 70% { transform: scale(1.7); opacity: 0; } 100% { opacity: 0; } }
.tmk-ek-launcher:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 16px 32px -8px rgba(255,165,0,.5), 0 0 0 1px rgba(20,24,31,.1); }
/* оранжевые угловые «прицелы» */
.tmk-ek-cnr { position: absolute; width: 11px; height: 11px; pointer-events: none; z-index: 2; }
.tmk-ek-cnr-tr { top: 5px; right: 5px; border-top: 2px solid var(--ek-orange); border-right: 2px solid var(--ek-orange); }
.tmk-ek-cnr-bl { bottom: 5px; left: 5px; border-bottom: 2px solid var(--ek-orange); border-left: 2px solid var(--ek-orange); }
.tmk-ek-online { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%; background: var(--ek-online); box-shadow: 0 0 0 3px var(--ek-paper); z-index: 3; }

/* ---------- Teaser-попап (тёмная карточка с указателем) ---------- */
.tmk-ek-popup {
  position: fixed; bottom: 98px; right: 24px; z-index: 2147483600; width: 248px; cursor: pointer;
  background: linear-gradient(150deg, var(--ek-h1), var(--ek-h2)); color: #fff; border-radius: 14px; padding: 13px 14px;
  box-shadow: 0 18px 38px -10px rgba(20,24,31,.55), 0 0 0 1px rgba(20,24,31,.4);
  opacity: 0; transform: translateY(10px) scale(.96); pointer-events: none; transform-origin: bottom right;
  transition: opacity .35s ease, transform .35s cubic-bezier(.34,1.56,.64,1);
}
.tmk-ek-popup.tmk-ek-show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.tmk-ek-popup::after { content: ''; position: absolute; bottom: -5px; right: 26px; width: 12px; height: 12px; background: var(--ek-h2); transform: rotate(45deg); }
.tmk-ek-popup-close { position: absolute; right: 9px; top: 9px; width: 20px; height: 20px; border: none; border-radius: 6px; background: rgba(255,255,255,.07); color: var(--ek-dim); font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; }
.tmk-ek-popup-close:hover { background: rgba(255,255,255,.16); color: #fff; }
.tmk-ek-popup-head { display: flex; align-items: center; gap: 10px; }
.tmk-ek-popup-av { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; object-position: center top; box-shadow: 0 0 0 1.5px var(--ek-teal); flex: none; }
.tmk-ek-popup-name { font-weight: 600; font-size: 13.5px; }
.tmk-ek-popup-role { font-family: var(--ek-mono); font-size: 8.5px; letter-spacing: .06em; color: #8b93a0; margin-top: 2px; }
.tmk-ek-popup-msg { font-size: 12.5px; line-height: 1.5; color: #d7dbe1; margin-top: 10px; }
.tmk-ek-popup-msg b { color: #fff; font-weight: 600; }
.tmk-ek-popup-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.tmk-ek-popup-foot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ek-online); }
.tmk-ek-popup-foot span { font-family: var(--ek-mono); font-size: 8.5px; letter-spacing: .05em; color: var(--ek-dim); }

/* ---------- Окно чата ---------- */
.tmk-ek-window {
  position: fixed; bottom: 96px; right: 24px; z-index: 2147483599;
  width: 392px; height: 660px; max-height: calc(100vh - 108px);
  display: flex; flex-direction: column; background: var(--ek-paper); border-radius: 15px; overflow: hidden;
  box-shadow: var(--ek-shadow);
  opacity: 0; transform: translateY(24px) scale(.97); pointer-events: none; transform-origin: bottom right;
  transition: opacity .28s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.tmk-ek-window.tmk-ek-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---------- Шапка ---------- */
.tmk-ek-header { background: linear-gradient(150deg, var(--ek-h1), var(--ek-h2)); color: #fff; padding: 14px 16px 0; flex-shrink: 0; }
.tmk-ek-h-row { display: flex; align-items: center; gap: 12px; }
.tmk-ek-h-avatar { position: relative; width: 44px; height: 44px; border-radius: 13px; overflow: hidden; flex: none; box-shadow: 0 0 0 1.5px var(--ek-teal), inset 0 1px 0 rgba(255,255,255,.7); }
.tmk-ek-h-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.tmk-ek-h-avatar::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; background: var(--ek-online); box-shadow: 0 0 0 2.5px var(--ek-h2); }
.tmk-ek-h-info { flex: 1; min-width: 0; }
.tmk-ek-h-name { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.tmk-ek-h-status { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tmk-ek-h-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ek-online); box-shadow: 0 0 0 3px rgba(54,184,156,.18); }
.tmk-ek-h-status span { font-size: 11.5px; color: #aeb6c0; }
.tmk-ek-close { width: 30px; height: 30px; border: none; border-radius: 9px; background: rgba(255,255,255,.06); color: #aeb6c0; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.tmk-ek-close:hover { background: rgba(255,255,255,.16); color: #fff; }
.tmk-ek-close svg { width: 16px; height: 16px; }
.tmk-ek-h-spec { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.08); padding: 9px 0 10px; font-family: var(--ek-mono); font-size: 10px; letter-spacing: .07em; color: #8b93a0; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.tmk-ek-h-spec i { color: var(--ek-orange); font-style: normal; }

/* ---------- Сообщения ---------- */
.tmk-ek-messages { flex: 1; min-height: 0; overflow-y: auto; background: var(--ek-canvas); padding: 16px; display: flex; flex-direction: column; gap: 11px; scrollbar-width: thin; scrollbar-color: #cfd5dc transparent; }
.tmk-ek-messages::-webkit-scrollbar { width: 6px; }
.tmk-ek-messages::-webkit-scrollbar-thumb { background: #cfd5dc; border-radius: 4px; }
/* дети не сжимаются flex-ом — иначе высокая lead-форма ужимается и кнопка обрезается */
.tmk-ek-messages > * { flex-shrink: 0; }

.tmk-ek-msg { max-width: 86%; font-size: 13.5px; line-height: 1.55; padding: 11px 13px; word-wrap: break-word; overflow-wrap: anywhere; animation: tmk-ek-fade .26s cubic-bezier(.34,1.56,.64,1); }
@keyframes tmk-ek-fade { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.tmk-ek-msg-bot { align-self: flex-start; background: var(--ek-paper); color: var(--ek-text); border: 1px solid var(--ek-line); border-radius: 14px 14px 14px 4px; box-shadow: 0 1px 2px rgba(20,24,31,.05); }
.tmk-ek-msg-user { align-self: flex-end; background: var(--ek-user); color: #fff; border-radius: 14px 14px 4px 14px; }
.tmk-ek-msg-bot a { color: var(--ek-link); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.tmk-ek-msg-bot strong { font-weight: 700; color: var(--ek-ink); }
.tmk-ek-msg-bot p { margin: 7px 0; }
.tmk-ek-msg-bot p:first-child { margin-top: 0; }
.tmk-ek-msg-bot p:last-child { margin-bottom: 0; }
.tmk-ek-msg-bot ul { list-style: none; margin: 7px 0 1px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tmk-ek-msg-bot li { display: flex; gap: 8px; align-items: baseline; }
.tmk-ek-msg-bot li::before { content: ''; width: 6px; height: 6px; background: var(--ek-orange); flex: none; transform: translateY(1px); }

/* ---------- Быстрые чипы ---------- */
.tmk-ek-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 16px 0; background: var(--ek-paper); }
.tmk-ek-chip { padding: 7px 12px; border: 1px solid var(--ek-line2); border-radius: 9px; background: var(--ek-paper); font-family: var(--ek-sans); font-size: 12px; font-weight: 500; color: #3a4150; cursor: pointer; transition: all .16s ease; white-space: nowrap; }
.tmk-ek-chip:hover { border-color: var(--ek-orange); color: var(--ek-ink); transform: translateY(-1px); }
.tmk-ek-chip:active { transform: scale(.96); }
.tmk-ek-chip-lead { border: none; background: var(--ek-orange); color: var(--ek-ink); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tmk-ek-chip-lead:hover { background: var(--ek-orange-h); color: var(--ek-ink); transform: translateY(-1px); }
.tmk-ek-chip-lead b { font-family: var(--ek-mono); font-size: 11px; font-weight: 500; }

/* ---------- Печатает ---------- */
.tmk-ek-typing { align-self: flex-start; display: flex; gap: 5px; align-items: center; background: var(--ek-paper); border: 1px solid var(--ek-line); border-radius: 14px 14px 14px 4px; padding: 12px 15px; box-shadow: 0 1px 2px rgba(20,24,31,.05); }
.tmk-ek-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ek-dim); animation: tmk-ek-type 1.3s infinite; }
.tmk-ek-dot:nth-child(2) { animation-delay: .18s; }
.tmk-ek-dot:nth-child(3) { animation-delay: .36s; }
@keyframes tmk-ek-type { 0%,60%,100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---------- Lead-форма ---------- */
.tmk-ek-lead { align-self: stretch; background: var(--ek-paper); border: 1px solid var(--ek-line); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(20,24,31,.05); animation: tmk-ek-fade .32s ease; }
.tmk-ek-lead-promohead { background: var(--ek-ink); padding: 9px 15px; display: flex; align-items: center; gap: 8px; }
.tmk-ek-lead-promohead svg { width: 14px; height: 14px; flex: none; }
.tmk-ek-lead-promohead span { font-family: var(--ek-mono); font-size: 10px; letter-spacing: .08em; color: var(--ek-orange-l); }
.tmk-ek-lead-body { padding: 14px; }
.tmk-ek-lead-body h4 { font-weight: 600; font-size: 15px; color: var(--ek-ink); }
.tmk-ek-fld { display: block; margin-top: 10px; }
.tmk-ek-fld-lbl { display: block; font-family: var(--ek-mono); font-size: 9px; letter-spacing: .1em; color: var(--ek-dim); margin-bottom: 5px; text-transform: uppercase; }
.tmk-ek-fld-lbl em { color: #c4cad1; font-style: normal; }
.tmk-ek-fld-lbl em.req { color: var(--ek-orange); }
.tmk-ek-lead input { width: 100%; border: 1px solid var(--ek-line2); border-radius: 10px; padding: 9px 12px; font-family: var(--ek-sans); font-size: 13px; color: var(--ek-ink); background: var(--ek-paper); outline: none; transition: border-color .2s, box-shadow .2s; }
.tmk-ek-lead input:focus { border: 1.5px solid var(--ek-ink); box-shadow: 0 0 0 3px rgba(27,30,36,.06); }
.tmk-ek-lead-submit { width: 100%; margin-top: 12px; border: none; border-radius: 11px; padding: 12px; background: var(--ek-orange); color: var(--ek-ink); font-family: var(--ek-sans); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .2s, transform .15s; }
.tmk-ek-lead-submit:hover { background: var(--ek-orange-h); }
.tmk-ek-lead-submit:active { transform: scale(.98); }
.tmk-ek-lead-submit:disabled { opacity: .6; cursor: not-allowed; }
.tmk-ek-lead-hint { font-size: 11px; color: var(--ek-dim); line-height: 1.4; margin-top: 10px; }
.tmk-ek-lead-hint b { color: var(--ek-orange-d); font-weight: 600; }
.tmk-ek-lead-hint.tmk-ek-hint-err, .tmk-ek-lead-hint.tmk-ek-hint-err b { color: #e74c3c; }
.tmk-ek-lead-note { font-size: 10.5px; color: var(--ek-dim); line-height: 1.45; margin-top: 9px; text-align: center; }
.tmk-ek-lead-note a { color: var(--ek-link); text-decoration: underline; }

/* ---------- Lead success (тёмная карточка) ---------- */
.tmk-ek-leadres { align-self: stretch; animation: tmk-ek-fade .32s ease; }
.tmk-ek-done { background: linear-gradient(150deg, var(--ek-h1), var(--ek-h2)); border-radius: 14px; padding: 15px; color: #fff; display: flex; gap: 12px; align-items: flex-start; }
.tmk-ek-done.tmk-ek-done-coupon { border-radius: 14px 14px 0 0; }
.tmk-ek-done-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--ek-online); display: flex; align-items: center; justify-content: center; flex: none; }
.tmk-ek-done-ic svg { width: 16px; height: 16px; }
.tmk-ek-done-t { font-weight: 600; font-size: 14px; }
.tmk-ek-done-s { font-size: 12px; color: #c2c8d0; line-height: 1.5; margin-top: 3px; }

/* ---------- Купон-промокод ---------- */
.tmk-ek-coupon { position: relative; align-self: stretch; background: var(--ek-paper); border: 1.5px dashed #ffbf66; border-top: none; border-radius: 0 0 14px 14px; padding: 15px 16px; box-shadow: 0 1px 2px rgba(20,24,31,.05); animation: tmk-ek-fade .32s ease; }
.tmk-ek-coupon::before, .tmk-ek-coupon::after { content: ''; position: absolute; top: -1px; width: 14px; height: 14px; border-radius: 50%; background: var(--ek-canvas); box-shadow: inset 0 0 0 1px rgba(20,24,31,.06); }
.tmk-ek-coupon::before { left: -8px; }
.tmk-ek-coupon::after { right: -8px; }
.tmk-ek-coupon-cap { font-family: var(--ek-mono); font-size: 9px; letter-spacing: .14em; color: #c08a2e; }
.tmk-ek-coupon-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.tmk-ek-coupon-code { font-family: var(--ek-mono); font-weight: 700; font-size: 25px; letter-spacing: .06em; color: var(--ek-ink); }
.tmk-ek-coupon-copy { display: flex; align-items: center; gap: 6px; border: 1px solid var(--ek-line2); border-radius: 9px; padding: 8px 11px; font-size: 12px; font-weight: 500; color: #3a4150; background: var(--ek-paper); cursor: pointer; transition: border-color .2s, color .2s; }
.tmk-ek-coupon-copy:hover { border-color: var(--ek-orange); color: var(--ek-ink); }
.tmk-ek-coupon-copy svg { width: 13px; height: 13px; }
.tmk-ek-coupon-note { font-size: 10.5px; color: var(--ek-dim); line-height: 1.45; margin-top: 9px; }
.tmk-ek-coupon-note b { font-family: var(--ek-mono); font-size: 10px; color: var(--ek-text); font-weight: 500; }

/* ---------- Поле ввода ---------- */
.tmk-ek-input-area { flex-shrink: 0; display: flex; gap: 8px; align-items: flex-end; padding: 11px 16px 6px; background: var(--ek-paper); }
.tmk-ek-textarea { flex: 1; resize: none; border: 1px solid var(--ek-line2); border-radius: 11px; background: var(--ek-paper); color: var(--ek-text); font-family: var(--ek-sans); font-size: 13px; padding: 11px 13px; outline: none; max-height: 96px; min-height: 44px; line-height: 1.4; transition: border-color .2s, box-shadow .2s; scrollbar-width: thin; scrollbar-color: #cfd5dc transparent; }
.tmk-ek-textarea::placeholder { color: var(--ek-dim); }
.tmk-ek-textarea:focus { border-color: var(--ek-orange); box-shadow: 0 0 0 3px rgba(255,165,0,.12); }
.tmk-ek-send { width: 42px; height: 42px; flex: none; border: none; border-radius: 11px; background: var(--ek-orange); color: var(--ek-ink); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s, transform .15s; }
.tmk-ek-send:hover { background: var(--ek-orange-h); }
.tmk-ek-send:active { transform: scale(.9); }
.tmk-ek-send:disabled { opacity: .5; cursor: not-allowed; }
.tmk-ek-send svg { width: 17px; height: 17px; }

.tmk-ek-credit { flex-shrink: 0; text-align: center; font-family: var(--ek-mono); font-size: 8.5px; letter-spacing: .04em; color: #b3b9c1; padding: 6px 0 9px; background: var(--ek-paper); }

/* ---------- Мобильный ---------- */
@media (max-width: 520px) {
  .tmk-ek-window { width: 100vw; height: 100dvh; max-height: 100dvh; right: 0; bottom: 0; border-radius: 0; }
  .tmk-ek-launcher { bottom: 16px; right: 16px; width: 58px; height: 58px; }
  .tmk-ek-popup { right: 12px; bottom: 84px; width: calc(100vw - 88px); max-width: 248px; }
}
