/* Typography and primary color follow the product brand. */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400..700&display=swap");
:root { font: 15px/1.65 'Segoe UI', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #202123; background: #fff; --line: #e8e8e8; --muted: #6b6b6b; --primary: #2e8b57; --primary-dark: #1f6a40; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100dvh; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 10px; background: var(--primary); color: #fff; padding: 9px 15px; }
button:hover:not(:disabled, .quiet) { background: var(--primary-dark); }
button:disabled { opacity: .35; cursor: default; }
button.quiet { background: transparent; color: inherit; }
button.quiet:hover, nav button.selected { background: #e9e9e9; }
button:focus-visible, a:focus-visible, summary:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid #686868; outline-offset: 3px; }
button.icon { width: 36px; height: 36px; padding: 0; flex: 0 0 auto; font-size: 24px; line-height: 1; }
/* Side panels: 12px panel padding plus 12px row padding puts every label 24px from the edge; icon buttons sit 5px in so their glyphs end 24px from the edge too. */
aside { min-height: 0; display: flex; flex-direction: column; background: #f7f7f7; border-right: 1px solid #f0f0f0; padding: 16px 12px; }
/* A 36px line centres the brand on the header row. */
.brand { margin: 0 12px 16px; line-height: 36px; color: var(--primary); font-size: 23px; font-weight: 650; letter-spacing: -.7px; text-decoration: none; }
#new { text-align: left; border: 1px solid #ddd; padding: 9px 11px; }
nav { min-height: 0; flex: 1; overflow-y: auto; margin: 16px 0; }
nav button { width: 100%; display: block; text-align: left; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 13px; padding: 9px 12px; }
.chat { display: flex; align-items: center; margin: 3px 0; border-radius: 10px; }
.chat:hover, .chat:has(.selected) { background: #e9e9e9; }
nav .chat button:hover { background: transparent; }
/* The options button shows on hover, keyboard focus, the open chat or while its menu is open; touch screens always show it. */
nav .more { opacity: 0; margin-right: 5px; }
.chat:hover .more, .chat:focus-within .more, .chat:has(.selected) .more, .chat.open .more { opacity: 1; }
@media (hover: none) { nav .more { opacity: 1; } }
.chat.open { background: #e9e9e9; }
.menu { inset: auto; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 6px 20px #0000001f; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: #c0392b; }
.account { border-top: 1px solid var(--line); padding: 16px 0 0; font-size: 12px; }
.meter { display: flex; flex-wrap: wrap; justify-content: space-between; margin: 0 12px 12px; }
.bar ~ span { color: var(--muted); font-size: 11px; }
.bar { flex-basis: 100%; height: 4px; margin: 4px 0 2px; border-radius: 2px; background: #e4e4e4; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--primary); }
.bar i.full { background: #c0392b; }
.account-row { display: flex; align-items: center; gap: 2px; margin-top: 4px; padding: 0 5px 0 12px; }
#identity { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .icon, .actions .icon, nav .icon, #files-bar .icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); }
.account .icon:hover, .actions .icon:hover, nav .icon:hover, #files-bar .icon:hover { background: #e9e9e9; color: inherit; }
.account svg, .actions svg, nav svg, .menu svg, header svg, #files-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
summary { cursor: pointer; }
main.workspace { min-width: 0; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
header { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px 24px; }
header .icon { display: grid; place-items: center; }
header svg { width: 20px; height: 20px; }
h1 { min-width: 0; font-size: 17px; font-weight: 550; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#conversation { overflow-y: auto; overscroll-behavior: contain; padding: 12px 28px 40px; position: relative; }
#chat, .composer-area { width: 100%; max-width: 760px; margin-inline: auto; }
#chat:empty { display: none; }
.welcome { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding-bottom: 7vh; text-align: center; }
.welcome h2 { font-size: clamp(24px, 3vw, 30px); font-weight: 550; letter-spacing: -.8px; margin: 0 0 8px; line-height: 1.3; }
.welcome p { color: var(--muted); font-size: 14px; margin: 0; }
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; max-width: 640px; }
.examples button { border: 1px solid var(--line); border-radius: 18px; padding: 7px 14px; font-size: 13px; }
.message { margin: 0 0 32px; overflow-wrap: anywhere; text-align: justify; }
.message .author { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.message pre { margin: 0; font: inherit; white-space: pre-wrap; word-break: break-word; }
.message.user { margin-left: auto; max-width: 85%; width: fit-content; background: #f3f3f3; padding: 12px 20px; border-radius: 22px; }
.message.user .author { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.message.streaming .markdown > :last-child::after, .message.streaming .markdown:empty::after { content: "●"; display: inline-block; font-size: 10px; margin-left: 5px; vertical-align: middle; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown pre, .markdown .table { margin: 0 0 14px; }
.markdown ul, .markdown ol { padding-left: 24px; }
.markdown li + li { margin-top: 4px; }
.markdown li > p { margin: 0; }
.markdown li > p + * { margin-top: 6px; }
.markdown li > ul, .markdown li > ol { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { font-size: 15px; font-weight: 600; line-height: 1.4; margin: 22px 0 10px; white-space: normal; overflow: visible; }
.markdown h1 { font-size: 20px; }
.markdown h2 { font-size: 18px; }
.markdown h3 { font-size: 16px; }
.markdown code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f3f3f3; border-radius: 5px; padding: 1px 5px; }
.markdown pre { background: #f6f6f6; border-radius: 10px; padding: 12px 14px; overflow-x: auto; white-space: pre; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid #ddd; color: #555; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.markdown .table { overflow-x: auto; }
.markdown table { border-collapse: collapse; font-size: 14px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; }
.markdown th { background: #f7f7f7; font-weight: 600; }
.markdown a { color: #1a5fb4; }
.message.incomplete { border-left: 2px solid #ccc; padding-left: 16px; }
.message small { display: block; color: var(--muted); margin-top: 10px; }
.citations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.citations:empty { display: none; }
.citations button { font-size: 11px; border: 1px solid var(--line); border-radius: 16px; padding: 3px 10px; }
.citations > span { font-size: 11px; color: var(--muted); align-self: center; margin-right: 2px; }
.produced { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.produced button { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.produced span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.produced svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.produced svg:first-child { color: var(--primary); }
.produced svg:last-child:not(:first-child) { color: var(--muted); }
/* Pulls the icon's padding left so the glyph lines up with the answer text. */
.actions { margin: 6px 0 0 -7px; }
.unanswered p { margin: 0; color: #555; }
.unanswered button { margin-top: 10px; border: 1px solid var(--line); border-radius: 18px; padding: 6px 14px; }
.message.asking { background: #f2f6fc; border: 1px solid #d3e0f2; border-left: 4px solid #1a5fb4; border-radius: 14px; padding: 14px 18px 16px; }
.message.asking .author { color: #1a5fb4; }
.choices { display: grid; gap: 8px; margin-top: 14px; }
.choices button.quiet { width: 100%; text-align: left; line-height: 1.4; background: #fff; color: #174a8c; border: 1px solid #c4d4ec; border-radius: 12px; padding: 10px 14px; }
.choices button.quiet:hover { background: #e6eefa; border-color: #1a5fb4; }
.choices small { margin-top: 2px; }
.composer-area { padding: 0 16px 12px; }
.status-line { color: var(--muted); font-size: 12px; min-height: 20px; margin: 0 8px 8px; }
#elapsed:not(:empty) { margin-left: 8px; font-variant-numeric: tabular-nums; }
#elapsed:not(:empty)::before { content: "· "; }
#error { color: #8c2929; background: #fff2f2; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-top: 0; }
#compose { display: flex; align-items: flex-end; gap: 12px; background: #f4f4f4; padding: 13px 14px 13px 20px; border: 1px solid #ededed; border-radius: 26px; }
#compose:focus-within { border-color: #c9c9c9; }
textarea { min-width: 0; width: 100%; border: 0; background: transparent; resize: none; padding: 5px 0; max-height: 180px; line-height: 1.7; color: inherit; }
textarea:focus-visible { outline: none; }
#send, #cancel { border-radius: 50%; display: grid; place-items: center; }
#send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
#cancel svg { width: 20px; height: 20px; fill: currentColor; }
.composer-footer { display: flex; justify-content: center; align-items: baseline; gap: 18px; margin-top: 9px; font-size: 11px; color: var(--muted); position: relative; }
#activity > summary { list-style: none; text-decoration: underline; text-underline-offset: 3px; }
#activity[open] { position: absolute; bottom: 28px; right: 0; z-index: 2; width: min(620px, 100%); padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 8px 40px #0001; }
#progress { max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
#health { font-size: 12px; }
dialog { width: min(850px, 94vw); max-height: 85dvh; border: 1px solid var(--line); border-radius: 18px; padding: 26px; color: inherit; overflow-wrap: anywhere; }
dialog::backdrop { background: #0005; }
dialog h2 { font-size: 20px; font-weight: 550; margin-top: 0; }
.dialog-close { float: right; }
dialog pre { white-space: pre-wrap; font-size: 12px; }
dialog label { display: block; margin-bottom: 16px; }
select { max-width: 100%; }
#export-policy { color: var(--muted); font-size: 13px; }
#preview { width: min(1000px, 96vw); max-height: 94dvh; }
#preview-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; font-size: 13px; }
#preview-tools button { padding: 6px 12px; }
#page-label { color: var(--muted); margin: 0 6px; }
#zoom-tools { display: flex; gap: 4px; margin-left: auto; }
#preview-frame { height: max(240px, calc(94dvh - 210px)); overflow: auto; background: #f4f4f4; border-radius: 10px; }
#preview-image { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; }
#preview-text { margin: 16px 0; }
#preview-details { margin-top: 16px; font-size: 13px; }
#preview-note { color: var(--muted); font-size: 13px; }
#preview-quote { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid #ccc; background: #fafafa; border-radius: 0 8px 8px 0; font-size: 13px; max-height: 24dvh; overflow: auto; }
#preview-quote::before { content: "Cited passage"; display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
#preview-quote:not([hidden]) ~ #preview-frame { height: max(220px, calc(70dvh - 210px)); }
.markdown .cite.pending { color: var(--muted); border-style: dashed; cursor: default; }
.markdown .cite { display: inline; padding: 0 7px; margin: 0 1px; font-size: 12px; line-height: 1.5; border: 1px solid var(--line); border-radius: 10px; color: #1a5fb4; white-space: nowrap; }
/* Files bar: a third grid column on desktop, an overlay on phones. */
#files-bar { display: none; min-height: 0; flex-direction: column; background: #f7f7f7; border-left: 1px solid #f0f0f0; padding: 16px 12px; overflow-y: auto; }
body.files-open { grid-template-columns: 250px minmax(0, 1fr) 300px; }
body.files-open.sidebar-closed { grid-template-columns: minmax(0, 1fr) 300px; }
body.files-open #files-bar { display: flex; }
.files-head { min-height: 36px; display: flex; align-items: center; justify-content: space-between; margin: 0 5px 8px 12px; }
.files-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
#files-bar p { margin: 4px 12px; }
#files-status:empty { display: none; }
#files-status { color: var(--muted); font-size: 12px; }
.file { display: flex; align-items: center; gap: 2px; padding: 6px 5px 6px 12px; border-radius: 10px; font-size: 13px; }
.file:hover { background: #e9e9e9; }
.file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { display: block; color: var(--muted); font-size: 11px; }
.empty { color: var(--muted); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#sidebar-backdrop { display: none; }
body.sidebar-closed { grid-template-columns: minmax(0, 1fr); }
body.sidebar-closed aside { display: none; }
body.login { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 100dvh; place-items: center; padding: 24px; background: #fafafa; }
.card { width: min(400px, 100%); padding: 36px; background: white; border: 1px solid var(--line); border-radius: 18px; }
.card h1 { font-size: 24px; white-space: normal; }
.card p { font-size: 14px; }
.card label { display: block; margin: 16px 0; }
.card input { display: block; width: 100%; border: 1px solid #ccc; padding: 10px; border-radius: 8px; }
/* Focus recolors the field border instead of drawing a second ring outside it. */
.card input:focus-visible { outline: 2px solid var(--primary); outline-offset: -1px; }
.card button { width: 100%; margin-top: 8px; }
.card .version { margin: 20px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); }
  aside { display: none; }
  body.sidebar-open aside { display: flex; position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 5; }
  body.sidebar-open #sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 4; background: #0005; border-radius: 0; }
  header { padding: 12px; }
  #conversation { padding: 12px 20px 24px; }
  .composer-area { padding-inline: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .composer-footer { gap: 12px; font-size: 10px; }
  .message.user { max-width: 92%; }
  #preview { padding: 16px; }
  body.files-open, body.files-open.sidebar-closed { grid-template-columns: minmax(0, 1fr); }
  body.files-open #files-bar { position: fixed; inset: 0 0 0 auto; width: min(320px, 100%); z-index: 5; box-shadow: -6px 0 24px #0000001f; }
}
/* Product polish: long brand, law-mode coverage note, export actions. */
.brand { font-size: 18px; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.welcome .coverage { max-width: 64ch; margin-top: 10px; line-height: 1.5; font-size: 12px; }
.actions { display: flex; align-items: center; gap: 6px; }
.actions .export { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; background: #fff; }
.actions .export:hover { background: #f5f5f5; }
