:root {
  color: #16201d;
  background: #f5f8f6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* { box-sizing: border-box; }

/* Author display rules for the two app shells must not override HTML hidden. */
[hidden] { display: none !important; }

html, body { height: 100%; overflow: hidden; }
body { margin: 0; min-width: 320px; min-height: 100dvh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.6; }

.sr-only { clip: rect(0, 0, 0, 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
.wordmark, .eyebrow, .message-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; margin: 0; }

.login-shell { align-items: center; background: #e8f1ed; display: flex; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.login-panel { background: #ffffff; border: 1px solid #c9d7d0; border-radius: 8px; box-shadow: 0 18px 48px rgba(22, 32, 29, 0.11); display: grid; gap: 1rem; max-width: 25rem; padding: 2rem; width: 100%; }
.login-panel h1 { font-size: 2rem; line-height: 1; margin: 0 0 1.5rem; }
.login-panel label { font-size: 0.9rem; font-weight: 700; }
.login-panel input { border: 1px solid #9aaea4; border-radius: 5px; min-height: 2.9rem; padding: 0.65rem 0.75rem; }
.login-panel input:focus, .composer textarea:focus { border-color: #08745c; box-shadow: 0 0 0 3px rgba(8, 116, 92, 0.16); outline: none; }
.form-error { color: #a32d26; font-size: 0.88rem; margin: 0; min-height: 1.2rem; }
.primary-button { background: #08745c; border: 1px solid #08745c; border-radius: 5px; color: #ffffff; font-weight: 750; min-height: 2.9rem; }
.primary-button:hover { background: #075e4b; }

.app-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; min-height: 0; overflow: hidden; }
.topbar { align-items: center; background: #f5f8f6; border-bottom: 1px solid #c9d7d0; display: flex; justify-content: space-between; min-height: 4.35rem; padding: 0.75rem clamp(1rem, 3vw, 3rem); }
.brand-block { display: flex; gap: 0.7rem; align-items: baseline; }
.brand-subtitle { color: #60716a; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; margin: 0; }
.topbar-actions { align-items: center; display: flex; gap: 0.5rem; }
.icon-text-button, .icon-button { background: transparent; border: 1px solid #b7c8c0; border-radius: 5px; color: #16201d; min-height: 2.35rem; }
.icon-text-button { display: inline-flex; gap: 0.35rem; align-items: center; padding: 0 0.65rem; }
.icon-button { font-size: 1.15rem; width: 2.35rem; }
.icon-text-button:hover, .icon-button:hover { background: #e1ece6; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 23rem); margin: 0 auto; max-width: 90rem; min-height: 0; overflow: hidden; width: 100%; }
.conversation-column { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; overflow: hidden; padding: clamp(1rem, 2.8vw, 2.4rem); }
.conversation { display: flex; flex-direction: column; gap: 1.25rem; margin: 0 auto; max-width: 48rem; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 1.5rem; width: 100%; }
.message { max-width: 90%; padding: 0.95rem 1.1rem; }
.message-label { color: #08745c; margin-bottom: 0.42rem !important; }
.message-content { min-width: 0; overflow-wrap: anywhere; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 0.9rem; white-space: normal; }
.message-content h2, .message-content h3 { color: #164d40; line-height: 1.3; margin: 1.1rem 0 0.55rem; }
.message-content h2 { font-size: 1.08rem; }
.message-content h3 { font-size: 1rem; }
.message-content ul, .message-content ol { margin: 0.7rem 0 0.95rem; padding-left: 1.35rem; }
.message-content li + li { margin-top: 0.42rem; }
.message-content li::marker { color: #08745c; font-weight: 800; }
.message-content blockquote { border-left: 2px solid #c3d2ca; color: #455850; margin: 0.85rem 0; padding-left: 0.85rem; }
.message-content code { background: #e8f1ed; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; padding: 0.08em 0.28em; }
.message-content hr { border: 0; border-top: 1px solid #d5e0da; margin: 1rem 0; }
.citation-marker { color: #08745c; font-size: 0.9em; font-weight: 750; white-space: nowrap; }
.assistant-message { align-self: flex-start; background: #ffffff; border-left: 3px solid #08745c; }
.user-message { align-self: flex-end; background: #d7e8dd; border-left: 3px solid #e2a634; }
.user-message .message-label { color: #6d5000; }
.welcome-message { max-width: 38rem; padding-top: 1.25rem; }
.suggestion-list { border-top: 1px solid #d5e0da; display: grid; margin-top: 1.1rem; }
.suggestion-list button { background: transparent; border: 0; border-bottom: 1px solid #d5e0da; color: #164d40; display: flex; font-size: 0.92rem; gap: 1rem; justify-content: space-between; padding: 0.75rem 0; text-align: left; }
.suggestion-list button:hover { color: #a76a00; }

.composer { align-items: flex-end; background: #ffffff; border: 1px solid #aebfb6; border-radius: 8px; display: flex; gap: 0.65rem; margin: 0 auto; max-width: 48rem; padding: 0.65rem; width: 100%; }
.composer textarea { border: 0; flex: 1; max-height: 11.25rem; min-height: 1.55rem; padding: 0.25rem 0.35rem; resize: none; }
.send-button { align-items: center; background: #08745c; border: 0; border-radius: 5px; color: #ffffff; display: flex; font-size: 1.2rem; height: 2.4rem; justify-content: center; width: 2.4rem; }
.send-button:hover { background: #075e4b; }

.sources-column { background: #ecf2ee; border-left: 1px solid #c9d7d0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(1rem, 2.2vw, 2rem); }
.sources-heading { align-items: center; background: #ecf2ee; border-bottom: 1px solid #c3d2ca; display: flex; justify-content: space-between; padding-bottom: 0.75rem; position: sticky; top: 0; z-index: 1; }
.sources-heading span { align-items: center; background: #e2a634; border-radius: 50%; display: inline-flex; font-size: 0.75rem; font-weight: 800; height: 1.55rem; justify-content: center; min-width: 1.55rem; }
.sources-list { display: grid; gap: 0.7rem; padding-top: 1rem; }
.sources-empty { color: #65756e; font-size: 0.9rem; margin: 0; }
.source-item { border-bottom: 1px solid #cbd8d1; display: grid; gap: 0.65rem; grid-template-columns: 1.4rem minmax(0, 1fr); padding: 0.8rem 0; }
.source-number { color: #08745c; font-size: 0.8rem; font-weight: 800; padding-top: 0.05rem; }
.source-copy { min-width: 0; }
.source-copy p, .source-copy a { color: #16201d; display: block; font-size: 0.9rem; font-weight: 720; margin: 0; overflow-wrap: anywhere; text-decoration: none; }
.source-copy a:hover { color: #08745c; text-decoration: underline; }
.source-copy small { color: #65756e; display: block; font-size: 0.77rem; margin-top: 0.2rem; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .topbar { min-height: 4rem; }
  .brand-subtitle { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(8rem, 28vh); }
  .conversation-column { min-height: 0; padding: 1rem; }
  .conversation { min-height: 0; }
  .message { max-width: 96%; }
  .sources-column { border-left: 0; border-top: 1px solid #c9d7d0; min-height: 0; padding: 1.15rem 1rem; }
}
