* {
  box-sizing: border-box;
}

:root {
  --primary: #1769e0;
  --primary-dark: #0d4fae;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #687386;
  --border: #e3e8f0;
  --soft: #eef5ff;
  --success: #20a464;
  --shadow: 0 10px 35px rgba(20, 44, 80, .08);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1400px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 78px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-size: 16px;
  font-weight: 800;
  background: var(--primary);
  box-shadow: 0 7px 18px rgba(23, 105, 224, .22);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #526070;
  font-size: 14px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
}

.sidebar {
  height: fit-content;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.sidebar-title {
  padding: 4px 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.category {
  width: 100%;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 11px;
  color: #3e4a5d;
  background: transparent;
  text-align: left;
  margin-bottom: 3px;
  transition: .15s ease;
}

.category:hover,
.category.active {
  color: var(--primary-dark);
  background: var(--soft);
}

.chat-panel {
  min-width: 0;
  min-height: 680px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.welcome {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 15px;
  background: var(--soft);
}

.welcome-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: white;
  font-size: 24px;
}

.welcome h1 {
  margin: 0 0 6px;
  font-size: 23px;
}

.welcome p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.suggestion-section {
  padding: 18px 0 8px;
}

.section-heading {
  margin-bottom: 10px;
  font-weight: 750;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion {
  padding: 9px 12px;
  border: 1px solid #d7e3f6;
  border-radius: 999px;
  color: #28558d;
  background: #f8fbff;
  text-align: left;
}

.suggestion:hover {
  border-color: var(--primary);
  background: var(--soft);
}

.chat-messages {
  flex: 1;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  padding: 12px 3px 18px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.user-message {
  justify-content: flex-end;
}

.avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.bubble {
  max-width: min(760px, 85%);
}

.user-message .bubble {
  order: -1;
}

.message-name {
  margin: 0 0 4px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message-content {
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f3f6fa;
}

.user-message .message-content {
  color: white;
  background: var(--primary);
}

.input-area {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

#user-input {
  flex: 1;
  min-height: 50px;
  max-height: 150px;
  resize: vertical;
  padding: 13px 15px;
  border: 1px solid #d7dfea;
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: white;
}

#user-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, .1);
}

.send-btn {
  min-height: 50px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--primary);
  font-weight: 750;
}

.send-btn:hover {
  background: var(--primary-dark);
}

.send-btn:disabled {
  cursor: wait;
  opacity: .65;
}

.send-icon {
  font-size: 15px;
}

.followup-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.followup-btn {
  padding: 8px 10px;
  border: 1px solid #cbdcf4;
  border-radius: 10px;
  color: #28558d;
  background: white;
  text-align: left;
  font-size: 13px;
}

.followup-btn:hover {
  background: var(--soft);
  border-color: var(--primary);
}

.category-note {
  margin: 0 0 10px;
  padding: 8px 11px;
  border-radius: 9px;
  color: #496079;
  background: #f6f8fb;
  font-size: 13px;
}

.disclaimer {
  padding-top: 10px;
  color: #7a8493;
  font-size: 11px;
  line-height: 1.45;
}

.footer {
  padding: 15px 28px;
  display: flex;
  justify-content: space-between;
  color: #7b8594;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

@media (max-width: 850px) {
  .topbar {
    padding: 13px 16px;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand-subtitle {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    overflow-x: auto;
    display: flex;
    gap: 6px;
    padding: 9px;
  }

  .sidebar-title {
    display: none;
  }

  .category {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    margin: 0;
  }

  .chat-panel {
    min-height: calc(100vh - 150px);
    padding: 15px;
  }

  .welcome h1 {
    font-size: 19px;
  }

  .welcome p {
    font-size: 13px;
  }

  .footer {
    padding: 12px 16px;
    gap: 10px;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .status {
    display: none;
  }

  .welcome {
    align-items: flex-start;
  }

  .welcome-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .input-area {
    flex-direction: column;
    align-items: stretch;
  }

  .send-btn {
    justify-content: center;
  }

  .suggestions {
    display: grid;
  }

  .suggestion {
    border-radius: 11px;
  }
}
