:root {
  --ink: #171714;
  --paper: #f3f0e8;
  --panel: #fbfaf6;
  --muted: #6e6c65;
  --line: #d8d3c6;
  --acid: #d9ff57;
  --orange: #f1683a;
  --violet: #7867d9;
  --blue: #57a9c7;
  --shadow: 0 20px 60px rgba(35, 32, 23, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); color: var(--ink); background: var(--paper); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar { min-height: calc(72px + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; padding: env(safe-area-inset-top) 5vw 0; border-bottom: 1px solid var(--line); background: rgba(243,240,232,.88); backdrop-filter: blur(15px); position: sticky; top: 0; z-index: 10; }
.topbar-actions { display: flex; gap: 8px; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 27px; height: 27px; position: relative; display: inline-block; }
.brand-mark i { position: absolute; width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--ink); }
.brand-mark i:nth-child(2) { left: 9px; }
.brand-mark i:nth-child(3) { left: 4px; top: 10px; background: var(--acid); }
.prototype { font: 650 9px/1 ui-monospace, SFMono-Regular, monospace; text-transform: uppercase; letter-spacing: .1em; border: 1px solid var(--line); border-radius: 99px; padding: 5px 7px; color: var(--muted); }

main { width: min(1120px, 90vw); margin: 0 auto; }
.hero { padding: 84px 0 48px; max-width: 880px; }
.eyebrow { font: 700 11px/1.2 ui-monospace, SFMono-Regular, monospace; letter-spacing: .13em; text-transform: uppercase; color: var(--orange); margin-bottom: 20px; }
h1 { font: 500 clamp(48px, 7.7vw, 100px)/.91 Georgia, "Times New Roman", serif; letter-spacing: -.055em; margin: 0; }
h1 em { font-weight: 400; color: var(--violet); }
.hero > p { color: var(--muted); font-size: 18px; max-width: 650px; margin: 32px 0 0; }

.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.composer { padding: 28px; border-radius: 4px; position: relative; }
.composer:before { content: ""; width: 55px; height: 4px; background: var(--acid); position: absolute; top: -1px; left: 28px; }
.composer label { display: block; font: 700 12px/1 ui-monospace, SFMono-Regular, monospace; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
textarea { width: 100%; resize: vertical; border: 0; outline: 0; background: transparent; font: 500 25px/1.35 Georgia, serif; padding: 5px 0 20px; }
textarea::placeholder, input::placeholder { color: #aaa69c; }
.context-row { display: flex; gap: 16px; align-items: center; border-top: 1px solid var(--line); padding-top: 18px; }
.context-row input { flex: 1; border: 0; background: transparent; outline: 0; min-width: 0; }
.primary-button, .ghost-button, .icon-button, .account-button { border: 0; background: none; }
.primary-button { background: var(--ink); color: white; padding: 13px 18px; display: inline-flex; gap: 28px; align-items: center; justify-content: space-between; font-weight: 700; border-radius: 2px; }
.primary-button:hover { background: var(--violet); }
.primary-button:disabled { opacity: .5; cursor: wait; }
.ghost-button { border: 1px solid var(--line); padding: 9px 13px; background: rgba(255,255,255,.35); border-radius: 2px; font-size: 13px; }
.ghost-button:hover { border-color: var(--ink); }
.account-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 2px; background: var(--ink); color: white; font-size: 13px; }
.account-button:hover { background: var(--violet); }
.account-dot { width: 7px; height: 7px; border-radius: 50%; background: #aaa69c; }
.account-button.signed-in .account-dot { background: var(--acid); }

.table-section, .process, .results { padding: 90px 0 15px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 25px; }
.section-heading > div { display: flex; align-items: center; gap: 14px; }
.section-heading h2 { font: 500 32px/1 Georgia, serif; margin: 0; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.step { font: 700 10px/1 ui-monospace, SFMono-Regular, monospace; color: var(--orange); }
.colleague-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.colleague-card { min-height: 240px; background: var(--panel); border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.colleague-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.avatar { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; font: 500 25px/1 Georgia, serif; background: var(--color); margin-bottom: 34px; position: relative; }
.avatar:after { content: ""; position: absolute; inset: -5px; border: 1px solid var(--color); border-radius: 50%; opacity: .55; }
.colleague-card h3 { margin: 0; font: 500 22px/1.1 Georgia, serif; }
.role { color: var(--orange); font: 700 10px/1 ui-monospace, SFMono-Regular, monospace; text-transform: uppercase; letter-spacing: .08em; margin: 8px 0 14px; }
.perspective { color: var(--muted); font-size: 13px; flex: 1; }
.model-badge { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); font: 650 10px/1 ui-monospace, SFMono-Regular, monospace; text-transform: uppercase; color: var(--muted); }
.model-badge i { width: 7px; height: 7px; border-radius: 50%; background: #78a85e; }

.process-track { display: flex; align-items: center; justify-content: center; margin: 40px 0 30px; }
.process-track > i { width: 12%; height: 1px; background: var(--line); }
.process-step { display: flex; align-items: center; gap: 12px; color: #aaa69c; }
.process-step > span { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; font: 700 11px/1 ui-monospace, monospace; }
.process-step b, .process-step small { display: block; }
.process-step b { font: 700 11px/1.4 ui-monospace, monospace; text-transform: uppercase; }
.process-step small { font-size: 11px; }
.process-step.active { color: var(--ink); }
.process-step.active > span { background: var(--acid); border-color: var(--ink); }
.thinking { text-align: center; padding: 70px 20px; }
.thinking h3 { font: 500 26px/1 Georgia, serif; margin: 25px 0 8px; }
.thinking p { color: var(--muted); margin: 0; }
.orbit { position: relative; width: 80px; height: 80px; margin: auto; animation: spin 5s linear infinite; }
.orbit:after { content: ""; position: absolute; inset: 20px; border: 1px solid var(--ink); border-radius: 50%; }
.orbit span { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--orange); }
.orbit span:nth-child(1) { top: 0; left: 32px; }
.orbit span:nth-child(2) { right: 0; top: 32px; background: var(--violet); }
.orbit span:nth-child(3) { bottom: 0; left: 32px; background: var(--acid); }
.orbit span:nth-child(4) { left: 0; top: 32px; background: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

.consensus-card { padding: 38px; border-top: 4px solid var(--acid); }
.consensus-top { display: grid; grid-template-columns: 1fr 160px; gap: 30px; align-items: start; }
.consensus-card h3 { font: 500 36px/1.1 Georgia, serif; letter-spacing: -.02em; margin: 0 0 20px; }
.answer { color: #4d4b45; font-size: 17px; max-width: 760px; }
.score { text-align: center; border-left: 1px solid var(--line); }
.score strong { display: block; font: 500 54px/1 Georgia, serif; color: var(--violet); }
.score span { font: 700 9px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.consensus-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.consensus-columns h4 { font: 700 10px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .1em; }
.consensus-columns ul { padding: 0; margin: 16px 0 0; list-style: none; }
.consensus-columns li { padding: 8px 0 8px 22px; position: relative; }
.consensus-columns li:before { content: "↳"; position: absolute; left: 0; color: var(--orange); }
.result-note { color: var(--muted); font-size: 12px; margin: 26px 0 0; }
.transcript { margin-top: 16px; padding: 0 30px; box-shadow: none; }
.transcript summary { cursor: pointer; padding: 22px 0; display: flex; justify-content: space-between; font-weight: 650; }
.message { padding: 24px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 25px; }
.message-meta b, .message-meta span, .message-meta small { display: block; }
.message-meta b { font-family: Georgia, serif; font-size: 18px; }
.message-meta span { color: var(--orange); font: 700 9px/1.8 ui-monospace, monospace; text-transform: uppercase; }
.message-meta small { color: var(--muted); text-transform: capitalize; }
.message p { margin: 0; color: #4d4b45; }
.message.error { background: #fff2ed; margin: 0 -30px; padding-left: 30px; padding-right: 30px; }
.message.error p { color: #9f4227; }

dialog { width: min(820px, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,19,17,.6); backdrop-filter: blur(4px); }
.dialog-shell { padding: 30px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; }
.dialog-header h2 { font: 500 36px/1 Georgia, serif; margin: 0; }
.dialog-header .eyebrow { margin-bottom: 9px; }
.icon-button { font-size: 29px; line-height: 1; }
.dialog-intro { color: var(--muted); max-width: 650px; }
.local-setup { display: flex; align-items: center; gap: 9px; padding: 14px; margin: 20px 0 5px; background: var(--acid); border: 1px solid #bfdc4e; }
.local-setup > div { flex: 1; }
.local-setup strong, .local-setup span { display: block; }
.local-setup strong { font: 700 12px/1.4 ui-monospace, monospace; text-transform: uppercase; }
.local-setup span { color: #555b31; font-size: 11px; }
.local-setup .ghost-button { background: rgba(255,255,255,.45); border-color: #aabd59; white-space: nowrap; }
.config-card { border-top: 1px solid var(--line); padding: 20px 0; }
.config-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.config-title h3 { margin: 0; font: 500 20px/1 Georgia, serif; }
.remove-button { border: 0; background: none; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.form-grid input, .form-grid select { display: block; width: 100%; border: 1px solid var(--line); background: var(--panel); padding: 9px 10px; margin-top: 4px; outline: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.provider-fields { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.model-picker { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: end; }
.discover-button { height: 38px; border: 1px solid var(--line); background: var(--panel); padding: 0 11px; font-size: 11px; font-weight: 700; }
.discover-button:hover { border-color: var(--ink); }
.discover-button:disabled { opacity: .55; cursor: wait; }
.model-status { grid-column: 1 / -1; margin: -2px 0 0; color: var(--muted); font-size: 10px; }
.moderator-box { background: #eae5d9; padding: 18px; margin-top: 8px; }
.moderator-box h3 { margin: 0 0 12px; font: 500 19px/1 Georgia, serif; }
.dialog-actions { display: flex; justify-content: space-between; margin-top: 25px; }
.save-group { display: flex; align-items: center; gap: 12px; }
.save-group span { color: var(--muted); font-size: 10px; transition: color .2s; }
.save-group span.confirmed { color: #537934; }
.install-dialog { width: min(500px, 92vw); }
.install-steps { margin: 30px 0; }
.install-steps p { background: var(--panel); border: 1px solid var(--line); margin: 9px 0; padding: 15px; }
.install-steps strong { color: var(--violet); margin-right: 8px; }
.install-done { width: 100%; }
.account-dialog { width: min(680px, 94vw); }
.google-button { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 11px; margin-top: 22px; border: 1px solid var(--line); background: white; color: var(--ink); text-decoration: none; font-weight: 700; border-radius: 2px; }
.google-button:hover { border-color: var(--ink); box-shadow: 0 4px 15px rgba(0,0,0,.06); }
.google-button svg { width: 18px; height: 18px; }
.google-button.disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.google-setup-note { margin: 7px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font: 650 9px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.auth-divider:before, .auth-divider:after { content: ""; height: 1px; flex: 1; background: var(--line); }
.auth-tabs { display: flex; gap: 4px; padding: 4px; margin: 24px 0 18px; background: #e7e2d6; }
.auth-tab { flex: 1; border: 0; padding: 10px; background: transparent; font-weight: 700; color: var(--muted); }
.auth-tab.active { background: var(--panel); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.auth-form { display: grid; gap: 12px; }
.auth-form label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.auth-form input { display: block; width: 100%; min-height: 44px; border: 1px solid var(--line); background: var(--panel); padding: 10px; margin-top: 4px; outline: 0; font-size: 16px; }
.auth-form input:focus, .key-entry input:focus { border-color: var(--violet); }
.form-help { color: var(--muted); font-size: 11px; margin: -3px 0 2px; }
.form-error { min-height: 18px; color: #a33e24; font-size: 12px; margin: 0; }
.full-button { width: 100%; }
.account-summary { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin: 24px 0 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.account-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--acid); font: 500 22px/1 Georgia, serif; }
.account-summary strong, .account-summary span { display: block; }
.account-summary span { color: var(--muted); font-size: 12px; }
.vault-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.vault-heading h3 { margin: 0; font: 500 23px/1 Georgia, serif; }
.vault-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.secure-badge { padding: 5px 8px; border: 1px solid #aabd59; background: var(--acid); font: 700 9px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.key-vault { display: grid; gap: 10px; margin-top: 18px; }
.key-card { padding: 15px; border: 1px solid var(--line); background: var(--panel); }
.key-card-top { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 10px; }
.key-card-top strong { font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.key-status { color: var(--muted); font: 650 9px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; }
.key-status.saved { color: #537934; }
.key-entry { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; }
.key-entry input { min-width: 0; border: 1px solid var(--line); background: white; padding: 9px 10px; }
.key-entry button { white-space: nowrap; }
.key-callout { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--line); background: #eeeadf; color: var(--muted); font-size: 11px; }
.key-callout button { padding: 5px 8px; }
.provider-endpoint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 10px; }

footer { width: min(1120px, 90vw); margin: 100px auto 0; border-top: 1px solid var(--line); padding: 25px 0 45px; display: flex; justify-content: space-between; color: var(--muted); font: 650 9px/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }

@media (max-width: 760px) {
  .topbar { padding-left: 4vw; padding-right: 4vw; }
  .prototype { display: none; }
  .topbar-actions .ghost-button { min-height: 42px; padding: 8px 11px; }
  .account-button { min-height: 42px; }
  main { width: 92vw; }
  .hero { padding-top: 55px; }
  .hero > p { font-size: 16px; }
  .context-row { flex-direction: column; align-items: stretch; }
  .context-row input { padding: 8px 0; }
  .colleague-grid { grid-template-columns: 1fr 1fr; }
  .section-heading p { display: none; }
  .process-track { justify-content: space-between; }
  .process-step div { display: none; }
  .process-track > i { flex: 1; }
  .consensus-top, .consensus-columns { grid-template-columns: 1fr; }
  .score { border-left: 0; border-top: 1px solid var(--line); padding-top: 25px; text-align: left; }
  .message { grid-template-columns: 1fr; gap: 10px; }
  .form-grid, .provider-fields { grid-template-columns: 1fr; }
  .form-grid input, .form-grid select { min-height: 46px; font-size: 16px; }
  .discover-button { height: 46px; }
  .local-setup { align-items: stretch; flex-wrap: wrap; }
  .local-setup > div { flex-basis: 100%; }
  .form-grid .wide { grid-column: auto; }
  dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; }
  .dialog-shell { min-height: 100%; padding: calc(22px + env(safe-area-inset-top)) 20px calc(22px + env(safe-area-inset-bottom)); }
  .dialog-actions { position: sticky; bottom: calc(-22px - env(safe-area-inset-bottom)); background: var(--paper); padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); }
  .save-group span { display: none; }
  .key-entry { grid-template-columns: 1fr auto; }
  .key-entry .remove-key { grid-column: 1 / -1; }
  textarea, .context-row input { font-size: 16px; }
}

@media (max-width: 460px) {
  .brand > span:nth-child(2) { display: none; }
  #installButton { display: none !important; }
  .topbar-actions { gap: 5px; }
  .topbar-actions button { padding-left: 9px; padding-right: 9px; }
  .colleague-grid { grid-template-columns: 1fr; }
  .colleague-card { min-height: 205px; }
  .composer, .consensus-card { padding: 22px; }
  h1 { font-size: 49px; }
  footer { flex-direction: column; gap: 10px; }
}

@media (display-mode: standalone) {
  .prototype, #installButton { display: none !important; }
}
