/* ЯСНА — стили демо-виджета ИИ-помощника для портала МИА «Россия сегодня».
   Автономно, без внешних шрифтов/CDN. Все классы с префиксом yasna-, чтобы не конфликтовать с CSS портала.
   Палитра: #4272D8 / #205CD8 / #000F5A / #F1F6FB / #EDF8FF / #D9E3F7 / #545454. */

:root {
  --yasna-blue: #4272D8;
  --yasna-blue-hover: #205CD8;
  --yasna-dark: #000F5A;
  --yasna-bg-1: #F1F6FB;
  --yasna-bg-2: #EDF8FF;
  --yasna-bg-3: #D9E3F7;
  --yasna-text: #545454;
  --yasna-title: #000000;
  --yasna-white: #FFFFFF;
  --yasna-shadow: 0 4px 20px rgba(0, 15, 90, .12);
  --yasna-shadow-strong: 0 12px 40px rgba(0, 15, 90, .22);
  --yasna-online: #2ecc71;
}

/* Общий контейнер-скоуп: сброс наследования порталом, но шрифт наследуем */
.yasna-root,
.yasna-root * {
  box-sizing: border-box;
}
.yasna-root {
  font-family: inherit;
  line-height: 1.45;
  color: var(--yasna-text);
}

/* ============ FAB (плавающая кнопка) ============ */
.yasna-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--yasna-blue) 0%, var(--yasna-dark) 100%);
  color: var(--yasna-white);
  box-shadow: var(--yasna-shadow-strong);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: yasna-fab-in .35s ease both;
  padding: 0;
}
.yasna-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 16px 44px rgba(0, 15, 90, .32);
}
.yasna-fab:active { transform: scale(.97); }
.yasna-fab svg { width: 30px; height: 30px; display: block; }

/* пульсирующее кольцо */
.yasna-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--yasna-blue);
  opacity: .55;
  animation: yasna-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes yasna-pulse {
  0%   { transform: scale(1);   opacity: .55; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes yasna-fab-in {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* бейдж-искра на кнопке */
.yasna-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #fff;
  color: var(--yasna-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 15, 90, .25);
}

/* тултип «Спросите Ясну» */
.yasna-fab-tip {
  position: absolute;
  right: 74px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: var(--yasna-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: var(--yasna-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.yasna-fab-tip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--yasna-dark);
}
.yasna-fab:hover .yasna-fab-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.yasna-fab.yasna-hidden { display: none; }

/* ============ Панель чата ============ */
.yasna-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 48px);
  background: var(--yasna-white);
  border-radius: 16px;
  box-shadow: var(--yasna-shadow-strong);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: yasna-panel-in .28s cubic-bezier(.2, .8, .3, 1) both;
  border: 1px solid var(--yasna-bg-3);
}
@keyframes yasna-panel-in {
  from { transform: translateY(16px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}
.yasna-panel.yasna-hidden { display: none; }

/* Шапка */
.yasna-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(120deg, var(--yasna-blue) 0%, var(--yasna-dark) 100%);
  color: #fff;
  flex-shrink: 0;
}
.yasna-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yasna-blue) 0%, var(--yasna-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
}
.yasna-header .yasna-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .4);
}
.yasna-header-info { flex: 1; min-width: 0; }
.yasna-header-name {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.yasna-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yasna-online);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, .3);
  display: inline-block;
}
.yasna-header-sub {
  font-size: 11.5px;
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yasna-header-status {
  font-size: 11px;
  opacity: .95;
  margin-top: 1px;
}
.yasna-close {
  background: rgba(255, 255, 255, .15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
  flex-shrink: 0;
}
.yasna-close:hover { background: rgba(255, 255, 255, .28); }

/* Тело — лента сообщений */
.yasna-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
  scroll-behavior: smooth;
}
.yasna-body::-webkit-scrollbar { width: 8px; }
.yasna-body::-webkit-scrollbar-thumb {
  background: var(--yasna-bg-3);
  border-radius: 8px;
}
.yasna-body::-webkit-scrollbar-track { background: transparent; }

/* Строка сообщения */
.yasna-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  animation: yasna-msg-in .25s ease both;
}
@keyframes yasna-msg-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.yasna-msg-bot { justify-content: flex-start; }
.yasna-msg-user { justify-content: flex-end; }

