:root {
  color-scheme: light;
  --page: #fbfcfa;
  --ink: #182722;
  --muted: #586763;
  --line: #dce4e0;
  --green: #126651;
  --deep: #0a4f3e;
  --soft: #e9f3ee;
  --white: #fff;
  --error: #a2322f;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
:focus-visible { outline: 3px solid #83b9a4; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg { width: 21px; height: 21px; flex: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar { height: 77px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 clamp(18px, 5vw, 65px); }
.account, .quiet, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 999px;
  min-height: 40px; padding: 0 13px; font-size: 14px; font-weight: 550; white-space: nowrap;
}
.account { border-color: var(--line); color: var(--ink); background: var(--white); padding: 0 16px; }
.quiet:hover, .icon-button:hover, .account:hover { background: var(--soft); color: var(--deep); }
.top-brand { margin-right: auto; padding-left: 0; }
.top-action { padding-left: 8px; }
.small-logo { font-weight: 760; font-size: 19px; letter-spacing: -.05em; color: var(--ink); }
.small-logo span, .brand span { color: var(--green); }
.entry { width: min(100% - 36px, 660px); margin: clamp(73px, 17vh, 155px) auto 45px; text-align: center; }
.brand { font-size: clamp(24px, 5vw, 34px); line-height: 1; margin: 0 0 20px; font-weight: 760; letter-spacing: -.07em; }
.brand i { display: inline-block; width: .17em; height: .17em; margin-left: .105em; vertical-align: baseline; border-radius: 50%; background: var(--green); }
#hero-title { font-size: clamp(49px, 10vw, 76px); line-height: 1; margin: 0; font-weight: 760; letter-spacing: -.07em; }
.intro { margin: 18px 0 32px; color: var(--muted); font-size: clamp(15px, 2.7vw, 17px); line-height: 1.65; }
.source-box {
  padding: 13px 12px 11px; text-align: left; border: 1px solid #d8e2dd; background: var(--white);
  border-radius: 24px; box-shadow: 0 7px 25px rgba(25, 61, 48, .07);
}
.source-box:focus-within { border-color: #8eb9a8; box-shadow: 0 7px 27px rgba(25, 61, 48, .09); }
.source-box.drop { border-color: var(--green); background: var(--soft); }
.source-input-row { display: flex; align-items: flex-start; gap: 12px; padding: 6px 9px 12px; color: #59756a; }
.source-input-row svg { margin-top: 2px; }
textarea { width: 100%; resize: none; min-width: 0; background: transparent; border: 0; color: var(--ink); line-height: 1.5; }
textarea:focus { outline: none; }
textarea::placeholder { color: #65746e; opacity: 1; }
#source-input { padding: 0; min-height: 28px; }
#source-input.expanded { min-height: 102px; resize: vertical; }
.source-actions, .input-actions { display: flex; align-items: center; gap: 4px; }
.source-actions { justify-content: space-between; gap: 6px; }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 43px; padding: 0 17px; background: var(--green); color: var(--white);
  border: 1px solid transparent; border-radius: 999px; font-size: 14px; font-weight: 650; white-space: nowrap;
}
.primary:hover { background: var(--deep); }
.primary svg { width: 17px; height: 17px; }
.formats { font-size: 13px; color: var(--muted); margin: 13px 0 0; line-height: 1.4; }
.status { min-height: 0; margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.status:empty { display: none; }
.status.error { color: var(--error); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 0 0 9px 8px; padding-left: 10px; border-radius: 9px; color: var(--deep); background: var(--soft); font-size: 13px; }
.file-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip button { width: 30px; height: 30px; min-height: 30px; padding: 0; font-size: 20px; }
.chat { width: min(100% - 36px, 740px); margin: 8px auto 0; }
.guide-header { display: flex; align-items: center; gap: 13px; min-height: 78px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--deep); background: var(--soft); font-weight: 720; }
.guide-details { min-width: 0; flex: 1; }
.guide-details h1 { margin: 0; font-size: clamp(18px, 4vw, 24px); line-height: 1.25; letter-spacing: -.035em; overflow-wrap: anywhere; }
.guide-details p { margin: 5px 0 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-details a, .citation { color: var(--deep); }
.voice-toggle { border-color: var(--line); }
.voice-toggle[aria-pressed="true"], #paste-mode[aria-pressed="true"] { color: var(--deep); background: var(--soft); }
.messages { min-height: 49vh; padding: 25px 0 15px; display: flex; flex-direction: column; gap: 22px; }
.message { max-width: min(92%, 625px); }
.message.user { align-self: flex-end; }
.message-label { margin: 0 0 7px 1px; font-size: 12px; color: var(--muted); font-weight: 700; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 15px 17px; line-height: 1.6; font-size: 16px; border: 1px solid var(--line); border-radius: 5px 18px 18px; background: var(--white); }
.user .message-body { background: var(--soft); border-color: transparent; border-radius: 18px 5px 18px 18px; }
.message-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 13px; }
.message-tools .quiet { min-height: 34px; font-size: 13px; padding: 0 8px 0 2px; }
.citation { max-width: 100%; background: var(--soft); padding: 4px 8px; border-radius: 6px; overflow-wrap: anywhere; }
details.citation[open] { flex-basis: 100%; line-height: 1.45; }
details.citation summary { cursor: pointer; }
.composer-area { position: sticky; bottom: 0; padding: 8px 0 max(15px, env(safe-area-inset-bottom)); background: var(--page); }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; min-height: 36px; }
.advance { color: var(--deep); padding-right: 5px; }
.composer { display: flex; align-items: center; gap: 6px; min-height: 61px; border-radius: 20px; background: var(--white); border: 1px solid var(--line); padding: 7px 8px 7px 15px; }
.composer:focus-within { border-color: #8eb9a8; }
.composer textarea { padding: 4px 0; }
.microphone { padding: 0; width: 43px; min-height: 43px; flex: none; }
.microphone[aria-pressed="true"] { color: var(--error); background: #faeeec; }
.send { min-width: 42px; min-height: 42px; padding: 0; }
.send svg { width: 21px; height: 21px; }
dialog { width: min(100% - 36px, 410px); padding: 0; border: 1px solid var(--line); border-radius: 23px; color: var(--ink); box-shadow: 0 16px 70px #17282130; }
dialog::backdrop { background: #16271f55; }
.login-form { position: relative; display: grid; gap: 13px; padding: 30px; }
.login-form .login-brand { margin: 0; color: var(--ink); }
.login-form h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.login-form p:not(.status) { margin: 0 0 5px; color: var(--muted); font-size: 14px; }
.login-form label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login-form input { border: 1px solid var(--line); border-radius: 11px; padding: 11px; width: 100%; color: var(--ink); }
.login-form .primary { margin-top: 4px; }
.close { position: absolute; top: 11px; right: 11px; font-size: 23px; padding: 0; width: 38px; }
@media (max-width: 510px) {
  .topbar { height: 61px; }
  .entry { margin-top: max(81px, 14vh); }
  .intro { margin: 17px 0 25px; }
  .source-box { padding: 10px 7px 8px; border-radius: 19px; }
  .source-input-row { gap: 7px; padding-left: 6px; padding-right: 6px; }
  .source-input-row svg { width: 18px; }
  .source-actions .quiet, .source-actions .primary { padding: 0 8px; font-size: 12px; gap: 4px; }
  .source-actions svg { width: 16px; }
  .source-actions, .input-actions { gap: 1px; }
  .top-action { font-size: 12px; padding-left: 1px; }
  .voice-toggle span { display: none; }
}
