:root {
  --navy: #0C1A2F;
  --navy-70: rgba(12, 26, 47, 0.70);
  --navy-40: rgba(12, 26, 47, 0.40);
  --navy-15: rgba(12, 26, 47, 0.10);
  --off: #F7F6F4;
  --white: #ffffff;
  --serif: 'EB Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--off);
  color: var(--navy);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--navy);
  color: var(--white);
}
.brand { font-family: var(--serif); font-size: 24px; letter-spacing: 0.5px; }
.tag { font-size: 11px; color: rgba(255, 255, 255, 0.6); }

.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
}

/* Consent gate */
.consent {
  max-width: 560px;
  margin: 40px auto;
  padding: 0 24px 40px;
}
.consent h1 { font-family: var(--serif); font-weight: 500; font-size: 32px; }
.wording {
  background: var(--white);
  border: 1px solid var(--navy-15);
  border-radius: 10px;
  padding: 18px 22px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--navy-70);
}
.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 0;
  font-size: 15px;
  cursor: pointer;
}
.consent-row input { margin-top: 3px; width: 18px; height: 18px; }

/* Chat */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 0;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.assistant {
  background: var(--white);
  border: 1px solid var(--navy-15);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: var(--navy);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.typing { color: var(--navy-40); font-style: italic; }
.msg.error { background: #fdf0ee; border: 1px solid #e8c4bd; align-self: center; }

.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 0;
  border-top: 1px solid var(--navy-15);
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--navy-15);
  border-radius: 10px;
  padding: 12px 14px;
  font: 15px var(--sans);
  color: var(--navy);
  background: var(--white);
  max-height: 140px;
}
.composer textarea:focus { outline: 2px solid var(--navy-40); }

button.primary, button.secondary, button.attach {
  font: 600 14px var(--sans);
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  border: none;
}
button.primary { background: var(--navy); color: var(--white); }
button.primary:disabled { background: var(--navy-40); cursor: not-allowed; }
button.secondary {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--navy);
}
button.attach {
  background: var(--white);
  border: 1px solid var(--navy-15);
  color: var(--navy-70);
  font-size: 18px;
  padding: 10px 14px;
}

.submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.banner {
  background: #eef5ee;
  border: 1px solid #cfe3cf;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 15px;
  margin-bottom: 10px;
}
.fine { font-size: 12px; color: var(--navy-40); }
.fine a { color: var(--navy-70); }
