:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
  --bg: #ffffff;
  --sidebar: #f7f7f5;
  --surface: #ffffff;
  --soft: #f5f5f3;
  --hover: #eeeeeb;
  --selected: #e9e9e6;
  --border: #e7e7e3;
  --text: #252521;
  --muted: #73736f;
  --muted-strong: #55554f;
  --accent: #22221e;
  --focus: #7b9ccb;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, textarea, select, input { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, textarea:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-shell, .codex-shell { min-height: 100dvh; width: 100%; }
.codex-shell { display: flex; height: 100dvh; overflow: hidden; }
.icon-rail { width: 62px; flex: 0 0 62px; background: #fbfaf9; border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 11px; padding: 52px 6px 14px; }
.rail-button { width: 43px; height: 43px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; color: #80807d; background: transparent; }
.rail-button:hover, .rail-button.rail-active { background: #efeeec; color: #262622; }
.rail-button svg { width: 22px; height: 22px; }
.rail-spacer { flex: 1; }
.rail-avatar { width: 31px; height: 31px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #1b9e8c; color: #fff; font-size: 11px; font-weight: 650; }
.sidebar { width: 430px; flex: 0 0 430px; background: #fbfaf9; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar-top { height: 65px; padding: 0 19px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-brand { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 640; letter-spacing: -.035em; }
.codex-mark, .welcome-symbol, .message-mark { display: inline-flex; align-items: center; justify-content: center; }
.codex-mark svg { width: 23px; height: 23px; stroke-width: 1.55; }
.new-chat-button { margin: 8px 12px 19px; display: flex; align-items: center; gap: 11px; min-height: 40px; width: calc(100% - 24px); padding: 0 10px; background: transparent; border: 0; border-radius: 8px; font-weight: 500; text-align: left; }
.new-chat-button:hover, .sidebar-row:hover { background: var(--hover); }
.new-chat-button svg { width: 18px; height: 18px; }
.sidebar-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 20px; scrollbar-color: #d6d6d2 transparent; scrollbar-width: thin; }
.sidebar-section { margin-bottom: 22px; }
.sidebar-section h2 { color: #858580; font-size: 14px; line-height: 1.4; font-weight: 600; margin: 0 9px 8px; }
.sidebar-list { display: grid; gap: 2px; }
.sidebar-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 37px; border: 0; border-radius: 8px; background: transparent; padding: 6px 9px; text-align: left; font-size: 14px; }
.sidebar-row.selected { background: var(--selected); font-weight: 600; }
.row-icon { flex: 0 0 18px; display: inline-flex; }
.row-icon svg, .sidebar-footer svg { width: 17px; height: 17px; }
.row-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; }
.sidebar-running { width: 6px; height: 6px; background: #4b8f66; border-radius: 50%; flex: 0 0 6px; }
.sidebar-empty { color: var(--muted); font-size: 13px; margin: 4px 10px 0; }
.sidebar-footer { padding: 11px 12px 16px; border-top: 1px solid var(--border); }
.main-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; background: var(--bg); }
.codex-topbar { height: 65px; min-height: 65px; display: flex; align-items: center; gap: 13px; padding: 0 28px; border-bottom: 1px solid var(--border); }
.topbar-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.topbar-title strong { font-size: 16px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-status { margin-left: auto; flex: none; color: var(--muted-strong); font-size: 12px; }
.topbar-status.running { color: #26754c; }
.topbar-status.failed { color: #aa453f; }
.welcome-panel { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 42px 24px 80px; }
.welcome-inner { width: min(100%, 720px); text-align: center; margin-top: -50px; }
.welcome-symbol svg { width: 36px; height: 36px; stroke-width: 1.25; }
.welcome-inner h1 { margin: 19px 0 3px; font-size: clamp(25px, 4vw, 32px); font-weight: 600; letter-spacing: -.045em; line-height: 1.22; }
.welcome-inner p { color: var(--muted); margin: 0 0 31px; font-size: 14px; }
.codex-composer { width: min(100%, 920px); background: var(--surface); border: 1px solid #e4e4e1; border-radius: 22px; box-shadow: 0 5px 22px rgba(25,25,20,.045); padding: 12px 17px 11px; text-align: left; }
.codex-composer:focus-within { border-color: #aaa9a3; box-shadow: 0 8px 34px rgba(25,25,20,.075); }
.project-selector-label { display: flex; align-items: center; gap: 8px; color: var(--muted-strong); font-size: 12px; font-weight: 600; margin: 1px 1px 10px; }
.project-selector-label select { max-width: min(100%, 330px); min-height: 30px; padding: 2px 24px 2px 8px; color: var(--text); background: var(--soft); border: 1px solid var(--border); border-radius: 7px; font-size: 12px; }
.codex-composer textarea { display: block; width: 100%; min-height: 70px; max-height: 240px; resize: vertical; background: transparent; border: 0; outline: 0; color: var(--text); padding: 3px 5px; font-size: 15px; line-height: 1.5; }
.codex-composer textarea::placeholder { color: #969690; }
.codex-composer textarea:disabled { cursor: not-allowed; }
.composer-bottom { display: flex; justify-content: space-between; align-items: end; gap: 12px; min-height: 34px; }
.composer-hint { color: #92928d; font-size: 11px; padding: 0 5px 4px; }
.send-button { width: 32px; height: 32px; flex: 0 0 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; background: var(--accent); color: #fff; }
.send-button:hover:not(:disabled) { background: #454540; }
.send-button:disabled { opacity: .35; cursor: not-allowed; }
.send-button svg { width: 17px; height: 17px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.codex-messages { width: 100%; min-height: 0; flex: 1; overflow: auto; padding: 38px max(28px, calc((100% - 760px)/2)) 16px; scroll-behavior: auto; }
.codex-message { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 29px; max-width: 100%; }
.codex-message.user { justify-content: flex-end; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.66; font-size: 14px; max-width: 100%; }
.codex-message.user .message-content { background: var(--soft); border-radius: 14px; padding: 10px 14px; max-width: min(100%, 620px); }
.message-mark { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; color: var(--text); }
.message-mark svg { width: 19px; height: 19px; }
.codex-message.system .message-content { color: var(--muted); font-size: 12px; }
.codex-activity { display: flex; align-items: center; gap: 9px; color: var(--muted-strong); font-size: 13px; margin: 5px 0 22px 36px; }
.pulse-dot { width: 7px; height: 7px; background: #57916c; border-radius: 50%; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }
.chat-input-area { width: 100%; padding: 12px max(28px, calc((100% - 920px)/2)) 18px; background: linear-gradient(0deg,#fff 85%,rgba(255,255,255,.92)); }
.chat-input-area .codex-composer { width: 100%; }
.chat-input-area .codex-composer { padding-top: 10px; padding-bottom: 8px; }
.chat-input-area .codex-composer textarea { min-height: 34px; }
.running-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.stop-button { min-height: 32px; border: 1px solid var(--border); border-radius: 7px; padding: 3px 12px; background: var(--surface); }
.stop-button:hover { background: var(--hover); }
.privacy-note { text-align: center; font-size: 11px; margin: 9px 0 0; color: #9b9b96; }
.toast { position: fixed; z-index: 90; bottom: 25px; left: 50%; transform: translateX(-50%); max-width: min(90vw,500px); padding: 10px 16px; background: var(--text); color: #fff; box-shadow: 0 10px 30px #0002; border-radius: 8px; font-size: 13px; }
.mobile-only { display: none; }
.icon-button { border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; }
.icon-button.mobile-only { display: none; }
.icon-button:hover { background: var(--hover); }
.sidebar-scrim { display: none; }

.login-screen { display: flex; min-height: 100dvh; align-items: center; justify-content: center; padding: 24px; background: var(--sidebar); }
.login-card { width: min(100%, 380px); background: #fff; border: 1px solid var(--border); box-shadow: 0 18px 55px rgba(20,20,15,.07); border-radius: 18px; padding: 32px; }
.login-card .brand-mark { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; }
.login-card .brand-mark svg { width: 30px; height: 30px; }
.login-card h1 { font-size: 24px; line-height: 1.2; margin: 17px 0 6px; letter-spacing: -.035em; }
.login-card p { color: var(--muted); margin: 0 0 23px; font-size: 14px; }
.login-card .field { display: grid; gap: 7px; margin-bottom: 16px; font-size: 13px; font-weight: 600; }
.login-card input { width: 100%; height: 44px; border: 1px solid #d8d8d4; border-radius: 8px; padding: 0 12px; background: #fff; color: var(--text); }
.primary-button { min-height: 42px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; padding: 9px 15px; }
.primary-button:hover { background: #44443e; }
.primary-button:disabled { opacity: .5; cursor: not-allowed; }
.login-card .primary-button { width: 100%; }
.error-text { color: #a93833 !important; margin: 13px 0 0 !important; font-size: 13px !important; }

@media (max-width: 760px) {
  .icon-rail { display: none; }
  .sidebar { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(82vw, 290px); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 30px #00000012; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.visible { display: block; position: fixed; inset: 0; z-index: 50; background: #0006; }
  .icon-button.mobile-only { display: inline-flex; }
  .codex-topbar { padding: 0 13px; height: 58px; min-height: 58px; }
  .topbar-title { flex: 1; }
  .topbar-status { max-width: 85px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .welcome-panel { padding: 30px 20px 55px; align-items: center; }
  .welcome-inner { margin-top: -30px; }
  .welcome-inner p { margin-bottom: 22px; }
  .codex-messages { padding: 24px 18px 10px; }
  .chat-input-area { padding: 10px 13px calc(12px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .codex-composer textarea { min-height: 68px; font-size: 16px; }
  .new-chat-button, .sidebar-row { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Desktop layout follows the four-pane Codex window reference. */
.codex-shell { display: grid; grid-template-columns: 62px 430px minmax(0,1fr); grid-template-rows: 47px minmax(0,1fr); }
.codex-shell:has(.preview-panel) { grid-template-columns: 62px 430px minmax(0,1fr) 403px; }
.window-bar { grid-column: 1 / -1; grid-row: 1; min-width: 0; display: flex; align-items: center; gap: 17px; padding: 0 17px; background: #edf2f5; border-bottom: 1px solid #dfe4e7; color: #40464a; font-size: 13px; }
.window-navigation, .window-menu { display: flex; align-items: center; gap: 8px; }
.window-menu { gap: 20px; }
.window-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; }
.window-icon:hover { background: #dce3e7; }
.window-icon svg { width: 16px; height: 16px; }
.forward-icon svg { transform: rotate(180deg); }
.window-divider { width: 1px; height: 18px; background: #cbd3d8; margin: 0 3px; }
.window-name { margin-left: auto; color: #7b8388; font-size: 12px; }
.icon-rail { grid-column: 1; grid-row: 2; width: 62px; min-height: 0; padding-top: 16px; }
.sidebar { grid-column: 2; grid-row: 2; width: 430px; min-height: 0; }
.main-panel { grid-column: 3; grid-row: 2; min-width: 0; }
.sidebar-top { justify-content: flex-start; gap: 7px; }
.sidebar-brand { margin-right: auto; font-size: 18px; }
.brand-chevron { color: #858585; font-size: 22px; line-height: 1; margin-top: -7px; font-weight: 400; }
.sidebar-search-button { width: 34px; height: 34px; }
.sidebar-search { padding: 0 14px 8px; }
.sidebar-search[hidden] { display: none; }
.sidebar-search input { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 0 10px; outline: none; }
.show-more-button { width: 100%; min-height: 33px; border: 0; border-radius: 7px; background: transparent; text-align: left; padding: 5px 10px; color: var(--muted); font-size: 13px; }
.show-more-button:hover { background: var(--hover); color: var(--text); }
.chat-link { padding-left: 10px; }
.sidebar-list { grid-template-columns: minmax(0,1fr); }
.sidebar-row, .row-label { min-width: 0; }
.chat-link[hidden] { display: none; }
.topbar-folder { display: inline-flex; color: #7d7d78; }
.topbar-folder svg { width: 19px; height: 19px; }
.topbar-panel-button { margin-left: auto; }
.topbar-status + .topbar-panel-button { margin-left: 0; }
.preview-panel { grid-column: 4; grid-row: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; border-left: 1px solid #e4e4e1; }
.preview-tabs { height: 65px; min-height: 65px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 11px 0 15px; }
.preview-tab { display: inline-flex; align-items: center; gap: 9px; padding: 0 10px; height: 41px; border-radius: 8px; background: #f4f4f2; font-size: 13px; font-weight: 550; }
.preview-tab svg { width: 16px; height: 16px; }
.preview-toolbar { display: flex; align-items: center; gap: 9px; height: 54px; min-height: 54px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.preview-site-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #151515; color: white; font-size: 12px; font-weight: 700; }
.preview-address { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #6f6f6c; font-size: 12px; }
.preview-toolbar .icon-button svg { width: 16px; height: 16px; }
.preview-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.preview-symbol { width: 58px; height: 58px; display: inline-flex; align-items: center; justify-content: center; border-radius: 17px; background: #f3f3f1; color: #50504b; }
.preview-symbol svg { width: 27px; height: 27px; }
.preview-body h2 { font-size: 16px; font-weight: 600; margin: 20px 0 5px; }
.preview-body p { color: var(--muted); font-size: 13px; margin: 0 0 23px; overflow-wrap: anywhere; }
.preview-body p strong { color: var(--text); font-weight: 550; }
.preview-open { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 13px; border-radius: 8px; background: #262622; color: #fff; font-size: 13px; }
.preview-open:hover { background: #474741; }
.preview-open svg { width: 15px; height: 15px; }
.chat-input-area { padding-bottom: 19px; }
.chat-input-area .codex-composer { min-height: 103px; }
.chat-input-area .codex-composer textarea { min-height: 39px; }
@media (max-width: 1500px) {
  .codex-shell:has(.preview-panel) { grid-template-columns: 62px 430px minmax(0,1fr); }
  .preview-panel, .topbar-panel-button, #window-panel { display: none; }
}
@media (max-width: 950px) {
  .codex-shell, .codex-shell:has(.preview-panel) { grid-template-columns: 62px 280px minmax(0,1fr); }
  .sidebar { width: 280px; }
  .window-menu { display: none; }
}
@media (max-width: 760px) {
  .codex-shell, .codex-shell:has(.preview-panel) { display: flex; flex-direction: column; }
  .window-bar { height: 33px; min-height: 33px; padding: 0 13px; }
  .window-navigation { display: none; }
  .window-name { margin: 0; }
  .sidebar { width: min(82vw, 290px); }
  .main-panel { flex: 1; min-height: 0; }
  .topbar-folder { display: none; }
  .topbar-panel-button { display: none; }
}

/* A single dedicated workspace needs no project navigation or picker. */
.single-workspace .sidebar-section:has(#projects-heading),
.single-workspace #rail-projects,
.single-workspace .project-selector-label,
.single-workspace .welcome-inner > p,
.single-workspace .topbar-title span { display: none; }

/* Files, readable answers and mobile workspace controls. */
:root { --accent: #2563eb; --focus: #2563eb; --muted: #64676e; --file-bg: #f8fafc; --file-border: #dbe3ec; --error: #b42318; }
.send-button, .icon-button, .window-icon, .stop-button { min-width: 44px; min-height: 44px; touch-action: manipulation; }
.icon-button:active, .send-button:active, .file-download:active { filter: brightness(.9); }
.send-button { flex-basis: 44px; border-radius: 13px; }
.send-button:hover:not(:disabled), .primary-button:hover { background: #1d4ed8; }
.composer-bottom { align-items: center; }
.composer-tools { display: flex; align-items: center; gap: 9px; min-width: 0; }
.model-label { color: #344054; font-size: 12px; font-weight: 600; line-height: 1.5; }
.model-label > span { color: #667085; font-weight: 400; white-space: nowrap; }
.upload-hint { color: #667085; font-size: 11px; margin: 6px 4px 0; }
.codex-composer { transition: border-color .18s ease, box-shadow .18s ease; }
.codex-composer.drag-over { border: 2px dashed var(--accent); background: #eff6ff; }
.codex-composer textarea { max-height: min(30dvh, 240px); }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-list:not(:empty) { margin-bottom: 10px; }
.attachment-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--file-border); background: var(--file-bg); padding: 4px 3px 4px 10px; border-radius: 12px; max-width: 100%; min-width: 0; }
.attachment-chip > svg { flex: 0 0 20px; width: 20px; height: 20px; color: #475467; }
.attachment-chip > div { min-width: 0; }
.attachment-chip strong { display: block; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip span { display: block; font-size: 11px; color: #667085; overflow-wrap: anywhere; }
.attachment-chip progress { display: block; height: 4px; width: 100%; accent-color: var(--accent); }
.attachment-chip .icon-button { flex: 0 0 44px; }
.attachment-chip.upload-error { border-color: #fda29b; background: #fff7f6; }
.attachment-chip.upload-error span { color: var(--error); }
.message-stack { min-width: 0; max-width: 100%; flex: 1; }
.codex-message.user .message-stack { flex: 0 1 auto; max-width: min(100%, 620px); }
.message-content { font-size: 15px; }
.message-content.markdown { white-space: normal; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 15px; }
.markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 22px 0 9px; line-height: 1.35; }
.markdown h2 { font-size: 21px; }
.markdown h3 { font-size: 18px; }
.markdown ul, .markdown ol { padding-left: 24px; margin: 0 0 16px; }
.markdown li { padding-left: 3px; margin: 5px 0; }
.markdown a { color: #1d4ed8; text-decoration: underline; text-underline-offset: 3px; }
.markdown code { padding: 2px 5px; background: #f0f2f5; border-radius: 5px; font-size: .87em; font-family: ui-monospace, Consolas, monospace; }
.markdown blockquote { margin: 16px 0; padding: 4px 0 4px 14px; border-left: 3px solid #cbd5e1; color: #475467; }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 23px 0; }
.code-block { margin: 16px 0; overflow: hidden; border: 1px solid var(--file-border); border-radius: 12px; background: #f8fafc; }
.code-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding-left: 13px; color: #475467; background: #eef2f6; font-size: 12px; }
.copy-code { min-height: 44px; padding: 0 13px; border: 0; background: transparent; color: #344054; font-size: 12px; }
.copy-code:hover { background: #dfe7ef; }
.code-block pre { margin: 0; padding: 14px; max-width: 100%; overflow-x: auto; white-space: pre; }
.code-block pre code { padding: 0; background: transparent; white-space: pre; }
.table-scroll { overflow: auto; max-width: 100%; margin: 16px 0; border: 1px solid var(--file-border); border-radius: 10px; }
.markdown table { border-collapse: collapse; min-width: 100%; font-size: 13px; }
.markdown th, .markdown td { padding: 9px 12px; min-width: 100px; border-bottom: 1px solid var(--file-border); text-align: left; vertical-align: top; }
.markdown th { background: #f1f5f9; font-weight: 600; }
.markdown tr:last-child td { border-bottom: 0; }
.file-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: 100%; margin-top: 10px; }
.file-card { min-width: 0; overflow: hidden; border: 1px solid var(--file-border); border-radius: 12px; background: var(--file-bg); }
.file-card-row { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; }
.file-card-icon { color: #64748b; display: flex; flex: 0 0 20px; }
.file-card-icon svg { width: 20px; height: 20px; }
.file-card-copy { flex: 1; min-width: 0; }
.file-card-copy strong { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; font-weight: 600; }
.file-card-copy span { display: block; color: #667085; font-size: 11px; margin-top: 2px; }
.file-download { flex: 0 0 44px; background: white; border: 1px solid var(--file-border); color: #1d4ed8; }
.file-image-link { display: grid; place-items: center; aspect-ratio: 4 / 3; max-height: 430px; overflow: hidden; background: #e8edf2; text-align: center; }
.file-image { display: block; max-width: 100%; width: 100%; height: 100%; max-height: 430px; min-height: 0; object-fit: contain; }
.file-preview-link { display: flex; gap: 7px; align-items: center; min-height: 44px; padding: 8px 12px; border-top: 1px solid var(--file-border); color: #1d4ed8; font-size: 12px; }
.file-preview-link svg { width: 14px; height: 14px; }
.files-panel-body { min-height: 0; flex: 1; overflow: auto; padding: 18px 16px; }
.files-intro { margin: 0 0 15px; color: #667085; font-size: 12px; }
.files-empty { text-align: center; color: #667085; font-size: 13px; padding: 50px 16px; }
.files-empty > svg { width: 32px; height: 32px; color: #94a3b8; }
.files-editor-link { display: flex; min-height: 54px; align-items: center; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--border); color: #475467; font-size: 12px; }
.files-editor-link svg { width: 16px; height: 16px; }
.topbar-panel-button { display: inline-flex; }
.privacy-note { color: #667085; }
@media (min-width: 1501px) {
  .codex-shell { grid-template-columns: 54px 280px minmax(0,1fr); }
  .codex-shell:has(.preview-panel) { grid-template-columns: 54px 280px minmax(0,1fr) 330px; }
  .sidebar { width: 280px; }
  .icon-rail { width: 54px; }
}
@media (min-width: 761px) and (max-width: 1500px) {
  .codex-shell, .codex-shell:has(.preview-panel) { grid-template-columns: 54px 250px minmax(0,1fr); }
  .sidebar { width: 250px; }
  .icon-rail { width: 54px; }
}
@media (max-width: 1500px) {
  .preview-panel { display: flex; position: fixed; z-index: 45; right: 0; top: 47px; bottom: 0; width: min(420px, 90vw); box-shadow: -20px 0 60px #0f172a26; border-left: 1px solid var(--file-border); }
  .topbar-panel-button { display: inline-flex; }
  .topbar-status { margin-left: auto; }
}
@media (max-width: 760px) {
  .window-bar { display: none; }
  .codex-topbar { min-height: 64px; height: 64px; gap: 6px; padding: env(safe-area-inset-top) 8px 0; }
  .preview-panel { top: 0; z-index: 65; width: min(420px, 100vw); padding-top: env(safe-area-inset-top); }
  .preview-tabs { height: 64px; min-height: 64px; }
  .topbar-title strong { font-size: 14px; }
  .topbar-title span { font-size: 11px; }
  .topbar-status { font-size: 10px; max-width: 64px; }
  .welcome-panel { padding: 24px 14px; }
  .welcome-inner { margin-top: 0; }
  .codex-messages { padding: 22px 14px 10px; }
  .codex-message { gap: 8px; }
  .message-mark { width: 18px; flex-basis: 18px; }
  .message-mark svg { width: 18px; }
  .message-content { font-size: 16px; }
  .codex-composer { border-radius: 18px; padding-left: 10px; padding-right: 10px; }
  .project-selector-label { align-items: start; flex-direction: column; font-size: 12px; }
  .project-selector-label select { width: 100%; max-width: 100%; min-height: 44px; font-size: 16px; }
  .model-label { font-size: 11px; }
  .composer-tools { gap: 4px; }
  .upload-hint { font-size: 10px; }
  .attachment-chip { width: 100%; }
  .attachment-chip > div { flex: 1; }
  .attachment-chip strong { max-width: none; }
  .chat-input-area { padding: 8px 10px calc(9px + env(safe-area-inset-bottom)); }
  .privacy-note { font-size: 10px; margin-top: 7px; }
  .running-actions { font-size: 10px; }
  .files-editor-link { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) and (max-height: 520px) {
  .privacy-note, .upload-hint { display: none; }
  .chat-input-area .codex-composer { min-height: 0; }
  .codex-composer textarea { min-height: 34px; max-height: 90px; }
}

/* Separate file downloads and image export settings. */
.bulk-download-tools { padding: 0 0 17px; margin-bottom: 15px; border-bottom: 1px solid var(--file-border); }
.bulk-selection-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 9px; }
.bulk-select-all { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; font-size: 12px; cursor: pointer; }
.bulk-select-all input, .file-select input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: 0 0 18px; }
.text-button { background: transparent; border: 0; color: #1d4ed8; padding: 7px; min-height: 44px; font-size: 12px; }
.bulk-download-tools .primary-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; font-size: 12px; width: 100%; padding: 10px; }
.bulk-download-tools .primary-button svg { flex: 0 0 17px; }
.bulk-download-tools .primary-button span { white-space: nowrap; }
.bulk-download-note { color: #667085; font-size: 11px; margin: 9px 0; line-height: 1.5; }
.bulk-download-status { font-size: 12px; color: #344054; overflow-wrap: anywhere; }
.bulk-download-status:not(:empty) { margin: 10px 0; }
.secondary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 8px 13px; color: #344054; background: #fff; border: 1px solid var(--file-border); border-radius: 8px; font-size: 12px; cursor: pointer; }
.secondary-button:hover { background: #f1f5f9; }
.secondary-button:disabled { opacity: .5; cursor: not-allowed; }
.file-select { display: inline-flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; flex: 0 0 44px; cursor: pointer; margin-left: -8px; }
.image-export-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; border: 0; border-top: 1px solid var(--file-border); background: transparent; color: #1d4ed8; text-align: left; padding: 10px 12px; font-size: 12px; }
.image-export-button span { color: #667085; font-size: 11px; text-align: right; }
.image-export-button:hover { background: #eff6ff; }
.export-dialog { width: min(540px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); margin: auto; padding: 22px; border: 1px solid var(--file-border); border-radius: 18px; background: #fff; color: var(--text); box-shadow: 0 24px 80px #0f172a33; overflow: auto; }
.export-dialog::backdrop { background: #0f172a80; }
.export-dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.export-dialog-heading h2 { font-size: 21px; line-height: 1.3; margin: 0 0 5px; }
.export-dialog-heading p { margin: 0 0 18px; color: #667085; font-size: 12px; overflow-wrap: anywhere; }
.export-dialog-heading .icon-button { flex: 0 0 44px; margin-top: -8px; margin-right: -8px; }
.export-source-size { margin: 0 0 18px; font-size: 13px; color: #475467; }
.export-field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: #344054; min-width: 0; }
.export-field select, .export-field input { width: 100%; min-height: 46px; min-width: 0; border: 1px solid #cbd5e1; border-radius: 9px; padding: 8px 10px; background: #fff; color: #1e293b; font-size: 15px; font-weight: 400; }
.export-dimensions { padding: 0; margin: 18px 0 12px; border: 0; min-width: 0; }
.export-dimensions legend { padding: 0; margin-bottom: 8px; color: #344054; font-size: 13px; font-weight: 600; }
.export-dimensions:disabled { opacity: .5; }
.export-dimensions-row { display: flex; align-items: end; gap: 10px; margin-top: 12px; }
.export-dimensions-row > label { flex: 1; }
.export-dimensions-row > span { padding-bottom: 11px; color: #667085; }
.export-help { color: #667085; font-size: 12px; line-height: 1.55; margin: 11px 0; }
.export-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.export-actions button { flex: 1; white-space: nowrap; }
.export-actions .primary-button { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; min-height: 44px; }
#export-status { font-size: 12px; color: #344054; margin: 10px 0; }
@media (max-width: 760px) {
  .export-dialog { padding: 19px 16px; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .export-field select, .export-field input { font-size: 16px; }
  .export-dialog-heading h2 { font-size: 20px; }
}
