* { box-sizing: border-box; }

:root {
  color-scheme: light;
  font: 15px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1d2433;
  background: #eef0f4;
}

html, body { height: 100%; }
body { margin: 0; height: 100dvh; min-height: 100%; overflow: hidden; background: #eef0f4; }
main { height: 100%; min-height: 0; padding: 16px; }
[hidden] { display: none !important; }

.content {
  height: 100%; min-height: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  gap: 16px; overflow: hidden;
}
.workspace, .chat-panel {
  min-height: 0; min-width: 0; overflow: hidden;
  border: 1px solid #d9dde5; border-radius: 12px; background: #fff;
  box-shadow: 0 10px 30px rgba(32, 39, 55, .06);
}
.workspace { display: flex; flex-direction: column; }
.workspace-header {
  position: relative; z-index: 3;
  min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  gap: 16px; padding: 14px 18px; border-bottom: 1px solid #e5e7ec; flex-shrink: 0;
}
.workspace-kicker {
  display: block; margin-bottom: 3px; color: #8a91a0;
  font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase;
}
.workspace h1 { margin: 0; font-size: 17px; font-weight: 680; letter-spacing: -.01em; }
.workspace-header > div:first-child { min-width: 0; }
.apps-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid #e5e7ec; flex-shrink: 0; }
.apps-header-actions { display: flex; align-items: center; gap: 6px; }
.canvas-tabs { justify-self: center; }
.workspace-header .preview-actions { justify-self: end; }
.home-header-actions { display: flex; align-items: center; gap: 6px; grid-column: -2 / -1; grid-row: 1; justify-self: end; }
.theme-light-icon { display: none; }
[data-theme="dark"] .theme-light-icon { display: block; }
[data-theme="dark"] .theme-dark-icon { display: none; }
.app-icon { display: block; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; box-shadow: 0 2px 5px #27304412; object-fit: contain; }
.message-app-link .app-icon { width: 26px; height: 26px; border-radius: 7px; }
.explorer-root .app-icon { width: 20px; height: 20px; border-radius: 5px; }
.workspace h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { flex: 1; min-height: 0; }
.home-view { display: flex; flex-direction: column; align-items: center; padding: 32px; overflow: auto; background: radial-gradient(ellipse at 50% 40%, #f2f4ff, #fff 65%); }
.home-shell { width: 100%; max-width: 620px; margin: auto 0; flex-shrink: 0; }
.home-welcome { max-width: 460px; margin: 0 auto; text-align: center; }
.home-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; margin-bottom: 18px; border: 1px solid #dce1fc; border-radius: 16px; background: #fff; color: #5468e7; }
.home-icon .lucide { width: 26px; height: 26px; }
.home-welcome h2 { margin: 0 0 12px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.03em; font-weight: 650; }
.home-welcome p { margin: 0; color: #8a91a0; font-size: 14px; line-height: 1.7; }
.home-note { display: block; margin-top: 16px; color: #9298a5; font-size: 11px; }
.home-recents { margin-top: 32px; }
.home-links { display: flex; flex-wrap: wrap; justify-content: flex-end; margin-top: 18px; }
.home-usage-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; background: transparent; color: #626b7b; font-size: 13px; }
.home-usage-link .lucide { width: 16px; height: 16px; }
.home-usage-link:hover:not(:disabled) { background: #edf0f7; color: #394152; }
.usage-view { overflow: auto; padding: 30px; }
.usage-shell { max-width: 960px; margin: 0 auto; }
.usage-counter-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.usage-counter-controls label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.usage-counter-controls select, .usage-reset { padding: 8px 12px; border: 1px solid #e1e5ef; border-radius: 8px; background: #fafbfc; color: #394152; font: inherit; font-size: 13px; }
.usage-reset { display: inline-flex; align-items: center; gap: 7px; }
.usage-reset .lucide { width: 15px; height: 15px; }
.usage-reset:hover:not(:disabled) { background: #edf0f7; }
.usage-period-note { margin: 12px 0 20px; color: #687080; font-size: 12px; line-height: 1.6; }
[data-theme="dark"] :is(.usage-counter-controls select, .usage-reset) { background: var(--raised); border-color: var(--line); color: #cccccc; }
[data-theme="dark"] .usage-reset:hover:not(:disabled) { background: var(--hover); }
[data-theme="dark"] .usage-period-note { color: var(--muted); }
.usage-intro h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.03em; }
.usage-intro p, .usage-details, .usage-footnote, #usage-empty, #usage-status { color: #687080; font-size: 13px; line-height: 1.6; }
.usage-intro p { margin: 0 0 26px; }
.usage-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.usage-card { padding: 20px; border: 1px solid #e1e5ef; border-radius: 12px; background: #fafbfc; min-width: 0; }
.usage-card h3 { margin: 0 0 14px; font-size: 12px; font-weight: 550; color: #687080; }
.usage-card strong { display: block; font-size: clamp(20px, 2.5vw, 32px); letter-spacing: -.04em; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-card > span { display: block; margin-top: 10px; color: #687080; font-size: 11px; }
.usage-card-total { background: #f2f5ff; border-color: #d8dff5; }
.usage-details { margin: 16px 0 30px; font-size: 12px; }
.usage-workspaces h2 { margin: 0 0 16px; font-size: 16px; }
#usage-content > .usage-workspaces { margin-top: 26px; }
.usage-table-scroll { overflow-x: auto; border: 1px solid #e1e5ef; border-radius: 12px; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.usage-table th, .usage-table td { padding: 16px; text-align: right; border-bottom: 1px solid #e8ebf1; white-space: nowrap; }
.usage-table thead th { color: #687080; font-size: 11px; font-weight: 550; background: #fafbfc; }
.usage-sort { display: inline-flex; align-items: center; gap: 7px; padding: 6px 0; border: 0; border-radius: 3px; background: transparent; color: inherit; font: inherit; white-space: nowrap; }
.usage-sort:hover:not(:disabled) { background: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.usage-sort:focus-visible { outline: 2px solid #687bf0; outline-offset: 4px; }
.usage-sort span { display: inline-block; width: 1em; }
.usage-table th:first-child { text-align: left; }
.usage-table tbody th { font-weight: 550; min-width: 160px; max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
.usage-table small { display: block; margin-top: 5px; color: #687080; font-size: 11px; font-weight: 400; }
.usage-table td:last-child { font-weight: 650; }
.usage-table tbody tr:last-child > * { border-bottom: 0; }
.usage-footnote { margin-top: 20px; font-size: 11px; }
.usage-missing { color: #8b6508; font-size: 12px; line-height: 1.6; }
[data-theme="dark"] .home-usage-link { color: var(--muted); }
[data-theme="dark"] .home-usage-link:hover:not(:disabled) { color: #eeeeee; background: var(--hover); }
[data-theme="dark"] :is(.usage-card, .usage-table thead th) { background: var(--raised); }
[data-theme="dark"] :is(.usage-card, .usage-table-scroll, .usage-table th, .usage-table td) { border-color: var(--line); }
[data-theme="dark"] .usage-card.usage-card-total { background: #203344; border-color: #304b62; }
[data-theme="dark"] :is(.usage-intro p, .usage-details, .usage-footnote, #usage-empty, #usage-status, .usage-card h3, .usage-card > span, .usage-table thead th, .usage-table small) { color: var(--muted); }
[data-theme="dark"] .usage-missing { color: #d7ba7d; }
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.recent-heading h2 { margin: 0; color: #50596a; font-size: 13px; font-weight: 650; }
#recent-app-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.recent-app { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 70px; padding: 14px; border: 1px solid #e1e5ef; border-radius: 12px; background: #ffffffd9; color: #394152; text-align: left; box-shadow: 0 2px 6px #27304404; }
.recent-app:hover:not(:disabled) { background: #f4f6ff; border-color: #bcc5f2; }
.recent-app-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.recent-app > .lucide { width: 15px; height: 15px; color: #929aaf; }
.recent-browse { border-style: dashed; background: #f5f6fc; color: #6270bf; }
.recent-browse-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px; background: #e9ecfa; }
.apps-empty { padding: 24px 0; color: #8a91a0; font-size: 14px; }
.preview-actions #close-workspace { margin-left: 4px; border-left: 1px solid #d9dde5; border-radius: 0 5px 5px 0; }
.workspace-content {
  position: relative; overflow: auto;
  background: linear-gradient(#f5f6f8 1px, transparent 1px), linear-gradient(90deg, #f5f6f8 1px, transparent 1px), #fcfcfd;
  background-size: 24px 24px;
}
.workspace-empty {
  position: absolute; inset: 0; display: grid; place-content: center;
  justify-items: center; gap: 14px; color: #9298a5; padding: 20px; text-align: center;
}
.workspace-placeholder {
  width: 54px; height: 44px; border: 1px dashed #bdc3ce; border-radius: 9px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 8px 8px 0 -3px #fcfcfd, 8px 8px 0 -2px #d8dce4;
}
.workspace-empty p { margin: 0; }
.preview-stage { position: relative; display: flex; justify-content: center; }
iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-stage .preview-pending { position: absolute; inset: 0; margin: 0 auto; opacity: 0; pointer-events: none; }
.preview-overlay { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; background: rgba(255, 255, 255, .28); }
.preview-overlay-badge { display: inline-flex; align-items: center; gap: 9px; padding: 12px 16px; border: 1px solid #e0e3e9; border-radius: 12px; background: #fff; color: #50596a; box-shadow: 0 4px 20px #27304412; font-size: 13px; }
.preview-overlay.refreshing .lucide { animation: preview-spin 1.2s linear infinite; }
.preview-overlay .build-icon, .build-description, .build-progress, .build-clock { display: none; }
.preview-overlay.building { background: rgba(245, 247, 255, .32); }
.preview-overlay.building .preview-overlay-badge { width: min(320px, calc(100vw - 60px)); padding: 24px; flex-direction: column; gap: 14px; border-color: #dce1fc; border-radius: 18px; box-shadow: 0 12px 40px #5468e718; }
.preview-overlay.building .refresh-icon { display: none; }
.preview-overlay.building .build-icon { display: block; width: 30px; height: 30px; color: #5468e7; animation: build-glow 2s ease-in-out infinite; }
.preview-overlay.building #preview-overlay-text { font-size: 15px; font-weight: 650; color: #394152; }
.preview-overlay.building .build-clock { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.preview-overlay:not(.building) #stop-preview-build { display: none; }
#stop-preview-build { min-width: 100px; }
#build-elapsed { font-size: clamp(42px, 5vw, 60px); font-weight: 600; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: #5468e7; }
.build-clock-label { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8a91a0; }
.preview-overlay.building .build-description { display: block; text-align: center; color: #8a91a0; font-size: 12px; line-height: 1.6; }
.preview-overlay.building .build-progress { display: block; width: 100%; height: 3px; overflow: hidden; border-radius: 4px; background: #edf0ff; }
.build-progress span { display: block; width: 40%; height: 100%; border-radius: inherit; background: #7e8df0; animation: build-progress 1.8s ease-in-out infinite; }
@keyframes build-glow { 50% { opacity: .5; transform: scale(.92); } }
@keyframes build-progress { from { transform: translateX(-100%); } to { transform: translateX(350%); } }
@media (prefers-reduced-motion: reduce) { .preview-overlay.building .build-icon, .build-progress span { animation: none; } }
@keyframes preview-spin { to { transform: rotate(360deg); } }
.creation-opening { width: min(360px, calc(100vw - 40px)); padding: 30px 24px; border: 1px solid #e0e3e9; border-radius: 18px; background: #fff; color: #394152; text-align: center; box-shadow: 0 16px 60px #27304424; }
.creation-opening::backdrop { background: #18202c66; backdrop-filter: blur(3px); }
.creation-opening h2 { margin: 18px 0 10px; font-size: 17px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; outline: none; }
.creation-opening p { margin: 0; font-size: 13px; line-height: 1.6; color: #737d8e; }
.creation-opening .secondary-button { margin-top: 22px; min-width: 100px; }
.opening-spinner { width: 28px; height: 28px; margin: auto; border: 3px solid #e4e8f7; border-top-color: #5468e7; border-radius: 50%; animation: preview-spin 1s linear infinite; }
[data-theme="dark"] .creation-opening { background: #252526; border-color: #3c3c3c; color: #ccc; }
[data-theme="dark"] .creation-opening p { color: #aaa; }
[data-theme="dark"] .opening-spinner { border-color: #3c3c3c; border-top-color: #6caee0; }
@media (prefers-reduced-motion: reduce) { .opening-spinner { animation: none; } }
@media (prefers-reduced-motion: reduce) { .preview-overlay.refreshing .lucide { animation: none; } }
.preview-stage.mobile iframe { width: 390px; max-width: 100%; box-shadow: 0 0 20px #0001; }

.chat-panel { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-header {
  min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  gap: 12px; padding: 16px; border-bottom: 1px solid #e5e7ec;
}
.chat-name { font-size: 18px; font-weight: 720; line-height: 1.1; letter-spacing: -.01em; }
.chat-workspace-badge { display: none; justify-content: flex-start; align-items: center; gap: 6px; min-width: 0; width: 100%; min-height: 44px; padding: 6px 16px; border: 0; border-bottom: 1px solid #edf0f4; border-radius: 0; background: #f7f8fa; color: #687080; font-size: 11px; font-weight: 500; line-height: 16px; text-align: left; }
.chat-workspace-badge:hover:not(:disabled) { background: #edf0f7; }
.chat-workspace-badge:focus-visible { outline: 2px solid #5468e7; outline-offset: -2px; }
.chat-workspace-badge .lucide { width: 13px; height: 13px; flex-shrink: 0; }
.chat-workspace-badge .workspace-view-icon { width: 16px; height: 16px; margin-left: auto; }
#chat-workspace-icon { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex-shrink: 0; }
#chat-workspace-icon .app-icon { width: 16px; height: 16px; flex-basis: 16px; border-radius: 4px; box-shadow: none; }
#chat-workspace-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .chat-workspace-badge { background: var(--raised); border-color: var(--line); color: var(--muted); }
[data-theme="dark"] .chat-workspace-badge:hover:not(:disabled) { background: var(--hover); }
@media (max-width: 760px) {
  .chat-panel { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .chat-workspace-badge { display: flex; }
}
.chat-header > div:first-child { min-width: 0; }
#chat { min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow-y: auto; overscroll-behavior: contain; background: #fafbfc; }
#chat::-webkit-scrollbar, #conversation-list::-webkit-scrollbar, .workspace-content::-webkit-scrollbar { width: 10px; }
#chat::-webkit-scrollbar-thumb, #conversation-list::-webkit-scrollbar-thumb, .workspace-content::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: #c9ced7; background-clip: padding-box; }
.composer { padding: 12px; border-top: 1px solid #e5e7ec; background: #fff; }
.composer-box { position: relative; border: 1px solid #d2d6de; border-radius: 20px; background: #fff; }
.composer-box:focus-within { border-color: #7181e8; box-shadow: 0 0 0 3px rgba(84, 104, 231, .12); }
.composer .composer-credits { position: static; width: auto; max-width: calc(100% - 112px); min-width: 0; height: 40px; padding: 0 6px; border-radius: 8px; background: transparent; display: flex; align-items: center; gap: 6px; color: #747b89; font-size: 12px; font-weight: 400; line-height: 16px; font-variant-numeric: tabular-nums; }
.composer .composer-credits:hover:not(:disabled) { background: #e9edff; color: #4558d5; }
.composer-credits[hidden] { display: none; }
.composer-credits .lucide { width: 15px; height: 15px; flex-shrink: 0; }
#chat-credits { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .composer-credits { color: var(--muted); }
[data-theme="dark"] .composer .composer-credits:hover:not(:disabled) { background: var(--hover); color: #eeeeee; }
.msg { max-width: 86%; padding: 10px 12px; border-radius: 10px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.user { align-self: flex-end; border-bottom-right-radius: 3px; background: #273044; color: #fff; }
.msg.agent, .msg.error { align-self: stretch; width: 100%; max-width: 100%; padding: 12px 0; border: 0; border-radius: 0; background: transparent; line-height: 1.6; }
.error { color: #b43d3d; }
.thinking { display: flex; align-items: center; gap: 9px; color: #747b89; font-size: 13px; }
.thinking-time { color: #8a91a0; font-variant-numeric: tabular-nums; }
.thinking-dots { display: inline-flex; align-items: center; gap: 3px; }
.thinking-dots i { width: 4px; height: 4px; border-radius: 50%; background: #5468e7; animation: thinking-pulse 1.2s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .3s; }
.message-duration { color: #8a91a0; font-size: 11px; margin-bottom: 6px; }
.message-markdown { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; }
.message-markdown.markdown-fallback { white-space: pre-wrap; }
.message-markdown > :first-child { margin-top: 0; }
.message-markdown > :last-child { margin-bottom: 0; }
.message-markdown p, .message-markdown ul, .message-markdown ol, .message-markdown blockquote, .message-markdown pre, .message-table { margin: .7em 0; }
.message-markdown :is(h1, h2, h3, h4, h5, h6) { margin: 1em 0 .4em; line-height: 1.3; font-weight: 650; }
.message-markdown h1 { font-size: 1.35em; }
.message-markdown h2 { font-size: 1.2em; }
.message-markdown :is(h3, h4, h5, h6) { font-size: 1.05em; }
.message-markdown :is(ul, ol) { padding-left: 1.6em; }
.message-markdown li + li { margin-top: .25em; }
.message-markdown li > p { margin: .25em 0; }
.message-markdown a[href] { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.message-markdown blockquote { padding-left: .85em; border-left: 3px solid currentColor; opacity: .85; }
.message-markdown code { font-family: Consolas, monospace; font-size: .9em; padding: .12em .3em; border-radius: 4px; background: #80808020; }
.message-markdown pre { max-width: 100%; overflow-x: auto; white-space: pre; padding: 12px; border-radius: 8px; background: #80808018; }
.message-markdown pre code { padding: 0; background: none; overflow-wrap: normal; }
.message-markdown hr { border: 0; border-top: 1px solid #80808060; margin: 1em 0; }
.message-markdown input[type="checkbox"] { width: auto; min-height: 0; margin: 0 .35em 0 0; }
.message-table { max-width: 100%; overflow-x: auto; }
.message-table table { border-collapse: collapse; width: 100%; font-size: .95em; }
.message-table th, .message-table td { border: 1px solid #80808060; padding: 6px 9px; text-align: left; min-width: 80px; }
.message-table th { background: #80808018; font-weight: 650; }
.msg.event { align-self: stretch; display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 0; border-radius: 0; color: #737d8e; font-size: 12px; line-height: 20px; background: transparent; }
.msg.event::before, .msg.event::after { content: ""; flex: 1; min-width: 12px; height: 0; border-top: 1px solid var(--event-divider, #e2e6ed); }
.msg.event .lucide { width: 13px; height: 13px; flex-shrink: 0; }
.msg.event span { min-width: 0; text-align: center; }
.message-app-links { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; white-space: normal; }
.message-app-link { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 10px; border: 1px solid #dce1fc; border-radius: 8px; background: #f3f5ff; color: #4558d5; font-size: 12px; font-weight: 600; text-align: left; }
.message-app-link span { flex: 1; overflow-wrap: anywhere; }
.message-app-link .lucide { width: 15px; height: 15px; }
.message-app-link:hover:not(:disabled) { background: #e9edff; }
@keyframes thinking-pulse { 0%, 80%, 100% { opacity: .35; } 40% { opacity: 1; } }
textarea {
  display: block; width: 100%; min-height: 112px; max-height: 180px; resize: none;
  border: 0; border-radius: 20px; padding: 14px 16px 58px;
  outline: none; background: transparent; color: #1d2433; font: inherit; line-height: 1.35;
}
button { min-width: 70px; border: 0; border-radius: 9px; padding: 10px 16px; background: #5468e7; color: #fff; font: 700 14px system-ui, sans-serif; cursor: pointer; }
.composer button { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; min-width: 40px; padding: 10px; border-radius: 50%; display: grid; place-items: center; }
.composer-controls { display: flex; align-items: center; gap: 8px; padding: 0 8px 8px; }
.composer-controls > button { position: static; flex-shrink: 0; }
.composer-controls :is(#send, #stop-build) { margin-left: auto; }
.composer #input { height: 64px; min-height: 64px; max-height: min(160px, 30dvh); padding: 14px 16px 8px; overflow-y: auto; }
.composer #input.has-more-below { mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent); }
button:hover:not(:disabled) { background: #4558d5; }
button:disabled { cursor: not-allowed; opacity: .5; }
.composer #attach-files { left: 8px; right: auto; background: transparent; color: #747b89; }
.composer #attach-files:hover:not(:disabled) { background: #eef0f5; color: #4558d5; }
.pending-attachments { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; padding: 10px 10px 0; }
.attachment-chip { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid #e1e5ed; border-radius: 10px; background: #f7f8fc; color: #50596a; font-size: 12px; }
.attachment-chip > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip .lucide, .message-attachments .lucide { width: 15px; height: 15px; flex-shrink: 0; }
.attachment-chip small { white-space: nowrap; color: #747b89; }
.composer .attachment-chip button { position: static; width: 24px; height: 24px; min-width: 24px; padding: 4px; color: #747b89; background: transparent; }
.composer .attachment-chip button:hover:not(:disabled) { background: #e9edff; color: #4558d5; }
.attachment-error { margin: 8px 4px 0; color: #b43d3d; font-size: 12px; }
.attachment-uploading { padding: 4px; font-size: 12px; color: #747b89; }
.dragging-files .composer-box { border-color: #5468e7; background: #f3f5ff; box-shadow: 0 0 0 3px #5468e722; }
.message-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; white-space: normal; }
.message-attachments a { display: flex; align-items: center; gap: 7px; color: inherit; text-decoration: none; border: 1px solid #ffffff40; border-radius: 8px; padding: 8px; font-size: 12px; }
.message-attachments a:hover { background: #ffffff15; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #7181e8; outline-offset: 3px; }

/* Compact controls for the app preview, using the existing interface colors. */
.tabs, .preview-actions, .chat-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chat-header-actions { gap: 8px; }
.chat-header > .app-library-button { justify-self: center; }
.chat-header .chat-header-actions { justify-self: end; }
.tabs { padding: 3px; gap: 2px; border-radius: 9px; background: #eef0f5; }
.nav-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding: 8px 10px; border-radius: 6px; background: transparent; color: #667084; font-size: 12px; font-weight: 600; }
.nav-tab .lucide { width: 15px; height: 15px; }
.app-library-button { background: #eef0f5; border: 1px solid #e1e5ed; border-radius: 8px; }
.app-library-button:hover:not(:disabled) { background: #e5e9f4; color: #394152; }
.app-library-button[aria-pressed="true"] { background: #edf0ff; border-color: #c5cef6; color: #4558d5; }
.app-library-button[aria-pressed="true"]:hover:not(:disabled) { background: #e5eaff; color: #4558d5; }
.tabs .nav-tab:hover { background: #e0e5f1; color: #394152; }
.tabs .nav-tab[aria-selected="true"] { background: #5468e7; color: #fff; box-shadow: 0 1px 3px #27304414; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; width: 34px; height: 34px; padding: 8px; background: #f7f8fa; color: #747b89; border-radius: 6px; text-decoration: none; }
.icon-button:hover:not(:disabled) { background: #e9ecf3; }
.lucide { width: 18px; height: 18px; flex-shrink: 0; }
#new-chat { background: transparent; border: 1px solid #d9dde5; }
.chat-picker { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; min-height: 0; padding: 16px; background: #fafbfe; box-shadow: -8px 0 24px #27304414; transform: translate3d(100%, 0, 0); visibility: hidden; pointer-events: none; transition: transform 360ms cubic-bezier(.22, 1, .36, 1), visibility 0s linear 360ms; will-change: transform; }
.chat-picker.is-open { transform: translate3d(0, 0, 0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
.chat-picker-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.chat-picker-header h2 { margin: 0; font-size: 18px; font-weight: 650; }
.chat-picker-header p { margin: 5px 0 0; font-size: 12px; color: #8a91a0; }
#chat-search { width: 100%; padding: 11px 12px; border: 1px solid #d9dde8; border-radius: 10px; background: white; color: #394152; font: inherit; font-size: 13px; }
#chat-picker-status { margin: 16px 0 0; color: #747b89; font-size: 13px; }
#conversation-list { list-style: none; padding: 0 6px 16px 16px; margin: 16px -16px -16px; display: flex; flex: 1; flex-direction: column; gap: 8px; overflow-y: auto; scrollbar-gutter: stable; min-height: 0; }
.chat-picker-header, #chat-search, #chat-picker-status { flex-shrink: 0; }
.conversation-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px; background: #fff; border: 1px solid #e1e5ef; border-radius: 10px; color: #50596a; text-align: left; font-size: 13px; font-weight: 500; }
.conversation-item > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.conversation-item small { display: block; margin-top: 5px; color: #8a91a0; font-size: 11px; font-weight: 400; }
.conversation-item:hover:not(:disabled) { background: #f0f3fc; border-color: #c5cef6; }
.conversation-item[aria-current="true"] { background: #edf0ff; border-color: #c5cef6; color: #4558d5; }
.conversation-row { display: flex; flex-shrink: 0; align-items: center; gap: 6px; }
.conversation-row .conversation-item { flex: 1; min-width: 0; }
.delete-chat { flex-shrink: 0; color: #a66c6c; }
.delete-chat:hover:not(:disabled) { color: #b43d3d; background: #fff0f0; }
@media (prefers-reduced-motion: reduce) { .chat-picker { transition: none; } }
.preview-actions { padding: 3px; gap: 1px; border: 1px solid #e5e7ec; border-radius: 8px; background: #fafbfc; }
.preview-actions .icon-button { background: transparent; color: #8991a0; width: 30px; min-width: 30px; height: 30px; padding: 6px; }
.preview-actions .icon-button:hover:not(:disabled) { color: #394152; background: #e9ecf3; }
.preview-actions .lucide { width: 16px; height: 16px; }
.preview-actions #mobile[aria-pressed="true"] { background: #e4e8ef; color: #394152; }
.detail-view { padding: 20px; overflow: auto; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-heading h2 { font-size: 17px; font-weight: 600; }
.file-explorer { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); overflow: hidden; }
.explorer-sidebar { min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; background: #fafbfc; border-right: 1px solid #e5e7ec; }
#file-list { min-height: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: 12px; }
.explorer-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.explorer-heading h2 { margin: 0; color: #747b89; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.explorer-root { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12px; font-weight: 650; }
.explorer-root span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-root .lucide { width: 16px; color: #747b89; }
.file-tree { list-style: none; margin: 0; padding: 0; }
.file-tree .file-tree { margin-left: 19px; border-left: 1px solid #e5e7ec; }
.file-row { width: 100%; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 0; background: transparent; color: #50596a; font: 12px/1.4 ui-monospace, Consolas, monospace; text-align: left; cursor: pointer; }
.file-row:hover:not(:disabled) { background: #edf0f6; }
.file-row:focus-visible { outline: 2px solid #7181e8; outline-offset: -2px; }
.file-row[aria-current="true"] { color: #4558d5; background: #e9edff; box-shadow: inset 2px 0 #5468e7; }
.file-row .lucide { width: 15px; height: 15px; }
.file-row .folder-chevron, .file-indent { width: 12px; height: 12px; flex-shrink: 0; }
.tree-folder[open] > summary .folder-chevron { transform: rotate(90deg); }
.file-row::-webkit-details-marker { display: none; }
.folder-icon { color: #b58b49; }
.file-type-icon { color: #7181a7; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-message { padding: 8px 14px; color: #8a91a0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.tree-error { color: #a23a3a; }
.file-viewer { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.file-viewer-header { display: flex; align-items: center; gap: 9px; min-height: 55px; padding: 12px 16px; border-bottom: 1px solid #e5e7ec; color: #747b89; font-size: 12px; }
#file-path { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #50596a; }
.file-viewer-header small { font-size: 10px; white-space: nowrap; color: #9298a5; }
.file-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; color: #9298a5; text-align: center; font-size: 13px; }
.file-placeholder .lucide { width: 32px; height: 32px; stroke-width: 1.3; }
.file-image-view { flex: 1; min-height: 0; overflow: auto; padding: 20px; display: grid; place-items: center; }
.file-image-view img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.file-placeholder p { margin: 0; max-width: 320px; overflow-wrap: anywhere; }
.file-source { flex: 1; min-height: 0; display: grid; grid-template-columns: max-content minmax(max-content, 1fr); grid-auto-rows: max-content; align-content: start; overflow: auto; padding: 16px 0; tab-size: 2; }
.file-source pre { margin: 0; padding-right: 20px; font: 12px/1.8 ui-monospace, Consolas, monospace; color: #394152; }
.file-source code { font: inherit; }
.file-source pre, .file-source #file-code, .file-source #file-lines { display: contents; white-space: normal; }
.file-code-line { grid-column: 2; min-height: 1.8em; padding-right: 20px; white-space: pre; }
.file-source.word-wrap { grid-template-columns: max-content minmax(0, 1fr); }
.word-wrap .file-code-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.file-line-number { grid-column: 1; position: sticky; left: 0; z-index: 1; padding: 0 16px; margin-right: 16px; text-align: right; border-right: 1px solid #eef0f4; background: #fff; color: #a0a7b5; user-select: none; }
#toggle-word-wrap { flex-shrink: 0; }
#reload-files, #toggle-word-wrap { width: 28px; height: 28px; min-width: 28px; min-height: 28px; padding: 6px; }
#reload-files .lucide, #toggle-word-wrap .lucide { width: 16px; height: 16px; }
#toggle-word-wrap[aria-pressed="true"] { color: #4558d5; background: #e9edff; }
[data-theme="dark"] #toggle-word-wrap[aria-pressed="true"] { color: #75beff; background: #20394b; }
[data-theme="dark"] .file-line-number { background: var(--surface); border-color: var(--line); color: var(--muted); }
.file-source {
  --code-comment: #008000; --code-keyword: #0000ff; --code-string: #a31515;
  --code-number: #098658; --code-function: #795e26; --code-type: #267f99;
  --code-property: #0451a5; --code-tag: #800000; --code-punctuation: #606060;
}
#file-code .token:is(.comment, .prolog, .doctype, .cdata) { color: var(--code-comment); }
#file-code .token:is(.keyword, .atrule, .boolean) { color: var(--code-keyword); }
#file-code .token:is(.string, .char, .attr-value, .regex, .inserted) { color: var(--code-string); }
#file-code .token.number { color: var(--code-number); }
#file-code .token:is(.function, .function-variable) { color: var(--code-function); }
#file-code .token:is(.class-name, .builtin) { color: var(--code-type); }
#file-code .token:is(.property, .attr-name, .variable, .selector) { color: var(--code-property); }
#file-code .token:is(.tag, .deleted) { color: var(--code-tag); }
#file-code .token:is(.punctuation, .operator) { color: var(--code-punctuation); }
#file-code .token:is(.bold, .important) { font-weight: 600; }
#file-code .token.italic { font-style: italic; }
[data-theme="dark"] .file-source {
  --code-comment: #6a9955; --code-keyword: #c586c0; --code-string: #ce9178;
  --code-number: #b5cea8; --code-function: #dcdcaa; --code-type: #4ec9b0;
  --code-property: #9cdcfe; --code-tag: #569cd6; --code-punctuation: #cccccc;
}
.file-meta { padding: 7px 14px; border-top: 1px solid #e5e7ec; color: #9298a5; font-size: 11px; }
#app-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.publish-intro { max-width: 640px; margin-bottom: 24px; }
.publish-intro h2 { margin: 0 0 10px; font-size: 22px; }
.publish-intro p, .publish-card p { color: #747b89; font-size: 13px; line-height: 1.6; }
.publish-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.publish-card { display: flex; flex-direction: column; align-items: flex-start; padding: 22px; border: 1px solid #e5e7ec; border-radius: 14px; background: #f7f8fa; }
.publish-card-heading { display: flex; align-items: center; gap: 10px; }
.publish-icon { width: 24px; height: 24px; flex-shrink: 0; color: #667084; }
.publish-card h3 { margin: 0; font-size: 16px; }
.publish-card p { flex: 1; margin: 10px 0 24px; }
.publish-card button { display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; width: 100%; min-height: 40px; margin-top: auto; padding: 10px 12px; background: #e9ecf1; color: #667084; font-size: 12px; opacity: 1; cursor: not-allowed; }
.publish-card button span { font-size: 11px; font-weight: 400; }
.publish-details { margin: 0 0 18px; font-size: 12px; color: #747b89; }
.publish-details summary, .connection-dialog summary { cursor: pointer; padding: 6px 0; }
.publish-card .publish-details p { margin: 8px 0 0; font-size: 12px; }
.publish-availability { display: block; margin-bottom: 18px; color: #747b89; font-size: 12px; }
.connection-step-label { color: #5468e7; font-weight: 600; }
.connection-guidance, .connection-advanced { margin-top: 14px; font-size: 13px; }
.connection-advanced { border-top: 1px solid #e5e7ec; padding-top: 10px; }
.connection-dialog input[type="file"] { padding: 10px 0; border: 0; background: transparent; }
.connection-dialog small { display: block; margin-top: 8px; color: #747b89; }
[data-theme="dark"] :is(.publish-details, .publish-availability, .connection-dialog small) { color: var(--muted); }
[data-theme="dark"] .connection-step-label { color: #a6b5ff; }
[data-theme="dark"] .connection-advanced { border-color: var(--line); }
.publish-card #download-project:not(:disabled) { background: #5468e7; color: #fff; cursor: pointer; }
.publish-card #download-project:hover:not(:disabled) { background: #4355c6; }
.publish-card :is(#save-github-connection, #save-server-connection):not(:disabled) { cursor: pointer; color: #fff; background: #5468e7; }
.saved-connections { margin-top: 32px; }
.saved-connections > p { font-size: 13px; line-height: 1.6; color: #747b89; }
#connections-list { list-style: none; padding: 0; display: grid; gap: 10px; }
#connections-list li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; border: 1px solid #e5e7ec; border-radius: 10px; }
#connections-list strong { overflow-wrap: anywhere; }
#connections-list small { display: block; margin-top: 6px; color: #747b89; }
.connection-actions { display: flex; gap: 8px; }
.connection-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.connection-identity > div { min-width: 0; }
.connection-type-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.connection-dialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; border: 1px solid #d9dde5; border-radius: 16px; color: #394152; }
.connection-dialog::backdrop { background: #18202c66; }
.connection-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.connection-dialog p, .connection-dialog small { font-size: 13px; line-height: 1.6; }
.connection-dialog fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.connection-dialog legend { font-size: 13px; font-weight: 600; }
.connection-dialog label { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 13px; }
.connection-token-heading { position: relative; display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; }
.connection-token-heading label { margin: 0; }
.connection-info { display: inline-flex; }
.connection-dialog .connection-info-button { display: inline-flex; align-items: center; justify-content: center; width: 24px; min-width: 24px; height: 24px; padding: 4px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.connection-dialog .connection-info-button:hover:not(:disabled) { background: #edf0f7; color: #394152; }
.connection-info-button:focus-visible { outline: 2px solid #7186e8; outline-offset: 2px; }
.connection-tooltip { position: absolute; z-index: 2; left: 0; bottom: 100%; width: min(280px, 100%); padding: 10px 12px; border-radius: 8px; background: #263143; color: #fff; box-shadow: 0 4px 14px #0002; font-size: 12px; font-weight: 400; line-height: 1.5; }
[data-theme="dark"] .connection-dialog .connection-info-button:hover:not(:disabled) { background: var(--hover); color: #eee; }
[data-theme="dark"] .connection-tooltip { background: #e5e9f1; color: #202632; }
.connection-dialog input, .connection-dialog textarea, .connection-dialog select { width: 100%; min-width: 0; border: 1px solid #d9dde5; border-radius: 6px; padding: 10px; font: inherit; background: #fff; color: inherit; }
.connection-dialog textarea { resize: vertical; min-height: 100px; font-family: monospace; }
#connection-error, #remove-connection-error { color: #b43d3d; }
[data-theme="dark"] .connection-dialog { color: #ccc; background: var(--surface); border-color: var(--line); }
[data-theme="dark"] :is(.connection-dialog input, .connection-dialog textarea, .connection-dialog select) { color: #ccc; background: var(--raised); border-color: var(--line); }
[data-theme="dark"] #connections-list li { border-color: var(--line); }
[data-theme="dark"] :is(.saved-connections > p, #connections-list small) { color: var(--muted); }
[data-theme="dark"] :is(#connection-error, #remove-connection-error) { color: #f4a6a6; }
#download-project-status { display: block; font-size: 12px; line-height: 1.5; }
#download-project-status:not(:empty) { margin-top: 10px; }
[data-theme="dark"] .publish-card { background: var(--raised); border-color: var(--line); }
[data-theme="dark"] :is(.publish-intro p, .publish-card p, .publish-icon) { color: var(--muted); }
[data-theme="dark"] .publish-card button { background: #303033; color: #aaa; }
.apps-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.apps-toolbar select { max-width: 100%; padding: 8px 10px; border: 1px solid #d9dde5; border-radius: 8px; background: #fff; color: inherit; font: inherit; }
.app-item .app-item-label { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
.app-item .app-timestamp { font-weight: 400; line-height: 1.5; }
[data-theme="dark"] .apps-toolbar select { background: #252526; border-color: #3c3c3c; color: #ccc; }
.app-row { position: relative; display: flex; align-items: center; }
.app-row .app-item { flex: 1; min-width: 0; padding-right: 64px; }
.app-row .delete-app { position: absolute; right: 10px; width: 40px; height: 40px; background: transparent; border-color: transparent; }
.app-row.has-files-action .app-item { padding-right: 108px; }
.app-row .creation-files { position: absolute; right: 54px; width: 40px; height: 40px; background: transparent; border-color: transparent; }
.delete-app { flex-shrink: 0; color: #a66c6c; }
.delete-app:hover:not(:disabled) { color: #b43d3d; background: #fff0f0; }
.delete-dialog { max-width: min(420px, calc(100vw - 32px)); padding: 24px; border: 1px solid #d9dde5; border-radius: 16px; color: #1d2433; box-shadow: 0 16px 60px #27304430; }
.delete-dialog::backdrop { background: #1d243355; }
.delete-dialog h2 { margin: 0 0 12px; font-size: 18px; }
.delete-dialog p { margin: 0; color: #667084; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.secondary-button { background: #eef0f5; color: #50596a; }
.secondary-button:hover:not(:disabled) { background: #e0e5f1; }
.danger-button { background: #b43d3d; }
.danger-button:hover:not(:disabled) { background: #992e2e; }
.app-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 14px; background: #f7f8fa; color: #394152; text-align: left; font-size: 13px; font-weight: 500; border: 1px solid #e5e7ec; }
.app-item:hover:not(:disabled) { background: #eef0f8; }
.app-item[aria-current="true"] { border-color: #7181e8; background: #edf0ff; }
.app-item span { flex: 1; overflow-wrap: anywhere; }
.app-item small { color: #747b89; font-size: 11px; }
#logs { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.6 ui-monospace, Consolas, monospace; color: #394152; }
#notice { padding: 12px 16px; border-top: 1px solid #f0d2d2; background: #fff5f5; color: #a23a3a; font-size: 12px; line-height: 1.6; max-height: 130px; overflow: auto; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.auth-loading { margin: 20vh auto; text-align: center; color: #8a91a0; }
.auth-screen { height: 100dvh; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 32px 20px 0; }
.auth-card { width: min(100%, 380px); padding: 28px 0; margin: auto 0; flex-shrink: 0; }
.auth-mark { width: 28px; height: 28px; color: #5468e7; margin-bottom: 18px; }
.auth-card h1 { margin: 0 0 12px; font-size: 28px; font-weight: 650; letter-spacing: -.03em; }
.auth-card > p { font-size: 14px; line-height: 1.6; color: #687080; }
#auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
#auth-form label { font-size: 13px; margin-top: 8px; }
#auth-form input { width: 100%; min-height: 44px; padding: 12px; border: 1px solid #d2d6de; border-radius: 8px; font: inherit; background: #fff; color: #293347; }
.auth-terms { display: flex; align-items: flex-start; gap: 9px; margin: 4px 0; }
#auth-form #auth-terms { flex: 0 0 18px; width: 18px; height: 18px; min-height: 18px; padding: 0; margin: 2px 0 0; accent-color: #5468e7; cursor: pointer; }
#auth-form .auth-terms label { margin: 0; font-size: 12px; line-height: 1.7; font-weight: 400; cursor: pointer; }
.auth-terms a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#auth-password-hint { color: #687080; font-size: 12px; }
#auth-submit { min-height: 44px; margin-top: 14px; border-radius: 8px; background: #5468e7; color: #fff; }
#auth-toggle { display: block; width: 100%; margin-top: 16px; padding: 12px 4px; background: transparent; color: #5468e7; font-size: 13px; }
#auth-email-actions { display: flex; justify-content: space-between; gap: 12px; }
#auth-email-actions button { padding: 8px 0; background: transparent; color: #5468e7; font-size: 13px; }
.auth-error { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: #b43d3d; }
.auth-card .auth-import-note { font-size: 12px; border-top: 1px solid #d9dde5; margin-top: 20px; padding-top: 16px; }
[data-theme="dark"] #auth-form input { background: var(--raised); border-color: var(--line); color: #cccccc; }
[data-theme="dark"] :is(.auth-card > p, #auth-password-hint) { color: var(--muted); }
[data-theme="dark"] :is(.auth-mark, #auth-toggle) { color: var(--accent); }
[data-theme="dark"] #auth-email-actions button { color: var(--accent); }
[data-theme="dark"] #auth-submit { background: #007acc; }
[data-theme="dark"] .auth-error { color: #f4a6a6; }
[data-theme="dark"] .auth-card .auth-import-note { border-color: var(--line); }
@media (prefers-reduced-motion: reduce) { .thinking-dots i { animation: none; } }
@media (max-width: 1100px) {
  .workspace-header { grid-template-columns: minmax(0, 1fr) auto; }
  .canvas-tabs { grid-column: 1 / -1; grid-row: 2; }
  .workspace-header .preview-actions { grid-column: 2; grid-row: 1; }
}
@media (max-width: 760px) {
  .usage-view { padding: 20px; }
  .usage-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-card-total { grid-column: 1 / -1; }
  .usage-card { padding: 16px; }
  .workspace-header { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .apps-header { padding: 12px; }
  .home-view { padding: 20px; }
  .home-icon { width: 44px; height: 44px; margin-bottom: 12px; }
  #recent-app-list { grid-template-columns: 1fr; }
  .chat-header { padding: 12px; gap: 8px; }
  .icon-button { width: 36px; }
  .file-explorer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 2fr); }
  .explorer-sidebar { min-width: 0; border-right: 0; border-bottom: 1px solid #e5e7ec; }
  .file-viewer-header { padding: 10px; }
  .file-viewer-header small { display: none; }
  .file-row { min-height: 36px; padding: 7px 6px; }
  button { min-height: 44px; }
  .composer button { width: 44px; height: 44px; }
  .msg { max-width: 92%; }
}


/* Theme the Kodie interface; creations retain their own design inside the iframe. */
:root[data-theme="dark"] {
  color-scheme: dark;
  color: #cccccc;
  background: #181818;
  --surface: #1e1e1e;
  --raised: #252526;
  --hover: #2d2d30;
  --line: #303030;
  --event-divider: #303030;
  --muted: #9d9d9d;
  --accent: #75beff;
}
[data-theme="dark"] body { background: #181818; }
[data-theme="dark"] :is(.workspace, .chat-panel, .composer, .composer-box, .file-viewer, .file-source #file-lines, .delete-dialog, #chat-search, .home-icon) { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] :is(.workspace, .chat-panel) { box-shadow: 0 10px 30px #0002; }
[data-theme="dark"] :is(.workspace-header, .apps-header, .chat-header, .file-viewer-header, .file-meta, .file-tree .file-tree, .preview-actions #close-workspace, #new-chat) { border-color: var(--line); }
[data-theme="dark"] .home-view { background: var(--surface); }
[data-theme="dark"] :is(#chat, .chat-picker, .explorer-sidebar, .preview-actions) { background: #1e1e1e; border-color: var(--line); }
[data-theme="dark"] :is(.workspace-kicker, .home-welcome p, .home-note, .apps-empty, .thinking, .thinking-time, .message-duration, .msg.event, .build-clock-label, .build-description, .chat-picker-header p, #chat-picker-status, .conversation-item small, .explorer-heading h2, .explorer-root .lucide, .tree-message, .file-viewer-header, .file-viewer-header small, .file-placeholder, .file-meta, .app-item small, .attachment-chip small, .attachment-uploading, .workspace-empty) { color: var(--muted); }
[data-theme="dark"] :is(.recent-heading h2, .recent-app, .app-item, .conversation-item, .file-row, #file-path, .file-source pre, #logs, textarea, #chat-search, .delete-dialog, .delete-dialog p, .preview-overlay-badge, .attachment-chip) { color: #cccccc; }
[data-theme="dark"] textarea::placeholder, [data-theme="dark"] #chat-search::placeholder { color: #989898; }
[data-theme="dark"] :is(.recent-app, .app-item, .conversation-item, .attachment-chip) { background: var(--raised); border-color: var(--line); }
[data-theme="dark"] :is(.recent-app, .app-item, .conversation-item):hover:not(:disabled) { background: var(--hover); border-color: #454545; }
[data-theme="dark"] :is(.home-icon, .recent-browse, .file-type-icon, #build-elapsed) { color: var(--accent); }
[data-theme="dark"] .recent-browse-icon { background: #2a2d2e; }
[data-theme="dark"] :is(.tabs, .app-library-button, .icon-button, .secondary-button) { background: var(--raised); color: var(--muted); border-color: var(--line); }
[data-theme="dark"] :is(.icon-button, .app-library-button, .secondary-button):hover:not(:disabled), [data-theme="dark"] .tabs .nav-tab:hover { background: var(--hover); color: #eeeeee; }
[data-theme="dark"] .nav-tab { color: var(--muted); }
[data-theme="dark"] .tabs .nav-tab[aria-selected="true"] { background: #007acc; color: #fff; }
[data-theme="dark"] :is(.app-library-button[aria-pressed="true"], .conversation-item[aria-current="true"], .file-row[aria-current="true"], .app-item[aria-current="true"], .message-app-link) { background: #20394b; border-color: #36556b; color: #c5e5ff; }
[data-theme="dark"] :is(.app-library-button[aria-pressed="true"], .message-app-link):hover:not(:disabled) { background: #26465c; color: #e4f3ff; }
[data-theme="dark"] .preview-actions .icon-button { background: transparent; color: var(--muted); }
[data-theme="dark"] .preview-actions .icon-button:hover:not(:disabled), [data-theme="dark"] .preview-actions #mobile[aria-pressed="true"] { background: var(--hover); color: #eeeeee; }
[data-theme="dark"] .file-row:hover:not(:disabled) { background: var(--hover); }
[data-theme="dark"] .file-source #file-lines { color: var(--muted); }
[data-theme="dark"] .user { background: #303030; }
[data-theme="dark"] :is(#chat, #conversation-list, .workspace-content)::-webkit-scrollbar-thumb { background-color: #424242; }
[data-theme="dark"] .workspace-content { background-image: linear-gradient(#262626 1px, transparent 1px), linear-gradient(90deg, #262626 1px, transparent 1px); background-color: #1e1e1e; }
[data-theme="dark"] .preview-stage iframe { background: var(--surface); }
[data-theme="dark"] .workspace-placeholder { background: var(--raised); border-color: #555555; box-shadow: 8px 8px 0 -3px #1e1e1e, 8px 8px 0 -2px #424242; }
[data-theme="dark"] .preview-overlay, [data-theme="dark"] .preview-overlay.building { background: #00000066; }
[data-theme="dark"] .preview-overlay-badge { background: #252526; border-color: #3c3c3c; box-shadow: 0 12px 40px #0004; }
[data-theme="dark"] .preview-overlay.building :is(#preview-overlay-text, .build-icon) { color: var(--accent); }
[data-theme="dark"] .preview-overlay.building .build-progress { background: #333333; }
[data-theme="dark"] .composer :is(#attach-files, .attachment-chip button) { color: var(--muted); }
[data-theme="dark"] .composer :is(#attach-files, .attachment-chip button):hover:not(:disabled) { background: var(--hover); color: #eeeeee; }
[data-theme="dark"] .dragging-files .composer-box { background: #20394b; }
[data-theme="dark"] :is(.error, .attachment-error, .tree-error, .delete-chat, .delete-app) { color: #f4a6a6; }
[data-theme="dark"] :is(.delete-chat, .delete-app):hover:not(:disabled) { background: #442727; color: #ffc5c5; }
[data-theme="dark"] #notice { background: #352323; border-color: #633535; color: #ffc0c0; }
[data-theme="dark"] .delete-dialog::backdrop { background: #000000b3; }
[data-theme="dark"] :is(#send, #stop-build) { background: #007acc; }
[data-theme="dark"] :is(#send, #stop-build):hover:not(:disabled) { background: #1177bb; }
[data-theme="dark"] :is(button, a, input):focus-visible { outline-color: #007acc; }
[data-theme="dark"] .composer-box:focus-within { border-color: #007acc; box-shadow: 0 0 0 2px #007acc22; }
[data-theme="dark"] .file-row[aria-current="true"] { box-shadow: inset 2px 0 #007acc; }
[data-theme="dark"] :is(.thinking-dots i, .build-progress span) { background: #3794ff; }
[data-theme="dark"] .dragging-files .composer-box { border-color: #007acc; box-shadow: 0 0 0 3px #007acc22; }

/* Quiet chrome keeps the creation and composer in focus. */
.workspace, .chat-panel { box-shadow: none; border-color: #e3e6ec; }
.workspace-header, .apps-header, .chat-header { min-height: 68px; border-bottom-color: #edf0f4; }
.workspace-header { padding-top: 12px; padding-bottom: 12px; }
.chat-header { padding-top: 12px; padding-bottom: 12px; }
.chat-name { font-size: 17px; font-weight: 650; }
.composer { border-top: 0; }
#chat { background: #fff; padding: 20px; }
.workspace-header .icon-button, .apps-header .icon-button, .chat-header .icon-button { background: transparent; }
#new-chat { border-color: transparent; }
.app-library-button { background: transparent; border-color: transparent; font-weight: 500; }
.preview-actions { padding: 0; gap: 4px; border: 0; background: transparent; }
.preview-actions .icon-button { width: 34px; min-width: 34px; height: 34px; }
.preview-actions #close-workspace { margin: 0; border: 0; border-radius: 6px; }
.tabs { background: #f3f4f6; padding: 3px; }
.tabs .nav-tab[aria-selected="true"] { background: #fff; color: #293347; box-shadow: 0 1px 3px #27304412; }
.home-view { background: #fff; }
.home-icon { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 0; margin-bottom: 16px; }
.recent-app { border-color: transparent; background: #f6f7f9; box-shadow: none; }
.recent-browse { border-style: solid; background: #f6f7f9; color: #667084; }
.recent-browse-icon { background: transparent; }
.conversation-item { border-color: transparent; background: transparent; }
.preview-overlay.building .preview-overlay-badge { width: min(280px, calc(100vw - 60px)); padding: 28px; gap: 18px; border-radius: 14px; border-color: #e5e7ec; box-shadow: 0 8px 30px #27304412; }
.preview-overlay.building #preview-overlay-text { font-size: 14px; font-weight: 500; }
.build-clock-label { font-size: 11px; letter-spacing: 0; text-transform: none; font-weight: 400; }
.preview-options { position: absolute; right: 18px; top: calc(100% - 4px); width: 216px; padding: 6px; border: 1px solid #e3e6ec; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px #1822351a; }
.preview-options :is(button, a) { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 10px; background: transparent; color: #50596a; border-radius: 6px; text-decoration: none; font: inherit; font-size: 13px; text-align: left; }
.preview-options :is(button, a):hover { background: #f1f3f7; }
.preview-options .mobile-check { margin-left: auto; visibility: hidden; }
.mobile-canvas-views { display: none; }
.preview-options .view-check { margin-left: auto; visibility: hidden; }
.preview-menu-separator { border: 0; border-top: 1px solid #e3e6ec; margin: 6px 4px; }
[data-theme="dark"] .preview-menu-separator { border-color: var(--line); }
.preview-options [aria-pressed="true"] .view-check { visibility: visible; }
@media (max-width: 760px) {
  .canvas-tabs { display: none; }
  .mobile-canvas-views { display: flex; flex-direction: column; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid #e3e6ec; }
  [data-theme="dark"] .mobile-canvas-views { border-color: var(--line); }
}
.preview-options #mobile[aria-pressed="true"] { background: #eef2f8; }
.preview-options #mobile[aria-pressed="true"] .mobile-check { visibility: visible; }
[data-theme="dark"] :is(.workspace, .chat-panel) { border-color: #2b2b2b; box-shadow: none; }
[data-theme="dark"] :is(.workspace-header, .apps-header, .chat-header) { border-bottom-color: #292929; }
[data-theme="dark"] :is(.workspace-header .icon-button, .apps-header .icon-button, .chat-header .icon-button, .app-library-button, .preview-actions, .home-icon) { background: transparent; border-color: transparent; }
[data-theme="dark"] #new-chat { border-color: transparent; }
[data-theme="dark"] :is(.workspace-header .icon-button, .apps-header .icon-button, .chat-header .icon-button, .app-library-button):hover:not(:disabled) { background: var(--hover); }
[data-theme="dark"] .app-library-button[aria-pressed="true"] { background: #2a2d2e; color: #eeeeee; }
[data-theme="dark"] .tabs { background: #242424; }
[data-theme="dark"] .tabs .nav-tab[aria-selected="true"] { background: #353535; color: #eeeeee; box-shadow: none; }
[data-theme="dark"] :is(.recent-app, .conversation-item) { border-color: transparent; }
[data-theme="dark"] .recent-browse-icon { background: transparent; }
[data-theme="dark"] .conversation-item { background: transparent; }
[data-theme="dark"] .conversation-item[aria-current="true"] { background: #2a2d2e; }
[data-theme="dark"] .preview-overlay.building #preview-overlay-text { color: #cccccc; }
[data-theme="dark"] .preview-overlay.building .preview-overlay-badge { border-color: #383838; box-shadow: 0 8px 30px #0003; }
[data-theme="dark"] .preview-options { background: #252526; border-color: #383838; box-shadow: 0 8px 24px #0005; }
[data-theme="dark"] .preview-options :is(button, a) { color: #cccccc; }
[data-theme="dark"] .preview-options :is(button, a):hover, [data-theme="dark"] .preview-options #mobile[aria-pressed="true"] { background: #333333; }
@media (max-width: 760px) {
  .preview-options { right: 12px; }
  .preview-options :is(button, a) { min-height: 44px; }
}

/* Account settings share the canvas navigation with Usage. */
.settings-view { overflow: auto; padding: 30px; }
.settings-shell { max-width: 680px; margin: 0 auto; }
.settings-section { padding: 6px 0 24px; margin-bottom: 24px; border-bottom: 1px solid #e5e7ec; }
.settings-section:last-child { border-bottom: 0; margin-bottom: 0; }
.settings-section h2 { margin: 0 0 20px; font-size: 16px; font-weight: 600; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 16px 0; font-size: 14px; }
.settings-row > :first-child { flex-shrink: 0; color: #687080; }
.settings-row > span:last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.settings-note { margin: 14px 0 0; color: #687080; font-size: 12px; line-height: 1.6; }
.settings-button, #theme-select { border: 1px solid #d9dde5; background: #fafbfc; color: #394152; border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 13px; }
.settings-button { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; }
.settings-button .lucide { width: 16px; height: 16px; }
.settings-button:hover { background: #edf0f7; }
#theme-select { min-width: 120px; }
[data-theme="dark"] .settings-section { border-color: var(--line); }
[data-theme="dark"] :is(.settings-note, .settings-row > :first-child) { color: var(--muted); }
[data-theme="dark"] :is(.settings-button, #theme-select) { background: var(--raised); border-color: var(--line); color: #cccccc; }
[data-theme="dark"] .settings-button:hover { background: var(--hover); }
@media (max-width: 760px) { .settings-view { padding: 20px; } .settings-row { gap: 12px; } }

/* Phones keep both panels mounted while showing one at a time. */
#mobile-chat, #mobile-canvas { display: none; }
@media (max-width: 760px) {
  body { overflow: hidden; }
  #app-shell { position: relative; height: var(--mobile-app-height, 100dvh); min-height: 0; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); }
  .content { flex: 1; height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; overflow: hidden; }
  .workspace, .chat-panel { height: 100%; border: 0; border-radius: 0; }
  #app-shell[data-mobile-panel="chat"] .workspace,
  #app-shell[data-mobile-panel="canvas"] .chat-panel { display: none; }
  .chat-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .chat-header .app-library-button { justify-self: center; min-width: 0; }
  .chat-header .chat-name { font-size: 17px; }
  .chat-header-actions { gap: 2px; }
  .chat-header-actions .icon-button { min-width: 36px; width: 36px; }
  #input, #chat-search, #auth-form input, select { font-size: 16px; }
  .composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .composer textarea { max-height: min(180px, 30dvh); }
}

@media (max-width: 760px) {
  #mobile-canvas { display: inline-flex; align-items: center; justify-content: center; }
  #app-shell[data-mobile-panel="canvas"] #mobile-chat { display: grid; place-items: center; }
  #mobile-chat { position: absolute; z-index: 5; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; min-width: 56px; padding: 0; border-radius: 50%; background: #5468e7; color: #fff; box-shadow: 0 4px 16px #0003; }
  #mobile-chat .lucide { width: 24px; height: 24px; }
  #mobile-chat:hover { background: #4558d5; }
  #mobile-chat:focus-visible { outline: 2px solid currentColor; outline-offset: -5px; }
  [data-theme="dark"] #mobile-chat { background: #007acc; }
  [data-theme="dark"] #mobile-chat:hover { background: #168bd2; }
  .home-view, .usage-view, .settings-view, .detail-view { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  .chat-header { gap: 4px; }
  .chat-header .app-library-button { gap: 5px; padding-left: 4px; padding-right: 4px; }
}

.creation-quota { margin-bottom: 20px; padding: 16px 18px; border: 1px solid #dce5df; border-radius: 12px; background: #f5f9f6; }
.creation-quota-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.creation-quota-heading strong { font-size: 15px; }
.creation-quota-heading span { font-size: 13px; color: #366746; font-weight: 600; }
.creation-quota p { margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: #59645e; }
.creation-quota.at-limit { border-color: #c39b5e; }
.creation-quota.at-limit .creation-quota-heading span { color: #825818; }
[data-theme="dark"] .creation-quota { background: #202923; border-color: #39483e; }
[data-theme="dark"] .creation-quota p { color: #b8c4bc; }
[data-theme="dark"] .creation-quota-heading span { color: #a0d3ae; }
[data-theme="dark"] .creation-quota.at-limit { border-color: #a7834b; }
[data-theme="dark"] .creation-quota.at-limit .creation-quota-heading span { color: #e7c184; }
