:root {
  color-scheme: light;
  --ink: #21312d;
  --muted: #71817b;
  --line: #e2e9e4;
  --paper: #ffffff;
  --canvas: #f1f5f1;
  --green: #3d755d;
  --green-dark: #2f624b;
  --soft-green: #e9f3ec;
  --danger: #a3423a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; padding: 32px; display: grid; place-items: center; }
.auth-panel { width: min(100%, 430px); padding: 38px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 20px 60px #26463712; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 14px; font-weight: 750; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; }
.eyebrow { margin: 18px 0 8px; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); line-height: 1.14; letter-spacing: -.035em; }
.intro { margin: 12px 0 26px; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 24px; padding: 4px; background: #f3f6f3; border-radius: 11px; }
.tab { border: 0; padding: 10px; color: var(--muted); background: transparent; border-radius: 8px; font-size: 13px; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 1px 4px #162d2117; }
label { display: block; margin: 15px 0 7px; font-size: 13px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid #d9e2dc; border-radius: 10px; background: #fff; color: var(--ink); outline: none; }
input { height: 46px; padding: 0 13px; }
input:focus, textarea:focus { border-color: #79a28b; box-shadow: 0 0 0 3px #3d755d18; }
.field-help, .privacy-note, .composer-note { color: var(--muted); font-size: 12px; line-height: 1.55; }
.field-help { margin: 7px 0 19px; }
.primary { width: 100%; height: 46px; border: 0; color: white; background: var(--green); border-radius: 10px; font-weight: 700; }
.primary:hover, .send-button:hover { background: var(--green-dark); }
.error { min-height: 20px; color: var(--danger); font-size: 13px; }
.privacy-note { margin: 20px 0 0; }
.hidden { display: none !important; }
.chat-panel { width: min(100%, 1180px); height: min(790px, calc(100vh - 64px)); min-height: 520px; display: grid; grid-template-columns: 270px minmax(0, 1fr); overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 20px 60px #26463712; }
.sidebar { display: flex; flex-direction: column; min-width: 0; padding: 22px 16px 14px; background: #f8faf8; border-right: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.new-chat { width: 100%; margin-top: 24px; padding: 11px 12px; text-align: left; color: var(--green-dark); background: var(--soft-green); border: 1px solid #d8e9dc; border-radius: 10px; font-size: 13px; font-weight: 650; }
.conversation-list { display: grid; align-content: start; gap: 5px; overflow-y: auto; margin: 18px -4px; }
.conversation-item { width: 100%; overflow: hidden; padding: 10px; border: 0; border-radius: 9px; text-align: left; color: #53615b; background: transparent; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.conversation-item:hover, .conversation-item.active { color: var(--ink); background: #eaf0eb; }
.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.account-email { max-width: 150px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.quiet-button { padding: 7px 8px; border: 0; color: var(--muted); background: transparent; font-size: 12px; }
.conversation { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-width: 0; padding: 0 38px 16px; }
.conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 20px; border-bottom: 1px solid var(--line); }
.conversation-header .eyebrow { margin-top: 0; }
.conversation-header h1 { font-size: 22px; }
.adapter-state { color: var(--muted); font-size: 11px; }
.messages { display: flex; flex-direction: column; gap: 20px; overflow-y: auto; padding: 28px 0; }
.empty-state { align-self: center; margin: auto 0; color: var(--muted); text-align: center; font-size: 14px; }
.message { max-width: min(82%, 720px); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 14px; }
.message.user { align-self: flex-end; padding: 12px 15px; color: #274435; background: var(--soft-green); border-radius: 15px 15px 4px 15px; }
.message.assistant { align-self: flex-start; color: var(--ink); }
.message-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.message-form { display: flex; align-items: flex-end; gap: 10px; padding: 9px; border: 1px solid #dce5df; border-radius: 15px; box-shadow: 0 4px 18px #2343330b; }
.message-form textarea { max-height: 150px; min-height: 42px; resize: vertical; padding: 10px 7px; border: 0; box-shadow: none; }
.message-form textarea:focus { box-shadow: none; }
.send-button { width: 38px; height: 38px; flex: 0 0 38px; border: 0; border-radius: 11px; color: white; background: var(--green); font-size: 20px; }
.send-button:disabled, .primary:disabled { cursor: wait; opacity: .6; }
.composer-note { margin: 9px 4px 0; text-align: center; font-size: 10px; }
.global-status { position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); margin: 0; color: var(--muted); font-size: 12px; }
.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; }

@media (max-width: 760px) {
  .shell { padding: 12px; }
  .auth-panel { padding: 28px 22px; }
  .chat-panel { height: calc(100vh - 24px); min-height: 440px; grid-template-columns: 76px minmax(0, 1fr); border-radius: 16px; }
  .sidebar { align-items: center; padding: 14px 8px 10px; }
  .brand-row span:last-child, .new-chat, .conversation-list, .account-email { display: none; }
  .sidebar-top { display: contents; }
  .sidebar-bottom { flex-direction: column; }
  .conversation { padding: 0 16px 12px; }
  .conversation-header { align-items: flex-start; flex-direction: column; gap: 8px; padding: 18px 0 14px; }
  .conversation-header h1 { font-size: 19px; }
  .messages { padding: 20px 0; }
  .message { max-width: 94%; }
}
