:root {
  --ink: #171918;
  --muted: #6d716e;
  --subtle: #8e928f;
  --canvas: #ffffff;
  --surface: #f7f7f5;
  --sidebar: #f3f4f1;
  --line: #e2e4df;
  --line-dark: #d4d7d1;
  --hover: #e9ebe6;
  --accent: #a95634;
  --accent-soft: #f4e7e0;
  --green: #397052;
  --shadow: 0 10px 35px rgba(25, 29, 26, .08), 0 2px 8px rgba(25, 29, 26, .05);
  color-scheme: light dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, textarea { font: inherit; }
button { color: inherit; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 260px; display: flex; flex-direction: column; padding: 14px 12px; background: var(--sidebar); border-right: 1px solid var(--line); transition: width .2s ease, padding .2s ease, transform .2s ease; }
.sidebar-brand { position: relative; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 7px; }
.logo-box { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.logo-box img { width: 26px; height: 26px; object-fit: contain; }
.brand-copy { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.brand-copy strong { font-size: 15px; letter-spacing: -.025em; }
.brand-copy small { font-size: 13px; color: var(--muted); }
.sidebar-close { display: none; margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 21px; cursor: pointer; }
.sidebar-toggle { position: absolute; z-index: 2; top: 12px; right: -25px; width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid var(--line-dark); border-radius: 50%; background: var(--canvas); color: var(--muted); box-shadow: 0 2px 7px rgba(20,24,21,.08); cursor: pointer; font-size: 16px; line-height: 1; }
.sidebar-toggle:hover { color: var(--ink); border-color: #bfc3bd; }

.new-chat { width: 100%; height: 42px; margin: 13px 0 20px; padding: 0 11px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line-dark); border-radius: 9px; background: #fff; font-size: 13px; font-weight: 550; cursor: pointer; box-shadow: 0 1px 2px rgba(20,24,21,.03); }
.new-chat:hover { border-color: #c5c8c2; background: #fcfcfb; }
.new-chat.active { border-color: #c9ccc6; background: var(--hover); }
.new-chat > span:first-child { width: 18px; color: var(--accent); font-size: 20px; font-weight: 350; }
.new-chat kbd { margin-left: auto; color: var(--subtle); background: transparent; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }

.sidebar-nav { min-height: 0; overflow-y: auto; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; }
.nav-label { margin: 18px 9px 7px; color: var(--subtle); font-size: 10px; font-weight: 650; letter-spacing: .075em; text-transform: uppercase; }
.new-project-icon { width: 25px; height: 25px; margin: 12px 5px 0 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; font-weight: 350; }
.new-project-icon:hover { background: var(--hover); color: var(--ink); }
.project-list { display: grid; gap: 2px; }
.project-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: center; border-radius: 8px; }
.project-row:hover, .project-row.active { background: var(--hover); }
.project-open { min-width: 0; height: 47px; display: flex; align-items: center; gap: 9px; padding: 5px 5px 5px 8px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.project-icon { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); color: var(--accent); font-size: 9px; font-weight: 700; }
.project-copy { min-width: 0; display: grid; gap: 3px; }
.project-copy strong, .project-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-copy strong { color: var(--ink); font-size: 11px; font-weight: 590; }
.project-copy small { color: var(--subtle); font-size: 9px; }
.project-delete { width: 24px; height: 24px; display: grid; place-items: center; visibility: hidden; border: 0; border-radius: 6px; background: transparent; color: var(--subtle); cursor: pointer; font-size: 16px; }
.project-row:hover .project-delete, .project-delete:focus-visible { visibility: visible; }
.project-delete:hover { background: var(--canvas); color: #b04e3b; }
.project-empty { margin: 5px 9px 0; color: var(--subtle); font-size: 10px; line-height: 1.4; }
.project-empty.error { color: #b04e3b; }
.nav-item, .context-item { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.nav-item { cursor: pointer; }
.nav-item.active, .nav-item:hover { background: var(--hover); }
.nav-item > span:nth-child(2), .context-item > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.nav-item strong, .context-item strong { overflow: hidden; color: #353936; font-size: 12px; font-weight: 560; text-overflow: ellipsis; white-space: nowrap; }
.nav-item small, .context-item small { overflow: hidden; color: var(--subtle); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.nav-icon, .context-icon { position: relative; width: 27px; height: 27px; flex: 0 0 27px; border-radius: 7px; background: #fff; border: 1px solid var(--line); }
.chat-icon::before { content: ""; position: absolute; inset: 7px 6px 8px; border: 1.5px solid var(--muted); border-radius: 4px; }
.chat-icon::after { content: ""; position: absolute; left: 8px; bottom: 5px; width: 5px; height: 5px; border-left: 1.5px solid var(--muted); transform: skew(-24deg); }
.book-icon::before { content: ""; position: absolute; inset: 6px 5px; border: 1.5px solid var(--muted); border-radius: 2px 4px 4px 2px; }
.book-icon::after { content: ""; position: absolute; left: 12px; top: 6px; bottom: 6px; border-left: 1px solid var(--line-dark); }
.globe-icon::before { content: ""; position: absolute; inset: 6px; border: 1.5px solid var(--muted); border-radius: 50%; }
.globe-icon::after { content: ""; position: absolute; left: 8px; right: 8px; top: 12px; border-top: 1px solid var(--muted); box-shadow: 0 -4px 0 -0.5px var(--muted), 0 4px 0 -0.5px var(--muted); }
.media-icon::before { content: ""; position: absolute; left: 6px; right: 6px; top: 7px; bottom: 7px; border: 1.5px solid var(--muted); border-radius: 3px; }
.media-icon::after { content: ""; position: absolute; left: 9px; bottom: 9px; width: 10px; height: 6px; background: linear-gradient(140deg, transparent 47%, var(--muted) 48% 56%, transparent 57%), linear-gradient(45deg, transparent 45%, var(--muted) 46% 54%, transparent 55%); }
.connected-dot { width: 6px; height: 6px; margin-left: auto; flex: 0 0 6px; border-radius: 50%; background: #77a28a; box-shadow: 0 0 0 3px rgba(81,135,103,.09); }
.connected-dot.offline { background: #b5b8b4; box-shadow: none; }

.sidebar-footer { margin-top: auto; padding: 14px 9px 3px; border-top: 1px solid var(--line); }
.ai-connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.ai-connection strong { font-weight: 620; white-space: nowrap; }
.ai-connection > span { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #c39d4c; box-shadow: 0 0 0 3px rgba(195,157,76,.11); }
.ai-connection.connected { color: var(--green); }
.ai-connection.connected > span { background: #57906d; box-shadow: 0 0 0 3px rgba(87,144,109,.12); }
.ai-connection.disconnected { color: #ac4938; }
.ai-connection.disconnected > span { background: #b8553d; box-shadow: 0 0 0 3px rgba(184,85,61,.12); }
.account-button { width: 100%; min-width: 0; min-height: 42px; display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 6px 4px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.account-avatar { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.account-button > span:last-child { min-width: 0; display: grid; gap: 2px; }
.account-button strong, .account-button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-button strong { font-size: 10px; font-weight: 600; }
.account-button small { color: var(--subtle); font-size: 9px; }

.app-shell { height: 100vh; margin-left: 260px; display: flex; flex-direction: column; min-width: 0; background: var(--canvas); transition: margin-left .2s ease; }
.topbar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { display: flex; align-items: center; gap: 8px; }
.page-title strong { font-size: 13px; letter-spacing: -.01em; }
.page-title span, .page-title small { color: var(--subtle); font-size: 12px; }
.menu-button { display: none; width: 32px; height: 32px; align-items: center; justify-content: center; flex-direction: column; gap: 4px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.menu-button span { width: 15px; height: 1.5px; background: var(--muted); }

.chat-viewport { min-height: 0; flex: 1; overflow-y: auto; scrollbar-gutter: stable; }
.chat-content { width: min(820px, calc(100% - 40px)); min-height: 100%; margin: 0 auto; padding: 56px 0 175px; }
.intro { min-height: calc(100vh - 290px); display: flex; flex-direction: column; align-items: center; justify-content: center; animation: appear .35s ease both; }
.intro.hidden { display: none; }
.intro-logo { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.intro-logo img { width: 43px; height: 43px; object-fit: contain; }
.intro h1 { margin: 0; max-width: 620px; text-align: center; font-size: clamp(28px, 4vw, 38px); font-weight: 550; line-height: 1.12; letter-spacing: -.035em; }
.intro > p { max-width: 600px; margin: 13px auto 30px; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.6; }
.suggestions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.suggestions button { position: relative; min-height: 86px; display: grid; gap: 7px; padding: 15px 42px 15px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.suggestions button:hover { border-color: #cfd2cc; background: var(--surface); transform: translateY(-1px); }
.suggestions strong { align-self: end; font-size: 13px; font-weight: 620; }
.suggestions span { align-self: start; color: var(--muted); font-size: 11px; line-height: 1.35; }
.suggestions i { position: absolute; top: 16px; right: 15px; color: var(--accent); font-size: 18px; font-style: normal; font-weight: 400; }

.conversation { display: grid; gap: 30px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; animation: message-in .22s ease both; }
.message-label { width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); font-size: 0; }
.message-label::before { content: ""; width: 28px; height: 28px; background: url('/static/logo.png') center / contain no-repeat; }
.message.user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.message.user .message-label { display: none; }
.message.user .message-body { width: fit-content; max-width: min(76%, 620px); padding: 11px 15px; border-radius: 17px 17px 4px 17px; background: #f0f1ef; }
.message-body { min-width: 0; padding-top: 4px; font-size: 14px; line-height: 1.72; }
.message-body p { margin: 0 0 13px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body h2, .message-body h3 { margin: 24px 0 8px; font-size: 15px; line-height: 1.4; }
.message-body ul, .message-body ol { margin: 10px 0; padding-left: 22px; }
.message-body code { padding: 2px 5px; border-radius: 4px; background: var(--surface); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.citation-ref { position: relative; display: inline; margin: 0 1px; padding: 0; border: 0; background: transparent; color: var(--accent); cursor: help; line-height: 1; }
.citation-ref > sup, .citation-missing { font-size: 8px; font-weight: 700; letter-spacing: .01em; }
.citation-missing { color: var(--muted); }
.citation-popover { position: absolute; z-index: 50; left: 0; bottom: calc(100% + 9px); width: min(330px, 78vw); display: grid; gap: 6px; padding: 11px 12px; visibility: hidden; border: 1px solid var(--line-dark); border-radius: 9px; background: var(--canvas); box-shadow: var(--shadow); color: var(--ink); opacity: 0; transform: translateY(4px); transition: opacity .14s ease, transform .14s ease, visibility .14s; text-align: left; white-space: normal; pointer-events: none; }
.citation-popover strong { font-size: 11px; font-weight: 650; line-height: 1.3; }
.citation-popover > span { color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.45; }
.citation-popover small { overflow: hidden; color: var(--subtle); font-size: 9px; font-weight: 500; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.citation-ref:hover .citation-popover, .citation-ref:focus-visible .citation-popover, .citation-ref:focus .citation-popover { visibility: visible; opacity: 1; transform: none; }
.warning { margin-top: 14px; padding: 9px 11px; border-radius: 7px; background: #fff7e7; color: #7b5e2e; font-size: 11px; }
.thinking-state { min-height: 34px; display: flex; align-items: center; gap: 11px; color: var(--muted); }
.thinking-state > span:last-child { display: grid; gap: 2px; }
.thinking-state strong { color: var(--ink); font-size: 12px; font-weight: 570; line-height: 1.25; }
.thinking-state small { color: var(--subtle); font-size: 10px; line-height: 1.25; }
.thinking-spinner { width: 16px; height: 16px; flex: 0 0 16px; border: 1.5px solid var(--line-dark); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.message-media { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 260px)); gap: 8px; margin: 0 0 12px; }
.message-media figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.message-media img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.message-media audio { display: block; width: calc(100% - 16px); margin: 10px 8px 5px; }
.stored-media { min-height: 55px; display: grid; place-items: center; padding: 10px; color: var(--muted); font-size: 10px; }
.message-media figcaption { padding: 7px 9px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }

.composer-dock { position: fixed; z-index: 20; left: 260px; right: 0; bottom: 0; padding: 38px 20px 14px; background: linear-gradient(transparent, rgba(255,255,255,.96) 32%, #fff 58%); transition: left .2s ease; }
.composer { width: min(820px, 100%); min-height: 106px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 10px; border: 1px solid var(--line-dark); border-radius: 18px; background: #fff; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: #bfc3bd; box-shadow: 0 12px 40px rgba(25,29,26,.1), 0 0 0 3px rgba(30,35,31,.025); }
.composer.dragging { border-color: var(--accent); box-shadow: 0 12px 40px rgba(169,86,52,.11), 0 0 0 3px var(--accent-soft); }
.composer textarea { width: 100%; min-height: 44px; max-height: 170px; resize: none; padding: 5px 7px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; line-height: 1.5; }
.composer textarea::placeholder { color: #969a96; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-actions-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.composer button { border: 0; cursor: pointer; }
.attach-button { height: 30px; display: flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; }
.attach-button:hover { background: var(--surface); color: var(--ink); }
.attach-button span:first-child { font-size: 18px; font-weight: 350; }
.context-pill { height: 27px; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 10px; }
.context-pill > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #5d9171; }
.project-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }
.memory-pill { max-width: 190px; border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: var(--accent-soft); color: var(--accent); }
.send-button { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 9px; background: #202321; color: #fff; font-size: 17px; font-weight: 500; }
.send-button:hover { background: #373b38; }
.send-button.stop-button { font-size: 10px; }
.send-button.stop-button:hover { background: #4a3330; }
.composer button:disabled { opacity: .42; cursor: wait; }
.composer-note { margin: 8px auto 0; color: var(--subtle); text-align: center; font-size: 9px; }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 7px; }
.attachment-chip { max-width: 250px; height: 34px; display: flex; align-items: center; gap: 7px; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.attachment-chip .kind { color: var(--accent); font-size: 8px; font-weight: 700; letter-spacing: .04em; }
.attachment-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.attachment-chip button { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 16px; }
.attachment-chip button:hover { color: var(--accent); background: #fff; }

.project-dialog { width: min(500px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line-dark); border-radius: 15px; background: var(--canvas); color: var(--ink); box-shadow: 0 24px 80px rgba(20,24,21,.24); }
.project-dialog::backdrop { background: rgba(18,21,19,.42); backdrop-filter: blur(3px); }
.project-dialog form { display: grid; gap: 8px; padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.dialog-heading small { color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.dialog-heading h2 { margin: 3px 0 0; font-size: 21px; font-weight: 580; letter-spacing: -.025em; }
.dialog-close { width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.dialog-close:hover { background: var(--surface); color: var(--ink); }
.project-dialog label { margin-top: 5px; font-size: 11px; font-weight: 620; }
.project-dialog input, .project-dialog textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--line-dark); border-radius: 9px; outline: 0; background: var(--canvas); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.45; }
.project-dialog textarea { resize: vertical; min-height: 108px; }
.project-dialog input:focus, .project-dialog textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.project-dialog form > p { margin: 3px 0 5px; color: var(--subtle); font-size: 10px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 7px; }
.dialog-actions button { height: 36px; padding: 0 13px; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 620; }
.secondary-button { border: 1px solid var(--line-dark); background: var(--canvas); color: var(--muted); }
.primary-button { border: 1px solid #202321; background: #202321; color: #fff; }
.dialog-actions button:disabled { opacity: .5; cursor: wait; }

.auth-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--canvas); }
.auth-card { width: min(400px, 100%); text-align: center; }
.auth-logo { width: 55px; height: 55px; display: grid; place-items: center; margin: 0 auto 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.auth-logo img { width: 45px; height: 45px; object-fit: contain; }
.auth-card > small { color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-card h1 { margin: 7px 0 9px; font-size: 28px; font-weight: 570; letter-spacing: -.035em; }
.auth-card > p { margin: 0 auto 24px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.auth-card form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.auth-card input { min-width: 0; height: 43px; padding: 0 12px; border: 1px solid var(--line-dark); border-radius: 10px; outline: 0; background: var(--canvas); color: var(--ink); font: inherit; font-size: 12px; }
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-card form button { height: 43px; padding: 0 14px; border: 1px solid #202321; border-radius: 10px; background: #202321; color: #fff; cursor: pointer; font-size: 11px; font-weight: 620; }
.auth-card button:disabled { opacity: .5; cursor: wait; }
.auth-divider { height: 35px; display: flex; align-items: center; gap: 9px; color: var(--subtle); font-size: 9px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.passkey-button { width: 100%; height: 43px; border: 1px solid var(--line-dark); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 620; }
.passkey-button span { margin-right: 5px; color: var(--accent); }
.auth-message { min-height: 37px; margin-top: 14px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.auth-message.error { color: #ac4938; }
.auth-message a { color: var(--accent); font-weight: 650; }

.profile-dialog { width: min(430px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line-dark); border-radius: 15px; background: var(--canvas); color: var(--ink); box-shadow: 0 24px 80px rgba(20,24,21,.24); }
.profile-dialog::backdrop { background: rgba(18,21,19,.42); backdrop-filter: blur(3px); }
.profile-card { padding: 22px; }
.profile-email { margin: 5px 0 18px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; }
.profile-passkey-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 4px 0 16px; }
.profile-passkey-row > span { display: grid; gap: 3px; }
.profile-passkey-row strong { font-size: 12px; }
.profile-passkey-row small { color: var(--subtle); font-size: 9px; }
.profile-passkey-row button { height: 34px; padding: 0 11px; border-radius: 8px; cursor: pointer; font-size: 10px; }
.profile-card > p { min-height: 18px; margin: 0 0 10px; color: var(--muted); font-size: 10px; }
.signout-button { width: 100%; height: 37px; border: 1px solid var(--line-dark); border-radius: 8px; background: transparent; color: #ac4938; cursor: pointer; font-size: 11px; font-weight: 620; }

body.sidebar-collapsed .sidebar { width: 72px; padding-left: 9px; padding-right: 9px; }
body.sidebar-collapsed .app-shell { margin-left: 72px; }
body.sidebar-collapsed .composer-dock { left: 72px; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .new-chat > span:nth-child(2),
body.sidebar-collapsed .new-chat kbd,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .project-copy,
body.sidebar-collapsed .project-delete,
body.sidebar-collapsed .context-item > span:nth-child(2),
body.sidebar-collapsed .context-item > .connected-dot,
body.sidebar-collapsed .ai-connection strong,
body.sidebar-collapsed .account-button > span:last-child,
body.sidebar-collapsed .project-empty { display: none; }
body.sidebar-collapsed .new-chat { justify-content: center; padding: 0; }
body.sidebar-collapsed .new-chat > span:first-child { width: auto; }
body.sidebar-collapsed .nav-heading { justify-content: center; }
body.sidebar-collapsed .new-project-icon { margin-right: 0; }
body.sidebar-collapsed .project-row { display: block; }
body.sidebar-collapsed .project-open { justify-content: center; padding: 5px; }
body.sidebar-collapsed .context-item { justify-content: center; padding: 7px 0; }
body.sidebar-collapsed .sidebar-footer { display: flex; justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-footer { flex-direction: column; align-items: center; }
body.sidebar-collapsed .account-button { justify-content: center; padding-left: 0; padding-right: 0; }

.sidebar-scrim { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 35px rgba(20,24,21,.12); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-toggle { display: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(18,21,19,.3); backdrop-filter: blur(2px); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .app-shell, body.sidebar-collapsed .app-shell { margin-left: 0; }
  .menu-button { display: flex; }
  .composer-dock, body.sidebar-collapsed .composer-dock { left: 0; }
  body.sidebar-collapsed .sidebar { width: 260px; padding: 14px 12px; }
  body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 7px; }
  body.sidebar-collapsed .brand-copy { display: flex; }
  body.sidebar-collapsed .new-chat > span:nth-child(2),
  body.sidebar-collapsed .new-chat kbd,
  body.sidebar-collapsed .context-item > .connected-dot,
  body.sidebar-collapsed .ai-connection strong { display: inline; }
  body.sidebar-collapsed .account-button > span:last-child { display: grid; }
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .project-empty { display: block; }
  body.sidebar-collapsed .project-copy,
  body.sidebar-collapsed .context-item > span:nth-child(2) { display: grid; }
  body.sidebar-collapsed .project-delete { display: grid; }
  body.sidebar-collapsed .new-chat { justify-content: flex-start; padding: 0 11px; }
  body.sidebar-collapsed .new-chat > span:first-child { width: 18px; }
  body.sidebar-collapsed .nav-heading { justify-content: space-between; }
  body.sidebar-collapsed .new-project-icon { margin-right: 5px; }
  body.sidebar-collapsed .project-row { display: grid; }
  body.sidebar-collapsed .project-open { justify-content: flex-start; padding: 5px 5px 5px 8px; }
  body.sidebar-collapsed .context-item { justify-content: flex-start; padding: 7px 9px; }
  body.sidebar-collapsed .sidebar-footer { display: block; padding: 14px 9px 3px; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 13px; }
  .page-title span { display: none; }
  .chat-content { width: calc(100% - 26px); padding-top: 34px; padding-bottom: 165px; }
  .intro { min-height: auto; padding: 32px 0 20px; justify-content: flex-start; }
  .intro h1 { font-size: 27px; }
  .intro > p { margin-bottom: 22px; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestions button { min-height: 72px; }
  .message { grid-template-columns: 30px minmax(0,1fr); gap: 10px; }
  .message.user .message-body { max-width: 88%; }
  .composer-dock { padding: 32px 10px 9px; }
  .composer { border-radius: 16px; }
  .attach-button span:last-child { display: none; }
  .context-pill { max-width: 145px; }
  .memory-pill { max-width: 115px; }
  .auth-card form { grid-template-columns: 1fr; }
  .composer-note { max-width: 310px; line-height: 1.35; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceeeb;
    --muted: #a8ada8;
    --subtle: #858b86;
    --canvas: #171918;
    --surface: #202320;
    --sidebar: #121412;
    --line: #2d312d;
    --line-dark: #3a3f3a;
    --hover: #252925;
    --accent: #d27a55;
    --accent-soft: #3a2821;
    --green: #83b99a;
    --shadow: 0 12px 38px rgba(0, 0, 0, .32), 0 2px 8px rgba(0, 0, 0, .22);
    color-scheme: dark;
  }

  .logo-box,
  .intro-logo,
  .auth-logo {
    background: #eeefeb;
    border-color: #d7d9d3;
  }

  .new-chat,
  .suggestions button,
  .composer,
  .auth-card input,
  .project-dialog input,
  .project-dialog textarea {
    background: #1d201e;
  }

  .new-chat:hover {
    border-color: #505650;
    background: #232724;
  }

  .nav-item strong,
  .context-item strong {
    color: var(--ink);
  }

  .nav-icon,
  .context-icon {
    background: #1b1e1c;
  }

  .topbar {
    background: rgba(23, 25, 24, .94);
  }

  .attachment-chip {
    background: #202320;
  }

  .suggestions button:hover,
  .attach-button:hover,
  .attachment-chip button:hover {
    background: #262a27;
  }

  .message.user .message-body {
    background: #292d2a;
  }

  .warning {
    background: #362c1d;
    color: #dfbd78;
  }

  .composer-dock {
    background: linear-gradient(transparent, rgba(23, 25, 24, .96) 32%, var(--canvas) 58%);
  }

  .composer:focus-within {
    border-color: #555b55;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35), 0 0 0 3px rgba(255, 255, 255, .025);
  }

  .send-button {
    background: #e4e7e3;
    color: #171918;
  }

  .send-button:hover {
    background: #cdd2cd;
  }

  .send-button.stop-button:hover {
    background: #d7b6aa;
  }

  .message-media figure {
    background: #202320;
  }

  .sidebar-scrim {
    background: rgba(0, 0, 0, .5);
  }

  .project-icon,
  .secondary-button {
    background: #1d201e;
  }

  .auth-card form button { background: #e4e7e3; border-color: #e4e7e3; color: #171918; }
}
