:root {
  --ink: #142535;
  --muted: #667785;
  --navy: #17324d;
  --blue: #265c88;
  --blue-soft: #e8f2f7;
  --cream: #f6f3ec;
  --paper: #fffefd;
  --line: #dce3e7;
  --shadow: 0 18px 55px rgba(23, 50, 77, 0.11);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(54, 125, 155, 0.12), transparent 34rem),
    linear-gradient(180deg, #faf9f6 0%, var(--cream) 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: 0 22px;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 50, 77, 0.12);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.03em; }

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--navy);
  border-radius: 50% 50% 46% 54% / 54% 46% 54% 46%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  transform: rotate(-3deg);
}
.brand-mark span { font-family: Georgia, serif; font-size: 0.86rem; transform: rotate(3deg); }
.brand-mark.large { width: 60px; height: 60px; }
.brand-mark.large span { font-size: 1.05rem; }

.quiet-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.62);
  padding: 9px 15px;
}
.quiet-button:hover { border-color: #aebdc6; background: white; }

.chat { padding: 42px 0 24px; overflow-wrap: anywhere; }

.welcome { max-width: 670px; margin: 8vh auto 0; text-align: center; }
.eyebrow { color: var(--blue); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.welcome h2, .login-card h2 { margin: 12px 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 500; letter-spacing: -0.035em; }
.welcome p { margin: 0 auto; max-width: 590px; color: var(--muted); line-height: 1.65; }

.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-top: 34px; text-align: left; }
.suggestions button {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  color: var(--ink);
  background: rgba(255,255,255,.7);
  line-height: 1.4;
}
.suggestions button:hover { transform: translateY(-2px); border-color: #9fb5c2; box-shadow: 0 9px 25px rgba(23,50,77,.08); }

.message { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px; margin: 0 0 28px; animation: arrive .24s ease-out; }
.message.user { grid-template-columns: minmax(0, 1fr); }
.message.user .bubble { justify-self: end; max-width: 80%; border-radius: 20px 20px 5px 20px; padding: 13px 17px; background: var(--navy); color: white; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--blue); font-family: Georgia, serif; font-size: .72rem; }
.bubble { min-width: 0; line-height: 1.62; }
.bubble p { margin: 0 0 12px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 7px 0 14px; padding-left: 22px; }
.bubble li { margin: 5px 0; }
.bubble a { color: #17628b; text-underline-offset: 3px; }
.message.user .bubble a { color: #d6f1ff; }
.bubble code { border-radius: 5px; background: rgba(23,50,77,.08); padding: 2px 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

.source-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.source-row a { max-width: 270px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--blue); background: white; font-size: .75rem; text-decoration: none; }

.status { min-height: 28px; color: var(--muted); padding: 0 6px 8px; font-size: .79rem; }
.status.active::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-right: 8px; border-radius: 50%; background: var(--blue); animation: pulse 1.2s infinite; }

.composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 9px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(23, 50, 77, 0.14);
  border-radius: 21px;
  background: rgba(255, 254, 253, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.composer textarea { width: 100%; max-height: 190px; resize: none; border: 0; outline: 0; padding: 10px 9px 6px; color: var(--ink); background: transparent; line-height: 1.45; }
.composer textarea::placeholder { color: #8b989f; }
.send-button { width: 43px; height: 43px; border: 0; border-radius: 14px; display: grid; place-items: center; background: var(--navy); color: white; }
.send-button:disabled { cursor: not-allowed; opacity: .45; }
.send-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-note { grid-column: 1 / -1; padding: 0 9px 1px; color: #87949c; font-size: .68rem; }

.login-layer { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(236, 237, 232, .86); backdrop-filter: blur(12px); }
.login-layer.hidden { display: none; }
.login-card { width: min(430px, 100%); display: grid; gap: 18px; padding: 38px; border: 1px solid rgba(23,50,77,.14); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.login-card h2 { margin: 5px 0; font-size: 2.1rem; }
.login-card p { margin: 0; color: var(--muted); }
.login-card label { margin-bottom: -10px; color: var(--navy); font-size: .78rem; font-weight: 700; }
.login-card input { width: 100%; border: 1px solid #bdc9cf; border-radius: 12px; padding: 12px 13px; outline: none; }
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(38,92,136,.12); }
.login-card button { border: 0; border-radius: 12px; padding: 12px; color: white; background: var(--navy); font-weight: 700; }
.login-error { min-height: 20px; color: #9e2f2f; font-size: .83rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes arrive { from { opacity: 0; transform: translateY(5px); } }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }

@media (max-width: 680px) {
  .shell { padding: 0 14px; }
  .topbar { min-height: 76px; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestions button { min-height: 0; }
  .welcome { margin-top: 4vh; }
  .message { grid-template-columns: 34px minmax(0,1fr); gap: 10px; }
  .avatar { width: 32px; height: 32px; }
  .message.user .bubble { max-width: 91%; }
  .composer { margin-bottom: 8px; }
  .login-card { padding: 28px 23px; }
}

