@font-face { font-family: "Montserrat"; src: url("/static/montserrat.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --navy: #0E2B63; --blue: #004F9F; --lime: #AFCA0B; --magenta: #E72582;
  --ink: #14213D; --muted: #5A6B8C; --line: #D9DFEA; --paper: #FFFFFF; --ground: #F3F5F9; --lime-soft: #F1F6D3;
  --font: "Montserrat", "Trebuchet MS", system-ui, sans-serif;
  --measure: 46rem;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1rem/1.6 var(--font); color: var(--ink); background: var(--ground); min-height: 100dvh; display: flex; flex-direction: column; }
button, textarea, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* top bar */
.bar { background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; }
.bar img { width: auto; display: block; }
.bar .where { font-weight: 600; color: var(--navy); font-size: .95rem; padding-left: 1rem; border-left: 1px solid var(--line); }
.bar .who { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .85rem; color: var(--muted); }
.bar .who span { display: none; }
.bar .who { gap: .5rem; white-space: nowrap; }
.bar .where { display: none; }
.bar img { height: 28px; }
.link { background: none; border: 0; padding: .35rem .2rem; color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* conversation */
main { flex: 1; width: 100%; max-width: calc(var(--measure) + 2rem); margin: 0 auto; padding: 1.5rem 1rem 1rem; }
.shell { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* earlier conversations */
.rail { background: var(--paper); border-bottom: 1px solid var(--line); padding: 0 1rem; font-size: .9rem; }
.rail summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: .6rem 0; }
.rail ul { list-style: none; margin: 0; padding: 0 0 .5rem; max-height: 40vh; overflow-y: auto; }
.rail li { display: flex; align-items: flex-start; gap: .25rem; border-top: 1px solid var(--line); }
.rail li button.open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: .55rem .25rem; cursor: pointer; color: var(--ink); line-height: 1.35; }
.rail li button.open:hover, .rail li.current button.open { color: var(--blue); }
.rail li.current { border-left: 3px solid var(--lime); padding-left: .4rem; }
.rail li small { display: block; color: var(--muted); font-size: .75rem; }
.rail li button.del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .55rem .35rem; font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
.rail li button.del:hover { color: var(--magenta); }
.rail .empty { color: var(--muted); margin: 0 0 .75rem; font-size: .85rem; }
.intro h1 { font-size: clamp(1.6rem, 5vw, 2.25rem); line-height: 1.15; font-weight: 700; color: var(--navy); margin: 1rem 0 .75rem; letter-spacing: -.01em; }
.intro p { margin: 0 0 1.5rem; color: var(--muted); max-width: 36rem; }
.intro h2 { font-size: .95rem; font-weight: 600; color: var(--ink); margin: 0 0 .5rem; }
.examples { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.examples li { border-bottom: 1px solid var(--line); }
.examples button { width: 100%; text-align: left; background: none; border: 0; padding: .8rem .25rem; cursor: pointer; color: var(--navy); font-weight: 500; }
.examples button:hover { background: var(--paper); color: var(--blue); }
.examples small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }

.turn { margin: 0 0 1.75rem; }
.question { font-weight: 600; font-size: 1.1rem; line-height: 1.4; color: var(--navy); margin: 0 0 .75rem; padding-left: .9rem; border-left: 4px solid var(--lime); overflow-wrap: anywhere; }
.answer { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1.1rem 1.1rem .4rem; overflow-wrap: anywhere; }
.answer > :first-child { margin-top: 0; }
.answer h1, .answer h2, .answer h3 { font-size: 1.05rem; line-height: 1.3; color: var(--navy); margin: 1.4rem 0 .5rem; font-weight: 700; }
.answer p, .answer ul, .answer ol { margin: 0 0 .9rem; }
.answer ul, .answer ol { padding-left: 1.2rem; }
.answer a { color: var(--blue); text-underline-offset: 3px; }
.answer hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.answer .scroll { overflow-x: auto; margin: 0 0 1rem; }
.answer table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
.answer th { text-align: left; font-weight: 600; color: var(--navy); border-bottom: 2px solid var(--navy); padding: .45rem .6rem .45rem 0; vertical-align: bottom; }
.answer td { border-bottom: 1px solid var(--line); padding: .45rem .6rem .45rem 0; vertical-align: top; }
.answer tr:last-child td { border-bottom: 0; }
.answer th:first-child, .answer td:first-child { min-width: 4.5rem; }

/* charts built from the queried data */
.chart { margin: .75rem 0 0; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.1rem; overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 34rem; height: auto; }

/* evidence trail: which queries produced the numbers */
.proof { margin: .5rem 0 0; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; }
.proof details { flex: 1 1 16rem; }
.proof summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: .3rem 0; }
.proof summary::marker { color: var(--lime); }
.proof ol { margin: .25rem 0 .5rem; padding-left: 1.3rem; }
.proof li { margin-bottom: .25rem; }
.proof li.failed { color: var(--magenta); }
.proof .none { padding: .3rem 0; }