.yasna-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yasna-blue) 0%, var(--yasna-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  align-self: flex-end;
}

.yasna-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.yasna-msg-bot .yasna-bubble {
  background: var(--yasna-bg-1);
  color: var(--yasna-text);
  border-bottom-left-radius: 5px;
}
.yasna-msg-user .yasna-bubble {
  background: var(--yasna-blue);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.yasna-bubble p { margin: 0 0 8px; }
.yasna-bubble p:last-child { margin-bottom: 0; }
.yasna-bubble b, .yasna-bubble strong { color: inherit; }

/* Индикатор печати */
.yasna-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}
.yasna-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yasna-blue);
  opacity: .55;
  animation: yasna-typing 1.1s infinite ease-in-out;
}
.yasna-typing span:nth-child(2) { animation-delay: .18s; }
.yasna-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes yasna-typing {
  0%, 60%, 100% { transform: translateY(0);   opacity: .45; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* Chips (кнопки-подсказки) */
.yasna-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.yasna-chip {
  background: #fff;
  border: 1px solid var(--yasna-blue);
  color: var(--yasna-blue);
  border-radius: 18px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  line-height: 1.2;
}
.yasna-chip:hover {
  background: var(--yasna-blue);
  color: #fff;
  transform: translateY(-1px);
}

/* Кнопки-действия внутри ответов */
.yasna-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.yasna-btn {
  background: var(--yasna-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  line-height: 1.2;
}
.yasna-btn:hover { background: var(--yasna-blue-hover); transform: translateY(-1px); }
.yasna-btn:active { transform: translateY(0); }
.yasna-btn-ghost {
  background: #fff;
  color: var(--yasna-blue);
  border: 1px solid var(--yasna-bg-3);
}
.yasna-btn-ghost:hover { background: var(--yasna-bg-1); }

/* ============ Карточки внутри ответов ============ */
.yasna-card {
  background: #fff;
  border: 1px solid var(--yasna-bg-3);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0, 15, 90, .06);
}
.yasna-card + .yasna-card { margin-top: 10px; }
.yasna-card-title {
  font-weight: 700;
  color: var(--yasna-dark);
  font-size: 14.5px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.yasna-card-sub {
  font-size: 12.5px;
  color: var(--yasna-text);
  margin: -4px 0 10px;
}

/* Крупное число (остаток отпуска, к выплате) */
.yasna-bignum {
  text-align: center;
  padding: 10px 0 12px;
}
.yasna-bignum-value {
  font-size: 40px;
  font-weight: 800;
  color: var(--yasna-blue);
  line-height: 1;
}
.yasna-bignum-label {
  font-size: 12.5px;
  color: var(--yasna-text);
  margin-top: 4px;
}

/* Мини-статы (положено / использовано / остаток) */
.yasna-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.yasna-stat {
  flex: 1;
  background: var(--yasna-bg-2);
  border-radius: 10px;
  padding: 9px 6px;
  text-align: center;
}
.yasna-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--yasna-dark);
  line-height: 1;
}
.yasna-stat-label {
  font-size: 10.5px;
  color: var(--yasna-text);
  margin-top: 4px;
}

/* Таблица (баланс, начисления, удержания) */
.yasna-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 4px 0;
}
.yasna-table th {
  text-align: left;
  font-weight: 600;
  color: var(--yasna-dark);
  padding: 7px 8px;
  border-bottom: 2px solid var(--yasna-bg-3);
  font-size: 12px;
}
.yasna-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--yasna-bg-1);
}
.yasna-table td.yasna-num,
.yasna-table th.yasna-num { text-align: right; white-space: nowrap; }
.yasna-table tr:last-child td { border-bottom: none; }
.yasna-table .yasna-row-total td {
  font-weight: 700;
  color: var(--yasna-dark);
  border-top: 2px solid var(--yasna-bg-3);
}

/* Инфо-блок / выноска */
.yasna-note {
  background: var(--yasna-bg-1);
  border-left: 3px solid var(--yasna-blue);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  color: var(--yasna-text);
  margin: 10px 0 0;
}
.yasna-note-accent {
  background: var(--yasna-bg-2);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 0;
  font-size: 13px;
}
.yasna-note-accent b { color: var(--yasna-dark); }

