:root {
  --navy: #112A48;
  --gold: #E6B86A;
  --off-white: #FDFBF6;
  --mid-grey: #8A95A1;
  --light-grey: #E4E8EC;
  --white: #FFFFFF;
}

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

html, body {
  height: 100%;
}

body {
  background: var(--off-white);
  color: var(--navy);
  font-family: 'Lato', system-ui, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#app {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 20px;
}

/* ── Header ── */

header {
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--light-grey);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--navy);
}

.logo-sep {
  color: var(--gold);
  font-weight: 300;
  font-size: 18px;
}

.logo-product {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid-grey);
}

/* ── Main layout ── */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 0 20px;
  min-height: 0;
}

#chat-wrap {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

#messages {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Messages ── */

.msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

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

.msg.user {
  align-self: flex-end;
}

.msg.assistant .bubble {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--navy);
}

.msg.assistant .bubble p + p {
  margin-top: 10px;
}

.msg.user .bubble {
  background: var(--navy);
  color: var(--off-white);
  padding: 11px 16px;
  border-radius: 3px 14px 14px 14px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ── Typing indicator ── */

#typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 18px 0 6px 2px;
}

#typing.hidden {
  display: none;
}

#typing span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: dot-pulse 1.3s ease-in-out infinite;
}

#typing span:nth-child(2) { animation-delay: 0.18s; }
#typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dot-pulse {
  0%, 70%, 100% { opacity: 0.25; transform: scale(0.8); }
  35%            { opacity: 1;    transform: scale(1.1); }
}

/* ── Input bar ── */

#input-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--light-grey);
  flex-shrink: 0;
}

#user-input {
  flex: 1;
  border: 1px solid var(--light-grey);
  border-radius: 4px;
  padding: 10px 14px;
  font-family: 'Lato', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--navy);
  background: var(--white);
  resize: none;
  outline: none;
  line-height: 1.55;
  transition: border-color 0.15s;
}

#user-input:focus {
  border-color: var(--navy);
}

#user-input:disabled {
  background: var(--light-grey);
  cursor: not-allowed;
  color: var(--mid-grey);
}

#send-btn {
  flex-shrink: 0;
  padding: 10px 22px;
  height: 42px;
  background: var(--navy);
  color: var(--off-white);
  border: none;
  border-radius: 4px;
  font-family: 'Lato', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

#send-btn:hover:not(:disabled) {
  background: #1c3f6e;
}

#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Done card ── */

#done-card {
  margin-top: 24px;
  padding: 28px 32px;
  border: 1px solid var(--gold);
  background: var(--white);
  flex-shrink: 0;
}

#done-card.hidden {
  display: none;
}

#done-text {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--navy);
  margin-bottom: 18px;
  white-space: pre-wrap;
}

.done-link {
  font-size: 12px;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.done-link:hover {
  text-decoration: underline;
}

/* ── Footer ── */

footer {
  padding: 14px 0;
  border-top: 1px solid var(--light-grey);
  text-align: center;
  flex-shrink: 0;
}

footer p {
  font-size: 12px;
  color: var(--mid-grey);
}

footer a {
  color: var(--mid-grey);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ── Responsive ── */

@media (max-width: 480px) {
  .logo-product { display: none; }
  .logo-sep     { display: none; }

  #input-bar {
    flex-direction: column;
    align-items: stretch;
  }

  #send-btn {
    align-self: flex-end;
    width: auto;
  }
}
