*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #39acbc;
  --teal-dark: #2a8a96;
  --teal-light: #e6f5f7;
  --beige: #faf8f6;
  --border: #e2ddd8;
  --text: #2c2c2c;
  --muted: #7a7a7a;
  --bubble-user: #39acbc;
  --bubble-ai: #f4f4f4;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--beige);
  color: var(--text);
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  height: 100%;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

/* Screens */
.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }

/* Card (select + complete screens) */
.card {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.logo {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.intro {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  color: var(--text);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7a7a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
select:focus { border-color: var(--teal); }

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 13px 20px;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 16px;
  background: white;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }

/* Chat screen layout */
#screen-chat {
  padding: 0;
  justify-content: flex-start;
}

.chat-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  width: 100%;
  flex-shrink: 0;
}
.chat-header-inner { display: flex; flex-direction: column; gap: 2px; }
.chat-name { font-size: 16px; font-weight: 700; }
.chat-title { font-size: 13px; color: var(--muted); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.message {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
}
.message.ai {
  background: var(--bubble-ai);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.message.user {
  background: var(--bubble-user);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.message.loading { opacity: 0.5; font-style: italic; }

.input-area {
  background: white;
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
}
textarea:focus { border-color: var(--teal); }

.input-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.input-actions .btn-primary { width: auto; padding: 10px 24px; flex-shrink: 0; }

/* Doc link */
.doc-link {
  display: block;
  text-align: center;
  text-decoration: none;
}
