:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #231d36;
  background: #f8f7fc;
  --ink: #231d36;
  --muted: #625b74;
  --line: #e5e0ef;
  --purple: #643bd8;
  --purple-hover: #5027bf;
  --rail: #19152d;
  --white: #fff;
  --radius: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
button, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 3px solid #946bfb; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.055em; line-height: 1.07; }
h2 { font-size: 1.13rem; letter-spacing: -.025em; }
p { line-height: 1.6; }
small { font-size: .8rem; }
svg { flex: none; vertical-align: middle; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--ink); font-size: .86rem; font-weight: 650; min-width: 0; }
label small { font-weight: 450; color: var(--muted); }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 46px; color: var(--ink); background: var(--white);
  border: 1px solid #d8d0e5; border-radius: 10px; padding: 11px 13px; font-weight: 450;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #716982; }
.eyebrow { color: #6842be; font-size: .7rem; font-weight: 750; letter-spacing: .16em; }
.intro { color: var(--muted); margin-top: 11px; }
.quiet { color: var(--muted); font-size: .87rem; }
.primary, .secondary, .ghost {
  min-height: 44px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 650;
  font-size: .86rem; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  transition: background-color 150ms, border-color 150ms;
}
.primary { color: #fff; background: var(--purple); }
.primary:hover:not(:disabled) { background: var(--purple-hover); }
.secondary { color: var(--ink); border-color: #dcd5eb; background: var(--white); }
.secondary:hover:not(:disabled), .ghost:hover:not(:disabled) { background: #f1ebff; border-color: #cfc1f3; }
.ghost { color: #5a4385; background: transparent; }
.wide { width: 100%; }
.form-message { color: #a12c4f; font-size: .84rem; }
.form-message:empty { display: none; }
.brand { display: flex; gap: 12px; align-items: center; text-align: left; font-size: .97rem; font-weight: 760; letter-spacing: -.015em; white-space: nowrap; }
.brand small { display: block; margin-top: 4px; color: #c4b5ef; letter-spacing: .16em; font-size: .56rem; }
.brand img { border-radius: 11px; }
.pill { display: inline-flex; align-items: center; gap: 7px; width: max-content; color: #514862; background: #eeebf3; border-radius: 99px; padding: 6px 10px; font-size: .72rem; font-weight: 680; white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { color: #176348; background: #e2f5ea; }
.pill.purple { color: #6134bf; background: #efe7ff; }
.pill.amber { color: #875310; background: #fff0d4; }
.pill.red { color: #a1274b; background: #fce8ee; }
.screen-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: #eee6ff; color: #663cc6; }
.boot, .recovery { max-width: 560px; margin: 12vh auto; padding: 24px; }
.recovery h1 { margin-top: 26px; }
.recovery p { margin: 10px 0 24px; }

.setup { min-height: 100dvh; display: grid; grid-template-columns: minmax(340px, .86fr) minmax(500px, 1.14fr); }
.setup-art { color: white; background: radial-gradient(ellipse at 55% 37%, #382565 0%, var(--rail) 65%); display: flex; flex-direction: column; align-items: flex-start; padding: clamp(30px,5vw,66px); overflow: hidden; }
.orbit { width: min(100%, 440px); align-self: center; margin: auto 0 4px; }
.orbit svg { width: 100%; }
.art-copy { margin-bottom: auto; }
.art-copy .eyebrow { color: #cbb8ff; }
.art-copy h2 { font-size: clamp(2.2rem, 4.4vw, 4.4rem); line-height: 1.02; letter-spacing: -.062em; margin-top: 13px; }
.art-copy p { color: #d0c6e6; margin-top: 17px; max-width: 360px; }
.art-footer { color: #d0c6e6; display: flex; align-items: center; gap: 8px; margin-top: 50px; font-size: .8rem; }
.setup-main { display: grid; place-items: center; padding: 48px 34px; background: #fbfaff; }
.setup-content { width: min(100%, 510px); }
.setup-content > .screen-icon { margin: 25px 0 16px; }
.setup-content form { margin-top: 26px; }
.setup-content h1 { font-size: clamp(2rem,4vw,2.65rem); }
.steps { display: flex; align-items: center; gap: 12px; padding: 0 0 17px; margin: 0; list-style: none; border-bottom: 1px solid var(--line); }
.steps li { display: inline-flex; gap: 6px; align-items: center; font-size: .73rem; font-weight: 650; color: var(--muted); }
.steps li span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: #eeeaf5; }
.steps .current { color: #5129ad; }
.steps .current span { background: #eae0ff; }
.login-note { display: flex; align-items: center; gap: 7px; margin-top: 18px; }
.two-fields { display: grid; grid-template-columns: .7fr 1.3fr; gap: 12px; }
#provider-fields { display: grid; gap: 13px; }
#setup-sign-out { margin-top: 8px; }
.callout { background: #f2edfc; border: 1px solid #e8dcff; border-radius: 10px; padding: 12px; font-size: .86rem; color: #514369; }

.shell { display: grid; grid-template-columns: 230px minmax(0,1fr); min-height: 100dvh; }
.rail { background: var(--rail); color: white; padding: 24px 16px 16px; display: flex; flex-direction: column; gap: 9px; position: sticky; top: 0; height: 100dvh; }
.rail .brand { padding-left: 6px; margin-bottom: 39px; }
.rail-label { color: #bbacd9; padding-left: 11px; font-size: .65rem; font-weight: 750; letter-spacing: .17em; }
.rail nav { display: grid; gap: 5px; }
.rail button { background: transparent; border: 1px solid transparent; display: flex; align-items: center; gap: 11px; padding: 11px; min-height: 45px; border-radius: 9px; color: #e5dcf7; text-align: left; font-weight: 560; font-size: .87rem; }
.rail button:hover { background: #312647; }
.rail button[aria-current] { color: white; background: #392956; border-color: #574379; }
.rail button[aria-current] svg { color: #ceb9ff; }
.rail-bottom { margin-top: auto; }
.rail-safe { display: flex; align-items: center; gap: 8px; color: #c6b9dd; font-size: .78rem; margin: 0 9px 8px; padding: 12px 0; border-bottom: 1px solid #433650; }
.sign-out { width: 100%; }
.main { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 0 clamp(20px,4vw,54px); min-height: 64px; background: #fff; border-bottom: 1px solid var(--line); font-weight: 650; font-size: .86rem; }
.page { max-width: 1190px; margin-inline: auto; padding: 34px clamp(20px,4vw,54px) 48px; }
.page.narrow { max-width: 880px; }
.page > .eyebrow, .chat-header .eyebrow { margin-bottom: 9px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; background: white; margin-top: 18px; }
.panel h2 { margin-bottom: 13px; }
.panel > .quiet + form { margin-top: 17px; }
.hero { display: grid; grid-template-columns: 1fr .72fr; overflow: hidden; position: relative; margin-top: 24px; border: 1px solid #e2d6fc; border-radius: 20px; background: radial-gradient(ellipse at 86% 40%, #d4c3ff, #ede5ff 47%, #f2edff 75%); }
.hero-copy { padding: 30px; position: relative; z-index: 1; }
.hero-copy h2 { margin: 13px 0 8px; font-size: clamp(1.75rem,3.6vw,3.1rem); line-height: 1.03; letter-spacing: -.055em; }
.hero-copy p { color: #554568; font-size: .91rem; }
.hero-copy button { margin-top: 18px; }
.hero-art { position: relative; display: grid; place-items: center; min-width: 0; }
.hero-art span { position: absolute; width: 83%; height: 62%; max-width: 290px; border: 1px solid #a382ed80; border-radius: 50%; transform: rotate(-28deg); }
.hero-art span:nth-child(2) { transform: rotate(27deg); }
.hero-art span:nth-child(3) { transform: rotate(85deg); }
.hero-art img { width: 76px; height: 76px; z-index: 1; transform: rotate(-13deg); border-radius: 20px; box-shadow: 0 16px 50px #7550b354; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.overview-grid .quiet { margin-top: 7px; }
.provider-status { display: flex; gap: 12px; align-items: center; }
.provider-status small, .source-row small { display: block; color: var(--muted); font-weight: 450; margin-top: 3px; }
.prompt-section { margin-top: 23px; }
.prompts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; }
.source-list { display: grid; margin-top: 16px; }
.source-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.source-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; font-weight: 780; font-size: .78rem; background: #ede7fb; color: #5c37a9; }
.source-mark.blue { background: #e9efff; color: #315cad; }
.source-mark.green { background: #e4f5eb; color: #246950; }
.source-mark.amber { background: #fff2d8; color: #8b5513; }

.chat-page { max-width: 1120px; margin-inline: auto; padding: 26px clamp(18px,4vw,50px) 12px; display: grid; grid-template-rows: auto minmax(220px,1fr) auto; height: calc(100dvh - 64px); min-height: 550px; }
.chat-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }
.chat-actions { display: flex; align-items: flex-end; gap: 9px; }
.chat-actions select { min-height: 44px; }
.thread { display: flex; flex-direction: column; overflow-y: auto; min-height: 0; padding: 15px 6px 15px 1px; gap: 14px; }
.chat-empty { margin: auto; text-align: center; padding: 17px 0; }
.chat-empty .screen-icon { margin: 0 auto 12px; }
.chat-empty h2 { font-size: 1.52rem; }
.chat-empty p { color: var(--muted); margin-top: 6px; }
.chat-empty .prompts { justify-content: center; }
.message { max-width: min(85%,660px); border-radius: 15px; border: 1px solid var(--line); background: white; padding: 12px 15px; align-self: flex-start; overflow-wrap: anywhere; }
.message.user { align-self: flex-end; background: #f1eaff; border-color: #e3d6fc; }
.message strong { font-size: .8rem; color: #603ca4; }
.message > div strong { color: inherit; font-size: inherit; }
.message > div { white-space: pre-wrap; line-height: 1.6; margin-top: 5px; }
.message small { color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.thinking { color: var(--muted); font-size: .86rem; }
.composer { gap: 7px; }
.composer-box { background: white; border: 1px solid #dcd4eb; border-radius: 15px; box-shadow: 0 4px 18px #2617430a; padding: 7px; }
.composer textarea { border-color: transparent; background: transparent; width: 100%; max-height: 160px; display: block; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attachment, #attachment-label { display: flex; min-width: 0; align-items: center; overflow-wrap: anywhere; color: var(--muted); font-size: .78rem; }
.attachment .ghost, .send { min-width: 44px; padding: 0; }
.composer-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .72rem; text-align: center; }

.stats { display: flex; gap: 14px; margin-top: 22px; }
.stats div { min-width: min(170px,47%); padding: 16px; background: #efe9fc; border-radius: 12px; }
.stats small { display: block; color: var(--muted); }
.stats strong { display: block; font-size: 1.7rem; margin-top: 4px; }
.issue-fields { display: grid; grid-template-columns: minmax(180px,1fr) minmax(110px,.35fr) auto; align-items: end; gap: 12px; }
.issued { margin-top: 15px; background: #f4efff; padding: 15px; border-radius: 12px; }
.issued p { font-size: .85rem; margin-bottom: 10px; }
.issued button { margin-top: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .76rem; }
td small { display: block; color: var(--muted); margin-top: 4px; }
td:last-child { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 960px) {
  .setup { grid-template-columns: minmax(255px,.7fr) minmax(420px,1fr); }
  .shell { grid-template-columns: 190px minmax(0,1fr); }
  .rail .brand { font-size: .84rem; gap: 8px; padding-left: 0; }
  .rail .brand img { width: 31px; height: 31px; }
}
@media (max-width: 720px) {
  .setup { display: block; }
  .setup-art { padding: 16px 20px; }
  .setup-art .orbit, .setup-art .art-copy, .setup-art .art-footer { display: none; }
  .setup-main { padding: 26px 20px 40px; }
  .shell { display: block; }
  .rail { position: static; height: auto; padding: 10px 12px 6px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px; }
  .rail .brand { margin: 0; padding-left: 5px; }
  .rail-label, .rail-safe { display: none; }
  .rail nav { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; }
  .rail nav button { justify-content: center; gap: 4px; padding: 5px 2px; font-size: .69rem; white-space: nowrap; }
  .rail nav svg { width: 15px; }
  .rail-bottom { margin: 0; grid-column: 2; grid-row: 1; }
  .sign-out span { display: none; }
  .rail .sign-out { min-width: 44px; justify-content: center; }
  .top { min-height: 49px; }
  .page { padding-top: 25px; }
  .chat-page { height: calc(100dvh - 158px); }
  .issue-fields { grid-template-columns: minmax(0,1fr) minmax(0,.65fr); }
  .issue-fields button { grid-column: 1 / -1; }
}
@media (max-width: 455px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 21px; }
  .hero-art { display: none; }
  .overview-grid { grid-template-columns: 1fr; gap: 0; }
  .two-fields { grid-template-columns: 1fr; }
  .chat-header { align-items: start; flex-direction: column; }
  .chat-actions { width: 100%; }
  .chat-actions .select-source { flex: 1; }
  .source-row { gap: 8px; }
  .steps { gap: 8px; }
  .steps li { font-size: .67rem; }
  .steps li span { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Source setup and connection checks */
.source-actions { display: flex; gap: 9px; align-items: center; justify-content: flex-end; }
.source-actions .secondary { white-space: nowrap; }
.connector-dialog { color: var(--ink); width: min(470px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 90px #19152d45; }
.connector-dialog::backdrop { background: #19152d90; }
.dialog-title { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.dialog-title h2 { flex: 1; }
.dialog-title button { padding: 9px 11px; }
.connector-dialog form { margin-top: 16px; }
.connector-dialog ol { padding-left: 22px; margin-bottom: 0; color: var(--muted); line-height: 1.6; }
.connector-dialog li + li { margin-top: 6px; }
.connector-dialog h3 { margin-bottom: 8px; font-size: .92rem; }
.form-message.success { color: #176348; }
.setup-content .setup-later { margin-top: 5px; }
.panel-heading, .settings-actions { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.panel-heading h2 { margin-bottom: 5px; }
.settings-actions { margin-top: 15px; justify-content: flex-start; flex-wrap: wrap; }
.settings-actions form { justify-items: start; }
.connect-chat { margin-top: 13px; }
@media (max-width: 520px) {
  .source-actions { flex-direction: column; align-items: flex-end; gap: 4px; }
  .source-actions .secondary { padding-inline: 9px; }
  .source-row small { line-height: 1.35; }
}
