.tavus-agent-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #f97316 0%, #2563eb 100%);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.tavus-agent-button:hover,
.tavus-agent-button:focus-visible {
  color: #fff;
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 16px 34px rgba(249, 115, 22, 0.2);
}

.tavus-agent-button:focus-visible,
.tavus-agent-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.tavus-agent-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tavus-agent-modal.is-open {
  display: flex;
}

.tavus-agent-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(10px);
}

.tavus-agent-dialog {
  position: relative;
  width: min(1280px, 100%);
  height: min(820px, calc(100vh - 32px));
  height: min(820px, calc(100dvh - 32px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #07111f;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.tavus-agent-topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}

.tavus-agent-title {
  font-size: 15px;
  font-weight: 700;
}

.tavus-agent-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.tavus-agent-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  transition: width 1s linear, background 1s ease;
}

.tavus-agent-timer {
  margin-left: auto;
  margin-right: 10px;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 300ms, border-color 300ms, color 300ms;
}

.tavus-timer-label {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tavus-timer-value {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.tavus-agent-timer.tavus-timer-warning {
  background: rgba(234, 179, 8, 0.2);
  border-color: rgba(234, 179, 8, 0.5);
  color: #fde047;
}

.tavus-agent-timer.tavus-timer-warning .tavus-agent-progress-fill,
.tavus-agent-progress-bar:has(+ .tavus-agent-topbar .tavus-timer-warning) .tavus-agent-progress-fill {
  background: linear-gradient(90deg, #f59e0b, #eab308);
}

.tavus-agent-timer.tavus-timer-critical {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  animation: tavus-timer-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes tavus-timer-pulse {
  from { opacity: 1; }
  to { opacity: 0.55; }
}

.tavus-agent-close {
  appearance: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.tavus-agent-frame,
.tavus-agent-fallback {
  width: 100%;
  height: calc(100% - 56px);
}

.tavus-agent-frame {
  display: block;
  border: 0;
  background: #050b14;
}

.tavus-agent-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.tavus-agent-fallback.is-visible {
  display: flex;
}

.tavus-agent-fallback strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 18px;
}

html[data-theme="light"] .tavus-agent-button {
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

body.tavus-agent-locked {
  overflow: hidden;
}

@media (max-width: 991px) {
  .header-buttons-wrap .button-text-light {
    display: none;
  }

  .header-buttons-wrap {
    margin-left: auto;
  }

  .tavus-agent-button {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
  }

  .tavus-agent-modal {
    padding: 8px;
  }

  .tavus-agent-dialog {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
  }
}

@media (max-width: 767px) {
  .header-buttons-wrap {
    display: flex !important;
  }

  .tavus-agent-modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  .tavus-agent-dialog {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .tavus-agent-topbar {
    height: 48px;
    padding: 0 10px 0 14px;
  }

  .tavus-agent-title {
    font-size: 14px;
  }

  .tavus-agent-close {
    width: 34px;
    height: 34px;
  }

  .tavus-agent-frame,
  .tavus-agent-fallback {
    height: calc(100% - 48px);
  }

  .tavus-timer-label {
    display: none;
  }

  .tavus-timer-value {
    font-size: 14px;
  }

  .tavus-agent-timer {
    padding: 4px 10px;
  }
}

@media (max-width: 767px) and (orientation: landscape) {
  .tavus-agent-topbar {
    height: 42px;
  }

  .tavus-agent-frame,
  .tavus-agent-fallback {
    height: calc(100% - 42px);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .tavus-agent-modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  .tavus-agent-dialog {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .tavus-agent-topbar {
    height: 42px;
    padding: 0 10px 0 14px;
  }

  .tavus-agent-frame,
  .tavus-agent-fallback {
    height: calc(100% - 42px);
  }
}
