* { box-sizing: border-box; }
.context-info { display:flex; flex-direction:column; gap:4px; margin:8px 4px 0; padding-top:9px; border-top:1px solid var(--line); color:var(--muted); font-size:11px; line-height:1.6; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.context-warning:empty { display:none; }
.context-warning { color:#dcaa77; }
[data-theme="light"] .context-warning { color:#955117; }
.composer-options { display:flex; align-items:center; gap:4px; flex:0 1 auto; min-width:0; max-width:35%; }
.route-control { display:inline-flex; align-items:center; justify-content:center; gap:8px; max-width:180px; height:32px; min-width:0; padding:0 8px; border:0; border-radius:8px; color:var(--secondary); font-size:13px; }
.route-control > span:first-child { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.route-control svg { width:12px; height:12px; transition:transform .16s ease; }
.route-control[aria-expanded="true"] { background:var(--hover); color:var(--text); }
.route-control[aria-expanded="true"] svg { transform:rotate(180deg); }
.route-control:hover:not(:disabled) { background:var(--hover); }
.route-control:disabled { opacity:.5; }
.route-panel { --route-panel-max-height:480px; position:fixed; inset:auto; width:400px; max-width:calc(100vw - 32px); max-height:var(--route-panel-max-height); margin:0; padding:8px; overflow:hidden; border:1px solid var(--border); border-radius:12px; background:var(--panel); color:var(--text); box-shadow:0 8px 28px #0003; }
#route-list { margin-top:0; max-height:360px; }
.route-list-caption { flex-shrink:0; padding:4px 10px 10px; font-size:11px; line-height:18px; color:var(--muted); }
.route-option { align-items:flex-start; border-bottom:1px solid var(--line); }
.route-choice-body { flex:1; min-width:0; }
.route-choice-name { color:var(--text); font-weight:500; }
.route-choice-description { margin-top:3px; color:var(--muted); font-size:12px; line-height:18px; white-space:normal; }
.route-choice-price { margin-top:5px; color:var(--secondary); font-size:12px; line-height:18px; font-variant-numeric:tabular-nums; }
.route-option > svg { flex-shrink:0; margin-top:3px; }
.route-disclaimer { flex-shrink:0; margin:8px 10px 2px; color:var(--muted); font-size:11px; line-height:17px; }
.route-panel-content { display:flex; flex-direction:column; min-height:0; max-height:calc(var(--route-panel-max-height) - 18px); overflow:hidden; }
.route-price-details { flex-shrink:0; min-height:0; margin-top:8px; padding-top:8px; border-top:1px solid var(--line); }
.route-price-details summary { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:4px 8px; list-style:none; color:var(--muted); font-size:12px; line-height:20px; cursor:pointer; border-radius:6px; }
.route-price-details summary::-webkit-details-marker { display:none; }
.route-price-details summary:hover { background:var(--hover); color:var(--text); }
.route-price-details summary svg { width:12px; height:12px; }
.route-price-details[open] summary svg { transform:rotate(180deg); }
.route-price-body { max-height:min(160px,max(0px,calc(var(--route-panel-max-height) - 144px))); padding:0 8px 8px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.route-price-caption { display:flex; justify-content:space-between; gap:12px; padding-top:16px; color:var(--muted); font-size:12px; line-height:20px; }
.route-prices { color:var(--secondary); font-size:13px; line-height:20px; font-variant-numeric:tabular-nums; }
.route-tier { margin-top:12px; padding-top:12px; border-top:1px solid var(--line); }
.route-tier-label { margin-bottom:8px; color:var(--secondary); font-size:12px; }
.route-price-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 20px; }
.route-price { display:flex; align-items:baseline; justify-content:space-between; gap:8px; min-width:0; }
.route-price > span:last-child { color:var(--text); white-space:nowrap; }
.route-note { margin:12px 0 0; padding-top:12px; border-top:1px solid var(--line); color:var(--muted); font-size:12px; line-height:1.7; }
.route-note:empty { display:none; }
@media(max-width:380px){ .route-price-grid{grid-template-columns:1fr}.route-control{max-width:132px} }
:root { font-family: var(--font); font-size: 16px; color: var(--text); background: var(--bg); }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; outline-offset: 4px; }
button { border: 0; background: none; color: inherit; cursor: pointer; transition: background .16s ease, color .16s ease, border-color .16s ease; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, select:focus-visible, .conversation-scroll:focus-visible { outline: 2px solid var(--accent); }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 18px; height: 18px; flex-shrink: 0; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* The app owns the viewport; only the conversation and history scroll. */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar-width); height: 100dvh; display: flex; flex-direction: column; padding: 16px 12px 12px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 4px 0 8px; }
.wordmark { display: flex; align-items: center; gap: 8px; font-size: 23px; font-weight: 600; letter-spacing: -.5px; }
.brand-symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.wordmark .brand-mark { display: block; width: 26px; height: 26px; object-fit: contain; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); }
.icon-button:hover { background: var(--selected); color: var(--text); }
.new-chat { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; margin-top: 16px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--hover); font-size: 14px; text-align: left; }
.new-chat:hover { background: var(--selected); }
.shortcut { margin-left: auto; color: var(--muted); font: 11px/20px Consolas, monospace; white-space: nowrap; }
.primary-nav { display: grid; gap: 2px; margin-top: 12px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 12px; border-radius: 8px; color: var(--secondary); font-size: 14px; text-align: left; }
.nav-item > [data-icon] { width: 20px; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--selected); color: var(--text); }
.history-heading { display: flex; justify-content: space-between; align-items: center; margin: 24px 12px 8px; color: var(--muted); font-size: 12px; line-height: 20px; }
.history-heading svg { width: 14px; height: 14px; }
.history { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.history-empty { margin: 12px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.history-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; margin-bottom: 2px; border-radius: 8px; color: var(--secondary); font-size: 14px; }
.history-item:hover { background: var(--hover); }
.history-item.selected { color: var(--text); background: var(--selected); }
.history-delete { display: grid; place-items: center; width: 24px; height: 24px; margin-left: auto; padding: 4px; border-radius: 4px; color: var(--muted); opacity: 0; }
.history-delete svg { width: 14px; height: 14px; }
.history-item:hover .history-delete, .history-item:focus-within .history-delete { opacity: 1; }
.history-delete:hover { background: var(--selected); color: var(--text); }
.sidebar-bottom { flex-shrink: 0; padding-top: 12px; }
.balance-card { padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.balance-label { color: var(--muted); font-size: 12px; line-height: 16px; }
.balance-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.sidebar-balance { font-size: 18px; line-height: 28px; font-variant-numeric: tabular-nums; }
.small-button { padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--secondary); font-size: 12px; line-height: 20px; }
.small-button:hover { color: var(--text); background: var(--selected); }
.profile-button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; margin-top: 4px; padding: 12px 8px; border-radius: 8px; text-align: left; }
.profile-button:hover { background: var(--hover); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--raised); color: var(--secondary); font-size: 13px; }
.profile-button > span:nth-child(2) { min-width: 0; }
.profile-button strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.profile-button small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.profile-button > [data-icon] { margin-left: auto; color: var(--muted); transform: rotate(-90deg); }
.profile-button svg { width: 14px; height: 14px; }

