:root {
  color-scheme: light dark;
  --paper: #f0ece4;
  --surface: #f8f4ed;
  --inset: #e7e1d7;
  --ink: #1c1917;
  --muted: #5f5953;
  --rule: #cec6b9;
  --accent: #6d4f25;
  --on-accent: #fffaf3;
  --attention: #874239;
  --radius: .8rem;
  --shadow: 0 12px 40px rgb(42 32 19 / 12%);
  font: 1rem/1.53 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191714;
    --surface: #211e19;
    --inset: #302a22;
    --ink: #f1e9dc;
    --muted: #b7ad9e;
    --rule: #494237;
    --accent: #dec092;
    --on-accent: #2c2115;
    --attention: #f2a599;
    --shadow: 0 12px 40px rgb(0 0 0 / 28%);
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select, textarea, .link-button { min-height: 2.75rem; border: 1px solid var(--rule); border-radius: .55rem; background: var(--surface); }
button, .link-button { padding: .38rem .75rem; cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .58; cursor: default; }
input, select, textarea { padding: .5rem .65rem; max-width: 100%; }
input, textarea { width: 100%; }
textarea { min-width: 0; resize: vertical; max-height: 30dvh; }
input[type=file] { min-width: 0; font-size: .92rem; }
label { font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .15em; }
a, p, pre, li, h1, h2 { overflow-wrap: anywhere; }
.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
@media (hover: hover) { button:not(:disabled):hover, .link-button:hover { box-shadow: inset 0 0 0 1px var(--rule); } }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
.skip:focus { position: fixed; z-index: 4; left: 1rem; top: 1rem; padding: .6rem; background: var(--surface); }
.wordmark { font: 600 1.65rem/1.05 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.sign-in { width: min(100%, 24rem); padding: clamp(1.25rem, 5vw, 2rem); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.sign-in .wordmark { font-size: 2.35rem; margin: 0 0 1rem; }
.sign-in form { display: grid; gap: .55rem; }
.sign-in form label:not(:first-child) { margin-top: .35rem; }
.sign-in form button { margin-top: .55rem; }
.workspace { max-width: 49rem; margin-inline: auto; padding: max(env(safe-area-inset-top), .35rem) max(env(safe-area-inset-right), .75rem) max(env(safe-area-inset-bottom), .75rem) max(env(safe-area-inset-left), .75rem); }
.top { min-height: 3.5rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .25rem .4rem; }
.account { position: relative; min-width: 0; max-width: min(55%, 16rem); color: var(--muted); }
.account summary { cursor: pointer; padding: .55rem .25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account button { position: absolute; z-index: 2; top: 100%; right: 0; white-space: nowrap; box-shadow: var(--shadow); }
.navigation { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; padding: .25rem; background: var(--inset); border: 1px solid var(--rule); border-radius: var(--radius); }
.navigation button { border-color: transparent; background: transparent; }
.navigation [aria-current="page"] { border-color: var(--rule); background: var(--surface); font-weight: 650; }
.pane { padding: clamp(.55rem, 3vw, 1.1rem) .35rem; }
.pane-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 .75rem; }
.pane-heading h1 { margin: 0; font: 600 clamp(1.7rem, 5vw, 2.25rem)/1.13 Georgia, "Times New Roman", serif; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.upload, .history { padding: .7rem; margin-bottom: .75rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.upload { display: grid; gap: .55rem; }
.upload select { display: block; width: 100%; margin-top: .25rem; }
.file-search { margin-block: .1rem .5rem; }
.file-list, .messages, .history ul, .source-list { list-style: none; padding: 0; margin: 0; }
.file-list li + li { border-top: 1px solid var(--rule); }
.file-row, .history button { height: auto; border: 0; border-radius: .4rem; width: 100%; display: flex; align-items: center; gap: .75rem; text-align: left; padding: .55rem .45rem; background: transparent; }
.file-row .filename { min-width: 0; flex: 1; }
.file-row small { color: var(--muted); font-size: .77rem; flex-shrink: 0; }
.more { margin-top: .85rem; }
.status { margin: .25rem 0 .4rem; color: var(--muted); font-size: .92rem; }
.status:empty, .thread-heading:empty { display: none; }
[data-error] { color: var(--attention); }
.history { max-height: min(50dvh, 23rem); overflow: auto; }
.history button { min-height: 2.75rem; }
.history li + li { border-top: 1px solid var(--rule); }
.thread-heading h2 { font-size: 1rem; margin: 0 0 .2rem; }
.scope { font-size: .88rem; color: var(--muted); margin: 0 0 .45rem; }
.chat { min-height: min(39rem, calc(100dvh - 8.5rem)); display: flex; flex-direction: column; }
.messages { display: grid; gap: 1rem; align-content: start; flex: 1; min-height: 4rem; padding-block: .4rem .8rem; }
.message { min-width: 0; }
.message.user { justify-self: end; max-width: min(87%, 36rem); border: 1px solid var(--rule); background: var(--inset); border-radius: var(--radius); padding: .55rem .75rem; }
.message.assistant { border-bottom: 1px solid var(--rule); padding: .15rem 0 .85rem; }
.message p { white-space: pre-wrap; margin: 0 0 .55rem; }
.message p:last-child { margin-bottom: 0; }
.answer-status { font-weight: 650; }
.answer-items { padding-inline-start: 1.25rem; margin-block: .4rem; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; }
th, td { padding: .38rem .6rem; text-align: start; border: 1px solid var(--rule); vertical-align: top; }
.source-list { padding: .2rem 0 .35rem; display: grid; gap: .35rem; }
.message details { margin-top: .55rem; }
.message summary { color: var(--accent); cursor: pointer; padding-block: .5rem; }
.source-list button, .source-list a { display: block; width: 100%; text-align: left; }
.link-button { align-content: center; width: fit-content; text-decoration: none; }
.composer { position: sticky; bottom: 0; padding: .45rem .1rem max(.55rem, env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--rule); }
.composer form { display: flex; align-items: end; gap: .45rem; }
.composer button { flex-shrink: 0; }
.composer [data-check] { margin-bottom: .4rem; }
.mode { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .87rem; margin-bottom: .4rem; }
.mode select { min-height: 2.25rem; padding-block: .15rem; }
.sheet { position: fixed; inset: auto 0 0; margin: 0 auto; width: min(100%, 39rem); max-width: unset; max-height: 85vh; max-height: 85dvh; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.sheet::backdrop { background: rgb(0 0 0 / .48); }
.sheet-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: .8rem; border-bottom: 1px solid var(--rule); }
.sheet-heading h2 { margin: .2rem 0 0; font: 600 1.35rem/1.25 Georgia, "Times New Roman", serif; }
.sheet-body { padding: .9rem .8rem max(1rem, env(safe-area-inset-bottom)); }
.sheet-body p { margin: 0 0 .7rem; }
.sheet-body blockquote { margin: 0 0 1rem; white-space: pre-wrap; padding: .7rem .8rem; border-inline-start: 3px solid var(--accent); background: var(--inset); border-radius: .2rem; }
.sheet-body mark { color: var(--on-accent); background: var(--accent); border-radius: .12rem; }
.sheet-body label { display: block; margin-bottom: .75rem; }
.sheet-body select { display: block; margin-top: .25rem; width: 100%; }
@media (min-width: 42rem) { .sheet { inset: 0; margin: auto; border-radius: var(--radius); } }
