.ai-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.ai-page__hero {
  margin-bottom: 18px;
}

.ai-page__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(192, 54, 78, 0.08);
  color: #c0364e;
  font-size: 13px;
  font-weight: 700;
}

.ai-page__title {
  margin: 14px 0 8px;
  font-family: "Playfair Display", serif;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
  color: #151515;
}

.ai-page__subtitle {
  max-width: 720px;
  font-size: 16px;
  line-height: 1.65;
  color: #666;
}

.ai-activated {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid #cbe7d2;
  border-radius: 18px;
  background: #f1fbf3;
  color: #1d5b2b;
  font-size: 14px;
}

.ai-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.ai-panel {
  border: 1px solid #ece7e2;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(27, 24, 31, 0.05);
}

.ai-sidebar {
  position: sticky;
  top: 90px;
  padding: 18px;
}

.ai-sidebar__section + .ai-sidebar__section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #f1ece7;
}

.ai-sidebar__label {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9b8e85;
}

.ai-plan-card {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffaf8 0%, #f8f5ff 100%);
  border: 1px solid #f0e6ef;
}

.ai-plan-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-plan-card__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ai-plan-color, #c0364e);
  flex: 0 0 auto;
}

.ai-plan-card__name {
  font-size: 14px;
  font-weight: 700;
  color: #1e1a1d;
}

.ai-plan-card__nums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 14px 0 10px;
  gap: 12px;
}

.ai-plan-card__remaining {
  font-family: "Playfair Display", serif;
  font-size: 34px;
  line-height: 1;
  color: var(--ai-plan-color, #c0364e);
}

.ai-plan-card__total {
  font-size: 12px;
  color: #7f7277;
}

.ai-plan-card__bar {
  height: 6px;
  border-radius: 999px;
  background: #eee6ed;
  overflow: hidden;
}

.ai-plan-card__fill {
  height: 100%;
  width: var(--ai-plan-progress, 0%);
  background: var(--ai-plan-color, #c0364e);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.ai-plan-card__meta {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.55;
  color: #7f7277;
}

.ai-side-btn,
.ai-side-link,
.ai-auth-btn,
.ai-pay-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ai-side-btn:hover,
.ai-side-link:hover,
.ai-auth-btn:hover,
.ai-pay-btn:hover {
  transform: translateY(-1px);
}

.ai-side-link {
  justify-content: flex-start;
  background: #faf7f3;
  border-color: #efe6de;
  color: #43383d;
}

.ai-side-link + .ai-side-link {
  margin-top: 10px;
}

.ai-chat {
  display: flex;
  flex-direction: column;
  min-height: 720px;
  overflow: hidden;
}

.ai-chat__head {
  padding: 22px 24px 16px;
  border-bottom: 1px solid #f2ece7;
}

.ai-chat__title {
  font-size: 22px;
  font-weight: 700;
  color: #1c1719;
}

.ai-chat__desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.6;
  color: #706469;
}

.ai-chat__messages {
  flex: 1;
  min-height: 420px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(192, 54, 78, 0.05), transparent 28%),
    linear-gradient(180deg, #fffefd 0%, #fbf8f5 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-empty {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: #847980;
}

.ai-empty__icon {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 14px;
}

.ai-empty__title {
  font-size: 20px;
  font-weight: 700;
  color: #1f1b1d;
}

.ai-empty__text {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 78%;
  animation: aiMsgIn 0.2s ease;
}

.ai-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg--assistant {
  align-self: flex-start;
}

.ai-msg__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.ai-msg--user .ai-msg__avatar {
  background: linear-gradient(135deg, #c0364e, #91283b);
}

.ai-msg--assistant .ai-msg__avatar {
  background: linear-gradient(135deg, #151515, #434343);
}

.ai-msg__bubble {
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 24px rgba(32, 24, 30, 0.06);
}

.ai-msg--assistant .ai-msg__bubble {
  background: #fff;
  color: #201d1f;
  border-bottom-left-radius: 6px;
}

.ai-msg--user .ai-msg__bubble {
  background: linear-gradient(135deg, #c0364e, #aa2c44);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-typing {
  display: none;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 12px 16px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(32, 24, 30, 0.06);
}

.ai-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c0364e;
  animation: aiBounce 1s infinite ease-in-out;
}

.ai-typing__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-typing__dot:nth-child(3) {
  animation-delay: 0.3s;
}

.ai-paywall {
  margin: 4px 0;
  padding: 24px 20px;
  border-radius: 22px;
  border: 1px solid #f0d7de;
  background: linear-gradient(145deg, #fff8fa 0%, #faf6ff 100%);
  text-align: center;
}

.ai-paywall__icon {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 10px;
}

.ai-paywall__title {
  font-size: 22px;
  font-weight: 700;
  color: #1e1a1d;
}

.ai-paywall__text {
  max-width: 460px;
  margin: 10px auto 0;
  font-size: 14px;
  line-height: 1.7;
  color: #665c62;
}

.ai-paywall__actions,
.ai-auth-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.ai-pay-btn {
  background: linear-gradient(135deg, #c0364e, #95273c);
  color: #fff;
  box-shadow: 0 14px 24px rgba(192, 54, 78, 0.18);
}

.ai-auth-btn {
  min-width: 180px;
  background: #fff;
  border-color: #eadce2;
  color: #332d30;
}

.ai-auth-btn--primary {
  background: #151515;
  border-color: #151515;
  color: #fff;
}

.ai-paywall__note {
  margin-top: 12px;
  font-size: 12px;
  color: #8a7f84;
}

.ai-chat__composer {
  padding: 18px 20px 20px;
  border-top: 1px solid #f2ece7;
  background: #fff;
}

.ai-chat__inputwrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: 18px;
  border: 1px solid #eee4dd;
  background: #faf7f4;
}

.ai-chat__input {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  color: #1c1719;
}

.ai-chat__send {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #c0364e, #95273c);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

.ai-chat__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-chat__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: #8a7f84;
}

.ai-chat__quota {
  color: var(--ai-plan-color, #c0364e);
  font-weight: 700;
}

@keyframes aiMsgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes aiBounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
}

@media (max-width: 1080px) {
  .ai-shell {
    grid-template-columns: 1fr;
  }

  .ai-sidebar {
    position: static;
    order: 2;
  }

  .ai-chat {
    min-height: 640px;
  }
}

@media (max-width: 720px) {
  .ai-page {
    padding: 18px 12px 36px;
  }

  .ai-chat__head,
  .ai-chat__messages,
  .ai-chat__composer,
  .ai-sidebar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ai-msg {
    max-width: 92%;
  }

  .ai-chat__foot {
    flex-direction: column;
  }

  .ai-auth-btn,
  .ai-pay-btn {
    width: 100%;
  }
}
