@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,600;9..144,700;9..144,800&display=swap');

:root {
  --ei-primary: #102b46;
  --ei-primary-dark: #0f2438;
  --ei-primary-700: #1a3c5e;
  --ei-accent: #c9a24b;
  --ei-accent-light: #e0c374;
  --ei-accent-100: #f7ecd4;
  --ei-cream: #f7f3ed;
  --ei-text: #243244;
  --ei-muted: #5b6472;
  --ei-border: #e5e0d8;
  --ei-white: #ffffff;
  --ei-radius-sm: 6px;
  --ei-radius: 10px;
  --ei-radius-lg: 16px;
  --ei-radius-xl: 24px;
  --ei-shadow-sm: 0 1px 3px rgba(15, 36, 56, .08);
  --ei-shadow: 0 4px 12px rgba(15, 36, 56, .08);
  --ei-shadow-lg: 0 8px 24px rgba(15, 36, 56, .10);
  --ei-font-display: 'Fraunces', Georgia, serif;
  --ei-font: 'Geist', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--ei-font);
  color: var(--ei-text);
  background: var(--ei-cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, textarea { font-family: inherit; }

/* ---------- Shell ---------- */

.q-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.q-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: var(--ei-white);
  border-bottom: 1px solid var(--ei-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.q-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ei-font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--ei-primary);
  text-decoration: none;
}

.q-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ei-primary);
  color: var(--ei-accent-light);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-family: var(--ei-font);
  font-weight: 800;
}

.q-topbar-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--ei-muted);
  letter-spacing: .02em;
}

.q-progress {
  height: 3px;
  background: #ece7de;
}

.q-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ei-accent), var(--ei-accent-light));
  transition: width .35s ease;
}

.q-main {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 32px) 210px;
}

/* ---------- Messages ---------- */

.q-msg {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  animation: q-in .35s ease both;
}

@keyframes q-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.q-avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--ei-primary);
  color: var(--ei-accent-light);
}

.q-msg.user .q-avatar {
  background: var(--ei-accent-100);
  color: var(--ei-primary);
}

.q-bubble {
  max-width: 640px;
  background: var(--ei-white);
  border: 1px solid var(--ei-border);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.55;
  box-shadow: var(--ei-shadow-sm);
}

.q-msg.user { flex-direction: row-reverse; }

.q-msg.user .q-bubble {
  background: var(--ei-primary);
  border-color: var(--ei-primary);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

.q-bubble p { margin: 0 0 10px; }
.q-bubble p:last-child { margin-bottom: 0; }

.q-bubble .q-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ei-accent);
  margin-bottom: 6px;
}

.q-typing {
  display: inline-flex;
  gap: 5px;
  padding: 4px 0;
}

.q-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ei-accent);
  animation: q-blink 1.1s infinite ease-in-out;
}

.q-typing i:nth-child(2) { animation-delay: .15s; }
.q-typing i:nth-child(3) { animation-delay: .3s; }

@keyframes q-blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- Answer dock ---------- */

.q-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(247, 243, 237, .94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--ei-border);
  padding: 14px clamp(16px, 4vw, 32px) 18px;
  z-index: 30;
}

.q-dock-inner { max-width: 860px; margin: 0 auto; }

.q-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.q-chip {
  border: 1px solid #d9d2c6;
  background: var(--ei-white);
  color: var(--ei-text);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .16s ease;
  line-height: 1.2;
}

.q-chip:hover { border-color: var(--ei-accent); transform: translateY(-1px); }

.q-chip[aria-pressed="true"] {
  background: var(--ei-primary);
  border-color: var(--ei-primary);
  color: #fff;
}

.q-chip:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.q-chip-hint {
  font-size: 11px;
  color: var(--ei-muted);
  margin: 0 0 8px;
}

.q-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.q-input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 1px solid #d9d2c6;
  background: var(--ei-white);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ei-text);
  outline: none;
  max-height: 130px;
}

.q-input:focus { border-color: var(--ei-accent); box-shadow: 0 0 0 3px rgba(201, 162, 75, .16); }

.q-send {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--ei-accent);
  color: var(--ei-primary-dark);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: .18s ease;
}

.q-send:hover { background: var(--ei-accent-light); }
.q-send:disabled { background: #ded6c6; color: #8b8477; cursor: not-allowed; }

.q-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ei-muted);
}

/* ---------- Recap ---------- */

.q-recap {
  background: var(--ei-white);
  border: 1px solid var(--ei-border);
  border-radius: var(--ei-radius-lg);
  padding: 22px;
  box-shadow: var(--ei-shadow);
  margin: 6px 0 10px;
}

.q-recap h3 {
  font-family: var(--ei-font-display);
  font-size: 19px;
  margin: 0 0 4px;
  color: var(--ei-primary);
}

.q-recap .q-recap-sub {
  font-size: 12.5px;
  color: var(--ei-muted);
  margin: 0 0 16px;
}

.q-recap-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.q-recap-item {
  border: 1px solid #efeae1;
  background: #fbf9f5;
  border-radius: 12px;
  padding: 12px 14px;
}

.q-recap-item span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ei-accent);
  margin-bottom: 4px;
}

.q-recap-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ei-primary);
}

.q-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  background: var(--ei-primary);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--ei-shadow);
}

.q-cta:hover { background: var(--ei-primary-700); }

.q-cta[disabled] { opacity: .55; cursor: progress; }

.q-link {
  color: var(--ei-primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--ei-accent);
}

@media (max-width: 620px) {
  .q-main { padding-bottom: 250px; }
  .q-bubble { font-size: 14.5px; padding: 12px 15px; }
  .q-topbar-note { display: none; }
  .q-chip { font-size: 13px; padding: 8px 13px; }
}
