.hw-ai-coach-shell {
  --hw-coach-primary: var(--hw-color-primary, #883ca6);
  --hw-coach-primary-strong: var(--hw-color-primary-strong, #742f90);
  --hw-coach-primary-soft: var(--hw-color-primary-soft, #f6edfb);
  --hw-coach-secondary: var(--hw-color-secondary, #297c38);
  --hw-coach-secondary-strong: var(--hw-color-secondary-strong, #1f5e2a);
  --hw-coach-secondary-soft: var(--hw-color-secondary-soft, #ecf7ef);
  --hw-coach-ink: #15221a;
  --hw-coach-ink-soft: #68746d;
  --hw-coach-line: rgba(21, 34, 26, 0.08);
  --hw-coach-panel: #faf7fc;
  --hw-coach-panel-strong: #f6fbf7;
  --hw-coach-card: rgba(255, 255, 255, 0.94);
  --hw-coach-user: linear-gradient(135deg, var(--hw-coach-primary) 0%, var(--hw-coach-primary-strong) 100%);
  --hw-coach-shadow: 0 24px 60px rgba(20, 36, 28, 0.16);
  border: 1px solid var(--hw-coach-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(136, 60, 166, 0.14), transparent 34%),
    radial-gradient(circle at bottom left, rgba(41, 124, 56, 0.08), transparent 28%),
    linear-gradient(180deg, var(--hw-coach-panel) 0%, var(--hw-coach-panel-strong) 100%);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(38, 52, 41, 0.1);
}

.hw-ai-coach-shell.is-locked {
  padding: 16px;
  border-style: dashed;
  background: #f8f6f0;
}

.hw-ai-coach-shell__header h2 {
  margin: 6px 0 8px;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--hw-coach-ink);
}

.hw-ai-coach-shell__header p,
.hw-ai-coach-shell__message,
.hw-ai-coach-flyout__body p,
.hw-ai-coach-shell__hint {
  color: var(--hw-coach-ink-soft);
}

.hw-ai-coach-shell__kicker {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hw-coach-primary);
}

.hw-ai-coach-panel {
  display: grid;
}

.hw-ai-coach-shell__body {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.hw-ai-coach-shell__messages {
  min-height: 168px;
  max-height: 360px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(250, 247, 252, 0.98), rgba(245, 251, 247, 0.98));
  border: 1px solid rgba(136, 60, 166, 0.12);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  gap: 10px;
  scrollbar-width: thin;
}

.hw-ai-coach-shell__message {
  max-width: min(86%, 640px);
  padding: 10px 12px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 13px;
  background: var(--hw-coach-secondary-soft);
  border: 1px solid rgba(41, 124, 56, 0.12);
}

.hw-ai-coach-shell__message.is-user {
  margin-left: auto;
  background: var(--hw-coach-user);
  color: #883ca6;
  border-color: transparent;
  box-shadow: 0 4px 4px rgba(20, 49, 38, 0.18);
}

.hw-ai-coach-shell__message.is-assistant {
  background: #ffffff;
  border-color: rgba(136, 60, 166, 0.14);
}

.hw-ai-coach-shell__message.is-system {
  max-width: 100%;
  background: linear-gradient(180deg, rgba(246, 237, 251, 0.75), rgba(236, 247, 239, 0.7));
  border-style: dashed;
}

.hw-ai-coach-shell__message-body {
  white-space: pre-line;
}

.hw-ai-coach-shell__message-body a {
  color: var(--hw-coach-primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hw-ai-coach-shell__message.is-user .hw-ai-coach-shell__message-body a {
  color: #fff2c8;
}

.hw-ai-coach-shell__message-meta {
  margin-top: 5px;
  font-size: 10px;
  opacity: 0.72;
}

.hw-ai-coach-shell__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.hw-ai-coach-shell__composer input,
.hw-ai-coach-shell__composer button {
  border-radius: 16px;
  border: 1px solid rgba(136, 60, 166, 0.14);
  padding: 12px 13px;
  min-height: 46px;
}

.hw-ai-coach-shell__composer input {
  background: rgba(255, 255, 255, 0.9);
  color: var(--hw-coach-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.hw-ai-coach-shell__composer input::placeholder {
  color: #7d8f84;
}

.hw-ai-coach-shell__composer button {
  background: linear-gradient(135deg, var(--hw-coach-primary) 0%, var(--hw-coach-primary-strong) 100%);
  color: #1b1a1a;
  min-width: 88px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(210, 228, 219, 0.18);
  height: 37px;
}

.hw-ai-coach-shell__composer button:disabled,
.hw-ai-coach-shell__composer input:disabled {
  opacity: 0.72;
  cursor: wait;
}

.hw-ai-coach-shell__hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
}

.hw-ai-coach-launcher {
  position: fixed;
  right: 10px;
  bottom: 40px;
  z-index: 9999;
  width: 65px;
  height: 65px;
  border: 0;
  border-radius: 999px;
  background:#883ca6;
  color: #fff;
  padding: 10px 8px 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  text-align: center;
}

.hw-ai-coach-launcher__orb {
  display: grid;
  place-items: center;
  color: #ffffff;
  animation: hwCoachBeatFade 2.2s ease-in-out infinite;
}

.hw-ai-coach-launcher__orb .hw-icon {
  width: 20px;
  height: 20px;
  stroke: #cf25e7;
}

.hw-ai-coach-launcher__label {
  display: block;
  max-width: 60px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
  color: #fff;
}

.hw-ai-coach-flyout {
  position: fixed;
  right: 12px;
  bottom: 108px;
  width: min(368px, calc(100vw - 24px));
  z-index: 9999;
  background:
    radial-gradient(circle at top right, rgba(136, 60, 166, 0.12), transparent 28%),
    radial-gradient(circle at bottom left, rgba(41, 124, 56, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(250, 247, 252, 0.98), rgba(245, 251, 247, 0.98));
  border: 1px solid rgba(136, 60, 166, 0.12);
  border-radius: 24px;
  box-shadow: var(--hw-coach-shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.hw-ai-coach-flyout[hidden] {
  display: none !important;
}

.hw-ai-coach-flyout__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid rgba(136, 60, 166, 0.1);
  background: linear-gradient(90deg, rgba(78, 166, 60, 0.24), rgba(162, 15, 160, 0.12));
}

.hw-ai-coach-flyout__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hw-ai-coach-flyout__brand-orb {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--hw-coach-primary) 0%, var(--hw-coach-secondary) 100%);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hw-ai-coach-flyout__brand-orb .hw-icon {
  width: 18px;
  height: 18px;
  color: #883ca6;
}

.hw-ai-coach-flyout__brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  color: #1a161c;
}

.hw-ai-coach-flyout__brand-copy strong {
  font-size: 13px;
  line-height: 1.1;
  color: var(--hw-coach-ink);
}

.hw-ai-coach-flyout__brand-copy span {
  font-size: 10px;
  line-height: 1.2;
  color: var(--hw-coach-secondary);
}

.hw-ai-coach-flyout__body {
  padding: 12px;
}

.hw-ai-coach-flyout__close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(136, 60, 166, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--hw-coach-primary-strong);
  cursor: pointer;
}

.hw-ai-coach-flyout__close .hw-icon {
  width: 12px;
  height: 12px;
}

.hw-ai-coach-panel.is-compact .hw-ai-coach-shell__body {
  margin-top: 0;
  gap: 8px;
}

.hw-ai-coach-panel.is-compact .hw-ai-coach-shell__messages {
  min-height: 132px;
  max-height: 270px;
  padding: 10px;
}

@keyframes hwCoachBeatFade {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.95;
    box-shadow: 0 0 0 0 rgba(136, 60, 166, 0.2);
  }

  35% {
    transform: scale(1.12);
    opacity: 1;
    box-shadow: 0 0 0 8px rgba(136, 60, 166, 0);
  }

  55% {
    transform: scale(0.98);
    opacity: 0.86;
  }
}

@media (max-width: 640px) {
  .hw-ai-coach-shell {
    padding: 16px;
    border-radius: 20px;
  }

  .hw-ai-coach-shell__header h2 {
    font-size: 24px;
  }

  .hw-ai-coach-shell__body {
    gap: 8px;
  }

  .hw-ai-coach-shell__messages {
    min-height: 150px;
    max-height: 300px;
    padding: 10px;
    gap: 8px;
  }

  .hw-ai-coach-shell__message {
    max-width: 100%;
    font-size: 12.5px;
    padding: 9px 11px;
  }

  .hw-ai-coach-shell__composer {
    grid-template-columns: 1fr;
  }

  .hw-ai-coach-shell__composer input,
  .hw-ai-coach-shell__composer button {
    min-height: 37px;
    padding: 11px 12px;
  }

  .hw-ai-coach-launcher {
    right: 10px;
    bottom: 65px;
    width: 50px;
    height: 50px;
    padding: 8px 7px 7px;
  }

  .hw-ai-coach-launcher__label {
    font-size: 7px;
    max-width: 52px;
  }

  .hw-ai-coach-flyout {
    right: 8px;
    left: 8px;
    bottom: 96px;
    width: auto;
    border-radius: 22px;
  }

  .hw-ai-coach-flyout__header {
    padding: 10px 10px 8px 12px;
  }

  .hw-ai-coach-flyout__body {
    padding: 10px;
  }

  .hw-ai-coach-flyout__brand-copy strong {
    font-size: 12px;
  }

  .hw-ai-coach-flyout__brand-copy span {
    font-size: 9px;
  }
}