.main { display: flex; flex-direction: column; height: 100dvh; min-height: 0; margin-left: var(--sidebar-width); overflow: hidden; background: var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; min-height: 64px; padding: 0 28px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 13px; }
.topbar-right { flex-shrink: 0; }
.workspace-name { color: var(--muted); white-space: nowrap; }
.header-divider { color: var(--muted); opacity: .5; }
.workspace-section { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--secondary); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0; color: var(--muted); font-size: 13px; }
.text-button:hover { color: var(--text); }
.text-button svg { width: 16px; height: 16px; }
.login-button { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--secondary); font-size: 13px; }
.login-button:hover { color: var(--text); background: var(--hover); }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-radius: 8px; color: var(--muted); }
.theme-toggle:hover { color: var(--text); background: var(--hover); }
.theme-toggle .theme-moon { display: none; }
[data-theme="light"] .theme-toggle .theme-sun { display: none; }
[data-theme="light"] .theme-toggle .theme-moon { display: inline-flex; }
.mobile-menu, .mobile-shade { display: none; }

.chat-area { display: flex; flex: 1; flex-direction: column; justify-content: center; min-height: 0; width: 100%; padding: 32px 0; overflow-y: auto; }
.composer-region { width: calc(100% - 64px); max-width: var(--conversation-width); margin: 0 auto; flex-shrink: 0; }
.composer-region { padding-bottom: 12px; }
.composer { padding: 16px 16px 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); transition: border-color .16s ease; }
.composer:focus-within { border-color: var(--muted); }
.composer textarea { display: block; width: 100%; min-height: 56px; max-height: 200px; resize: none; padding: 0 4px; border: 0; outline: none; overflow-y: auto; background: transparent; color: var(--text); font-size: 16px; line-height: 26px; }
.composer textarea::placeholder { color: var(--muted); }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.model-control { display: flex; min-width: 0; }
.model-trigger { display:flex; align-items:center; gap:8px; min-width:0; max-width:260px; height:32px; padding:0 8px; border-radius:8px; color:var(--secondary); font-size:13px; }
.model-trigger:hover:not(:disabled), .model-trigger[aria-expanded="true"] { background:var(--hover); color:var(--text); }
.model-trigger:disabled { opacity:.5; }
#model-current { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.model-menu-chevron svg { width:12px; height:12px; transition:transform .16s ease; }
.model-trigger[aria-expanded="true"] .model-menu-chevron svg { transform:rotate(180deg); }
.model-panel { --model-panel-max-height:320px; position:fixed; inset:auto; width:312px; height:var(--model-panel-max-height); max-width:calc(100vw - 32px); max-height:var(--model-panel-max-height); margin:0; padding:8px; overflow:hidden; border:1px solid var(--border); border-radius:12px; background:var(--panel); color:var(--text); box-shadow:0 8px 28px #0003; }
.model-panel:popover-open { display:flex; flex-direction:column; }
.model-search { display:flex; align-items:center; gap:8px; flex-shrink:0; padding:0 8px 8px; border-bottom:1px solid var(--line); color:var(--muted); }
.model-search svg { width:16px; height:16px; }
.model-search input { min-width:0; padding:8px 0; border:0; border-radius:0; background:transparent; font-size:14px; }
.model-search input:focus { outline:0; }
.model-search:focus-within { border-color:var(--muted); }
.model-filters { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); flex-shrink:0; gap:4px; margin:8px 4px 0; }
.model-filters button { min-height:28px; padding:4px 6px; border-radius:6px; color:var(--muted); font-size:12px; line-height:20px; }
.model-filters button:hover { background:var(--hover); color:var(--text); }
.model-filters button[aria-pressed="true"] { background:var(--selected); color:var(--text); }
.model-list { flex:1; min-height:0; max-height:216px; margin-top:8px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; scrollbar-width:thin; }
.model-option { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:36px; padding:8px 10px; border-radius:6px; color:var(--secondary); font-size:13px; line-height:20px; text-align:left; }
.model-option > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.model-option:hover, .model-option:focus-visible { background:var(--hover); color:var(--text); }
.model-option[aria-selected="true"] { background:var(--selected); color:var(--text); }
.model-option svg { width:14px; height:14px; }
.model-empty { margin:16px 8px; color:var(--muted); font-size:13px; }
.model-glyph svg { width: 16px; height: 16px; }
.select-chevron { position: absolute; right: 8px; pointer-events: none; }
.select-chevron svg { width: 12px; height: 12px; }
.composer-actions { display: flex; align-items: center; gap: 12px; min-width: 0; margin-left: auto; }
.composer-actions .send-button { flex-shrink: 0; }
.send-button { --send-blue: #3476db; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; background: var(--send-blue); color: #fff; }
.send-button:hover:not(:disabled) { background: #285fb8; }
.send-button:disabled { background: color-mix(in srgb, var(--send-blue) 48%, var(--panel)); color: var(--text); }
.send-button svg { width: 20px; height: 20px; }
.page-footer { display: flex; align-items: center; justify-content: flex-end; flex-shrink: 0; min-height: 36px; padding: 8px 28px; color: var(--muted); font-size: 12px; }

/* Message and composer share a single reading width at every breakpoint. */
.chat-area.has-messages { justify-content: flex-start; padding: 0; overflow: hidden; }
.conversation-scroll { flex: 1; min-height: 0; width: 100%; padding: 24px 32px 28px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable both-edges; }
.messages { display: flex; flex-direction: column; gap: 28px; width: 100%; max-width: var(--conversation-width); margin: 0 auto; }
.has-messages .composer-region { width: 100%; max-width: none; padding: 12px 32px max(12px, env(safe-area-inset-bottom)); overflow: hidden; scrollbar-gutter: stable both-edges; }
.has-messages .composer { width: 100%; max-width: var(--conversation-width); margin: 0 auto; }
.chat-area.has-messages + .page-footer { display: none; }
.message { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.message.user { justify-content: flex-end; margin-top: 4px; }
.message.assistant + .message.user { margin-top: 12px; }
.message.user .message-content { max-width: 85%; padding: 12px 16px; border-radius: 16px; background: var(--user); color: var(--text); font-size: 16px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-avatar { width: 28px; height: 28px; padding: 4px 0; flex-shrink: 0; }
.assistant-avatar .brand-mark { display: block; width: 24px; height: 24px; object-fit: contain; }
.assistant-body { flex: 1; min-width: 0; }
.assistant-name { margin: 0 0 8px; color: var(--secondary); font-size: 13px; font-weight: 500; line-height: 28px; }
.assistant-body .message-content { color: var(--text); font-size: 16px; line-height: 1.85; overflow-wrap: anywhere; }
.message-content p { margin: 0 0 16px; white-space: pre-wrap; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { font-weight: 600; }
.message-content code { font: .875em/1.7 Consolas, "Cascadia Code", monospace; }
.message-content p > code { padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--code); }
.message-content pre { margin: 0 0 16px; padding: 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: 0 0 10px 10px; background: var(--code); font-size: 14px; line-height: 1.7; white-space: pre; }
.message-content pre:last-child { margin-bottom: 0; }
.code-label { margin-top: 16px; padding: 8px 16px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--raised); color: var(--secondary); font-size: 12px; line-height: 20px; }
.code-label:first-child { margin-top: 0; }
.message-actions { display: flex; gap: 8px; margin-top: 8px; }
.message-actions button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 4px 8px; margin-left: -8px; border-radius: 6px; color: var(--muted); font-size: 12px; }
.message-actions button:hover { background: var(--hover); color: var(--text); }
.message-actions svg { width: 14px; height: 14px; }
.streaming-text { white-space: pre-wrap; }
.inline-error { padding-left: 12px; border-left: 2px solid var(--error-line); color: var(--error) !important; font-size: 14px !important; }
.thinking { display: flex; align-items: center; gap: 4px; height: 28px; }
.thinking span { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: breathe 1.2s ease infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; }
.thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes breathe { 50% { opacity: .3; } }
.generation-status { display: flex; align-items: center; gap: 10px; min-height: 36px; margin-top: 8px; color: var(--secondary); font-size: 14px; }
.generation-spinner { display: inline-block; box-sizing: border-box; width: 18px; height: 18px; flex-shrink: 0; border: 2px solid var(--border); border-top-color: var(--text); border-right-color: var(--text); border-radius: 50%; transform-origin: center; animation: generation-spin 1s linear infinite; }
.generation-elapsed { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@keyframes generation-spin { to { transform: rotate(360deg); } }

/* Supporting flows use the same surfaces, controls and type scale. */
.modal { --modal-max-height: min(90dvh, calc(100dvh - 32px)); position: fixed; width: 460px; max-width: calc(100vw - 32px); max-height: var(--modal-max-height); padding: 48px 8px 12px 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: var(--text); }
.modal-scroll { max-height: calc(var(--modal-max-height) - 62px); padding: 0 24px 20px 32px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; }
.modal-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.modal::backdrop { background: var(--backdrop); }
.modal-close { position: absolute; z-index: 1; top: 12px; right: 20px; }
h2 { margin: 0 0 12px; font-size: 24px; line-height: 1.5; font-weight: 500; }
.modal-description { margin: 0 0 24px; color: var(--secondary); font-size: 14px; line-height: 1.8; }
.auth-modal { text-align: center; }
.auth-modal h2 { margin-bottom: 24px; }
.auth-mark { display: block; width: 40px; height: 40px; margin: 4px auto 16px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--code); }
.auth-tabs button { padding: 8px; border-radius: 6px; color: var(--secondary); font-size: 14px; line-height: 20px; }
.auth-tabs [aria-selected="true"] { background: var(--raised); color: var(--text); }
.auth-modal form { text-align: left; }
label { display: block; margin: 16px 0 8px; color: var(--secondary); font-size: 14px; }
input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: var(--code); color: var(--text); font-size: 14px; line-height: 20px; }
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--accent); }
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-field button { position: absolute; top: 6px; right: 6px; }
.primary-button { padding: 12px 20px; border-radius: 8px; background: var(--action); color: var(--action-text); font-size: 14px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.primary-button:hover:not(:disabled) { background: var(--action-hover); }
.primary-button:disabled { opacity: .45; }
.secondary-button { padding: 12px 20px; border: 1px solid var(--border); border-radius: 8px; color: var(--secondary); font-size: 14px; }
.secondary-button:hover { background: var(--hover); }
.full-width { width: 100%; }
.form-error { min-height: 8px; margin: 16px 0; color: var(--error); font-size: 13px; line-height: 1.7; }
#wallet-error:empty { display: none; }
.auth-bottom { margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.wallet-modal { width: 560px; }
.wallet-total { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--code); }
.wallet-total > span { color: var(--secondary); font-size: 13px; }
.wallet-total > strong { display: block; margin: 8px 0 20px; font-size: 36px; font-weight: 500; font-variant-numeric: tabular-nums; }
.wallet-total strong > span { padding-left: 8px; color: var(--muted); font-size: 12px; }
.wallet-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 20px; }
.wallet-stats b { margin-left: 8px; color: var(--secondary); font-weight: 400; font-variant-numeric: tabular-nums; }
.wallet-tabs { display: flex; gap: 24px; margin-top: 24px; border-bottom: 1px solid var(--line); }
.wallet-tabs button { padding: 0 0 12px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; }
.wallet-tabs .selected { border-color: var(--secondary); color: var(--text); }
.section-help { margin: 20px 0 16px; color: var(--secondary); font-size: 13px; line-height: 1.8; }
.redemption-notice { margin-top:20px; padding:14px 16px; border:1px solid var(--border); border-radius:10px; background:var(--hover); color:var(--secondary); font-size:12px; line-height:1.8; }
.redemption-notice h3 { margin:0 0 6px; color:var(--text); font-size:13px; font-weight:500; }
.redemption-notice ul { margin:0; padding-left:18px; }
.redemption-notice li + li { margin-top:3px; }
.redemption-notice strong { color:var(--text); font-weight:500; white-space:nowrap; }
.redeem-row { display: flex; gap: 8px; }
.redemption-label { display:block; margin:20px 0 8px; color:var(--secondary); font-size:13px; }
.redemption-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:12px; }
.purchase-code-button { display:flex; align-items:center; justify-content:center; gap:9px; min-height:46px; padding:11px 12px; border:1px solid var(--accent); border-radius:8px; background:var(--hover); color:var(--text); font-size:14px; font-weight:500; line-height:22px; text-decoration:none; }
.purchase-code-button svg { flex-shrink:0; width:16px; height:16px; }
.purchase-code-button:hover { background:var(--selected); }
.redemption-actions .primary-button { min-height:46px; padding:11px 12px; }
@media (max-width: 480px) {
  .redemption-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .redemption-actions .purchase-code-button { gap: 5px; padding-inline: 4px; }
  .redemption-actions .primary-button { grid-column: 1 / -1; }
}
.wallet-footer { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 20px; }
.wallet-footer svg { width: 14px; height: 14px; }
.amounts { display: flex; gap: 8px; margin: 16px 0; }
.amounts button { flex: 1; padding: 12px 0; border: 1px solid var(--border); border-radius: 8px; color: var(--secondary); font-size: 14px; }
.amounts .selected { border-color: var(--secondary); background: var(--selected); color: var(--text); }
.amounts button:disabled { opacity: .45; }
.order-header { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.order-header h3 { color: var(--secondary); font-size: 14px; font-weight: 500; }
.order-list { padding: 12px 0; color: var(--muted); font-size: 13px; }
.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--secondary); font-variant-numeric: tabular-nums; }
.order-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.search-modal { width: 540px; }
.search-modal h2 { margin-bottom: 24px; }
.search-results { display: grid; gap: 4px; margin-top: 16px; }
.search-results > button { padding: 12px; border-radius: 8px; color: var(--secondary); font-size: 14px; line-height: 20px; text-align: left; overflow-wrap: anywhere; }
.search-results > button:hover { background: var(--selected); color: var(--text); }
.search-results > p { color: var(--muted); font-size: 14px; }
.account-modal .secondary-button { margin-top: 12px; }
.toast { position: fixed; z-index: 100; bottom: 24px; left: calc(50% + var(--sidebar-width)/2); width: max-content; max-width: min(90vw, 480px); transform: translateX(-50%); padding: 12px 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); color: var(--text); font-size: 14px; line-height: 24px; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--border); }

