.chat-page-intro {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px) 0 clamp(16px, 3vw, 26px);
  background:
    radial-gradient(circle at 18% 18%, rgba(10, 168, 150, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(239, 249, 248, 0.95), rgba(255, 255, 255, 0.74));
}

.chat-page-intro::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(10, 168, 150, 0.2), transparent);
}

.chat-page-intro-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
}

.chat-page-intro-copy {
  max-width: 780px;
}

.chat-page-intro-copy h1 {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--ink);
  font-size: clamp(1.85rem, 3.8vw, 2.85rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.chat-page-intro-copy p {
  max-width: 700px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 1.8vw, 1.08rem);
  font-weight: 650;
  line-height: 1.7;
}

.chat-page-intro-status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 10px 12px;
  border: 1px solid rgba(10, 168, 150, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 36px rgba(20, 33, 38, 0.08);
}

.chat-page-intro-status span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  animation: chat-page-intro-pulse 1.4s ease-in-out infinite;
}

.chat-page-intro-status span:nth-child(2) {
  animation-delay: 0.16s;
}

.chat-page-intro-status span:nth-child(3) {
  animation-delay: 0.32s;
}

body.ui-theme-dark .chat-page-intro {
  background:
    radial-gradient(circle at 18% 18%, rgba(82, 205, 191, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(9, 23, 28, 0.96), rgba(14, 25, 31, 0.76));
}

body.ui-theme-dark .chat-page-intro-copy h1 {
  color: rgba(255, 255, 255, 0.94);
}

body.ui-theme-dark .chat-page-intro-copy p {
  color: rgba(232, 244, 246, 0.78);
}

body.ui-theme-dark .chat-page-intro-status {
  border-color: rgba(82, 205, 191, 0.28);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
}

@keyframes chat-page-intro-pulse {
  0%, 80%, 100% {
    opacity: 0.42;
    transform: scale(0.85);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.section.chat-page-section {
  padding-top: 18px;
}

.chat-page {
  max-width: 860px;
  margin: 0 auto;
}

.chat-page-window {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(20, 33, 38, 0.1);
}

body.ui-theme-dark .chat-page-window {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(19, 32, 40, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.chat-page-top {
  display: flex;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(20, 33, 38, 0.08);
}

.chat-page-agent {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
}

.chat-page-agent-mark {
  position: relative;
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: var(--teal-dark);
  background: rgba(10, 168, 150, 0.1);
  border: 1px solid rgba(10, 168, 150, 0.18);
}

.chat-page-agent-mark span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
}

.chat-page-agent-mark span {
  box-shadow: -9px 0 0 currentColor, 9px 0 0 currentColor;
}

.chat-page-top p {
  max-width: 520px;
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.45;
}

body.ui-theme-dark .chat-page-top {
  border-color: rgba(255, 255, 255, 0.1);
}

body.ui-theme-dark .chat-page-top h2 {
  color: rgba(255, 255, 255, 0.92);
}

body.ui-theme-dark .chat-page-agent-mark {
  color: #58d8c9;
  background: rgba(82, 205, 191, 0.1);
  border-color: rgba(82, 205, 191, 0.24);
}

.chat-page-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: clamp(220px, 32vh, 310px);
  max-height: 56vh;
  overflow-y: auto;
  padding: 6px 4px;
  scrollbar-width: thin;
}

.chat-page-message {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-page-message-brief {
  display: grid;
  gap: 10px;
}

.chat-page-brief-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chat-page-message-bot {
  align-self: flex-start;
  color: var(--ink);
  background: rgba(10, 168, 150, 0.1);
  border: 1px solid rgba(10, 168, 150, 0.18);
  border-bottom-left-radius: 6px;
}

.chat-page-message-user {
  align-self: flex-end;
  color: #ffffff;
  background: linear-gradient(135deg, var(--panel-teal), var(--panel-steel));
  border-bottom-right-radius: 6px;
}

.chat-page-mail-action,
.chat-page-submit-action,
.chat-page-open-request-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  padding: 8px 13px;
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--panel-teal), var(--panel-steel));
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.chat-page-mail-action:hover,
.chat-page-mail-action:focus-visible,
.chat-page-submit-action:hover,
.chat-page-submit-action:focus-visible,
.chat-page-open-request-action:hover,
.chat-page-open-request-action:focus-visible {
  box-shadow: 0 10px 22px rgba(8, 123, 112, 0.22);
  transform: translateY(-1px);
}

.chat-page-mail-action {
  color: var(--teal-dark);
  background: rgba(10, 168, 150, 0.1);
  border: 1px solid rgba(10, 168, 150, 0.26);
}

.chat-page-submit-action:disabled {
  opacity: 0.64;
  cursor: default;
  transform: none;
}

.chat-page-submit-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

body.ui-theme-dark .chat-page-message-bot {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(82, 205, 191, 0.12);
  border-color: rgba(82, 205, 191, 0.22);
}

body.ui-theme-dark .chat-page-mail-action {
  color: #58d8c9;
  background: rgba(82, 205, 191, 0.1);
  border-color: rgba(82, 205, 191, 0.26);
}

.chat-page-message.is-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.chat-page-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.chat-page-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.5;
  animation: chat-page-dot 1.1s infinite ease-in-out;
}

.chat-page-typing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.chat-page-typing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes chat-page-dot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 0.95;
    transform: translateY(-3px);
  }
}

