:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --line: #e6e8f0;
  --text-main: #1f2430;
  --text-subtle: #676c78;
  --brand: #0072bc;
  --brand-deep: #00548e;
  --brand-soft: #e9f5fc;
  --user-bubble: #242938;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  font-family: 'Manrope', sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(900px 440px at 50% -10%, rgba(0, 114, 188, 0.1), transparent 58%),
    linear-gradient(180deg, #fafbfe 0%, #f3f5fb 100%);
}

.chat-container {
  width: 100%;
  max-width: 820px;
  height: min(920px, 96vh);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 217, 227, 0.9);
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(27, 32, 49, 0.12);
  backdrop-filter: blur(14px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-topbar {
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: #ececf1;
  gap: 2px;
}

.view-pill {
  border: none;
  background: transparent;
  color: #5d616d;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.view-pill.active {
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 3px 10px rgba(31, 36, 48, 0.12);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.icon-button:hover {
  background: #f1f3f9;
  transform: translateY(-1px);
}

#messages {
  flex: 1;
  padding: 12px 22px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-message {
  margin: 18px auto 24px;
  width: min(100%, 640px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding: 18px 0 8px;
}

.welcome-mark {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 30px rgba(0, 114, 188, 0.24);
}

.welcome-mark span {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding-left: 0.08em;
}

.welcome-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.welcome-copy h1 {
  font-size: clamp(34px, 5vw, 42px);
  line-height: 1.04;
  font-weight: 800;
}

.welcome-copy p {
  font-size: 20px;
  color: var(--text-subtle);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-lockup strong {
  font-size: 15px;
  font-weight: 800;
  color: #2b3140;
}

.brand-lockup span {
  font-size: 14px;
  color: #777d89;
}

.suggestion-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.suggestion-item {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #242938;
  font-family: inherit;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.suggestion-item:hover {
  border-color: rgba(0, 114, 188, 0.45);
  background: #fff;
  transform: translateY(-1px);
}

.suggestion-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: min(84%, 690px);
  animation: messageSlide 0.2s ease-out;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg.bot {
  align-self: flex-start;
}

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 14px;
}

.msg.user .msg-avatar {
  background: linear-gradient(135deg, #334155, #111827);
}

.msg.bot .msg-avatar {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.msg-content {
  min-width: 0;
  border-radius: 22px;
  padding: 14px 16px;
  word-break: break-word;
}

.msg-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.msg-role {
  font-weight: 800;
  text-transform: uppercase;
}

.msg-time {
  white-space: nowrap;
}

.msg-body {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.msg.user .msg-content {
  color: #fff;
  background: var(--user-bubble);
  border-bottom-right-radius: 8px;
  box-shadow: 0 10px 24px rgba(36, 41, 56, 0.16);
}

.msg.user .msg-role,
.msg.user .msg-time {
  color: rgba(255, 255, 255, 0.74);
}

.msg.bot .msg-content {
  color: #252b37;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 8px;
  box-shadow: 0 10px 26px rgba(31, 36, 48, 0.07);
}

.msg.bot .msg-role {
  color: #353b49;
}

.msg.bot .msg-time {
  color: #7f8694;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid var(--line);
  border-bottom-left-radius: 8px;
  background: #fff;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #9aa1af;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

#input-area {
  padding: 14px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 22%);
}

.topic-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-strip::-webkit-scrollbar {
  display: none;
}

.topic-chip {
  border: 1px solid #dddfea;
  background: #fff;
  color: #2f3544;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.topic-chip.active {
  border-color: rgba(102, 80, 245, 0.7);
  color: var(--brand);
  background: var(--brand-soft);
}

.composer-shell {
  position: relative;
  border: 1px solid #d8dce7;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(31, 36, 48, 0.06);
  padding: 14px 18px 58px;
}

#message {
  width: 100%;
  min-height: 72px;
  max-height: 220px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.6;
}

#message::placeholder {
  color: #8a909d;
}

#send-btn {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: 0 14px 28px rgba(0, 114, 188, 0.28);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

#send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(0, 114, 188, 0.34);
}

#send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.composer-note {
  font-size: 13px;
  color: #7d8391;
  text-align: center;
}

.intake-overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(17, 31, 47, 0.52);
  backdrop-filter: blur(8px);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.intake-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intake-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(8, 21, 36, 0.28);
}

.intake-brand {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 12px 24px rgba(0, 114, 188, 0.25);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding-left: 0.08em;
}

.intake-heading {
  margin-top: 22px;
}

.intake-kicker {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intake-heading h1 {
  margin-top: 6px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.intake-heading > p:last-child {
  margin-top: 10px;
  color: var(--text-subtle);
  font-size: 15px;
  line-height: 1.55;
}

.intake-fields {
  display: grid;
  gap: 15px;
  margin-top: 24px;
}

.intake-fields label {
  display: grid;
  gap: 7px;
  color: #313846;
  font-size: 13px;
  font-weight: 700;
}

.intake-fields input,
.intake-fields select {
  width: 100%;
  height: 48px;
  border: 1px solid #d7dce6;
  border-radius: 12px;
  padding: 0 13px;
  outline: none;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.intake-fields input::placeholder {
  color: #9198a5;
}

.intake-fields input:focus,
.intake-fields select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.14);
}

.intake-submit {
  width: 100%;
  height: 52px;
  margin-top: 24px;
  border: none;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 12px 24px rgba(0, 114, 188, 0.24);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.intake-submit:hover {
  filter: brightness(1.05);
}

.history-view {
  width: min(100%, 640px);
  margin: auto;
  padding: 12px 0 24px;
}

.history-view h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
}

.history-description {
  margin-top: 8px;
  color: var(--text-subtle);
}

.history-empty {
  margin-top: 28px;
  min-height: 210px;
  border: 1px dashed #ced5e1;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: #777e8c;
  text-align: center;
}

.history-empty i {
  color: var(--brand);
  font-size: 25px;
  margin-bottom: 4px;
}

.history-empty strong {
  color: var(--text-main);
}

.history-empty span {
  font-size: 14px;
}

.history-item {
  width: 100%;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.history-item:hover {
  border-color: rgba(0, 114, 188, 0.45);
  transform: translateY(-1px);
}

.history-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--brand);
  background: var(--brand-soft);
}

.history-item-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.history-item-copy strong {
  font-size: 15px;
}

.history-item-copy span {
  color: var(--text-subtle);
  font-size: 13px;
}

.history-item > i {
  color: #969dab;
  font-size: 14px;
}

@media (max-height: 760px) and (min-width: 769px) {
  body {
    padding: 12px;
  }

  .chat-container {
    height: calc(100vh - 24px);
  }

  .chat-topbar {
    padding: 12px 16px 8px;
  }

  #messages {
    padding: 0 18px;
  }

  .welcome-message {
    gap: 12px;
    margin: 8px auto 18px;
  }

  .welcome-mark {
    width: 58px;
    height: 58px;
    border-radius: 19px;
  }

  .welcome-mark span {
    font-size: 18px;
  }

  .welcome-copy h1 {
    font-size: 31px;
  }

  .welcome-copy p {
    font-size: 17px;
  }

  .suggestion-list {
    display: none;
  }

  .suggestion-item {
    padding: 12px 16px;
    font-size: 15px;
  }

  #input-area {
    padding: 10px 16px 12px;
    gap: 8px;
  }

  .topic-chip {
    padding: 8px 13px;
    font-size: 14px;
  }

  .composer-shell {
    padding: 12px 16px 50px;
  }

  #message {
    min-height: 56px;
    font-size: 15px;
  }

  #send-btn {
    right: 14px;
    bottom: 10px;
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .composer-note {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .chat-container {
    height: 100vh;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
  }

  .chat-topbar {
    padding: 16px 16px 12px;
  }

  .view-pill {
    padding: 11px 18px;
  }

  #messages {
    padding: 8px 16px 0;
  }

  .welcome-copy h1 {
    font-size: 30px;
  }

  .welcome-copy p {
    font-size: 18px;
  }

  .suggestion-item {
    padding: 16px;
    font-size: 16px;
  }

  .msg {
    max-width: 94%;
  }

  #input-area {
    padding: 12px 14px 16px;
  }

  .composer-shell {
    padding: 16px 16px 60px;
  }

  #message {
    min-height: 76px;
    font-size: 16px;
  }

  .intake-overlay {
    padding: 14px;
  }

  .intake-card {
    max-height: calc(100vh - 28px);
    border-radius: 20px;
    padding: 24px 20px;
  }
}