/* Список шагов / чеклист */
.yasna-steps {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: yasna-step;
}
.yasna-steps li {
  position: relative;
  padding: 7px 0 7px 34px;
  font-size: 13px;
  border-bottom: 1px solid var(--yasna-bg-1);
}
.yasna-steps li:last-child { border-bottom: none; }
.yasna-steps li::before {
  counter-increment: yasna-step;
  content: counter(yasna-step);
  position: absolute;
  left: 0;
  top: 6px;
  width: 24px;
  height: 24px;
  background: var(--yasna-blue);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.yasna-checklist { list-style: none; margin: 6px 0 0; padding: 0; }
.yasna-checklist li {
  position: relative;
  padding: 7px 0 7px 30px;
  font-size: 13px;
  border-bottom: 1px solid var(--yasna-bg-1);
}
.yasna-checklist li:last-child { border-bottom: none; }
.yasna-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 7px;
  width: 20px;
  height: 20px;
  background: #eafaf1;
  color: var(--yasna-online);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Карточка сотрудника */
.yasna-person {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.yasna-person-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yasna-blue) 0%, var(--yasna-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
}
.yasna-person-info { flex: 1; min-width: 0; }
.yasna-person-name {
  font-weight: 700;
  color: var(--yasna-dark);
  font-size: 14px;
}
.yasna-person-pos {
  font-size: 12.5px;
  color: var(--yasna-text);
  margin: 1px 0 6px;
}
.yasna-person-row {
  font-size: 12.5px;
  color: var(--yasna-text);
  display: flex;
  gap: 6px;
  margin: 3px 0;
}
.yasna-person-row b { color: var(--yasna-dark); font-weight: 600; min-width: 66px; }

/* Слоты времени (переговорки) */
.yasna-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.yasna-slot {
  background: #fff;
  border: 1px solid var(--yasna-blue);
  color: var(--yasna-blue);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.yasna-slot:hover { background: var(--yasna-blue); color: #fff; }

/* Список для справок / переговорок */
.yasna-list-item {
  border: 1px solid var(--yasna-bg-3);
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 9px;
}
.yasna-list-item:last-child { margin-bottom: 0; }
.yasna-list-item-title {
  font-weight: 700;
  color: var(--yasna-dark);
  font-size: 13.5px;
  margin-bottom: 4px;
}
.yasna-list-item-meta {
  font-size: 12px;
  color: var(--yasna-text);
  margin: 2px 0;
}
.yasna-list-item-meta b { color: var(--yasna-dark); font-weight: 600; }

/* Подтверждение (успех) */
.yasna-success {
  background: #eafaf1;
  border: 1px solid #bfead0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: #1e6b43;
}
.yasna-success b { color: #14512f; }

/* Превью заявления */
.yasna-doc {
  background: #fff;
  border: 1px solid var(--yasna-bg-3);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: #2a2a2a;
  line-height: 1.55;
}
.yasna-doc-head {
  text-align: right;
  font-size: 12px;
  margin-bottom: 14px;
  color: #333;
}
.yasna-doc-title {
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--yasna-dark);
  margin: 6px 0 12px;
}
.yasna-doc-body { text-indent: 22px; margin-bottom: 14px; }
.yasna-doc-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #333;
  margin-top: 8px;
}

/* Поле ввода */
.yasna-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--yasna-bg-3);
  background: #fff;
  flex-shrink: 0;
  align-items: flex-end;
}
.yasna-input {
  flex: 1;
  border: 1px solid var(--yasna-bg-3);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  color: var(--yasna-text);
  max-height: 90px;
  min-height: 42px;
  line-height: 1.4;
  transition: border-color .15s ease;
}
.yasna-input:focus { border-color: var(--yasna-blue); }
.yasna-input::placeholder { color: #a7b0c0; }
.yasna-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: var(--yasna-blue);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .1s ease;
  flex-shrink: 0;
}
.yasna-send:hover { background: var(--yasna-blue-hover); }
.yasna-send:active { transform: scale(.94); }
.yasna-send svg { width: 20px; height: 20px; }

/* ============ Мобильная адаптация ============ */
@media (max-width: 600px) {
  .yasna-panel {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  .yasna-fab { right: 16px; bottom: 16px; }
}