.chat-page-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-page-quick-wrap {
  display: grid;
  gap: 8px;
}

.chat-page-quick-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-page-quick-btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--panel-teal), var(--panel-steel));
  border-color: transparent;
}

.chat-page-quick-btn-primary:hover,
.chat-page-quick-btn-primary:focus-visible {
  color: #ffffff;
  background: linear-gradient(135deg, var(--panel-teal), var(--panel-steel));
  box-shadow: 0 10px 22px rgba(8, 123, 112, 0.22);
}

.chat-page-quick-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(10, 168, 150, 0.28);
  background: rgba(10, 168, 150, 0.08);
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.chat-page-quick-btn:hover,
.chat-page-quick-btn:focus-visible {
  background: rgba(10, 168, 150, 0.16);
  transform: translateY(-1px);
}

.chat-page-quick-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

body.ui-theme-dark .chat-page-quick-btn {
  color: #58d8c9;
  background: rgba(82, 205, 191, 0.1);
  border-color: rgba(82, 205, 191, 0.26);
}

.chat-page-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-page-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
}

.chat-page-input:focus-visible {
  outline: none;
  border-color: rgba(10, 168, 150, 0.45);
  box-shadow: 0 0 0 3px rgba(10, 168, 150, 0.16);
}

body.ui-theme-dark .chat-page-input {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
}

.chat-page-send {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 14px;
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--panel-teal), var(--panel-steel));
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.chat-page-send:hover,
.chat-page-send:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(8, 123, 112, 0.28);
}

.chat-page-send:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.chat-page-status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .chat-page-intro {
    display: none;
  }

  .section.chat-page-section {
    padding-top: 10px;
    padding-bottom: 90px;
  }

  .chat-page {
    max-width: none;
  }

  .chat-page-window {
    height: clamp(420px, calc(100svh - 154px), 680px);
    min-height: 0;
    overflow: hidden;
    padding: 12px;
    border-radius: 18px;
  }

  .chat-page-top {
    padding-bottom: 10px;
  }

  .chat-page-agent {
    align-items: flex-start;
    gap: 10px;
  }

  .chat-page-agent-mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .chat-page-top p {
    display: none;
  }

  .chat-page-messages {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overscroll-behavior: contain;
  }

  .chat-page-message {
    max-width: 94%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
  }

  .chat-page-message-user {
    max-width: 90%;
    border-bottom-right-radius: 5px;
  }

  .chat-page-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .chat-page-quick::-webkit-scrollbar {
    display: none;
  }

  .chat-page-quick-btn {
    flex: 0 0 auto;
    max-width: min(260px, 82vw);
    padding: 8px 12px;
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-page-form {
    flex: 0 0 auto;
    gap: 8px;
    padding-top: 2px;
  }

  .chat-page-input {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .chat-page-send {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
  }
}
