:root { color-scheme: light; }
.theme-sun { display:none; }
.theme-toggle { flex-shrink:0; }
.theme-toggle svg { width:19px;height:19px; }
.model-list button { width:100%; }
.model-copy small { color:var(--muted); }
.thinking-indicator { display:flex;align-items:baseline;margin:7px 0;color:var(--muted);font-size:14px;line-height:1.8; }
.thinking-dots { display:inline-block;flex:0 0 3ch;width:3ch;white-space:nowrap;font-family:monospace; }
.thinking-dots::after { content:'...';display:block;overflow:hidden;width:1ch;animation:thinkingDots 1.35s steps(1,end) infinite !important; }
@keyframes thinkingDots { 0%,32% { width:1ch; } 33%,65% { width:2ch; } 66%,100% { width:3ch; } }
.message-meta:empty { display:none; }
.attachment-list.is-visible { gap:12px;padding:0 3px 15px; }
.attachment-chip.image-chip { position:relative;display:block;flex:0 0 104px;width:104px;height:104px;max-width:none;padding:0;border-radius:13px;background:var(--surface); }
.image-chip button.attachment-photo { display:block;width:100%;height:100%;padding:0;overflow:hidden;border-radius:12px;background:transparent; }
.attachment-photo img { display:block;width:100%;height:100%;object-fit:contain; }
.image-chip button.attachment-remove { position:absolute;top:-7px;right:-7px;display:grid;place-items:center;width:24px;height:24px;border:1px solid var(--line);border-radius:50%;background:var(--surface);color:var(--ink);font-size:17px;box-shadow:0 2px 8px #0001; }
.uploading-photo { position:absolute;left:5px;right:5px;bottom:5px;padding:4px;border-radius:6px;background:var(--surface);color:var(--muted);font-size:9px;text-align:center;pointer-events:none; }
.message-photo { display:block;width:min(220px,100%);max-width:100%;padding:0;overflow:hidden;border:1px solid var(--line);border-radius:13px;background:var(--surface);color:var(--muted);text-align:left;cursor:zoom-in; }
.message-photo img { display:block;width:100%;height:160px;object-fit:contain; }
.message-photo span { display:block;padding:7px 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px; }
.message-photo:hover { border-color:var(--coral); }
.media-photo-button { display:block;width:100%;padding:0;border:0;background:transparent;cursor:zoom-in; }
.file-preview-link { max-width:100%;padding:0;border:0;background:none;color:var(--ink);font-size:12px;text-align:left;overflow-wrap:anywhere;cursor:pointer; }
.file-preview-link:hover { text-decoration:underline; }
.image-viewer { width:min(1200px,calc(100vw - 40px));max-width:none;max-height:calc(100dvh - 40px);padding:0;overflow:hidden;border:1px solid var(--line);border-radius:18px;background:var(--canvas);color:var(--ink);box-shadow:0 20px 100px #0003; }
.image-viewer::backdrop { background:#0c0c0cb8;backdrop-filter:blur(6px); }
.image-viewer-header { display:flex;justify-content:space-between;align-items:center;gap:16px;padding:13px 18px;border-bottom:1px solid var(--line); }
.image-viewer-header strong { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500; }
.image-viewer-header > div { display:flex;align-items:center;gap:12px;flex-shrink:0; }
.image-viewer-header .close-dialog { font-size:25px; }
.image-viewer-header a { text-decoration:none; }
.image-viewer-stage { display:flex;align-items:center;justify-content:center;min-height:200px;max-height:calc(100dvh - 120px);padding:18px;overflow:auto; }
.image-viewer-stage img { display:block;width:auto;max-width:100%;height:auto;max-height:calc(100dvh - 165px);object-fit:contain; }
.image-viewer-stage p { font-size:12px;color:var(--muted); }
@media(max-width:760px) {
  .attachment-chip.image-chip { width:88px;height:88px;flex-basis:88px; }
  .image-viewer { width:calc(100vw - 16px);max-height:calc(100dvh - 20px);border-radius:13px; }
  .image-viewer-header { padding:10px 12px;gap:10px; }.image-viewer-stage { padding:10px; }
}
.sidebar-close { display:inline-flex;flex-shrink:0; }
.sidebar-head { gap:8px;padding-inline:8px; }
.settings-tools button { display:flex;flex-direction:column;justify-content:center;gap:4px;min-height:46px; }
.settings-tools small { font-size:9px;line-height:1.6;color:var(--muted);font-weight:400; }
.composer-wrap { background:linear-gradient(to bottom,transparent,var(--canvas) 20%); }
.mode-nav { margin-top:0;margin-bottom:25px; }
.history > .new-chat { flex-shrink:0;margin-bottom:10px; }
.history-list { overflow-x:hidden;min-width:0; }
.history-row { width:100%;min-width:0;flex-shrink:0; }
.history-row .history-item { display:flex;align-items:center;gap:7px;flex:1;min-width:0;width:100%;padding-right:35px; }
.history-title { flex:1;min-width:0; }
.history-pin { width:12px;height:12px;flex-shrink:0;color:var(--coral); }
.history-more { width:29px;height:29px;display:grid;place-items:center;padding:0;font-size:20px;line-height:1;letter-spacing:0;border-radius:7px; }
.history-more:hover,.history-more[aria-expanded="true"] { background:#e0e0e0;color:var(--ink); }
.chat-actions { position:fixed;inset:auto;margin:0;width:202px;padding:5px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--ink);box-shadow:0 8px 35px #21212120; }
.chat-actions:not(:popover-open) { display:none; }
.chat-actions button { display:flex;width:100%;align-items:center;gap:10px;min-height:37px;padding:9px 11px;border:0;border-radius:8px;background:transparent;color:inherit;text-align:left;font-size:12px;cursor:pointer; }
.chat-actions button svg { width:16px;height:16px;flex-shrink:0; }
.chat-actions button:hover,.chat-actions button:focus-visible { background:#efefef; }
.chat-actions .chat-action-danger { color:#bb4351; }
.chat-actions::backdrop { background:transparent; }
[data-theme="dark"] .history-more:hover,[data-theme="dark"] .history-more[aria-expanded="true"],[data-theme="dark"] .chat-actions button:hover,[data-theme="dark"] .chat-actions button:focus-visible { background:#3b3b3b; }
[data-theme="dark"] .chat-actions .chat-action-danger { color:#f1a5ad; }

@media(min-width:761px) {
  .workspace { --navigation-width:250px;grid-template-columns:var(--navigation-width) minmax(0,1fr);transition:grid-template-columns .18s ease; }
  .sidebar { width:var(--navigation-width);transition:transform .18s ease; }
  html[data-sidebar="collapsed"] .workspace { grid-template-columns:0 minmax(0,1fr); }
  html[data-sidebar="collapsed"] .sidebar { transform:translateX(-100%);visibility:hidden;pointer-events:none; }
  html[data-sidebar="collapsed"] .menu-button { display:inline-flex; }
}
@media(min-width:761px) and (max-width:1040px) { .workspace { --navigation-width:230px; } }

/* Neutral charcoal surfaces with the same teal brand accent as the light theme. */
:root[data-theme="dark"] {
  color-scheme:dark;
  --ink:#e7e7e7;--muted:#b4b4b4;--soft-muted:#949494;--line:#3d3d3d;
  --surface:#272727;--canvas:#1e1e1e;--sidebar:#191919;
  --coral:#81c6bc;--coral-dark:#9bd6ce;--shadow:0 5px 24px #0002;
  --dark-soft:#313131;--dark-hover:#3b3b3b;--dark-accent:#81c6bc;
}
[data-theme="dark"] .theme-moon { display:none; }
[data-theme="dark"] .theme-sun { display:block; }
[data-theme="dark"] :is(.main,.main-header,.desktop-app .titlebar) { background:var(--canvas); }
[data-theme="dark"] .sidebar { background:var(--sidebar);border-color:var(--line); }
[data-theme="dark"] :is(.sidebar-foot,.settings-row,.studio-tabs,.redeem-form,.activity-details,.ledger-row,.model-menu-head,.file-row,.admin-row) { border-color:var(--line); }
[data-theme="dark"] :is(.new-chat,.composer,.app-dialog,.model-menu,.secondary-button,.tariff-card,.jump-latest) { background:var(--surface);border-color:var(--line);color:var(--ink);box-shadow:none; }
[data-theme="dark"] .new-chat:hover,[data-theme="dark"] .secondary-button:hover { background:var(--dark-hover);border-color:#6e6e6e; }
[data-theme="dark"] :is(.brand-word,.welcome h1,.studio-heading h1,.dialog-head h2,.preset-dialog h2,.auth-story h1,.auth-form h2) { color:var(--ink); }
[data-theme="dark"] :is(.mode-item,.history-row .history-item,.conversation-title,.title-menu,.icon-button,.tool-button,.text-button,.model-select,.media-size) { color:var(--muted); }
[data-theme="dark"] :is(.mode-item:hover,.history-row:hover,.history-item:hover,.plan-card:hover,.profile:hover,.icon-button:hover,.tool-button:hover,.model-select:hover,.model-list button:hover,.model-list button.is-selected,.suggestions button:hover) { background:var(--dark-hover);color:var(--ink); }
[data-theme="dark"] :is(.mode-item.is-active,.history-row.is-current,.model-select,.media-size,.plan-icon,.avatar,.auth-tabs,.auth-models span) { background:var(--dark-soft);color:var(--dark-accent); }
[data-theme="dark"] :is(.mode-item.is-active svg,.history-row.is-current .history-item,.auto-spark,.studio-tabs button.is-active) { color:var(--dark-accent); }
[data-theme="dark"] :is(.section-label,.history-empty,.history-more,.plan-copy small,.profile-copy small,.chevron,.disclaimer,.dialog-eyebrow,.version-value,.settings-row small,.studio-heading > div > p:last-child,.studio-intro small,.studio-footnote,.preset-photo-hint,.prompt-details,.preset-photo-row span,.auth-kicker,.auth-footnote,.model-copy small,.media-copy small) { color:var(--soft-muted); }
[data-theme="dark"] :is(.form-description,.field-label,.welcome > p:not(.eyebrow),.settings-row strong,.auth-story > p,.activity-details,.ledger-row,.ledger-row small,.studio-intro > span,.studio-tabs button,.studio-filters button,.studio-empty p,.access-summary p,.plans-heading span,.allowance-description,.allowance-status,.allowance-note,.tariff-card p.tariff-description,.tariff-card small,.tariff-features,.tariff-card .pending-note) { color:var(--muted); }
[data-theme="dark"] :is(.history-search,.text-field,.config-json,.model-menu-head input) { color:var(--ink);background:#242424;border-color:var(--line); }
[data-theme="dark"] :is(.history-search:focus,.text-field:focus,.config-json:focus) { background:var(--surface);border-color:#8d8d8d;outline-color:#8d8d8d; }
[data-theme="dark"] :is(.composer textarea,.message-body,.media-copy p,.code-block) { color:var(--ink); }
[data-theme="dark"] .composer textarea::placeholder,[data-theme="dark"] .history-search::placeholder,[data-theme="dark"] .text-field::placeholder { color:var(--soft-muted);opacity:1; }
[data-theme="dark"] .composer:focus-within { border-color:#828282; }
[data-theme="dark"] :is(.send-button,.primary-button,.auth-submit) { background:var(--coral);color:#10231f; }
[data-theme="dark"] :is(.send-button:hover:not(:disabled),.primary-button:hover,.auth-submit:hover) { background:var(--coral-dark); }
[data-theme="dark"] :is(.header-usage,.suggestions button,kbd,.auth-models span) { color:var(--muted);border-color:var(--line);background:transparent; }
[data-theme="dark"] .header-usage:hover { background:var(--dark-hover);border-color:#828282; }
[data-theme="dark"] .connection-state { color:#bbbbbb; }
[data-theme="dark"] .connection-state.is-offline { color:#e0b576; }
[data-theme="dark"] .usage-dot,[data-theme="dark"] .studio-tabs button.is-active::after { background:#b2b2b2; }
[data-theme="dark"] :is(.message-body > strong,.message-meta,.message-meta .text-button) { color:var(--muted); }
[data-theme="dark"] .message.user .message-content { background:#373737;color:#e9e9e9;border-color:#464646; }
[data-theme="dark"] .message-content .inline-bold { color:#f0f0f0; }
[data-theme="dark"] :is(.message-content .inline-code,.code-block,.message-attachment,.attachment-chip,.prompt-details p) { background:var(--dark-soft);color:#d1d1d1;border-color:var(--line); }
[data-theme="dark"] .message-content a { color:#c6c6c6; }
[data-theme="dark"] .attachment-chip button { color:var(--muted); }
[data-theme="dark"] .attachment-chip button:hover { background:var(--dark-hover);color:var(--ink); }
[data-theme="dark"] :is(.messages,.studio-scroll) { scrollbar-color:#4f4f4f transparent; }
[data-theme="dark"] progress { background:var(--dark-soft); }
[data-theme="dark"] progress::-webkit-progress-bar { background:var(--dark-soft); }
[data-theme="dark"] .app-dialog::backdrop { background:#08080899; }
[data-theme="dark"] :is(.status-pill,.current-plan-badge,.studio-filters button.is-active,.tariff-card.current) { color:var(--dark-accent);background:var(--dark-soft);border-color:#606060; }
[data-theme="dark"] :is(.allowance-card,.media-placeholder,.preset-card,.preset-preview-wrap,.auth-story) { background:#272727;border-color:var(--line); }
[data-theme="dark"] :is(.allowance-head strong,.allowance-value,.plans-heading h3,.tariff-name,.tariff-price,.studio-empty h2) { color:#cfcfcf; }
[data-theme="dark"] :is(.allowance-symbol,.media-mark,.studio-empty > span) { color:#afafaf; }
[data-theme="dark"] :is(.pending-note,.message-meta.has-warning) { color:#d3b87c; }
[data-theme="dark"] :is(.danger-button,.form-error) { color:#f1a5ad; }
[data-theme="dark"] .danger-button { background:#44282a;border-color:#583237; }
[data-theme="dark"] .auth-screen { background:var(--canvas); }
[data-theme="dark"] :is(.auth-tabs button,.auth-wordmark) { color:var(--muted); }
[data-theme="dark"] .auth-tabs button.is-active { background:var(--surface);color:var(--dark-accent); }
[data-theme="dark"] .toast { background:#cccccc;color:#272727; }
@media(prefers-reduced-motion:reduce) { .workspace,.sidebar { transition:none; } }