@media (min-width: 761px) {
  .sidebar-collapsed { --sidebar-width: 64px; }
  .sidebar-collapsed .sidebar { padding: 16px 8px 12px; }
  .sidebar-collapsed .sidebar-brand { flex-direction: column; justify-content: flex-start; gap: 8px; padding: 0; }
  .sidebar-collapsed .wordmark { justify-content: center; width: 40px; height: 32px; }
  .sidebar-collapsed .wordmark > span,
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed .shortcut,
  .sidebar-collapsed .history-heading,
  .sidebar-collapsed .history,
  .sidebar-collapsed .balance-card { display: none; }
  .sidebar-collapsed #sidebar-collapse { width: 40px; height: 32px; color: var(--secondary); }
  .sidebar-collapsed .new-chat { justify-content: center; width: 40px; height: 40px; margin: 12px auto 0; padding: 0; }
  .sidebar-collapsed .primary-nav { justify-items: center; gap: 4px; }
  .sidebar-collapsed .nav-item { justify-content: center; width: 40px; height: 40px; padding: 0; }
  .sidebar-collapsed .sidebar-bottom { margin-top: auto; }
  .sidebar-collapsed .profile-button { justify-content: center; width: 40px; min-height: 40px; padding: 4px; margin: 4px auto 0; }
  .sidebar-collapsed .profile-button > span:not(.avatar) { display: none; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  :root { --sidebar-width: 240px; }
  .workspace-name, .header-divider { display: none; }
  .topbar { padding: 0 24px; }
  .model-trigger { max-width: 220px; }
}
@media (max-width: 760px) {
  .sidebar { width: 256px; max-width: calc(100vw - 48px); transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-shade.open { display: block; position: fixed; inset: 0; z-index: 19; background: var(--backdrop); }
  .main, .sidebar-collapsed .main { margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { height: 56px; min-height: 56px; gap: 8px; padding: 0 16px; }
  .topbar-left, .topbar-right { gap: 8px; }
  .workspace-name, .header-divider { display: none; }
  .workspace-section { max-width: 40vw; font-size: 14px; }
  .login-button { max-width: 104px; padding: 8px; font-size: 12px; }
  .chat-area { padding: 24px 0; }
  .composer-region { width: calc(100% - 32px); }
  .composer { padding: 12px; border-radius: 16px; }
  .composer textarea { min-height: 56px; padding: 0; }
  .model-trigger { gap: 6px; padding-left: 4px; max-width: min(46vw, 220px); font-size: 12px; }
  .conversation-scroll { padding: 16px 16px 24px; }
  .messages { gap: 24px; }
  .message { gap: 8px; }
  .message.user .message-content { max-width: 90%; padding: 10px 14px; }
  .assistant-avatar { width: 24px; }
  .assistant-avatar .brand-mark { width: 22px; height: 22px; }
  .assistant-name { margin-bottom: 4px; }
  .has-messages .composer-region { padding: 8px 16px max(12px, env(safe-area-inset-bottom)); }
  .page-footer { padding: 8px 16px; font-size: 12px; }
  .modal-scroll { padding: 0 16px 16px 24px; }
  .auth-modal { --auth-top-gap: clamp(16px, 6dvh, 48px); --modal-max-height: min(90dvh, calc(100dvh - var(--auth-top-gap) - 16px)); inset: 0; margin: var(--auth-top-gap) auto auto; padding-top: 40px; }
  .auth-modal .modal-scroll { max-height: calc(var(--modal-max-height) - 54px); }
  .auth-modal .auth-mark { margin-bottom: 12px; }
  .auth-modal .auth-tabs { margin-bottom: 20px; }
  .redeem-row { flex-direction: column; }
  .toast { left: 50%; }
  .history-delete { opacity: 1; }
  .nav-item { height: 40px; }
  .history-item { min-height: 40px; }
}
@media (max-height: 620px) {
  .page-footer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .generation-spinner { animation: generation-spin 2.4s linear infinite !important; }
}
