:root {
  color-scheme: light;
  --text: #192924;
  --muted: #54635b;
  --paper: #f6f7f3;
  --rail: #e9eee7;
  --line: #cfd9cf;
  --accent: #205849;
  --accent-dark: #143d33;
  --white: #fff;
  --error: #832f24;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button, select { touch-action: manipulation; }
a { color: var(--accent-dark); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .53; }
:focus-visible { outline: 3px solid #527f6a; outline-offset: 3px; }
.login-view { min-height: 100dvh; padding: 2rem 1rem; display: grid; align-content: center; justify-items: center; gap: 1.15rem; background: radial-gradient(ellipse at 68% 0%, #e1ece0 0%, transparent 58%); }
.login-card { background: var(--white); max-width: 430px; width: 100%; padding: clamp(1.4rem, 6vw, 2.45rem); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 16px 55px #223a2410; }
.product-name { margin: 0 0 .75rem; color: var(--accent); font-weight: 720; }
.login-card h1, .welcome h2 { font-family: Georgia, serif; font-weight: normal; font-size: clamp(2.4rem, 7vw, 3.45rem); margin: 0; line-height: 1.06; letter-spacing: -.042em; }
.login-form { margin-top: 1.9rem; display: grid; gap: .55rem; }
.login-form label { font-weight: 640; }
.login-form input, .ask-form textarea { border: 1px solid #afc0b3; border-radius: 11px; background: var(--white); width: 100%; }
.login-form input { padding: .7rem .75rem; margin-bottom: .45rem; min-height: 48px; }
.login-form .primary { margin-top: .5rem; }
.primary { min-height: 46px; padding: .6rem 1rem; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--white); font-weight: 690; }
.primary:hover:enabled { background: var(--accent-dark); }
.error { font-size: .94rem; line-height: 1.45; color: var(--error); }
.brand-mark, .login-mark, .welcome-mark { flex: 0 0 auto; display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 40px; height: 40px; padding-bottom: 10px; border-radius: 11px; background: var(--accent); }
.brand-mark i, .login-mark i, .welcome-mark i { width: 4px; height: 9px; border-radius: 2px; background: #e5eee6; transform: skewY(-16deg); }
.brand-mark i:nth-child(2), .login-mark i:nth-child(2), .welcome-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3), .login-mark i:nth-child(3), .welcome-mark i:nth-child(3) { height: 19px; }
.login-mark { width: 51px; height: 51px; border-radius: 14px; padding-bottom: 15px; }
.workspace { display: grid; grid-template-columns: minmax(230px, 274px) minmax(0, 1fr); height: 100dvh; }
.sidebar { background: var(--rail); border-right: 1px solid var(--line); display: flex; min-height: 0; flex-direction: column; padding: 1.15rem; gap: .9rem; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.new-chat { width: 100%; background: var(--white); border: 1px solid #acbfb0; border-radius: 10px; min-height: 46px; color: var(--accent-dark); padding: .45rem .7rem; font-weight: 690; text-align: left; }
.new-chat span { padding-right: .25rem; }
.new-chat:hover { background: #f7fbf8; }
.history-title { color: var(--muted); font-weight: 630; font-size: .92rem; margin-top: .3rem; }
.history { overflow-y: auto; flex: 1; }
.history p { color: var(--muted); font-size: .92rem; padding-left: .35rem; margin: .15rem 0; }
.history button { width: 100%; text-align: left; line-height: 1.25; border: 0; background: transparent; padding: .6rem .5rem; border-radius: 8px; min-height: 44px; overflow-wrap: anywhere; }
.history button:hover, .history button[aria-current="true"] { background: #d7e4d8; }
.account { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .4rem; border-top: 1px solid var(--line); color: var(--muted); overflow-wrap: anywhere; }
.quiet { background: transparent; color: var(--accent-dark); border: 0; border-radius: 9px; font-weight: 690; min-height: 44px; padding: .45rem .65rem; }
.quiet:hover { background: #dfe9e0; }
.chat { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .65rem 1.25rem; border-bottom: 1px solid var(--line); }
.top h1 { min-width: 0; margin: 0; font-size: 1.03rem; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { display: none; }
.provider-bar { display: flex; gap: .55rem; align-items: center; padding: .45rem 1.35rem; min-height: 42px; background: #ecf1ea; color: var(--accent-dark); }
.provider-bar p { margin: 0; font-size: .92rem; line-height: 1.4; }
.provider-bar > span { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: currentColor; }
.provider-bar[data-state="offline"] { color: #763e21; background: #f6ebde; }
.provider-bar[data-state="checking"] { color: var(--muted); }
.discussion { overflow-y: auto; overscroll-behavior: contain; }
.welcome { display: grid; align-content: center; max-width: 715px; margin: auto; min-height: min(460px, 100%); padding: 1.3rem; }
.welcome-mark { margin-bottom: 1.2rem; background: #dae8de; }
.welcome-mark i { background: var(--accent); }
.welcome p { color: var(--muted); max-width: 36ch; line-height: 1.5; margin: 1rem 0 0; }
.messages { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; width: min(100%, 760px); margin: 0 auto; padding: 1.1rem 1.15rem 1.5rem; }
.messages:empty { padding: 0; }
.message { min-width: 0; width: fit-content; max-width: min(100%, 660px); border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem; background: var(--white); }
.message.user { justify-self: end; background: #e4eee6; max-width: min(90%, 595px); }
.message.pending { color: var(--muted); }
.message strong { font-size: .85rem; color: var(--accent-dark); }
.message p { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.sources { display: grid; gap: .35rem; border-top: 1px solid var(--line); margin-top: .85rem; padding-top: .55rem; }
.sources a, .doc-list a { display: block; line-height: 1.4; overflow-wrap: anywhere; padding: .3rem 0; font-size: .92rem; text-decoration-color: #9eb4a3; text-underline-offset: .17em; }
.composer { border-top: 1px solid var(--line); padding: .7rem max(1rem, calc((100% - 728px) / 2)) max(.7rem, env(safe-area-inset-bottom)); background: var(--paper); }
.composer-error { margin-bottom: .5rem; }
.ask-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .55rem; }
.ask-form textarea { display: block; resize: none; min-height: 54px; padding: .65rem .7rem; line-height: 1.35; }
.ask-form textarea::placeholder { color: #616d65; }
.ask-form textarea:disabled { background: #eef0ea; }
.overlay { position: fixed; inset: 0; border: 0; background: #182b2366; z-index: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
dialog { width: min(540px, calc(100vw - 1.5rem)); max-height: 85dvh; border: 1px solid var(--line); border-radius: 15px; padding: 1rem; color: var(--text); background: var(--white); }
dialog::backdrop { background: #182b2366; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.dialog-header h2 { margin: 0; font-family: Georgia, serif; font-weight: normal; }
.doc-list a { padding: .75rem 0; }
.doc-list a + a { border-top: 1px solid var(--line); }
@media (max-width: 700px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(84vw, 310px); padding-bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 2; }
  .sidebar.open { display: flex; }
  .menu { display: inline-block; }
  .top { padding: .28rem .55rem; }
  .top h1 { flex: 1; text-align: center; font-size: .96rem; }
  .top .quiet { font-size: .9rem; padding-inline: .36rem; }
  .provider-bar { padding-inline: .8rem; }
  .welcome { padding: 1.1rem; min-height: min(330px, 100%); }
  .messages { padding-inline: .7rem; }
  .composer { padding-inline: .7rem; }
  .ask-form .primary { padding-inline: .65rem; font-size: .92rem; }
}
