:root {
  color-scheme: light;
  --paper: #fff;
  --white: #fff;
  --ink: #0d0d0d;
  --muted: #707070;
  --line: #e8e8e8;
  --accent: #171717;
  --soft-green: #f4f4f4;
  --sidebar: #f9f9f9;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { border: 0; background: transparent; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid #777; outline-offset: 3px; }
textarea:focus, input:focus { outline: none; }
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); font-size: 13px; }
.sr-only, .message-meta, .day-divider { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.icon-button { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; color: var(--ink); font-size: 28px; line-height: 1; }
.icon-button:hover { background: #f4f4f4; }
.chat-shell { position: fixed; top: var(--viewport-top,0px); left: 0; width: 100%; height: var(--app-height,100dvh); display: flex; flex-direction: column; overflow: hidden; }
.chat-header { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 12px; height: 64px; flex-shrink: 0; padding: 8px 20px; background: #ffffffed; z-index: 10; }
.menu-button { border: 1px solid #f0f0f0; box-shadow: 0 2px 8px #00000005; }
.header-copy { min-width: 0; width: fit-content; max-width: 100%; margin: 0 auto; padding: 8px 2px; border-radius: 10px; }
.header-copy:hover { background: #f9f9f9; }
.session-heading { display: flex; align-items: center; justify-content: center; min-width: 0; gap: 4px; }
.session-heading h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; line-height: 1.4; font-weight: 600; margin: 0; letter-spacing: -.3px; }
.session-heading svg { width: 18px; height: 18px; color: #777; }
.header-copy[data-busy="true"] .session-heading:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #171717; flex-shrink: 0; }
.tools-menu { position: relative; }
.tools-menu summary { list-style: none; position: relative; }
.tools-menu summary::-webkit-details-marker, .folder-group summary::-webkit-details-marker { display: none; }
.tools-menu summary svg { stroke-width: 2; }
.tools-popover { position: absolute; top: 48px; right: 0; width: 230px; max-width: calc(100vw - 24px); padding: 6px; background: white; border: 1px solid #ececec; border-radius: 16px; box-shadow: 0 6px 24px #00000017; z-index: 40; }
.tools-popover button { text-align: left; display: block; padding: 11px 12px; border-radius: 10px; width: 100%; font-size: 14px; min-height: 44px; }
.tools-popover button:hover { background: #f5f5f5; }
.tools-popover span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.menu-divider { height: 1px; background: var(--line); margin: 5px 8px; }
.notification-dot { position: absolute; top: 6px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #2678e7; border: 1px solid white; }

/* Transcript: neutral user bubbles and full-width assistant replies. */
.chat-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d9d9d9 transparent; scroll-padding: 24px 0; }
.conversation { width: min(100%,800px); min-height: 100%; margin: 0 auto; padding: 30px 28px 24px; }
.message { display: flex; width: 100%; margin: 0 0 28px; position: relative; }
.message-content { min-width: 0; width: 100%; max-width: 100%; }
.message.user { justify-content: flex-end; margin: 20px 0 32px; }
.user .message-content { width: fit-content; max-width: 82%; }
.message-body { font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; color: var(--ink); }
.user .message-body { background: #f4f4f4; padding: 10px 18px; border-radius: 24px; white-space: pre-wrap; line-height: 1.65; }
.message-body p { margin: 0 0 16px; white-space: pre-wrap; }
.message-body p:last-child { margin-bottom: 0; }
.message-body ul, .message-body ol { padding-left: 26px; margin: 16px 0; }
.message-body li { margin: 6px 0; }
.message-body h2, .message-body h3, .message-body h4 { font-size: 19px; line-height: 1.5; margin: 24px 0 12px; }
.message-body code { font: .88em/1.6 ui-monospace,SFMono-Regular,Menlo,monospace; background: #f1f1f1; padding: 2px 5px; border-radius: 5px; }
.message-body pre { overflow-x: auto; max-width: 100%; padding: 18px; margin: 20px 0; background: #f7f7f7; border: 1px solid #ececec; border-radius: 14px; white-space: pre; line-height: 1.6; }
.message-body pre code { padding: 0; background: transparent; font-size: 13px; }
.message-body blockquote { margin: 18px 0; padding: 0 16px; border-left: 3px solid #ddd; color: #555; }
.message-body a { color: #1a5fb4; text-underline-offset: 3px; }
.table-wrap { overflow-x: auto; max-width: 100%; margin: 18px 0; }
.message-body table { border-collapse: collapse; min-width: 100%; font-size: 14px; }
.message-body th, .message-body td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #ddd; }
.message-body th { font-weight: 600; background: #fafafa; }
.message-actions { display: flex; align-items: center; gap: 4px; margin: 6px 0 0 -8px; color: #777; }
.copy-button { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: #777; font-size: 12px; padding: 6px 8px; border-radius: 8px; }
.copy-button:hover { color: #111; background: #f4f4f4; }
.copy-button svg { width: 18px; height: 18px; }
.edit-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; font-size: 12px; color: #444; border: 1px solid #ddd; border-radius: 18px; padding: 6px 12px; margin-left: 4px; background: white; }
.edit-button:hover { background: #f4f4f4; }
.failed .message-body { color: #b42318; }
.message-state-badge { display: inline-block; font-size: 12px; margin-bottom: 8px; color: #b42318; }
.pending { display: flex; align-items: center; gap: 9px; font-size: 14px; color: #666; min-height: 28px; }
.thinking-dot { width: 9px; height: 9px; flex-shrink: 0; background: #171717; border-radius: 50%; animation: breathe 1.5s ease-in-out infinite; }
.pending-note, .sync-time { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 7px 0 0; }
.sync-time { font-size: 11px; }
.progress-group { margin: 0 0 24px; color: #666; }
.progress-group>summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; min-height: 40px; font-size: 14px; }
.progress-group>summary::-webkit-details-marker { display: none; }
.progress-group>summary svg { width: 16px; height: 16px; transition: transform .15s; }
.progress-group[open]>summary svg { transform: rotate(90deg); }
.progress-group>summary span { font-size: 12px; color: #999; }
.progress-items { border-left: 1px solid #ddd; padding: 8px 0 0 16px; margin-left: 7px; }
.progress-items .message { margin-bottom: 18px; }
.progress-items .message-body { color: #666; font-size: 14px; }
.load-earlier { display: block; min-height: 40px; margin: 0 auto 28px; font-size: 13px; color: #777; padding: 8px 16px; border: 1px solid #e5e5e5; border-radius: 22px; }
.load-earlier:hover { background: #f9f9f9; }
.jump-button { position: absolute; bottom: var(--composer-height,100px); left: 50%; transform: translate(-50%,-12px); z-index: 5; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: #555; background: white; border: 1px solid #e4e4e4; border-radius: 50%; box-shadow: 0 2px 6px #0000000a; }
.jump-button svg { width: 18px; height: 18px; }
.empty-state { min-height: 55dvh; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 20px 0; }
.empty-state h2 { font-size: 26px; font-weight: 500; line-height: 1.4; margin: 0 0 12px; letter-spacing: -.5px; }
.empty-state p { font-size: 14px; color: #777; line-height: 1.7; }

/* The input is anchored to the visible viewport, including mobile keyboards. */
.composer-footer { flex-shrink: 0; padding: 8px 24px max(10px,env(safe-area-inset-bottom)); background: white; }
.composer-inner { width: min(100%,768px); margin: 0 auto; }
.composer { border: 1px solid #e5e5e5; border-radius: 28px; background: white; box-shadow: 0 2px 12px #0000000b; overflow: hidden; }
.composer:focus-within { border-color: #d5d5d5; }
.composer-row { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; align-items: end; gap: 4px; padding: 7px; }
.composer textarea { width: 100%; display: block; padding: 5px 3px; margin: 0; min-height: 36px; max-height: 180px; line-height: 26px; font-size: 16px; background: transparent; color: #111; border: 0; resize: none; scrollbar-width: thin; }
.composer textarea::placeholder { color: #8f8f8f; opacity: 1; }
.add-image, .send-button { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.add-image { color: #111; }
.add-image:hover { background: #f2f2f2; }
.add-image svg { width: 24px; height: 24px; stroke-width: 1.8; }
.send-button { color: white; background: #0d0d0d; }
.send-button svg { width: 22px; height: 22px; stroke-width: 2; }
.send-button:disabled { opacity: 1; color: #fff; background: #d7d7d7; }
.composer-state { text-align: center; font-size: 11px; line-height: 1.4; color: #777; margin: 7px 0 0; }
.composer-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; line-height: 1.4; color: #8f8f8f; margin: 8px 4px 0; }
.form-message { background: #f5f5f5; color: #555; padding: 10px 14px; border-radius: 12px; margin: 0 0 10px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.form-message.error { background: #fff1ef; color: #a12c22; }
.connection-message { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; flex-shrink: 0; background: #fff7e7; color: #80591b; font-size: 12px; line-height: 1.6; }
.connection-message>span { max-width: 820px; overflow-wrap: anywhere; }
.connection-message button { white-space: nowrap; flex-shrink: 0; min-height: 36px; background: white; border: 1px solid #e8d9c0; border-radius: 20px; padding: 5px 12px; font-size: 12px; }
.queue-card { background: #f8f8f8; border: 1px solid #e5e5e5; padding: 14px 16px; border-radius: 16px; font-size: 14px; }
.queue-card>div { font-weight: 500; color: #333; }
.queue-card p { margin: 5px 0 10px; font-size: 12px; color: #777; }
.queue-card .edit-button { margin-left: 0; }
.image-drafts { display: flex; gap: 10px; padding: 12px 12px 0; overflow-x: auto; max-height: 146px; }
.draft-image { position: relative; flex: 0 0 96px; padding: 5px; background: #f7f7f7; border: 1px solid #e5e5e5; border-radius: 14px; }
.draft-image img { display: block; width: 84px; height: 64px; border-radius: 8px; object-fit: cover; background: #eee; }
.draft-image>button[data-remove-image] { position: absolute; top: -2px; right: -2px; width: 28px; height: 28px; background: #fff; border: 1px solid #ddd; border-radius: 50%; font-size: 20px; }
.draft-image>span { display: block; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; font-size: 10px; color: #777; }
.retry-image { min-height: 30px; font-size: 11px; padding: 2px 0; }

/* Project and chat navigation. */
.sidebar { position: fixed; left: 0; top: var(--viewport-top,0px); width: min(320px,calc(100vw - 64px)); height: var(--app-height,100dvh); z-index: 50; display: flex; flex-direction: column; background: var(--sidebar); padding: 16px 12px 12px; transform: translateX(-100%); transition: transform .22s ease; border-right: 1px solid #e5e5e5; }
.drawer-open .sidebar { transform: translateX(0); }
.drawer-overlay { position: fixed; inset: 0; z-index: 45; background: #0005; padding: 0; width: 100%; height: 100%; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 18px 4px; }
.brand { color: #111; text-decoration: none; font-size: 24px; font-weight: 650; letter-spacing: -.5px; }
.search-box { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 12px; margin-bottom: 22px; background: #ededed; border-radius: 12px; color: #777; }
.search-box svg { width: 19px; height: 19px; }
.search-box input { min-width: 0; width: 100%; border: 0; background: transparent; color: #222; font-size: 15px; line-height: 26px; }
.search-box input::placeholder { color: #888; }
.sidebar-caption { display: flex; justify-content: space-between; padding: 0 10px; margin-bottom: 10px; color: #777; font-size: 12px; }
.session-picker { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; margin: 0 -3px; padding: 0 3px; }
.folder-group { margin: 0 0 12px; }
.folder-group summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 9px 8px; color: #777; cursor: pointer; font-size: 13px; user-select: none; }
.folder-group summary:before { content: "›"; font-size: 17px; transition: transform .15s; }
.folder-group[open] summary:before { transform: rotate(90deg); }
.folder-group summary svg { width: 17px; height: 17px; }
.folder-label { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-count { font-size: 11px; color: #999; }
.folder-sessions { display: grid; gap: 2px; padding-left: 8px; }
.session-choice { width: 100%; min-height: 44px; text-align: left; display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #222; border-radius: 10px; font-size: 14px; line-height: 1.6; }
.session-choice:hover { background: #efefef; }
.session-choice.selected { background: #e9e9e9; color: #111; }
.session-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; background: #555; flex-shrink: 0; }
.unread-count, .queue-count { min-width: 20px; height: 20px; padding: 1px 5px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 10px; background: #171717; color: white; }
.queue-count { background: #e5e5e5; color: #555; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 16px 4px 0; margin-top: 12px; border-top: 1px solid #e5e5e5; }
.sidebar-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #1b1b1b; color: white; font-size: 15px; }
.sidebar-footer strong { display: block; font-size: 13px; font-weight: 500; }
.sidebar-footer div>span { display: block; margin-top: 2px; font-size: 11px; color: #888; }

/* Sheets, reminders, and image viewing retain their existing actions. */
.details-dialog { width: min(640px,calc(100vw - 32px)); max-height: 85dvh; overflow: auto; margin: auto; padding: 24px; border: 1px solid #e5e5e5; border-radius: 22px; box-shadow: 0 12px 80px #0002; background: white; color: #111; }
.details-dialog::backdrop { background: #0006; }
.details-dialog h2 { font-size: 20px; line-height: 1.4; font-weight: 600; margin: 0 0 16px; }
.details-dialog>p { font-size: 14px; line-height: 1.7; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; }
.eyebrow { display: block; font-size: 11px; color: #999; margin-bottom: 4px; }
.panel-tabs { display: flex; gap: 20px; align-items: center; padding: 0 0 12px; border-bottom: 1px solid #e5e5e5; margin-bottom: 18px; }
.panel-tabs button { min-height: 36px; padding: 4px 0; color: #888; font-size: 14px; }
.panel-tabs button.selected { color: #111; }
.panel-refresh { margin-left: auto; }
.panel-content { min-height: 160px; overflow-wrap: anywhere; }
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.service-item { min-width: 0; padding: 14px; background: #f7f7f7; border: 1px solid #eee; border-radius: 12px; }
.service-item dt { font-size: 12px; color: #777; margin-bottom: 8px; }
.service-item dd { margin: 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.service-item.wide { grid-column: 1/-1; }
.service-good { color: #18794e; }
.service-bad { color: #b42318; }
.log-output { font: 12px/1.7 ui-monospace,SFMono-Regular,monospace; max-height: 48dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; background: #f6f6f6; border-radius: 12px; }
.notification-toast { position: fixed; top: calc(var(--viewport-top,0px) + 72px); right: 16px; width: min(360px,calc(100vw - 32px)); z-index: 35; background: white; border: 1px solid #e4e4e4; border-radius: 20px; padding: 12px; box-shadow: 0 8px 32px #0002; }
#notification-toast-list { display: grid; gap: 4px; }
.notification-toast [data-notification-sequence] { width: 100%; display: grid; gap: 6px; text-align: left; padding: 10px; border-radius: 12px; }
.notification-toast [data-notification-sequence]:hover { background: #f4f4f4; }
.notification-toast strong { font-size: 13px; font-weight: 600; }
.notification-toast span { font-size: 13px; overflow-wrap: anywhere; }
.notification-toast>button { min-height: 32px; padding: 4px 10px; font-size: 12px; color: #777; }
.notification-item { padding: 12px 0; border-bottom: 1px solid #eee; }
.notification-target { display: grid; gap: 7px; width: 100%; text-align: left; padding: 10px; border-radius: 12px; }
.notification-target:hover { background: #f7f7f7; }
.notification-target>span { font-size: 12px; color: #777; }
.notification-target strong { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.notification-target small { font-size: 11px; color: #888; overflow-wrap: anywhere; }
.notification-item.unread .notification-target>span { color: #111; font-weight: 600; }
.notification-delivery { display: flex; align-items: center; gap: 10px; padding: 4px 10px; font-size: 11px; color: #777; }
.notification-item .pending-note { padding: 0 10px; }
.notification-highlight { border-radius: 10px; outline: 1px solid #ddd; outline-offset: 8px; }
.message-image { display: block; width: min(100%,440px); margin: 16px 0; white-space: normal; }
.user .message-image { margin: 10px 0 0; }
.image-open { display: block; width: 100%; padding: 0; border: 1px solid #e8e8e8; border-radius: 16px; overflow: hidden; background: #f5f5f5; cursor: zoom-in; }
.image-open img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.image-caption { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 1px; color: #888; font-size: 11px; }
.image-caption>span { min-width: 0; overflow-wrap: anywhere; }
.image-caption a { color: #777; white-space: nowrap; }
.image-unavailable { display: block; border-radius: 12px; padding: 12px; font-size: 13px; background: #fff6e6; color: #80591b; white-space: normal; }
.image-load-error { padding: 24px; font-size: 13px; color: #777; }
.image-dialog { width: min(1100px,96vw); max-height: 96dvh; margin: auto; padding: 16px; border: 0; border-radius: 18px; background: white; color: #111; }
.image-dialog::backdrop { background: #0009; }
.image-view-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
.image-view-header h2 { font-size: 15px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.image-view-header>div { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.image-view-header a { font-size: 12px; color: #555; text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.image-view-stage { display: grid; place-items: center; max-height: calc(90dvh - 70px); min-height: 100px; overflow: auto; background: #f8f8f8; border-radius: 12px; }
.image-view-stage img { display: block; max-width: 100%; max-height: calc(90dvh - 70px); height: auto; object-fit: contain; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; overflow: auto; }
.login-card { width: min(100%,360px); }
.login-card h1 { font-size: 28px; font-weight: 600; margin: 16px 0; }
.login-card p { font-size: 14px; color: #777; line-height: 1.7; }
.login-card label { display: block; font-size: 13px; margin: 30px 0 10px; }
.login-card input { width: 100%; padding: 14px; border: 1px solid #ccc; border-radius: 14px; font-size: 16px; background: white; }
.primary-button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 18px; margin-top: 18px; background: #111; color: white; border-radius: 24px; font-size: 14px; }
@keyframes breathe { 50% { opacity: .35; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { *,*:before,*:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (max-width: 767px) {
  .chat-header { height: 60px; padding: 7px 12px; gap: 8px; }
  .session-heading h1 { font-size: 17px; }
  .conversation { padding: 20px 16px 12px; }
  .message { margin-bottom: 26px; }
  .message.user { margin: 18px 0 28px; }
  .user .message-content { max-width: 88%; }
  .user .message-body { padding: 10px 16px; border-radius: 22px; }
  .message-body { line-height: 1.75; }
  .message-body h2,.message-body h3,.message-body h4 { font-size: 18px; }
  .message-actions { margin-top: 4px; }
  .copy-button { min-width: 40px; height: 40px; }
  .composer-footer { padding: 6px 12px max(10px,env(safe-area-inset-bottom)); }
  .composer-hint { justify-content: center; font-size: 10px; margin-top: 7px; }
  .keyboard-hint { display: none; }
  .search-box input { font-size: 16px; }
  .sidebar { background: white; }
  .details-dialog { width: 100%; max-height: min(86dvh,var(--app-height,86dvh)); margin: auto 0 0; padding: 26px 20px max(24px,env(safe-area-inset-bottom)); border: 0; border-radius: 24px 24px 0 0; }
  .details-dialog:before { content: ""; display: block; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 36px; height: 4px; background: #dedede; border-radius: 4px; }
  .details-dialog h2 { font-size: 19px; }
  .service-grid { grid-template-columns: 1fr; }
  .service-item.wide { grid-column: auto; }
  .notification-toast { top: calc(var(--viewport-top,0px) + 66px); }
  .image-dialog { margin: 0; width: 100vw; height: var(--app-height,100dvh); max-height: 100dvh; padding: 12px; border-radius: 0; }
  .image-view-header { gap: 6px; }
  .image-view-header h2 { font-size: 12px; }
  .image-view-header>div { gap: 8px; }
  .image-view-header a { font-size: 11px; }
  .image-view-stage { height: calc(var(--app-height,100dvh) - 80px); max-height: none; background: white; }
  .image-view-stage img { max-height: calc(var(--app-height,100dvh) - 80px); }
  .empty-state { min-height: 50dvh; }
  .empty-state h2 { font-size: 24px; }
}
@media (max-width: 359px) { .chat-header { gap: 4px; padding-inline: 8px; } .session-heading h1 { font-size: 16px; } .conversation { padding-inline: 14px; } .image-view-header h2 { max-width: 80px; } }
@media (max-width:767px) {
  .chat-header { height: calc(60px + env(safe-area-inset-top)); padding-top: calc(7px + env(safe-area-inset-top)); }
  .sidebar { padding-top: calc(16px + env(safe-area-inset-top)); }
}
@media (max-width:767px) {
  .sidebar { padding-bottom: max(12px,env(safe-area-inset-bottom)); }
  .details-dialog { top: auto; bottom: var(--viewport-bottom,0px); margin: 0; }
  .image-dialog[open] { display: flex; flex-direction: column; top: var(--viewport-top,0px); left: 0; right: auto; bottom: auto; padding-top: max(12px,env(safe-area-inset-top)); padding-bottom: max(12px,env(safe-area-inset-bottom)); }
  .image-view-header { flex-shrink: 0; }
  .image-view-header h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .image-view-stage { flex: 1; min-height: 0; height: auto; }
}
/* Keep off-screen transcript metadata inside the transcript's scrollport. */
.chat-shell { overflow: clip; }
.chat-scroll, .conversation, .composer, .header-copy { position: relative; }
@media (max-height:500px) {
  .draft-image { flex-basis: 76px; }
  .draft-image img { width: 64px; height: 40px; }
  .draft-image>span { max-width: 64px; }
  .image-drafts { max-height: 110px; }
}
@media (max-width:767px) {
  .details-dialog, .image-dialog { max-width: 100vw; }
}
/* Conversation discovery stays usable on touch screens without hover. */
.session-filters { display: flex; gap: 4px; padding: 8px 0 12px; flex-shrink: 0; }
.session-filters button { flex: 1; min-height: 40px; padding: 6px 7px; border-radius: 10px; font-size: 13px; color: #666; }
.session-filters button[aria-pressed="true"] { color: #111; background: #eaeaea; font-weight: 600; }
.session-row { display: flex; align-items: center; min-width: 0; border-radius: 10px; }
.session-row .session-choice { flex: 1; min-width: 0; width: 0; }
.pin-session { width: 40px; height: 44px; flex-shrink: 0; font-size: 20px; color: #777; border-radius: 10px; }
.pin-session[aria-pressed="true"] { color: #111; }
.pin-session:hover { background: #eaeaea; }
.code-block { margin: 20px 0; border: 1px solid #ececec; border-radius: 14px; overflow: hidden; background: #f7f7f7; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 14px; background: #eeeeee; font-size: 12px; color: #666; }
.code-toolbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-toolbar button { min-height: 40px; flex-shrink: 0; font-size: 12px; }
.message-body .code-block pre { margin: 0; border: 0; border-radius: 0; }
.clipboard-fallback { position: fixed; left: -9999px; top: 0; font-size: 16px; }
.message-body li>p { margin: 10px 0; }
.chat-scroll { overflow-anchor: none; }

/* Visible task progress without relying on desktop hover tooltips. */
.session-subtitle { display: flex; justify-content: center; align-items: center; gap: 5px; min-width: 0; margin-top: 2px; font-size: 11px; line-height: 1.5; color: #6b6b6b; white-space: nowrap; }
#folder-title { overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
#run-status { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.run-elapsed { flex-shrink: 0; color: #777; font-variant-numeric: tabular-nums; }
.send-button[aria-busy="true"] svg { display: none; }
.send-button[aria-busy="true"]::after { content: ''; width: 17px; height: 17px; border: 2px solid #999; border-top-color: #222; border-radius: 50%; animation: sending-spin .8s linear infinite; }
@keyframes sending-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .send-button[aria-busy="true"]::after { animation: none; } }
.table-block { max-width: 100%; min-width: 0; margin: 18px 0; }
.table-block .table-wrap { margin: 0; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.message-body .table-scroll-hint { margin: 0 0 7px; font-size: 12px; color: #707070; }
.message-body th,.message-body td { min-width: 9rem; max-width: 28rem; overflow-wrap: break-word; word-break: normal; vertical-align: top; }
.message-body th:first-child,.message-body td:first-child { min-width: 6rem; }
.message-body th:last-child,.message-body td:last-child { min-width: 14rem; }
@media (max-width:767px) {
  .chat-header { height: calc(78px + env(safe-area-inset-top)); }
  .header-copy { padding-block: 3px; }
  .session-heading h1 { font-size: 16px; }
  .session-subtitle #folder-title,.session-subtitle .subtitle-divider { display: none; }
  .session-subtitle { font-size: 11px; gap: 7px; }
}
.jump-button.has-new-replies { display: flex; align-items: center; justify-content: center; gap: 7px; width: auto; min-width: 120px; height: 40px; padding: 0 14px; border-radius: 24px; font-size: 13px; color: #1a5fb4; }
.unread-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: #1a5fb4; font-size: 12px; scroll-margin-top: 18px; }
.unread-divider::before,.unread-divider::after { content: ''; height: 1px; background: #d8e4f0; flex: 1; }
.draft-image-open { display: block; padding: 0; border-radius: 8px; }
.draft-image-open:hover { opacity: .85; }

/* Keep project navigation alongside the conversation when there is room. */
@media (min-width: 1024px) {
  .sidebar { width: 280px; transform: translateX(0); transition: none; }
  .chat-shell { left: 280px; width: calc(100% - 280px); }
  .desktop-sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .desktop-sidebar-collapsed .chat-shell { left: 0; width: 100%; }
  .drawer-overlay { display: none; }
}