.pending { color: var(--muted); padding: .6rem 0 .6rem .9rem; border-left: 4px solid var(--line); }
.pending::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@media (prefers-reduced-motion: reduce) { .pending::after { animation: none; content: "…"; } }
.error { background: #FDECF3; border: 1px solid var(--magenta); color: #8A1048; border-radius: 6px; padding: .8rem 1rem; }

/* composer */
.composer { position: sticky; bottom: 0; background: linear-gradient(to bottom, transparent, var(--ground) 1.2rem); padding: 1.5rem 1rem 1rem; }
.composer form { max-width: var(--measure); margin: 0 auto; background: var(--paper); border: 1.5px solid var(--navy); border-radius: 8px; padding: .6rem; }
.composer textarea { display: block; width: 100%; border: 0; resize: none; background: transparent; padding: .35rem .4rem; min-height: 2.6rem; max-height: 12rem; line-height: 1.5; }
.composer textarea:focus { outline: none; }
.composer form:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.composer .row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding-top: .4rem; }
.composer label { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.composer input[type=checkbox] { accent-color: var(--navy); width: 1rem; height: 1rem; }
.send { margin-left: auto; background: var(--lime); color: var(--navy); border: 0; border-radius: 6px; padding: .55rem 1.1rem; font-weight: 700; cursor: pointer; }
.send:hover { background: #9DB70A; }
.send:disabled { background: var(--line); color: var(--muted); cursor: default; }
.fine { max-width: var(--measure); margin: .5rem auto 0; font-size: .75rem; color: var(--muted); }

/* sign-in */
.gate { flex: 1; display: grid; place-items: center; padding: 1.5rem 1rem; }
.gate section { width: 100%; max-width: 26rem; background: var(--paper); border: 1px solid var(--line); border-top: 6px solid var(--lime); border-radius: 6px; padding: 2rem 1.5rem; }
.gate img { height: 44px; width: auto; }
.gate h1 { font-size: 1.5rem; line-height: 1.2; color: var(--navy); margin: 1.5rem 0 .5rem; }
.gate p { color: var(--muted); margin: 0 0 1.5rem; }
.gate a.go { display: block; text-align: center; background: var(--navy); color: #fff; text-decoration: none; font-weight: 600; padding: .8rem 1rem; border-radius: 6px; }
.gate a.go:hover { background: var(--blue); }
.gate .error { margin-bottom: 1rem; }

@media (min-width: 64rem) {
  .shell { flex-direction: row; }
  .rail { width: 17rem; flex: none; border-bottom: 0; border-right: 1px solid var(--line); padding: .75rem 1rem; position: sticky; top: 0; align-self: flex-start; height: calc(100dvh - 58px); overflow-y: auto; }
  .rail ul { max-height: none; }
  .rail summary { list-style: none; cursor: default; pointer-events: none; padding-top: .25rem; }
  .rail summary::-webkit-details-marker { display: none; }
}
@media (min-width: 40rem) {
  .bar { padding: .8rem 1.5rem; }
  .bar .who span { display: inline; }
  .bar .who { gap: .75rem; }
  .bar .where { display: block; }
  .bar img { height: 34px; }
  main { padding-top: 2.5rem; }
  .answer { padding: 1.4rem 1.5rem .6rem; }
}
