:root {
  color: #172720;
  background: #f8faf7;
  font: 16px/1.5 "Inter", "Geist", system-ui, sans-serif;
  --ink: #172720;
  --muted: #4e655a;
  --line: #dbe6de;
  --accent: #195741;
  --soft: #edf4ee;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #2a805f; outline-offset: 3px; }
h1 { margin: 0; letter-spacing: -.05em; line-height: 1.1; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: clamp(24px, 6vw, 40px); border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 16px 55px #153c2310; }
.logo { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--accent); color: white; font-weight: 750; flex: none; }
.login-card h1 { margin: 18px 0 28px; font-size: 2rem; }
.login-card form { display: grid; gap: 8px; }
.login-card label { font-size: .875rem; font-weight: 600; }
.login-card input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #b9cdc0; margin-bottom: 7px; }
.primary { padding: 9px 15px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent); color: white; font-weight: 650; }
.primary:hover:enabled { background: #113d2d; }
.error { margin: 5px 0 0; color: #9a2929; font-size: .9rem; }
.workspace { height: 100dvh; display: grid; grid-template-columns: minmax(200px, 264px) minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 18px; overflow: hidden; padding: 20px 16px 14px; border-right: 1px solid var(--line); background: var(--soft); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.new-chat { text-align: left; display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid #bbd1c2; border-radius: 9px; background: #f9fbf9; font-weight: 650; }
.sidebar nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.history-entry { border: none; border-radius: 7px; padding: 8px 10px; text-align: left; background: transparent; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: .9rem; flex: none; }
.history-entry:hover, .history-entry[aria-current="true"] { background: #dbe9de; }
.profile { display: flex; align-items: center; justify-content: space-between; padding: 9px 1px 0; border-top: 1px solid var(--line); font-size: .875rem; }
.profile span { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.profile button, .mobile-history { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 7px; color: var(--muted); }
.profile button:hover, .mobile-history:hover { border-color: #bbd1c2; }
.chat { min-width: 0; display: flex; min-height: 0; flex-direction: column; }
.chat-header { min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: #f8faf7; }
.chat-header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-name { color: var(--muted); margin-left: auto; text-align: right; font-size: .84rem; max-width: 45%; overflow-wrap: anywhere; }
.mobile-history { display: none; }
.scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 0 22px; }
.welcome { min-height: 100%; display: grid; place-items: center; text-align: center; }
.welcome h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
.messages { list-style: none; max-width: 760px; margin: 0 auto; padding: 24px 0 8px; display: grid; gap: 24px; }
.messages:empty { display: none; }
.message { display: grid; justify-items: start; gap: 5px; min-width: 0; }
.message.user { justify-items: end; }
.message-label { color: var(--muted); font-size: .76rem; font-weight: 700; padding-inline: 2px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.message.user .message-body { background: #e1ede4; border-radius: 16px 16px 4px 16px; padding: 10px 15px; max-width: min(87%, 550px); }
.composer-wrap { width: min(100%, 804px); margin: 0 auto; padding: 4px 22px max(16px, env(safe-area-inset-bottom)); }
.chat-status { color: var(--muted); min-height: 1.3em; margin: 0 0 6px 2px; font-size: .875rem; }
.composer { display: flex; align-items: end; gap: 8px; border: 1px solid #b9cdc0; background: white; border-radius: 15px; padding: 9px; }
.composer textarea { resize: vertical; min-height: 47px; max-height: 30dvh; flex: 1; min-width: 0; background: transparent; border: none; border-radius: 4px; color: var(--ink); padding: 5px 6px; }
.boot-status { margin: 40px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 680px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .workspace.history-open .sidebar { display: flex; }
  .workspace.history-open .chat { display: none; }
  .sidebar { height: 100dvh; border: none; }
  .mobile-history { display: inline-block; border-color: var(--line); }
  #hide-history { margin-left: auto; }
  .chat-header { padding-inline: 12px; gap: 8px; }
  .scroll, .composer-wrap { padding-inline: 14px; }
  .composer { gap: 4px; }
  .composer button { font-size: .875rem; padding-inline: 9px; }
}
