:root {
  color-scheme: light;
  --ink: #17211d;
  --ink-2: #26342e;
  --paper: #f3f0e7;
  --paper-2: #faf8f1;
  --line: #d7d5ca;
  --muted: #777b73;
  --accent: #c9f27c;
  --danger: #b53a43;
  --shadow: 0 24px 80px rgba(23, 33, 29, 0.16);
  font-family: "Segoe UI Variable", "Aptos", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(73, 132, 93, .28); outline-offset: 2px; }
.hidden { display: none !important; }

.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.eyebrow.dark { color: #667068; }
.button { min-height: 43px; border: 0; border-radius: 5px; padding: 0 18px; font-size: 13px; font-weight: 750; transition: transform .18s, background .18s, color .18s; }
.button:hover { transform: translateY(-1px); }
.button-accent { background: var(--accent); color: var(--ink); }
.button-accent-dark { background: var(--ink); color: var(--accent); }
.button-dark { background: var(--ink); color: white; }
.button-outline { border: 1px solid #b9bdb5; background: transparent; color: var(--ink); }
.button-ghost { background: transparent; color: #626760; }
.button-danger { border: 1px solid #e0bdc0; color: var(--danger); background: #fff7f7; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; display: grid; place-items: center; font-weight: 800; }
.icon-button:hover { background: rgba(23, 33, 29, .08); }
.icon-button.light { color: white; }
.icon-button.light:hover { background: rgba(255,255,255,.12); }

/* Login */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr); background: var(--paper-2); }
.login-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; background: var(--ink); isolation: isolate; }
.login-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(145deg, rgba(201,242,124,.12), transparent 38%), repeating-linear-gradient(0deg, transparent 0 39px, rgba(255,255,255,.035) 40px), repeating-linear-gradient(90deg, transparent 0 39px, rgba(255,255,255,.035) 40px); z-index: -2; }
.login-art::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: rgba(201,242,124,.06); filter: blur(1px); z-index: -1; }
.orbit { position: absolute; border: 1px solid rgba(201,242,124,.28); border-radius: 50%; animation: orbit 18s linear infinite; }
.orbit::after { content: ""; position: absolute; top: 50%; left: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.orbit-one { width: 380px; height: 380px; }
.orbit-two { width: 560px; height: 560px; animation-direction: reverse; animation-duration: 27s; }
@keyframes orbit { to { transform: rotate(360deg); } }
.login-mark { width: 148px; height: 148px; display: grid; place-items: center; border-radius: 30px; background: transparent; box-shadow: 0 0 0 14px rgba(23,33,29,.72), 0 20px 48px rgba(0,0,0,.28); }
.login-mark img { width: 100%; height: 100%; display: block; border-radius: 30px; object-fit: cover; }
.login-art p { margin: 48px 0 0; font: 700 11px/1.7 "Bahnschrift", sans-serif; letter-spacing: .28em; text-align: center; color: rgba(255,255,255,.58); }
.login-panel { padding: clamp(50px, 9vw, 130px); display: flex; flex-direction: column; justify-content: center; position: relative; }
.login-panel::before { content: "01 / SERVER ACCESS"; position: absolute; right: 48px; top: 40px; font: 700 10px "Bahnschrift", sans-serif; letter-spacing: .2em; color: #979b93; }
.login-copy h1 { max-width: 650px; margin: 20px 0 24px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(45px, 5.5vw, 80px); line-height: .98; font-weight: 400; letter-spacing: -.045em; }
.login-copy p { max-width: 510px; color: #666b64; font-size: 17px; line-height: 1.65; }
.login-form { margin-top: 58px; max-width: 570px; }
.login-form label { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 750; letter-spacing: .06em; }
.login-username { width: 100%; height: 49px; margin: 0 0 18px; border: 1px solid #c8c8bf; background: white; padding: 0 15px; border-radius: 5px; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.password-row input { height: 49px; border: 1px solid #c8c8bf; background: white; padding: 0 15px; border-radius: 5px; }
.login-form small { display: block; margin-top: 12px; color: #8a8d87; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }

/* Main shell */
.app-shell { height: 100vh; display: grid; grid-template-columns: 290px 1fr; background: var(--paper); }
.projects-panel { min-width: 0; min-height: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding: 13px 12px 12px; color: white; background: var(--ink); }
.brand { border: 0; background: transparent; color: white; display: flex; align-items: center; gap: 10px; padding: 0 7px 13px; text-align: left; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; color: var(--accent); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 21px; font-weight: 400; }
.brand small { display: block; margin-top: 1px; font: 700 8px "Bahnschrift", sans-serif; color: rgba(255,255,255,.45); letter-spacing: .18em; }
.panel-section-title { display: flex; align-items: center; justify-content: space-between; padding: 17px 9px 10px; border-top: 1px solid rgba(255,255,255,.1); }
.panel-section-title span { font: 700 10px "Bahnschrift", sans-serif; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .16em; }
.project-list-actions { display: flex; align-items: center; gap: 4px; }
.archive-projects-toggle { min-height: 26px; padding: 0 7px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: rgba(255,255,255,.42); font-size: 8px; }
.archive-projects-toggle b { min-width: 14px; margin-left: 3px; padding: 1px 4px; border-radius: 8px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.56); font-size: 7px; }
.archive-projects-toggle:hover, .archive-projects-toggle[aria-pressed="true"] { border-color: rgba(201,242,124,.25); background: rgba(201,242,124,.09); color: var(--accent); }
.projects-list { display: flex; min-height: 0; flex: 1 1 220px; max-height: none; flex-direction: column; gap: 4px; padding-right: 3px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: rgba(201,242,124,.35) transparent; }
.projects-list::-webkit-scrollbar, #codex-sidebar-tree-list::-webkit-scrollbar, .project-file-tree::-webkit-scrollbar, .chats-list::-webkit-scrollbar { width: 6px; }
.projects-list::-webkit-scrollbar-thumb, #codex-sidebar-tree-list::-webkit-scrollbar-thumb, .project-file-tree::-webkit-scrollbar-thumb, .chats-list::-webkit-scrollbar-thumb { border-radius: 6px; background: rgba(201,242,124,.3); }
.project-tone-0 { --project-color: #c9f27c; }
.project-tone-1 { --project-color: #ffb86b; }
.project-tone-2 { --project-color: #79c7ff; }
.project-tone-3 { --project-color: #ff8fa3; }
.project-tone-4 { --project-color: #c9a7ff; }
.project-tone-5 { --project-color: #72dfc1; }
.project-nav-item { width: 100%; border: 0; border-radius: 7px; background: transparent; padding: 7px 8px; color: white; display: flex; align-items: center; gap: 8px; text-align: left; transition: background .18s; }
.project-nav-item:hover { background: rgba(255,255,255,.07); }
.project-nav-item.active { background: rgba(255,255,255,.12); }
.project-nav-item.archived { opacity: .58; }
.project-nav-item.working { background: rgba(201,242,124,.08); box-shadow: inset 2px 0 var(--accent); }
.project-nav-item.working i { animation: liveProjectPulse 1.25s ease-in-out infinite; }
.project-nav-item i { flex: 0 0 29px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 6px; background: var(--project-color); color: var(--ink); font: normal 700 12px Georgia, serif; }
.project-nav-item span { min-width: 0; }
.project-nav-item strong, .project-nav-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-nav-item strong { font-size: 13px; }
.project-nav-item small { margin-top: 3px; font-size: 10px; color: rgba(255,255,255,.42); }
.project-nav-item.archived small::before { content: "АРХИВ · "; color: var(--accent); font-size: 7px; letter-spacing: .06em; }
.app-shell.project-open .projects-list { flex: 0 1 auto; max-height: min(20vh, 150px); padding-bottom: 4px; }
.sidebar-footer { flex: 0 0 auto; margin-top: auto; padding: 8px 3px 0; border-top: 1px solid rgba(255,255,255,.1); }
.connection-pill { display: flex; align-items: center; gap: 8px; padding: 7px 7px 13px; color: rgba(255,255,255,.6); font-size: 10px; }
.connection-pill i { width: 7px; height: 7px; border-radius: 50%; background: #a6aaa5; }
.connection-pill.online i { background: var(--accent); box-shadow: 0 0 0 4px rgba(201,242,124,.08); }
.connection-pill.offline i { background: #ff7a7a; }
.connection-pill.checking i { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.sidebar-footer-row { min-width: 0; padding: 5px; display: grid; grid-template-columns: minmax(0, 1fr) 31px 31px; align-items: center; gap: 3px; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; background: rgba(255,255,255,.045); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.sidebar-user { min-width: 0; margin: 0; padding: 4px; display: flex; align-items: center; gap: 8px; border: 0; }
.sidebar-user > i { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--ink); font: normal 700 12px Georgia, serif; }
.sidebar-user span { min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: white; font-size: 11px; }
.sidebar-user small { margin-top: 2px; color: rgba(255,255,255,.4); font-size: 9px; }
.sidebar-footer-action { width: 31px; height: 31px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: rgba(255,255,255,.55); font-size: 14px; transition: background .16s, color .16s, transform .16s; }
.sidebar-footer-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-footer-action:hover { color: var(--accent); background: rgba(201,242,124,.11); transform: translateY(-1px); }
.sidebar-footer-action.logout:hover { color: #ffafb5; background: rgba(255,143,163,.11); }
.sidebar-action { width: 100%; border: 0; border-radius: 5px; background: transparent; color: rgba(255,255,255,.62); padding: 9px 7px; display: flex; justify-content: space-between; font-size: 12px; }
.sidebar-action:hover { background: rgba(255,255,255,.07); color: white; }
.sidebar-action b { color: rgba(255,255,255,.28); font-weight: 400; }
.admin-nav-buttons { flex: 0 0 auto; margin: 9px 4px; display: grid; gap: 5px; }
.codex-nav-button { width: 100%; margin: 0; padding: 11px 9px; border: 1px solid rgba(201,242,124,.22); border-radius: 7px; background: rgba(201,242,124,.08); color: white; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; text-align: left; }
.codex-nav-button:hover, .codex-nav-button.active { background: rgba(201,242,124,.15); border-color: rgba(201,242,124,.42); }
.codex-nav-button > i { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--ink); font-style: normal; font-size: 18px; }
#codex-button > i { overflow: hidden; border-radius: 8px; background: transparent; }
#codex-button > i img { width: 100%; height: 100%; display: block; object-fit: cover; }
.codex-nav-button strong, .codex-nav-button small { display: block; }
.codex-nav-button strong { font-size: 11px; }.codex-nav-button small { margin-top: 2px; color: rgba(255,255,255,.43); font-size: 8px; }
.codex-nav-button > b { color: var(--accent); font-weight: 400; }
.automation-nav-button { border-color: rgba(121,199,255,.22); background: rgba(121,199,255,.07); }.automation-nav-button:hover, .automation-nav-button.active { border-color: rgba(121,199,255,.4); background: rgba(121,199,255,.14); }.automation-nav-button > i { background: #79c7ff; }

/* Project chats inside the single sidebar */
.sidebar-chats { min-height: 180px; flex: 1 1 auto; margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; overflow: hidden; }
.chats-header { min-height: 38px; padding: 2px 7px 4px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.project-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--project-color, var(--accent)); }
.chats-heading { min-width: 0; }
.chats-heading h2 { margin: 0; color: white; font: 400 14px Georgia, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-tabs { margin: 0 3px 6px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 3px; border-radius: 7px; background: rgba(255,255,255,.06); }
.sidebar-tabs button { min-height: 27px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: rgba(255,255,255,.45); font-size: 8px; font-weight: 700; }
.sidebar-tabs button:hover { color: white; }.sidebar-chats[data-tab="chats"] [data-sidebar-tab="chats"], .sidebar-chats[data-tab="files"] [data-sidebar-tab="files"] { background: rgba(255,255,255,.11); color: var(--accent); }
.sidebar-tabs .sidebar-new-chat { display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid rgba(201,242,124,.18); color: var(--accent); }
.sidebar-new-chat b { font-size: 13px; font-weight: 400; }.sidebar-new-chat:hover { background: rgba(201,242,124,.1) !important; color: var(--accent) !important; }
.sidebar-tab-panel { min-height: 0; flex: 1; display: none; flex-direction: column; overflow: hidden; }.sidebar-chats[data-tab="chats"] .sidebar-chat-tab, .sidebar-chats[data-tab="files"] .sidebar-files-tab { display: flex; }
.new-chat-button { margin: 2px 4px 9px; min-height: 36px; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; background: rgba(255,255,255,.08); color: white; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 10px; font-weight: 750; }
.new-chat-button:hover { background: rgba(255,255,255,.14); }
.new-chat-button span { font-size: 18px; font-weight: 400; }
.chats-label { padding: 2px 9px 6px; color: rgba(255,255,255,.34); font: 700 7px "Bahnschrift", sans-serif; letter-spacing: .16em; }
.chats-list { min-height: 70px; flex: 1; overflow-y: auto; padding: 0 0 10px; }
.chat-list-item { display: grid; grid-template-columns: 1fr auto; align-items: center; border-radius: 6px; }
.chat-list-item:hover { background: rgba(255,255,255,.07); }
.chat-list-item.active { background: rgba(255,255,255,.12); box-shadow: inset 2px 0 var(--accent); }
.chat-open { min-width: 0; border: 0; background: transparent; color: white; padding: 10px 8px 10px 10px; text-align: left; }
.chat-open span, .chat-open small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-open span { font-size: 11px; font-weight: 650; }
.chat-open small { margin-top: 4px; color: rgba(255,255,255,.35); font-size: 8px; }
.chat-delete { opacity: 0; width: 27px; height: 27px; margin-right: 3px; border: 0; border-radius: 50%; background: transparent; color: #ff9fa7; }
.chat-list-item:hover .chat-delete { opacity: 1; }
.chat-delete:hover { background: rgba(255,143,163,.13); }
.empty-list { padding: 25px 12px; text-align: center; color: rgba(255,255,255,.42); }
.empty-list span { font: 400 17px Georgia, serif; }
.empty-list p { font-size: 11px; line-height: 1.5; }
.files-header { min-height: 36px; padding: 4px 8px 5px; display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.4); }
.files-header span { font: 700 8px "Bahnschrift", sans-serif; letter-spacing: .16em; }
.files-header .icon-button { width: 28px; height: 28px; }
.project-file-tree { min-height: 72px; flex: 1 1 auto; overflow-y: auto; padding-bottom: 8px; }
.project-folder-row { min-height: 25px; padding: 6px 7px 3px calc(8px + var(--file-depth, 0) * 12px); color: rgba(255,255,255,.42); font-size: 8px; }
.project-file-row { min-height: 31px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; border-radius: 4px; }
.project-file-row:hover { background: rgba(255,255,255,.07); }
.project-file-open { min-width: 0; padding: 7px 7px 7px calc(8px + var(--file-depth, 0) * 12px); border: 0; background: transparent; color: rgba(255,255,255,.76); text-align: left; }
.project-file-open span, .project-file-open small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.project-file-open span { font-size: 9px; }.project-file-open small { margin-top: 2px; color: rgba(255,255,255,.32); font-size: 7px; }
.project-file-delete { opacity: 0; width: 25px; height: 25px; border: 0; border-radius: 50%; background: transparent; color: #ff9fa7; }.project-file-row:hover .project-file-delete { opacity: 1; }.project-file-delete:hover { background: rgba(255,143,163,.13); }
.project-file-download { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); font-size: 11px; text-decoration: none; }.project-file-download:hover { background: rgba(201,242,124,.1); }
.file-tree-empty { padding: 17px 10px; color: rgba(255,255,255,.37); font-size: 9px; line-height: 1.45; text-align: center; }

.codex-sidebar-tree { min-height: 0; flex: 1; display: flex; flex-direction: column; border-top: 1px solid rgba(255,255,255,.1); }
.codex-sidebar-tree > header { min-height: 51px; padding: 8px 6px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,.1); }
.codex-sidebar-tree > header span, .codex-sidebar-tree > header strong { display: block; }.codex-sidebar-tree > header span { color: var(--accent); font: 700 7px "Bahnschrift", sans-serif; letter-spacing: .15em; }.codex-sidebar-tree > header strong { margin-top: 3px; font: 400 14px Georgia, serif; }
#codex-sidebar-summary { padding: 7px 7px 4px; color: rgba(255,255,255,.38); font-size: 8px; }
.codex-sidebar-filters { padding: 2px 7px 7px; display: flex; flex-wrap: wrap; gap: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.codex-sidebar-filters label { display: flex; align-items: center; gap: 4px; color: rgba(255,255,255,.45); font-size: 7px; cursor: pointer; }
.codex-sidebar-filters input { width: 11px; height: 11px; margin: 0; accent-color: var(--accent); }
#codex-sidebar-tree-list { min-height: 0; overflow-y: auto; padding-bottom: 12px; }
.codex-tree-project { border-bottom: 1px solid rgba(255,255,255,.06); }
.codex-tree-project.archived { opacity: .62; }
.codex-tree-project-row { min-width: 0; display: flex; align-items: stretch; }
.codex-tree-project.working > .codex-tree-project-row > .codex-tree-project-button { background: rgba(201,242,124,.07); box-shadow: inset 2px 0 rgba(201,242,124,.7); }
.codex-tree-project-button { min-width: 0; min-height: 42px; flex: 1 1 auto; padding: 8px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 0; background: transparent; color: white; text-align: left; }
.codex-tree-project-button:hover, .codex-tree-project.active > .codex-tree-project-row > .codex-tree-project-button { background: rgba(255,255,255,.08); }.codex-tree-project-button > i { color: var(--accent); font-style: normal; font-size: 10px; }.codex-tree-project-button strong, .codex-tree-project-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.codex-tree-project-button strong { font-size: 10px; }.codex-tree-project-button small { margin-top: 2px; color: rgba(255,255,255,.33); font-size: 7px; }.codex-tree-project-button > b { color: rgba(255,255,255,.3); font-size: 8px; font-weight: 400; }
.codex-tree-project-new, .codex-tree-project-archive { width: 29px; flex: 0 0 29px; border: 0; background: transparent; color: rgba(255,255,255,.32); opacity: 0; transition: opacity .16s, color .16s, background .16s; }
.codex-tree-project-new { color: var(--accent); font-size: 15px; }
.codex-tree-project-row:hover .codex-tree-project-new, .codex-tree-project-row:hover .codex-tree-project-archive, .codex-tree-project.active .codex-tree-project-new, .codex-tree-project.active .codex-tree-project-archive, .codex-tree-project-new:focus-visible, .codex-tree-project-archive:focus-visible { opacity: 1; }
.codex-tree-project-new:hover { color: var(--ink); background: var(--accent); }
.codex-tree-project-archive:hover { color: var(--accent); background: rgba(201,242,124,.1); }
.codex-tree-threads { padding: 0 0 6px 18px; }
.codex-tree-thread-row { min-width: 0; display: flex; align-items: stretch; position: relative; }
.codex-tree-thread { min-width: 0; min-height: 38px; flex: 1 1 auto; padding: 7px 8px 7px 12px; border: 0; border-left: 1px solid rgba(201,242,124,.2); background: transparent; color: rgba(255,255,255,.67); text-align: left; }
.codex-tree-thread:hover, .codex-tree-thread.active { color: white; background: rgba(201,242,124,.08); border-left-color: var(--accent); }.codex-tree-thread strong, .codex-tree-thread small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.codex-tree-thread strong { font-size: 9px; }.codex-tree-thread small { margin-top: 3px; color: rgba(255,255,255,.3); font-size: 7px; }.codex-tree-thread.archived { opacity: .55; }
.codex-tree-archive { width: 29px; flex: 0 0 29px; border: 0; background: transparent; color: rgba(255,255,255,.35); opacity: 0; font-size: 12px; transition: opacity .16s, color .16s, background .16s; }
.codex-tree-thread-row:hover .codex-tree-archive, .codex-tree-thread-row.active .codex-tree-archive, .codex-tree-archive:focus-visible { opacity: 1; }
.codex-tree-archive:hover { background: rgba(201,242,124,.1); color: var(--accent); }
.codex-tree-thread.working { color: white; border-left-color: var(--accent); background: linear-gradient(90deg, rgba(201,242,124,.13), rgba(201,242,124,.025)); animation: liveThreadGlow 1.7s ease-in-out infinite; }
.codex-live-dot { width: 7px; height: 7px; margin-right: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(201,242,124,.55); vertical-align: -1px; animation: liveDot 1.25s ease-out infinite; }
@keyframes liveProjectPulse { 50% { transform: scale(.92); filter: brightness(1.18); } }
@keyframes liveThreadGlow { 50% { background-color: rgba(201,242,124,.12); } }
@keyframes liveDot { 55%, 100% { box-shadow: 0 0 0 6px rgba(201,242,124,0); } }
.mobile-back, .mobile-settings { display: none; }

/* Dashboard */
.workspace { min-width: 0; height: 100vh; overflow: hidden; background: var(--paper-2); }
.dashboard-view { height: 100%; overflow-y: auto; padding: clamp(34px, 5vw, 72px) clamp(34px, 6vw, 96px); background-image: radial-gradient(circle at 90% 6%, rgba(201,242,124,.17), transparent 21%), linear-gradient(90deg, rgba(23,33,29,.027) 1px, transparent 1px); background-size: auto, 42px 42px; }
.dashboard-header { display: flex; align-items: flex-start; justify-content: space-between; }
.dashboard-header h1 { margin: 18px 0 0; font: 400 clamp(42px, 5vw, 74px)/.97 Georgia, serif; letter-spacing: -.045em; }
.date-card { width: 75px; height: 87px; display: grid; place-content: center; text-align: center; border: 1px solid #c8cbc3; background: rgba(255,255,255,.6); }
.date-card span { font: 400 31px Georgia, serif; }
.date-card small { font: 700 9px "Bahnschrift", sans-serif; letter-spacing: .15em; color: #777c75; }
.setup-banner { margin: 42px 0 0; padding: 18px 20px; display: flex; justify-content: space-between; gap: 20px; align-items: center; background: var(--accent); border: 1px solid #a8cf5e; }
.setup-banner strong, .setup-banner span { display: block; }
.setup-banner strong { font-family: Georgia, serif; font-size: 18px; font-weight: 400; }
.setup-banner span { margin-top: 3px; font-size: 11px; }
.dashboard-section { margin-top: 70px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; padding-bottom: 13px; border-bottom: 1px solid #c9cbc4; }
.section-heading h2 { margin: 0; font: 400 24px Georgia, serif; }
.section-heading span { color: #7d8179; font-size: 10px; }
.project-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 10px; }
.project-card { min-height: 160px; padding: 15px; border: 1px solid #d4d4ca; border-radius: 9px; background: rgba(255,255,255,.76); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; gap: 13px; text-align: left; position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.project-card::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -34px; top: -34px; background: var(--project-color); opacity: .25; }
.project-card:hover { transform: translateY(-3px); border-color: #aeb0a8; box-shadow: 0 14px 34px rgba(23,33,29,.08); }
.project-card.archived { opacity: .68; filter: saturate(.65); }
.project-card.working { border-color: #91a86b; box-shadow: inset 0 0 0 1px rgba(142,174,85,.22), 0 14px 34px rgba(74,102,48,.11); }
.project-card.working > i { animation: liveProjectPulse 1.25s ease-in-out infinite; }
.project-card.archived .card-index::before { content: "АРХИВ · "; }
.project-card .card-index { position: absolute; top: 13px; right: 14px; font: 700 8px "Bahnschrift", sans-serif; letter-spacing: .13em; color: #9b9e96; }
.project-card > i { width: 43px; height: 43px; border-radius: 50%; display: grid; place-items: center; background: var(--project-color); font: normal 400 21px Georgia, serif; }
.project-card > div { align-self: center; grid-column: 1 / -1; }
.project-card h3 { margin: 0; font: 400 22px Georgia, serif; }
.project-card p { margin: 8px 0 0; color: #737870; font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card footer { grid-column: 1 / -1; display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid #e0e0d8; color: #888b84; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.project-card footer b { color: var(--ink); font-size: 16px; font-weight: 400; }
.add-card { border-style: dashed; align-content: center; color: #777c75; background: transparent; }
.add-card::after { display: none; }
.add-card > i { background: transparent; border: 1px solid #b8bbb3; font-family: inherit; }
.dashboard-bottom { margin-top: 52px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.tip-card, .api-card { min-height: 126px; padding: 23px; border-top: 1px solid #bbbeb6; background: rgba(232,230,221,.5); }
.tip-card > span, .api-card > span { font: 700 9px "Bahnschrift", sans-serif; letter-spacing: .16em; color: #868a82; }
.tip-card p { margin: 18px 0 0; max-width: 600px; font: 400 17px/1.4 Georgia, serif; }
.api-card strong { display: block; margin-top: 16px; font-size: 13px; }
.api-card p { margin: 5px 0 0; color: #7c8179; font-size: 10px; }

/* Project landing */
.project-view { height: 100%; padding: clamp(30px, 5vw, 65px); overflow-y: auto; position: relative; background: radial-gradient(circle at 82% 18%, rgba(201,242,124,.14), transparent 28%), var(--paper-2); }
.project-hero-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 13px; background: var(--project-color, var(--accent)); font: 400 25px Georgia, serif; }
.project-view h1 { margin: 10px 0 9px; max-width: 780px; font: 400 clamp(34px, 5vw, 58px)/1 Georgia, serif; letter-spacing: -.035em; }
.project-view > p { max-width: 680px; color: #666c64; font-size: 14px; line-height: 1.55; }
.project-actions { display: flex; gap: 9px; margin-top: 24px; }
.context-preview { max-width: 780px; margin-top: 36px; padding: 17px 0; border-top: 1px solid #c9ccc4; }
.context-preview span { font: 700 9px "Bahnschrift", sans-serif; letter-spacing: .16em; color: #7f847c; }
.context-preview p { margin: 14px 0 0; max-height: 110px; overflow: auto; white-space: pre-wrap; font-size: 12px; line-height: 1.6; color: #666b64; }

/* Chat */
.chat-view { height: 100%; display: grid; grid-template-rows: 53px 1fr auto; background: var(--paper-2); }
.chat-header { display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(250,248,241,.94); backdrop-filter: blur(12px); }
.chat-title-wrap { min-width: 0; }
.chat-title-wrap > span { display: block; color: #8a8f87; font: 700 8px "Bahnschrift", sans-serif; letter-spacing: .15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat-title { max-width: 55vw; margin: 2px 0 0; padding: 0; border: 0; background: transparent; font: 400 16px Georgia, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.chat-ai-status { min-height: 25px; margin-left: auto; padding: 3px 9px; display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; border: 1px solid #d6dad2; border-radius: 14px; background: #f4f5f1; color: #6d756f; font-size: 9px; font-weight: 750; white-space: nowrap; }
.chat-ai-status i { width: 7px; height: 7px; border-radius: 50%; background: #a7ada7; }.chat-ai-status.working { border-color: #a8c978; background: #eef8df; color: #496331; }.chat-ai-status.working i { background: #75a43f; animation: liveDot 1.25s ease-out infinite; }
.chat-list-item.working .chat-open { background: #f1f8e7; }.chat-list-item.working .chat-open small { color: #527039; font-weight: 750; }.chat-list-item.working .chat-open span { display: flex; align-items: center; }
.messages { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.message { width: min(100%, 1120px); margin: 0 auto; display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 12px; padding: 16px clamp(13px, 3vw, 35px); }
.message.user { background: transparent; border: 0; }.message.user .message-content { width: min(88%, 820px); margin-left: auto; padding: 11px 13px; border: 1px solid #d8ded5; border-radius: 10px; background: #f0f4ed; }.message.assistant .message-content { padding: 4px 0 8px; }
.message-avatar { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #bfc2ba; font: 700 9px "Bahnschrift", sans-serif; }
.message.assistant .message-avatar { overflow: hidden; background: var(--ink); border-color: #33433b; color: var(--accent); font: 400 20px Georgia, serif; }.message.assistant .message-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.message-content { min-width: 0; }
.message-content > header { min-height: 28px; display: flex; justify-content: space-between; align-items: start; }
.message-content > header strong { font-size: 11px; }
.copy-message { width: 28px; height: 28px; min-width: 28px; padding: 0; display: grid; place-items: center; opacity: 0; border: 0; border-radius: 6px; background: transparent; color: #7a827c; }
.copy-message svg, .codex-copy-response svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.copy-message:hover { background: #edf0eb; color: #405149; }
.copy-message.copied { background: #edf6dd; color: #4d6639; }
.message:hover .copy-message { opacity: 1; }
.message-actions { display: flex; align-items: center; gap: 5px; }.save-message-file { opacity: 0; border: 0; background: transparent; color: #667568; font-size: 9px; }.message:hover .save-message-file { opacity: 1; }
.markdown-body { color: #303a35; font-size: 13px; line-height: 1.62; overflow-wrap: anywhere; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h3, .markdown-body h4, .markdown-body h5 { margin: 22px 0 10px; font-family: Georgia, serif; line-height: 1.25; }
.markdown-body h3 { font-size: 24px; }.markdown-body h4 { font-size: 20px; }.markdown-body h5 { font-size: 17px; }
.markdown-body ul { padding-left: 20px; }
.markdown-body li { margin: 5px 0; }
.markdown-body code { padding: 2px 5px; border-radius: 3px; background: #e1e0d8; font: 12px Consolas, monospace; }
.markdown-body a { color: #27644d; text-underline-offset: 2px; }
.markdown-body blockquote { margin: 14px 0; padding: 3px 16px; border-left: 3px solid #96ad69; color: #666b64; }
.code-block { margin: 17px 0; border: 1px solid #303b36; border-radius: 7px; overflow: hidden; background: #1d2823; color: #e9eee9; }
.code-block > summary { min-height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; background: #26342e; color: #aebbb3; font: 700 9px "Bahnschrift", sans-serif; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; user-select: none; }
.code-block > summary::-webkit-details-marker { display: none; }
.code-block > summary > span { min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.code-block > summary > span::before { content: "▸"; flex: 0 0 auto; color: #d0f48d; font-size: 10px; transition: transform .16s; }
.code-block[open] > summary > span::before { transform: rotate(90deg); }
.code-block > summary b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-block > summary small { flex: 0 0 auto; color: #74837a; font-size: 8px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.code-block button { border: 0; background: transparent; color: #aebbb3; font-size: 9px; }
.code-block button:hover { color: white; }
.code-block pre { margin: 0; padding: 16px; overflow-x: auto; }
.code-block pre code { padding: 0; background: transparent; color: inherit; font: 12px/1.6 Consolas, "Courier New", monospace; }
.message-error { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--danger); background: #fff0f0; color: #8d343b; font-size: 11px; }
.typing-dots { display: flex; gap: 4px; padding: 5px 0; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: #7b827b; animation: dots 1.1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 50% { transform: translateY(-4px); opacity: .45; } }
.empty-chat { grid-row: 2; align-self: center; justify-self: center; text-align: center; padding: 30px; }
.empty-symbol { width: 61px; height: 61px; margin: 0 auto 26px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--ink); font: 400 36px Georgia, serif; }
.empty-chat > span { color: #8b8f87; font: 700 9px "Bahnschrift", sans-serif; letter-spacing: .17em; }
.empty-chat h2 { margin: 10px 0; font: 400 36px Georgia, serif; }
.empty-chat p { margin: 0; color: #7a7f77; font-size: 12px; }
.prompt-chips { margin-top: 30px; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.prompt-chips button { border: 1px solid #caccc4; border-radius: 20px; padding: 8px 12px; background: transparent; font-size: 10px; color: #60665f; }
.prompt-chips button:hover { border-color: #798079; color: var(--ink); }
.composer-wrap { padding: 12px clamp(25px, 7vw, 105px) 16px; background: linear-gradient(transparent, var(--paper-2) 22%); }
.composer { max-width: 1050px; margin: 0 auto; border: 1px solid #bfc2ba; border-radius: 10px; background: white; box-shadow: 0 12px 34px rgba(23,33,29,.08); position: relative; }
.composer.dragging { border-color: #7b955f; box-shadow: 0 0 0 3px rgba(126,156,100,.18), 0 12px 34px rgba(23,33,29,.08); }
.composer.dragging::after { content: "Отпустите файлы, чтобы прикрепить"; position: absolute; inset: 7px; z-index: 3; display: grid; place-items: center; border: 1px dashed #79905e; border-radius: 6px; background: rgba(244,250,234,.96); color: #506144; font-size: 11px; font-weight: 700; pointer-events: none; }
.composer textarea { display: block; width: 100%; min-height: 54px; max-height: 180px; resize: none; border: 0; outline: 0; padding: 16px 18px 6px; background: transparent; color: var(--ink); line-height: 1.5; }
.pending-attachments { padding: 7px 12px 2px; display: flex; flex-wrap: wrap; gap: 5px; }
.pending-file { max-width: 260px; min-height: 36px; padding: 5px 7px; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 1px solid #d1d3cc; border-radius: 6px; background: #f2f1eb; color: #59615a; }
.pending-file > i, .pending-file > img { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px; background: #e0e6d7; color: #506044; font: normal 700 7px "Bahnschrift", sans-serif; text-transform: uppercase; object-fit: cover; }
.pending-preview { width: 26px; height: 26px; display: block; color: #506044; text-decoration: none; }.pending-preview > i, .pending-preview > img { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px; background: #e0e6d7; color: #506044; font: normal 700 7px "Bahnschrift", sans-serif; text-transform: uppercase; object-fit: cover; font-style: normal; }
.pending-file span { min-width: 0; }
.pending-file strong, .pending-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-file strong { font-size: 8px; }.pending-file small { margin-top: 2px; color: #8a8f88; font-size: 7px; }
.pending-file button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--danger); padding: 0; }
.pending-file button:hover { background: #fde6e7; }
.composer-bottom { min-height: 42px; display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 7px 18px; }
.composer-tools { min-width: 0; display: flex; align-items: center; gap: 7px; }
.composer-tools > .keyboard-hint { color: #a0a39d; font-size: 8px; }
.composer-attach-button { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; padding: 0; border: 1px solid #d1d3cc; border-radius: 50%; background: transparent; color: #59645d; line-height: 1; }
.composer-attach-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-attach-button:hover { border-color: #83917f; background: #f1f4ed; }
.composer-attach-button:disabled { opacity: .45; cursor: wait; }
.composer-model-line { min-width: 0; height: 27px; display: flex; align-items: center; gap: 1px; padding: 0 5px 0 7px; border-radius: 4px; color: #6f7770; }
.control-caption { display: none; }
.composer-model-line select { width: auto; max-width: 190px; height: 25px; padding: 0; border: 0; outline: 0; appearance: none; background: transparent; color: #4f5a53; font-size: 9px; font-weight: 650; text-overflow: ellipsis; cursor: pointer; }
.composer-model-line i { font: normal 11px/1 sans-serif; color: #929790; pointer-events: none; transform: translateY(-1px); }
.composer-model-line:hover { background: #f3f3ee; }
.reasoning-line { padding-left: 6px; border-left: 1px solid #dedfd9; }
.reasoning-line select { max-width: 96px; color: #6b746c; font-size: 8px; font-weight: 600; }
.reasoning-line.image-model { opacity: .38; cursor: not-allowed; }.reasoning-line.image-model select { cursor: not-allowed; }
.composer-tools.auto-mode .reasoning-line { display: none; }
.file-upload-status { color: #78836f; font-size: 8px; white-space: nowrap; }
.file-upload-status.error { color: var(--danger); }
#send-button { width: 33px; height: 33px; border: 0; border-radius: 5px; background: var(--ink); color: var(--accent); font-size: 19px; }
#send-button.stop { color: #ffb4ba; font-size: 11px; }
.composer-wrap > small { display: block; margin-top: 8px; text-align: center; color: #9a9d96; font-size: 8px; }

/* Modals */
.modal { width: min(620px, calc(100vw - 30px)); max-height: min(88vh, 820px); padding: 0; border: 0; border-radius: 9px; background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow); overflow: auto; }
.modal::backdrop { background: rgba(13,22,18,.58); backdrop-filter: blur(5px); }
.modal > form:first-child { padding: 30px; }
.modal header { display: flex; justify-content: space-between; align-items: start; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.modal h2 { margin: 8px 0 0; font: 400 30px Georgia, serif; }
.modal-close { width: 32px; height: 32px; border: 0; background: transparent; color: #777c75; font-size: 25px; line-height: 1; }
.modal label { display: block; margin-top: 20px; font-size: 11px; font-weight: 700; }
.modal label > input, .modal label > textarea, .input-action-row input, .input-action-row select { width: 100%; margin-top: 8px; border: 1px solid #c6c8c0; border-radius: 5px; background: white; color: var(--ink); padding: 11px 12px; outline: 0; font-size: 13px; font-weight: 400; }
.modal label > input:focus, .modal label > textarea:focus, .input-action-row input:focus, .input-action-row select:focus { border-color: #6f8263; box-shadow: 0 0 0 3px rgba(126,156,100,.12); }
.modal textarea { resize: vertical; line-height: 1.5; }
.modal label > small { display: block; margin-top: 6px; color: #8a8e87; font-size: 9px; font-weight: 400; }
.modal fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.modal legend { font-size: 11px; font-weight: 700; }
.color-options { display: flex; gap: 10px; margin-top: 10px; }
.color-options label { margin: 0; }
.color-options input { position: absolute; opacity: 0; }
.color-options i { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--paper-2); background: var(--project-color); box-shadow: 0 0 0 1px #c6c9c1; }
.color-options input:checked + i { box-shadow: 0 0 0 2px var(--ink); }
.modal-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.project-modal-actions { grid-template-columns: auto auto 1fr auto auto; }
.project-modal { width: min(760px, calc(100vw - 30px)); max-height: none; overflow: hidden; border-radius: 14px; }
.project-modal > form:first-child { padding: 0; }
.project-modal-header { min-height: 108px; padding: 23px 25px 19px; border-bottom: 1px solid #d9dbd3; background: linear-gradient(135deg, #f4f7ed 0%, #faf8f1 58%, #f0eee7 100%); }
.project-modal-heading { min-width: 0; display: flex; align-items: center; gap: 14px; }
.project-modal-heading > i { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; background: var(--ink); color: var(--accent); box-shadow: 0 8px 22px rgba(23,33,29,.14); font: normal 300 29px/1 "Segoe UI", sans-serif; }
.project-modal-heading h2 { margin-top: 5px; font-size: 26px; }
.project-modal-heading p { margin: 4px 0 0; color: #7c817a; font-size: 10px; }
.project-modal .modal-close { flex: 0 0 34px; border-radius: 50%; background: rgba(23,33,29,.055); transition: background .16s, color .16s, transform .16s; }
.project-modal .modal-close:hover { background: var(--ink); color: white; transform: rotate(4deg); }
.project-form-grid { padding: 18px 25px 3px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; }
.project-form-main { min-width: 0; }
.project-modal label { margin-top: 0; color: #505950; font-size: 10px; letter-spacing: .025em; }
.project-modal label + label, .project-modal fieldset { margin-top: 14px; }
.project-modal label > input, .project-modal label > textarea { margin-top: 6px; border-color: #d0d3ca; border-radius: 8px; padding: 10px 11px; background: #fff; transition: border-color .16s, box-shadow .16s, background .16s; }
.project-modal label > input { height: 42px; }
.project-modal label > textarea { resize: none; }
.project-modal #project-description { height: 78px; }
.project-modal #project-instructions { height: 172px; }
.project-modal legend { color: #505950; font-size: 10px; letter-spacing: .025em; }
.project-modal .color-options { gap: 8px; margin-top: 8px; }
.project-modal .color-options label { position: relative; padding: 3px; border-radius: 10px; cursor: pointer; }
.project-modal .color-options i { width: 27px; height: 27px; border: 0; box-shadow: 0 0 0 1px rgba(23,33,29,.14), inset 0 1px rgba(255,255,255,.45); transition: transform .16s, box-shadow .16s; }
.project-modal .color-options label:hover i { transform: translateY(-2px) scale(1.05); }
.project-modal .color-options input:checked + i { box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--ink), 0 4px 10px rgba(23,33,29,.16); }
.project-modal-actions { margin: 16px 25px 0; padding: 15px 0 20px; }
.project-modal-actions .button { min-height: 38px; border-radius: 7px; font-size: 11px; }

/* Image preview and mask editor */
.codex-image-dialog { width: min(1120px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: #111a16; color: white; box-shadow: 0 28px 90px rgba(5,12,9,.4); }
.codex-image-dialog::backdrop { background: rgba(8,14,11,.78); backdrop-filter: blur(8px); }
.codex-image-dialog section { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.codex-image-dialog header { min-height: 61px; padding: 9px 16px 9px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255,255,255,.1); background: #17211d; }
.codex-image-dialog header span { color: rgba(255,255,255,.48); font: 700 8px "Bahnschrift", sans-serif; letter-spacing: .15em; }
.codex-image-dialog header h2 { max-width: min(780px, 72vw); margin: 3px 0 0; overflow: hidden; color: white; font: 400 18px Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.codex-image-dialog .modal-close { flex: 0 0 auto; border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: white; }
.codex-image-preview { min-height: 260px; max-height: calc(100dvh - 155px); padding: 14px; display: grid; place-items: center; overflow: auto; background: radial-gradient(circle at 50% 10%, #25342e, #0d1411 65%); }
.codex-image-preview img { max-width: 100%; max-height: calc(100dvh - 185px); display: block; border-radius: 8px; object-fit: contain; box-shadow: 0 14px 46px rgba(0,0,0,.3); }
.codex-image-dialog footer { min-height: 61px; padding: 10px 16px; display: flex; justify-content: flex-end; border-top: 1px solid rgba(255,255,255,.09); background: #17211d; }
.codex-image-dialog footer .button { min-height: 40px; display: grid; place-items: center; text-decoration: none; }
.image-editor-dialog { width: min(1080px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: #f7f5ee; color: var(--ink); box-shadow: 0 28px 90px rgba(5,12,9,.32); }
.image-editor-dialog::backdrop { background: rgba(8,14,11,.72); backdrop-filter: blur(7px); }
.image-editor-shell { min-height: 0; }
.image-editor-header { height: 62px; padding: 0 18px 0 21px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #d8d8d0; background: rgba(250,248,241,.96); }
.image-editor-header span { color: #81877f; font: 700 8px "Bahnschrift", sans-serif; letter-spacing: .16em; }
.image-editor-header h2 { margin: 3px 0 0; font: 400 19px Georgia, serif; }
.image-editor-header .modal-close { border-radius: 50%; background: #ecebe5; }
.image-editor-layout { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.image-editor-preview { min-width: 0; padding: 16px; background: #17211d; }
.image-editor-stage { position: relative; width: fit-content; max-width: 100%; min-height: 240px; margin: 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: #0d1411; box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.image-editor-stage.ready { min-height: 0; }
.image-editor-stage img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.image-editor-stage canvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: .58; cursor: crosshair; touch-action: none; }
#image-editor-loading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: #17211d; color: rgba(255,255,255,.55); font-size: 11px; }
.image-editor-stage.ready #image-editor-loading { display: none; }
.image-editor-hint { min-height: 37px; padding: 10px 2px 0; display: flex; align-items: start; gap: 8px; color: rgba(255,255,255,.55); font-size: 9px; line-height: 1.45; }
.image-editor-hint i { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(201,242,124,.08); }
.image-edit-form { min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 19px; background: #f7f5ee; }
.image-edit-tools { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: end; padding-bottom: 17px; border-bottom: 1px solid #dbd9d0; }
.image-edit-tools label, .image-edit-prompt { display: block; color: #525b54; font-size: 9px; font-weight: 750; }
.image-edit-tools input { width: 100%; margin-top: 8px; accent-color: #607d48; }
.image-edit-tools .button { min-height: 34px; padding: 0 10px; font-size: 9px; }
.image-edit-prompt { flex: 1; }
.image-edit-prompt textarea { width: 100%; min-height: 145px; margin-top: 7px; padding: 12px; resize: none; border: 1px solid #c8cbc2; border-radius: 8px; background: white; outline: 0; color: var(--ink); font-size: 12px; line-height: 1.5; }
.image-edit-prompt textarea:focus { border-color: #78915f; box-shadow: 0 0 0 3px rgba(126,156,100,.13); }
.image-edit-actions { margin-top: auto; display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.image-edit-actions .button { min-height: 42px; display: grid; place-items: center; font-size: 11px; text-decoration: none; }
.settings-note { display: flex; gap: 12px; align-items: center; margin-top: 20px; padding: 13px; background: #edf6dd; border: 1px solid #d6e8b5; }
.settings-note i { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: #78a13f; }
.settings-note p { margin: 0; color: #566149; font-size: 10px; line-height: 1.5; }
.pc-admin-note.warning { border-color: #e7cf9b; background: #fff8e8; }.pc-admin-note.warning i { background: #d2962f; }.pc-admin-note.warning p { color: #75571e; }
.settings-server-control { margin-top: 14px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #e1c5c7; border-radius: 6px; background: #fff7f7; }
.settings-server-control strong, .settings-server-control span { display: block; }.settings-server-control strong { font-size: 11px; }.settings-server-control span { margin-top: 4px; color: #7f6d6f; font-size: 9px; line-height: 1.4; }.settings-server-control .button { flex: 0 0 auto; }

.message-files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }.message-file { max-width: 330px; padding: 7px 9px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 1px solid #cdd1c9; border-radius: 5px; background: #f4f3ed; color: #445049; font-size: 9px; text-decoration: none; }.message-file:hover { border-color: #8fa07e; }.message-file b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }.message-file small { color: #858b84; white-space: nowrap; }
.message-image { width: min(330px, 100%); padding: 7px; display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 9px; border: 1px solid #cdd1c9; border-radius: 6px; background: #f4f3ed; color: #445049; text-align: left; cursor: zoom-in; }.message-image:hover { border-color: #8fa07e; }.message-image img { width: 70px; height: 58px; border-radius: 4px; object-fit: cover; background: #e4e5df; }.message-image span, .message-image b, .message-image small { min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.message-image b { font-size: 9px; }.message-image small { margin-top: 4px; color: #7e857d; font-size: 8px; }
.message-image.generated { width: min(620px, 100%); padding: 8px; display: block; border-radius: 10px; background: white; box-shadow: 0 8px 25px rgba(23,33,29,.08); transition: transform .18s, box-shadow .18s; }.message-image.generated:hover { transform: translateY(-2px); box-shadow: 0 13px 31px rgba(23,33,29,.12); }.message-image.generated img { width: 100%; height: auto; max-height: 560px; display: block; border-radius: 7px; object-fit: contain; }.message-image.generated span { padding: 8px 4px 2px; }.message-image.generated b { font-size: 10px; }
.input-action-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.settings-connection { margin-top: 14px; padding: 10px 12px; border-radius: 4px; background: #ecebe5; color: #6f746d; font-size: 10px; }
.settings-connection.success { background: #edf6dd; color: #536540; }
.settings-connection.error { background: #fff0f0; color: #8f3f46; }
.password-form { padding: 22px 30px 30px; border-top: 1px solid var(--line); background: #eeece4; }
.password-form h3 { margin: 0 0 13px; font: 400 17px Georgia, serif; }
.password-fields { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 8px; }
.password-fields input { min-width: 0; border: 1px solid #c5c7bf; border-radius: 5px; padding: 10px; background: white; font-size: 11px; }
.account-management { padding: 22px 30px 30px; border-top: 1px solid var(--line); }
.account-management-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; }
.account-management-head h3 { margin: 6px 0 0; font: 400 18px Georgia, serif; }
.account-management-head > small { color: #858a82; font-size: 9px; }
.accounts-list { margin-top: 15px; display: flex; flex-direction: column; gap: 5px; }
.account-row { min-height: 48px; padding: 7px 8px; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 9px; border: 1px solid #d6d7d0; border-radius: 5px; background: white; }
.account-row > i { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: #e6efd5; color: var(--ink); font: normal 700 11px Georgia, serif; }
.account-row span { min-width: 0; }
.account-row strong, .account-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row strong { font-size: 11px; }.account-row small { margin-top: 3px; color: #898d86; font-size: 9px; }
.account-row > b { color: #77836f; font: 700 8px "Bahnschrift", sans-serif; letter-spacing: .08em; }
.account-row > button { width: 27px; height: 27px; border: 0; border-radius: 50%; background: transparent; color: var(--danger); }
.account-row > button:hover { background: #fff0f0; }
.account-row .account-edit { width: auto; padding: 0 9px; border-radius: 4px; color: #536149; font-size: 9px; }
.account-row .account-edit:hover { background: #eef5e2; }
.account-row .account-delete { color: var(--danger); }
.account-policy-form { margin-top: 15px; padding: 17px; border: 1px solid #d2d4cc; border-radius: 6px; background: #f6f4ed; }
.account-policy-form > header { padding-bottom: 13px; }
.account-policy-form h4 { margin: 0 0 13px; font: 400 18px Georgia, serif; }
.account-policy-form header h4 { margin: 5px 0 0; }
.account-identity-fields { display: grid; grid-template-columns: .8fr 1fr 1.2fr; gap: 7px; }
.account-policy-form input, .account-policy-form select, .account-policy-form textarea { min-width: 0; border: 1px solid #c5c7bf; border-radius: 5px; padding: 10px; background: white; font-size: 10px; }
.api-mode-options { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.api-mode-options legend { width: 100%; margin-bottom: 9px; }
.api-mode-options label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 10px; font-weight: 600; }
.api-mode-options input, .inline-check input { width: auto; margin: 0; padding: 0; }
.account-own-api { display: grid; grid-template-columns: 1.25fr .75fr; gap: 9px; }
.account-own-api label:only-child { grid-column: 1 / -1; }
.account-own-api label, .account-default-model { margin-top: 12px; }
.account-model-policy { margin-top: 16px; padding-top: 13px; border-top: 1px solid #d6d7d0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account-model-policy strong { display: block; font-size: 11px; }
.inline-check { display: flex !important; align-items: center; gap: 6px; margin-top: 7px !important; font-size: 9px !important; font-weight: 500 !important; }
.model-checkbox-grid { max-height: 160px; margin: 10px 0; padding: 9px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; overflow-y: auto; border: 1px solid #d6d7d0; border-radius: 4px; background: white; font-size: 9px; }
.model-checkbox-grid.muted { color: #8a8e87; background: #efeee8; }
.model-checkbox-grid label { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 500; overflow-wrap: anywhere; }
.model-checkbox-grid input { width: auto; margin: 0; padding: 0; }

/* Local Codex admin view */
.codex-view { height: 100%; min-height: 0; overflow: hidden; padding: 16px 22px 18px; display: flex; flex-direction: column; background: radial-gradient(circle at 93% 0, rgba(121,199,255,.12), transparent 25%), linear-gradient(180deg, #fbfaf6, #f2f0e9); }
.codex-page-header { min-height: 42px; padding: 0 4px 9px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #d5d7d0; }
.codex-page-title { min-width: 0; display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }.codex-page-title strong { font: 400 15px Georgia, serif; }.codex-page-title span { color: #8a8f88; font-size: 8px; }
.codex-status { min-width: 0; min-height: 34px; margin-left: auto; padding: 6px 10px; display: flex; align-items: center; gap: 7px; color: #606a62; font-size: 11px; font-weight: 600; white-space: nowrap; }
.codex-status i { width: 8px; height: 8px; border-radius: 50%; background: #999; }.codex-status.checking i { animation: pulse 1.2s infinite; }.codex-status.online i { background: #75a43f; }.codex-status.offline i { background: var(--danger); }
.codex-refresh-compact { min-height: 34px; padding: 0 12px; display: flex; align-items: center; gap: 6px; border: 1px solid #c8cbc3; border-radius: 6px; background: rgba(255,255,255,.55); color: #4f5b53; font-size: 11px; font-weight: 650; }.codex-refresh-compact:hover { border-color: #8c9a82; background: white; }.codex-refresh-compact b { font-size: 16px; font-weight: 400; }
.codex-project-section { margin-top: 45px; }
.codex-no-project { min-height: 0; flex: 1; display: grid; place-content: center; text-align: center; color: #858a83; }.codex-no-project span { font: 700 9px "Bahnschrift", sans-serif; letter-spacing: .15em; }.codex-no-project p { max-width: 430px; font-size: 11px; line-height: 1.55; }
.codex-project-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 9px; }
.codex-project-card { min-width: 0; min-height: 96px; padding: 13px; border: 1px solid #d0d2cb; border-radius: 5px; background: rgba(255,255,255,.74); text-align: left; }
.codex-project-card:hover, .codex-project-card.active { border-color: #78906d; box-shadow: inset 3px 0 var(--accent); }
.codex-project-card strong, .codex-project-card small, .codex-project-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codex-project-card strong { font: 400 17px Georgia, serif; }.codex-project-card small { margin-top: 7px; color: #777d76; font-size: 8px; }.codex-project-card span { margin-top: 12px; color: #626b64; font-size: 9px; }
.codex-project-workspace { min-height: 0; flex: 1; margin-top: 6px; display: flex; flex-direction: column; }
.codex-workspace-header { min-height: 25px; padding: 2px 5px 5px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid #dedfd9; overflow: hidden; white-space: nowrap; }.codex-workspace-header strong { flex: 0 0 auto; font: 400 13px Georgia, serif; }.codex-workspace-header span { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #858a83; font: 8px Consolas, monospace; }
.codex-view.thread-selected .codex-workspace-header { display: none; }
.codex-archive-toggle { display: flex; align-items: center; gap: 7px; font-size: 10px; white-space: nowrap; }
.codex-followup-form { position: relative; flex: 0 0 auto; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; border: 1px solid #bec3b9; border-radius: 11px; background: rgba(255,255,255,.97); box-shadow: 0 9px 30px rgba(23,33,29,.1), 0 1px 2px rgba(23,33,29,.07); transition: border-color .18s, box-shadow .18s, transform .18s; }
.codex-followup-form:focus-within { border-color: #879b75; box-shadow: 0 0 0 3px rgba(126,156,100,.1), 0 12px 34px rgba(23,33,29,.11); }
.codex-followup-form.dragging { border-color: #6f8a59; box-shadow: 0 0 0 4px rgba(126,156,100,.18), 0 14px 36px rgba(23,33,29,.12); transform: translateY(-2px); }
.codex-followup-form.dragging::after { content: "Отпустите файлы, чтобы прикрепить"; position: absolute; inset: 5px; z-index: 5; display: grid; place-items: center; border: 1px dashed #6f8a59; border-radius: 8px; background: rgba(245,250,236,.96); color: #4d6639; font-size: 11px; font-weight: 750; pointer-events: none; }
.codex-followup-form textarea { width: 100%; resize: none; min-height: 42px; max-height: 150px; border: 0; outline: 0; padding: 6px 7px; background: transparent; line-height: 1.45; }
.codex-run-controls { min-width: 0; display: flex; align-items: center; gap: 7px; }
.codex-run-controls .composer-attach-button { width: 34px; height: 34px; flex-basis: 34px; }
.codex-run-controls .composer-model-line { min-height: 34px; flex: 0 1 auto; margin: 0; padding-inline: 9px; border: 1px solid #d8dad3; background: #f7f7f3; }
.codex-run-controls .composer-model-line select { width: auto; max-width: 230px; height: 32px; font-size: 12px; font-weight: 700; }
.codex-run-controls .composer-model-line + .composer-model-line { padding-left: 9px; border-left: 1px solid #d8dad3; }
.codex-run-controls .composer-model-line + .composer-model-line select { max-width: 145px; color: #59645d; font-size: 12px; }
.codex-upload-status { color: #778271; font-size: 10px; white-space: nowrap; }
.codex-run-controls .button { min-height: 36px; margin-left: auto; padding: 0 15px; font-size: 11px; }
.codex-pending-attachments { padding: 2px 5px 4px; }
.codex-task-layout { min-height: 0; flex: 1; margin-top: 7px; display: block; overflow: hidden; border: 1px solid #cdd0c8; border-radius: 10px; background: white; box-shadow: 0 12px 34px rgba(23,33,29,.07); }
.codex-thread-list { min-width: 0; max-height: 680px; overflow-y: auto; border-right: 1px solid #d7d9d2; background: #f1efe8; }
.codex-thread-button { width: 100%; padding: 13px; border: 0; border-bottom: 1px solid #dbdcd6; background: transparent; text-align: left; }
.codex-thread-button:hover, .codex-thread-button.active { background: white; box-shadow: inset 3px 0 var(--accent); }.codex-thread-button strong, .codex-thread-button small, .codex-thread-button span { display: block; }.codex-thread-button strong { font-size: 11px; line-height: 1.35; }.codex-thread-button small { margin-top: 5px; color: #81867f; font-size: 8px; }.codex-thread-button span { margin-top: 7px; color: #677068; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }.codex-thread-button.archived { opacity: .6; }
.codex-thread-detail { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; background: #fbfaf6; }
.codex-mobile-tree-button { display: none; }
.codex-thread-empty { margin: auto; padding: 35px; text-align: center; color: #858a83; }.codex-thread-empty span { font: 700 9px "Bahnschrift", sans-serif; letter-spacing: .15em; }.codex-thread-empty p { max-width: 360px; font-size: 11px; line-height: 1.5; }
#codex-thread-content { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.codex-thread-header { min-height: 57px; padding: 9px 14px; display: flex; flex: 0 0 auto; justify-content: space-between; gap: 15px; align-items: center; border-bottom: 1px solid #e2e3de; background: rgba(255,255,255,.86); }.codex-thread-heading { min-width: 0; flex: 1 1 auto; }.codex-thread-header span { color: #778078; font: 700 7px "Bahnschrift", sans-serif; letter-spacing: .12em; }.codex-thread-header h2 { max-width: 760px; margin: 3px 0 0; font: 400 17px Georgia, serif; }.codex-thread-header > div:last-child { display: flex; gap: 6px; }.codex-thread-header .button { min-height: 29px; padding: 0 9px; font-size: 8px; }
.codex-thread-header .codex-thread-status { width: max-content; max-width: 100%; min-height: 21px; padding: 3px 8px; display: inline-flex; align-items: center; gap: 6px; overflow: hidden; border: 1px solid #d5d9d2; border-radius: 12px; background: #f3f4f0; color: #667069; font: 750 8px/1.2 "Segoe UI Variable", sans-serif; letter-spacing: .02em; text-overflow: ellipsis; white-space: nowrap; }
.codex-thread-status::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #a4aaa5; }.codex-thread-status.working { border-color: #a7c978; background: #eef8df; color: #46612e; }.codex-thread-status.working::before { background: #75a43f; animation: liveDot 1.25s ease-out infinite; }.codex-thread-status.completed { border-color: #cbd7bf; background: #f2f7ec; color: #53644a; }.codex-thread-status.completed::before { background: #7da051; }.codex-thread-status.checking { border-color: #ddd4b3; background: #fff9e7; color: #75652e; }.codex-thread-status.checking::before { background: #c2a43d; }
.codex-load-older { flex: 0 0 auto; min-height: 32px; margin: 9px auto 0; padding: 0 14px; border: 1px solid #d2d5cd; border-radius: 16px; background: #f3f3ed; color: #657065; font-size: 9px; font-weight: 700; }.codex-load-older:hover { border-color: #8b9c80; background: #eef5e3; color: #40533f; }.codex-load-older:disabled { opacity: .6; cursor: wait; }
.codex-activity { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 15px clamp(13px, 4vw, 48px) 24px; background: radial-gradient(circle at 12% 0, rgba(201,242,124,.055), transparent 25%), #fbfaf6; }
.codex-turn { width: min(100%, 1080px); margin: 0 auto 18px; padding-bottom: 14px; border-bottom: 1px solid #e4e4df; animation: codexTurnIn .28s ease both; }.codex-turn > header { display: flex; justify-content: space-between; color: #8b9089; font-size: 7px; text-transform: uppercase; letter-spacing: .08em; }
@keyframes codexTurnIn { from { opacity: 0; transform: translateY(4px); } }
.codex-item { margin-top: 8px; padding: 10px 12px; border: 1px solid #e1e2dd; border-left: 3px solid #b7bbb3; border-radius: 8px; background: rgba(255,255,255,.94); box-shadow: 0 2px 9px rgba(23,33,29,.035); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }.codex-item.userMessage { width: min(88%, 820px); margin-left: auto; border-color: #c9dde9; background: #f2f8fb; }.codex-item.agentMessage { border-color: #d9dfd1; border-left-color: #8fb44e; background: rgba(255,255,255,.98); }.codex-item.commandExecution, .codex-item.fileChange, .codex-item.mcpToolCall, .codex-item.collabAgentToolCall { border-color: #ded3ea; border-left-color: #c9a7ff; background: #faf7ff; font-family: Consolas, monospace; font-size: 9px; }.codex-item.reasoning { border-color: #deded9; color: #747a73; background: #f3f2ed; }.codex-item > strong { display: block; margin-bottom: 5px; font-family: "Segoe UI Variable", sans-serif; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.codex-item.agentMessage { position: relative; }.codex-item.agentMessage > strong { min-height: 30px; padding-right: 38px; display: flex; align-items: center; }
.codex-copy-response { position: absolute; top: 6px; right: 7px; width: 30px; height: 30px; min-width: 30px; min-height: 30px; padding: 0; display: grid; place-items: center; border: 1px solid #d5d8d1; border-radius: 6px; background: #f7f8f4; color: #657067; }.codex-copy-response:hover { border-color: #91a180; color: #40533f; background: #f0f6e8; }.codex-copy-response.copied { border-color: #91ad6b; color: #4d6639; background: #edf6dd; }
.codex-item.userMessage.pending { opacity: .78; border-style: dashed; background: #f7fbfd; }.codex-item.userMessage.pending > strong { color: #60746a; }
@keyframes codexSendSpin { to { transform: rotate(360deg); } }
.codex-item > summary { margin: -10px -12px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; cursor: pointer; font-family: "Segoe UI Variable", sans-serif; }
.codex-item > summary::-webkit-details-marker { display: none; }
.codex-item > summary::before { content: "▸"; flex: 0 0 auto; color: #777f77; font-size: 9px; transition: transform .16s; }
.codex-item[open] > summary { margin-bottom: 0; border-bottom: 1px solid rgba(80,85,80,.12); }
.codex-item[open] > summary::before { transform: rotate(90deg); }
.codex-item > summary strong { margin-right: auto; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.codex-item > summary span { color: #858a83; font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.codex-technical-group { margin-top: 8px; border: 1px solid #dddfe0; border-left: 3px solid #98a09b; border-radius: 8px; background: #f4f5f2; box-shadow: 0 2px 9px rgba(23,33,29,.025); }
.codex-technical-group > summary { min-width: 0; min-height: 40px; padding: 7px 11px; display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; color: #68716b; font-family: "Segoe UI Variable", sans-serif; }
.codex-technical-group > summary::-webkit-details-marker { display: none; }
.codex-technical-group > summary::before { content: "▸"; flex: 0 0 auto; color: #68716b; font-size: 10px; transition: transform .16s; }
.codex-technical-group[open] > summary { border-bottom: 1px solid #dddeda; }
.codex-technical-group[open] > summary::before { transform: rotate(90deg); }
.codex-technical-group > summary strong { flex: 0 0 auto; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.codex-technical-group > summary b { min-width: 22px; padding: 2px 6px; border-radius: 10px; background: #dfe3de; color: #4f5953; font-size: 9px; text-align: center; }
.codex-technical-group > summary span { min-width: 0; flex: 1; overflow: hidden; color: #858c87; font-size: 8px; text-align: right; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.codex-technical-group.pending > summary b { background: #e6f3cf; color: #52663d; }
.codex-technical-items { padding: 1px 8px 8px; }
.codex-technical-items > .codex-item { margin-top: 7px; box-shadow: none; }
.codex-item.fileChange { font-family: "Segoe UI Variable", "Aptos", sans-serif; }
.codex-file-changes { margin-top: 9px; }
.codex-file-change-overview { min-height: 38px; padding: 6px 8px; display: flex; align-items: center; gap: 7px; border: 1px solid #d9ddd7; border-radius: 7px; background: #f5f7f2; }
.codex-file-change-overview strong { margin-right: auto; color: #455149; font-size: 10px; }
.codex-file-change-overview span { min-width: 38px; padding: 3px 7px; border-radius: 10px; font: 700 9px Consolas, monospace; text-align: center; }
.codex-file-change-overview .addition { background: #dff2df; color: #27643a; }
.codex-file-change-overview .deletion { background: #f8dede; color: #9b3038; }
.codex-file-change-list { margin-top: 7px; display: grid; gap: 5px; }
.codex-file-change { overflow: hidden; border: 1px solid #dadcd7; border-radius: 7px; background: white; }
.codex-file-change > summary { min-width: 0; min-height: 40px; padding: 5px 8px; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 7px; list-style: none; cursor: pointer; }
.codex-file-change > summary::-webkit-details-marker { display: none; }
.codex-file-change > summary::before { content: "▸"; color: #727a74; font-size: 9px; transition: transform .16s; }
.codex-file-change[open] > summary::before { transform: rotate(90deg); }
.codex-file-change > summary em { min-width: 70px; padding: 3px 7px; border-radius: 10px; font-size: 8px; font-style: normal; font-weight: 800; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.codex-file-change.add > summary em { background: #dff2df; color: #27643a; }
.codex-file-change.delete > summary em { background: #f8dede; color: #9b3038; }
.codex-file-change.update > summary em { background: #e5e8f6; color: #475181; }
.codex-file-change.rename > summary em { background: #f6ead5; color: #876024; }
.codex-file-change > summary strong { min-width: 0; overflow: hidden; color: #3f4943; font: 600 10px Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.codex-diff-stats { display: flex; align-items: center; gap: 5px; font: 700 9px Consolas, monospace; }
.codex-diff-stats b { color: #27713e; }.codex-diff-stats i { color: #ad3941; font-style: normal; }
.codex-unified-diff { max-height: 520px; overflow: auto; border-top: 1px solid #dedfdc; background: #fbfbfa; font: 9px/1.45 Consolas, monospace; }
.codex-diff-line { min-width: max-content; display: grid; grid-template-columns: 42px 42px minmax(520px, 1fr); }
.codex-diff-line > span { padding: 1px 7px; border-right: 1px solid rgba(80,85,80,.09); color: #a0a59f; text-align: right; user-select: none; }
.codex-diff-line code { padding: 1px 9px; color: #414844; font: inherit; white-space: pre; }
.codex-diff-line.addition { background: #e7f6e8; }.codex-diff-line.addition code { color: #1f6335; }
.codex-diff-line.deletion { background: #fde9e9; }.codex-diff-line.deletion code { color: #98323a; }
.codex-diff-line.hunk { background: #edf1f8; }.codex-diff-line.hunk code { color: #4d5e82; }
.codex-diff-line.meta code { color: #7e8580; font-style: italic; }
.codex-diff-empty { padding: 14px; color: #858b85; font-size: 9px; text-align: center; }
.codex-item pre { margin: 10px 0 0; overflow-x: auto; white-space: pre-wrap; }
.codex-item-files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; font-family: "Segoe UI Variable", sans-serif; white-space: normal; }
.codex-attachment { max-width: 340px; min-height: 38px; padding: 6px 8px; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid #d1d3cc; border-radius: 5px; background: white; color: #445049; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.codex-attachment:hover { border-color: #879b75; }.codex-attachment > i { font-style: normal; text-align: center; color: #65804e; }.codex-attachment span, .codex-attachment b, .codex-attachment small { min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.codex-attachment b { font-size: 9px; }.codex-attachment small { margin-top: 3px; color: #81877f; font-size: 8px; }
.codex-attachment.image { width: min(340px, 100%); grid-template-columns: 82px minmax(0, 1fr); }.codex-attachment.image img { width: 82px; height: 64px; border-radius: 4px; object-fit: cover; background: #e7e8e2; }
.codex-attachment.image.generated { width: min(620px, 100%); max-width: 620px; padding: 8px; display: block; border-radius: 10px; box-shadow: 0 8px 23px rgba(23,33,29,.08); }.codex-attachment.image.generated img { width: 100%; height: auto; max-height: 520px; display: block; border-radius: 7px; object-fit: contain; }.codex-attachment.image.generated span { padding: 8px 4px 2px; }
.codex-work-summary { margin-top: 14px; padding: 12px; border: 1px solid #cbd9bc; border-left: 4px solid #80a84d; border-radius: 10px; background: linear-gradient(135deg, #f5faec, #fff 45%); box-shadow: 0 6px 20px rgba(57,81,39,.07); }
.codex-work-summary > header { display: flex; align-items: center; gap: 10px; }.codex-work-summary > header > i { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; background: #7da84a; color: white; font-size: 15px; font-style: normal; font-weight: 800; }.codex-work-summary > header div { min-width: 0; }.codex-work-summary > header strong, .codex-work-summary > header span { display: block; }.codex-work-summary > header strong { color: #3f5332; font-size: 12px; }.codex-work-summary > header span { margin-top: 2px; color: #718067; font-size: 9px; }
.codex-work-summary-body { margin-top: 11px; display: grid; gap: 12px; }.codex-work-summary-body section { min-width: 0; }.codex-work-summary-body h3 { margin: 0 0 7px; color: #596657; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.codex-work-summary .codex-file-changes, .codex-work-summary .codex-item-files { margin-top: 0; }.codex-work-summary .codex-item-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }.codex-work-summary .codex-attachment.image.generated { width: 100%; max-width: none; padding: 6px; }.codex-work-summary .codex-attachment.image.generated img { height: 150px; object-fit: cover; }.codex-work-summary .codex-attachment.image.generated span { padding: 6px 3px 1px; }
.codex-followup-form { margin: 10px clamp(10px, 3vw, 32px) 11px; }

/* Automations */
.automations-view { height: 100vh; overflow-y: auto; padding: clamp(26px, 4vw, 54px); background: radial-gradient(circle at 100% 0, rgba(121,199,255,.09), transparent 28%), var(--paper-2); }
.automations-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 22px; padding-bottom: 22px; border-bottom: 1px solid #d8d9d2; }
.automations-header h1 { margin: 8px 0 5px; font: 400 clamp(34px, 4vw, 52px)/1 Georgia, serif; }.automations-header p { max-width: 650px; margin: 0; color: #737a74; font-size: 13px; }
.automations-back { display: none; }
.automations-header-actions { display: flex; align-items: center; gap: 8px; }.automations-header-actions > span { margin-right: 4px; color: #7b827c; font-size: 11px; white-space: nowrap; }
.automations-note { margin-top: 17px; padding: 11px 13px; display: flex; align-items: center; gap: 10px; border: 1px solid #d6ddd0; border-radius: 8px; background: #f4f8ed; color: #64705f; font-size: 11px; line-height: 1.45; }.automations-note > i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #83aa4c; }.automations-note code { font-family: Consolas, monospace; }
.automations-list { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.automation-card { min-width: 0; padding: 15px; display: flex; flex-direction: column; border: 1px solid #d8dad4; border-top: 3px solid #86a65a; border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: 0 8px 26px rgba(23,33,29,.055); }.automation-card.paused { opacity: .72; border-top-color: #9a9f99; }.automation-card.running { border-top-color: #79c7ff; box-shadow: 0 0 0 3px rgba(121,199,255,.12), 0 8px 26px rgba(23,33,29,.055); }
.automation-card > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.automation-source { padding: 3px 7px; border-radius: 10px; background: #e6f0d8; color: #52683c; font-size: 8px; font-weight: 800; letter-spacing: .08em; }.automation-source.cockpit { background: #dceef9; color: #396682; }.automation-status { color: #79817b; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.automation-card-main { min-width: 0; margin-top: 12px; padding: 0; border: 0; background: transparent; text-align: left; }.automation-card-main h2 { margin: 0; font: 400 22px/1.15 Georgia, serif; }.automation-card-main p { margin: 8px 0 0; display: -webkit-box; overflow: hidden; color: #6d756f; font-size: 11px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.automation-card dl { margin: 14px 0 0; padding-top: 10px; display: grid; gap: 7px; border-top: 1px solid #ecece8; }.automation-card dl > div { min-width: 0; display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; }.automation-card dt { color: #929791; font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }.automation-card dd { min-width: 0; margin: 0; overflow: hidden; color: #4f5953; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.automation-error { margin-top: 10px; padding: 8px 9px; border-left: 3px solid #c14c55; background: #fff1f1; color: #8f343b; font-size: 10px; line-height: 1.4; }
.automation-card > footer { margin-top: auto; padding-top: 14px; display: grid; grid-template-columns: 1fr 1fr 34px; gap: 6px; }.automation-card > footer .button { min-height: 34px; padding-inline: 9px; font-size: 10px; }.automation-edit-icon { width: 34px; height: 34px; border: 1px solid #cfd2cb; border-radius: 6px; background: #f7f7f3; color: #5c665f; font-size: 15px; }
.automations-empty { min-height: 360px; display: grid; place-items: center; align-content: center; text-align: center; }.automations-empty > span { color: #8a908a; font-size: 9px; font-weight: 800; letter-spacing: .14em; }.automations-empty p { max-width: 440px; margin: 10px 0 18px; color: #737a74; font-size: 13px; line-height: 1.5; }

.automation-modal { width: min(880px, calc(100vw - 24px)); }
.automation-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.automation-form-grid label > select, .automation-interval select { width: 100%; height: 45px; margin-top: 7px; border: 1px solid #c6c8c1; border-radius: 5px; background: white; padding: 0 11px; }
.automation-name-field, .automation-schedule-fields, .automation-prompt-field, .automation-active { grid-column: 1 / -1; }
.automation-schedule-fields { padding: 13px !important; border: 1px solid #dedfd9 !important; border-radius: 8px; background: #f8f8f5; }.automation-schedule-fields legend { padding: 0 5px; }
.automation-schedule-row { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 10px; }.automation-schedule-row label { margin-top: 0; }
.automation-interval { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }.automation-interval input { width: 100%; height: 45px; margin-top: 7px; border: 1px solid #c6c8c1; border-radius: 5px; padding: 0 10px; }.automation-interval select { margin-top: 7px; }
.automation-weekdays { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 5px; }.automation-weekdays label { min-height: 34px; margin: 0; padding: 0 8px; display: flex; align-items: center; gap: 5px; border: 1px solid #d7d9d2; border-radius: 6px; background: white; font-size: 10px; }.automation-weekdays input { accent-color: #6f9342; }
.automation-prompt-field textarea { min-height: 130px; }
.automation-model-fields { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }.automation-model-fields label { margin-top: 20px; }
.automation-active { min-height: 42px; display: flex !important; align-items: center; gap: 8px; }.automation-active input { width: 18px !important; height: 18px !important; margin: 0 !important; accent-color: #739947; }
.automation-modal-actions { grid-template-columns: auto 1fr auto auto; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; align-items: end; gap: 8px; pointer-events: none; }
.toast { max-width: min(390px, calc(100vw - 40px)); padding: 12px 16px; border-left: 3px solid var(--ink); background: white; color: var(--ink); box-shadow: 0 12px 32px rgba(23,33,29,.2); font-size: 12px; opacity: 0; transform: translateY(8px); transition: .22s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { border-color: #75a43f; }.toast.error { border-color: var(--danger); }
.server-update-notice { position: fixed; top: 12px; left: 50%; z-index: 120; width: min(620px, calc(100vw - 24px)); padding: 12px 15px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; border: 1px solid #d99499; border-radius: 8px; background: #fff2f2; color: #742f35; box-shadow: 0 12px 36px rgba(45,16,19,.2); transform: translateX(-50%); }
.server-update-notice strong { font-size: 13px; white-space: nowrap; }.server-update-notice span { font-size: 12px; line-height: 1.4; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 270px 1fr; }
  .project-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .codex-project-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .codex-task-layout { grid-template-columns: 240px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  html, body { width: 100%; overflow: hidden; }
  .login-screen { display: block; background: var(--paper-2); }
  .login-art { height: 31vh; min-height: 220px; }
  .orbit-one { width: 220px; height: 220px; }.orbit-two { width: 340px; height: 340px; }
  .login-mark { width: 88px; height: 88px; box-shadow: 0 0 0 11px rgba(23,33,29,.85); }
  .login-mark span { font-size: 52px; }
  .login-art p { display: none; }
  .login-panel { min-height: 69vh; padding: 36px 25px calc(30px + env(safe-area-inset-bottom)); justify-content: flex-start; }
  .login-panel::before { display: none; }
  .login-copy h1 { margin-top: 13px; font-size: 43px; }
  .login-copy p { font-size: 14px; }
  .login-form { margin-top: 30px; }
  .password-row { grid-template-columns: 1fr; }

  .app-shell { position: relative; display: block; height: 100dvh; }
  .projects-panel, .workspace { position: absolute; inset: 0; width: 100%; height: 100%; transform: translateX(100%); transition: transform .24s ease; }
  .projects-panel { z-index: 3; transform: translateX(-100%); padding-top: calc(20px + env(safe-area-inset-top)); }
  .workspace { z-index: 1; transform: translateX(100%); }
  .app-shell[data-mobile-view="projects"] .projects-panel { transform: translateX(0); }
  .app-shell[data-mobile-view="chats"] .projects-panel { transform: translateX(0); }
  .app-shell[data-mobile-view="chat"] .workspace { transform: translateX(0); }
  .app-shell[data-mobile-view="projects"] .workspace, .app-shell[data-mobile-view="chats"] .workspace { transform: translateX(100%); }
  .app-shell[data-mobile-view="chat"] .projects-panel { transform: translateX(-100%); }
  .brand { padding-left: 14px; }
  .projects-list { padding-bottom: 20px; }
  .app-shell.project-open .projects-list { max-height: 22dvh; padding-bottom: 4px; }
  .project-nav-item { padding: 12px 10px; }
  .project-nav-item i { width: 34px; height: 34px; flex-basis: 34px; }
  .sidebar-footer { padding-bottom: env(safe-area-inset-bottom); }

  .mobile-back { display: block; grid-column: 1 / -1; width: max-content; margin: 0 0 8px; padding: 0; border: 0; background: transparent; color: #6f756e; font-size: 10px; }
  .sidebar-chats { margin-top: 8px; }
  .sidebar-tabs { grid-template-columns: 1fr 1fr auto; }
  .sidebar-tabs button { min-height: 37px; font-size: 10px; }
  .chats-header { min-height: 45px; }
  .workspace { background: var(--paper-2); }
  .dashboard-view { padding: calc(30px + env(safe-area-inset-top)) 22px calc(35px + env(safe-area-inset-bottom)); }
  .dashboard-header h1 { font-size: 45px; }
  .date-card { display: none; }
  .mobile-settings { display: block; border: 1px solid #c5c8c0; border-radius: 5px; background: transparent; padding: 8px 10px; font-size: 10px; }
  .setup-banner { margin-top: 30px; align-items: stretch; flex-direction: column; }
  .dashboard-section { margin-top: 44px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 135px; }
  .dashboard-bottom { grid-template-columns: 1fr; margin-top: 38px; }
  .project-view { padding: calc(22px + env(safe-area-inset-top)) 19px calc(25px + env(safe-area-inset-bottom)); }
  .project-view .mobile-back { margin-bottom: 20px; }
  .project-hero-mark { width: 49px; height: 49px; margin-bottom: 18px; }
  .project-view h1 { font-size: 36px; }
  .project-actions { align-items: stretch; flex-direction: column; }

  .chat-view { grid-template-rows: auto 1fr auto; height: 100dvh; }
  .chat-header { min-height: 102px; padding: calc(11px + env(safe-area-inset-top)) 15px 11px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
  .chat-header .mobile-back { grid-column: 1 / -1; margin: 0 0 4px; }
  #chat-title { max-width: 58vw; font-size: 17px; }
  .model-picker > span { display: none; }
  .model-picker select { max-width: 135px; }
  .message { grid-template-columns: 27px minmax(0, 1fr); gap: 8px; padding: 12px 10px; }
  .message.user .message-content { width: 96%; padding: 10px; }
  .message-avatar { width: 27px; height: 27px; }
  .message.assistant .message-avatar { font-size: 17px; }
  .markdown-body { font-size: 13px; }
  .message-image.generated { width: 100%; }.message-image.generated img { max-height: 55dvh; }
  .copy-message { opacity: 1; }
  .save-message-file { opacity: 1; }
  .empty-chat { padding: 20px; }
  .empty-chat h2 { font-size: 31px; }
  .prompt-chips { flex-direction: column; }
  .composer-wrap { padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); }
  .composer-tools > .keyboard-hint, .composer-wrap > small { display: none; }
  .composer textarea { min-height: 48px; padding: 13px 13px 5px; font-size: 15px; }
  .composer-bottom { min-height: 51px; padding: 4px 6px 7px; display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px; }
  .composer-tools { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1.15fr) minmax(104px, .85fr); gap: 5px; overflow: visible; }
  .composer-tools.auto-mode { grid-template-columns: 38px minmax(0, 1fr); }
  .composer-attach-button { width: 38px; height: 42px; border-radius: 8px; }
  .composer-attach-button svg { width: 17px; height: 17px; }
  .composer-model-line, .reasoning-line { width: 100%; max-width: none; height: 42px; padding: 5px 8px 4px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 11px 18px; gap: 0 3px; border: 1px solid #d6d8d1; border-radius: 8px; background: #f7f7f3; }
  .composer-model-line .control-caption { display: block; grid-column: 1; color: #8b918a; font-size: 8px; font-weight: 700; line-height: 10px; text-transform: uppercase; letter-spacing: .05em; }
  .composer-model-line select, .reasoning-line select { grid-column: 1; grid-row: 2; width: 100%; max-width: none; height: 18px; padding: 0; color: #37433d; font-size: 11px; font-weight: 700; }
  .composer-model-line i { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 13px; }
  .reasoning-line { border-left: 1px solid #d6d8d1; }
  .file-upload-status { display: none; }
  #send-button { width: 40px; height: 42px; align-self: center; border-radius: 8px; }

  .modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .modal > form:first-child { padding: 22px 19px; }
  .modal-actions { grid-template-columns: 1fr 1fr; }
  .modal-actions > span { display: none; }
  .modal-actions .button-danger { grid-column: 1 / -1; }
  .project-modal-actions #archive-project-button { grid-column: 1 / -1; }
  .project-modal { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); overflow: hidden; border-radius: 12px; }
  .project-modal > form:first-child { padding: 0; }
  .project-modal-header { min-height: 78px; padding: 14px 15px 12px; align-items: center; }
  .project-modal-heading { gap: 10px; }
  .project-modal-heading > i { flex-basis: 38px; width: 38px; height: 38px; border-radius: 10px; font-size: 23px; }
  .project-modal-heading h2 { margin-top: 2px; font-size: 22px; }
  .project-modal-heading p, .project-modal-heading .eyebrow { display: none; }
  .project-form-grid { padding: 12px 15px 0; display: block; }
  .project-modal label + label, .project-modal fieldset, .project-modal .project-instructions-field { margin-top: 10px; }
  .project-modal label > input, .project-modal label > textarea { margin-top: 4px; padding: 8px 10px; }
  .project-modal label > input { height: 38px; }
  .project-modal #project-description { height: 57px; }
  .project-modal #project-instructions { height: 82px; }
  .project-modal label > small { margin-top: 3px; font-size: 8px; }
  .project-modal .color-options { margin-top: 5px; }
  .project-modal .color-options i { width: 25px; height: 25px; }
  .project-modal-actions { margin: 10px 15px 0; padding: 10px 0 13px; grid-template-columns: 1fr 1fr; gap: 6px; }
  .project-modal-actions #delete-project-button, .project-modal-actions #archive-project-button { grid-column: auto; }
  .project-modal-actions .button { min-height: 36px; padding: 0 9px; }
  .codex-image-dialog { width: calc(100vw - 8px); max-height: calc(100dvh - 8px); border-radius: 12px; }.codex-image-dialog header { min-height: 52px; padding: 8px 10px 8px 13px; }.codex-image-dialog header span { display: none; }.codex-image-dialog header h2 { max-width: 73vw; font-size: 16px; }.codex-image-preview { min-height: 190px; max-height: calc(100dvh - 125px); padding: 6px; }.codex-image-preview img { max-height: calc(100dvh - 145px); border-radius: 6px; }.codex-image-dialog footer { min-height: 55px; padding: 8px; }.codex-image-dialog footer .button { width: 100%; }
  .image-editor-dialog { width: calc(100vw - 8px); max-height: calc(100dvh - 8px); border-radius: 12px; }
  .image-editor-header { height: 52px; padding: 0 11px 0 14px; }.image-editor-header h2 { font-size: 17px; }.image-editor-header span { display: none; }
  .image-editor-layout { display: block; }
  .image-editor-preview { padding: 8px 8px 5px; }
  .image-editor-stage { min-height: 180px; max-height: min(42dvh, 430px); border-radius: 7px; }
  .image-editor-hint { min-height: 30px; padding: 7px 2px 2px; font-size: 8px; }
  .image-edit-form { padding: 11px; gap: 10px; }
  .image-edit-tools { padding-bottom: 9px; }.image-edit-tools .button { min-height: 38px; }
  .image-edit-prompt textarea { min-height: 72px; max-height: 13dvh; padding: 9px; font-size: 12px; }
  .image-edit-actions .button { min-height: 40px; }
  .password-form { padding: 20px; }
  .password-fields { grid-template-columns: 1fr; }
  .account-management { padding: 20px; }
  .account-management-head { align-items: start; flex-direction: column; gap: 4px; }
  .account-form { grid-template-columns: 1fr; }
  .account-identity-fields, .account-own-api, .model-checkbox-grid { grid-template-columns: 1fr; }
  .codex-view { padding: calc(10px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom)); }
  .codex-page-header { min-height: 38px; padding: 0 2px 6px; display: grid; grid-template-columns: auto minmax(72px, auto) minmax(0, 1fr) auto; gap: 5px; }
  .codex-page-header .codex-page-back { grid-column: auto; width: 32px; min-height: 30px; margin: 0; display: grid; place-items: center; border: 1px solid #cdd0c8; border-radius: 7px; background: #f3f2ec; color: #46534c; font-size: 15px; }
  .codex-page-title { gap: 0; }.codex-page-title strong { font-size: 13px; }.codex-page-title span { display: none; }
  .codex-status { min-width: 0; min-height: 28px; margin: 0; padding: 3px; overflow: hidden; }.codex-status span { overflow: hidden; text-overflow: ellipsis; }
  .codex-refresh-compact { width: 32px; min-height: 30px; padding: 0; display: grid; place-items: center; }.codex-refresh-compact span { display: none; }.codex-refresh-compact b { font-size: 16px; }
  .codex-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .codex-project-workspace { margin-top: 4px; }
  .codex-workspace-header { min-height: 27px; padding: 2px 4px 5px; flex-direction: row; align-items: baseline; gap: 6px; }.codex-workspace-header strong { font-size: 13px; }.codex-workspace-header span { font-size: 8px; }
  .codex-view.thread-selected .codex-page-header, .codex-view.thread-selected > .codex-status, .codex-view.thread-selected .codex-workspace-header { display: none; }
  .codex-view.thread-selected .codex-project-workspace { margin-top: 0; padding-top: 0; border-top: 0; }
  .codex-followup-form { margin: 6px; padding: 7px; border-radius: 10px; }
  .codex-followup-form textarea { min-height: 44px; padding: 8px; font-size: 15px; }
  .codex-run-controls { display: grid; grid-template-columns: 40px minmax(0, 1.15fr) minmax(104px, .85fr); gap: 6px; }
  .codex-run-controls .composer-attach-button { width: 40px; height: 43px; }
  .codex-run-controls .composer-model-line, .codex-run-controls .composer-model-line + .composer-model-line { width: 100%; max-width: none; height: 43px; padding: 5px 8px 4px; border: 1px solid #d6d8d1; }
  .codex-run-controls .composer-model-line select, .codex-run-controls .composer-model-line + .composer-model-line select { width: 100%; max-width: none; height: 19px; color: #37433d; font-size: 11px; font-weight: 700; }
  .codex-upload-status { display: none; }
  .codex-run-controls .button { grid-column: 1 / -1; width: 100%; min-height: 42px; margin: 0; border-radius: 8px; font-size: 12px; }
  .codex-tree-archive, .codex-tree-project-new, .codex-tree-project-archive { opacity: 1; }
  .codex-task-layout { min-height: 0; display: block; }.codex-thread-list { max-height: 250px; border-right: 0; border-bottom: 1px solid #d7d9d2; }.codex-thread-detail { min-height: 0; }
  .codex-thread-header { min-height: 56px; padding: 7px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; align-items: center; }.codex-mobile-tree-button { min-height: 36px; padding: 0 9px; display: block; border: 1px solid #cdd0c8; border-radius: 8px; background: #f3f2ec; color: #46534c; font-size: 11px; font-weight: 750; }.codex-thread-header h2 { max-width: 100%; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.codex-thread-header > div:last-child { flex: 0 0 auto; }.codex-thread-header .button { min-height: 32px; padding: 0 8px; font-size: 9px; }.codex-thread-header #codex-interrupt-button:disabled { display: none; }
  .codex-activity { min-height: 0; padding: 10px 8px 17px; }
  .codex-item { padding: 9px 10px; }
  .codex-item > summary { margin: -9px -10px; padding: 11px 10px; }
  .codex-item[open] > summary { margin-bottom: 0; }
  .codex-technical-group > summary { min-height: 42px; padding: 8px 10px; }
  .codex-technical-items { padding: 0 7px 7px; }
  .codex-file-change > summary { min-height: 44px; }
  .codex-file-change > summary strong { font-size: 11px; }
  .codex-unified-diff { font-size: 10px; }

  .automations-view { height: 100dvh; padding: calc(15px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom)); }
  .automations-header { grid-template-columns: 44px minmax(0, 1fr); align-items: start; gap: 8px; padding-bottom: 14px; }
  .automations-back { width: 44px; min-width: 44px; min-height: 44px; margin: 0; display: grid; place-items: center; border: 1px solid #cdd0c8; border-radius: 8px; background: #f3f2ec; color: #46534c; font-size: 18px; }
  .automations-header h1 { margin-top: 5px; font-size: 32px; }.automations-header p { font-size: 12px; line-height: 1.4; }
  .automations-header-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }.automations-header-actions > span { grid-column: 1 / -1; }
  .automations-header-actions .button { min-height: 42px; }
  .automations-note { margin-top: 10px; font-size: 11px; }
  .automations-list { margin-top: 10px; grid-template-columns: 1fr; }
  .automation-card { padding: 13px; }.automation-card-main h2 { font-size: 21px; }.automation-card-main p { font-size: 12px; }
  .automation-card dd { font-size: 11px; }.automation-card > footer .button { min-height: 40px; font-size: 11px; }.automation-edit-icon { width: 40px; height: 40px; }
  .automation-modal { width: calc(100vw - 8px); max-height: calc(100dvh - 8px); overflow-y: auto; }
  .automation-form-grid { grid-template-columns: 1fr; gap: 0; }
  .automation-name-field, .automation-schedule-fields, .automation-prompt-field, .automation-active, .automation-model-fields { grid-column: auto; }
  .automation-model-fields { grid-template-columns: 1fr 1fr; gap: 8px; }
  .automation-schedule-row { grid-template-columns: 1fr 1fr; }.automation-schedule-row > label:first-child { grid-column: 1 / -1; }
  .automation-form-grid label > select, .automation-interval input, .automation-interval select { height: 48px; font-size: 16px; }
  .automation-modal-actions { position: sticky; bottom: 0; background: white; }

  /* Mobile usability: consistent type scale, tap targets and compact layouts. */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  button, a, label, summary { touch-action: manipulation; }
  input, textarea, select { font-size: 16px; }
  .button { min-height: 46px; padding-inline: 15px; font-size: 14px; }
  .icon-button, .sidebar-footer-action, .modal-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }

  .login-screen { height: 100dvh; min-height: 0; overflow-y: auto; }
  .login-art { height: min(25dvh, 190px); min-height: 150px; }
  .login-mark { width: 74px; height: 74px; box-shadow: 0 0 0 9px rgba(23,33,29,.85); }
  .login-mark span { font-size: 44px; }
  .login-panel { min-height: auto; padding: 27px 20px calc(28px + env(safe-area-inset-bottom)); }
  .login-copy h1 { margin: 12px 0 15px; font-size: clamp(34px, 10.5vw, 42px); line-height: 1.02; }
  .login-copy p { font-size: 15px; line-height: 1.5; }
  .login-form { margin-top: 24px; }
  .login-form label { margin-bottom: 7px; font-size: 14px; }
  .login-username, .password-row input { height: 52px; font-size: 16px; }
  .login-form small { font-size: 12px; line-height: 1.45; }

  .projects-panel { padding: calc(9px + env(safe-area-inset-top)) 10px calc(9px + env(safe-area-inset-bottom)); }
  .brand { min-height: 58px; padding: 2px 7px 10px; }
  .brand-mark { width: 40px; height: 40px; font-size: 33px; }
  .brand strong { font-size: 23px; }
  .brand small { font-size: 10px; }
  .panel-section-title { min-height: 52px; padding: 7px 7px; }
  .panel-section-title span { font-size: 12px; }
  .archive-projects-toggle { min-height: 40px; padding: 0 10px; font-size: 12px; }
  .archive-projects-toggle b { font-size: 10px; }
  .project-nav-item { min-height: 58px; padding: 9px 8px; gap: 10px; }
  .project-nav-item i { width: 38px; height: 38px; flex-basis: 38px; font-size: 15px; }
  .project-nav-item strong { font-size: 15px; }
  .project-nav-item small { margin-top: 3px; font-size: 12px; }
  .project-nav-item.archived small::before { font-size: 10px; }
  .connection-pill { min-height: 42px; padding: 7px; font-size: 12px; }
  .sidebar-footer-row { grid-template-columns: minmax(0, 1fr) 44px 44px; }
  .sidebar-user { min-height: 48px; }
  .sidebar-user > i { width: 36px; height: 36px; flex-basis: 36px; font-size: 14px; }
  .sidebar-user strong { font-size: 13px; }
  .sidebar-user small { font-size: 11px; }
  .codex-nav-button { min-height: 62px; margin-block: 8px; }
  .codex-nav-button strong { font-size: 14px; }
  .codex-nav-button small { font-size: 11px; }

  .chats-header { min-height: 54px; }
  .chats-heading h2 { font-size: 18px; }
  .sidebar-tabs { margin-bottom: 8px; }
  .sidebar-tabs button { min-height: 44px; padding-inline: 10px; font-size: 13px; }
  .sidebar-new-chat b { font-size: 18px; }
  .new-chat-button { min-height: 46px; font-size: 14px; }
  .chats-label { padding: 5px 10px 7px; font-size: 10px; }
  .chat-list-item { min-height: 56px; }
  .chat-open { min-height: 56px; padding: 9px 10px; }
  .chat-open span { font-size: 14px; }
  .chat-open small { font-size: 11px; }
  .chat-delete { width: 44px; height: 44px; opacity: 1; }
  .files-header { min-height: 48px; }
  .files-header span { font-size: 11px; }
  .files-header .icon-button { width: 44px; height: 44px; }
  .project-folder-row { min-height: 35px; padding-block: 9px 5px; font-size: 11px; }
  .project-file-row { min-height: 50px; grid-template-columns: minmax(0, 1fr) 44px 44px; }
  .project-file-open { min-height: 50px; padding-block: 8px; }
  .project-file-open span { font-size: 13px; }
  .project-file-open small { font-size: 10px; }
  .project-file-delete, .project-file-download { width: 44px; height: 44px; opacity: 1; }
  .file-tree-empty { padding: 20px 12px; font-size: 12px; }

  .app-shell.codex-open .brand, .app-shell.codex-open .sidebar-footer, .app-shell.codex-open .admin-nav-buttons { display: none; }
  .app-shell.codex-open .projects-panel { padding-top: calc(7px + env(safe-area-inset-top)); }
  .codex-sidebar-tree > header { min-height: 64px; padding: 8px; }
  .codex-sidebar-tree > header span { font-size: 10px; }
  .codex-sidebar-tree > header strong { font-size: 18px; }
  #codex-sidebar-summary { padding: 9px 9px 6px; font-size: 12px; }
  .codex-sidebar-filters { padding: 4px 8px 9px; gap: 4px 16px; }
  .codex-sidebar-filters label { min-height: 36px; gap: 8px; font-size: 12px; }
  .codex-sidebar-filters input { width: 18px; height: 18px; }
  .codex-tree-project-button { min-height: 60px; padding: 9px 8px; gap: 9px; }
  .codex-tree-project-button > i { font-size: 15px; }
  .codex-tree-project-button strong { font-size: 14px; }
  .codex-tree-project-button small { margin-top: 4px; font-size: 11px; }
  .codex-tree-project-button > b { font-size: 12px; }
  .codex-tree-project-new, .codex-tree-project-archive, .codex-tree-archive { width: 44px; min-width: 44px; flex-basis: 44px; font-size: 17px; }
  .codex-tree-threads { padding-left: 16px; }
  .codex-tree-thread { min-height: 54px; padding: 9px 8px 9px 12px; }
  .codex-tree-thread strong { font-size: 13px; }
  .codex-tree-thread small { font-size: 10px; }

  .mobile-back { min-height: 44px; padding: 0 5px; display: flex; align-items: center; font-size: 13px; font-weight: 700; }
  .mobile-settings { min-height: 44px; padding: 0 13px; font-size: 13px; }
  .dashboard-view { padding: calc(24px + env(safe-area-inset-top)) 18px calc(30px + env(safe-area-inset-bottom)); }
  .dashboard-header h1 { font-size: clamp(34px, 10vw, 41px); line-height: 1; }
  .setup-banner { margin-top: 26px; padding: 15px; }
  .setup-banner strong { font-size: 19px; }
  .setup-banner span { margin-top: 5px; font-size: 13px; line-height: 1.4; }
  .dashboard-section { margin-top: 42px; }
  .section-heading h2 { font-size: 25px; }
  .section-heading span { font-size: 12px; }
  .project-card p { font-size: 14px; }
  .project-card footer { font-size: 11px; }
  .tip-card > span, .api-card > span { font-size: 10px; }
  .api-card strong { font-size: 15px; }
  .api-card p { font-size: 12px; }

  .project-view { padding: calc(15px + env(safe-area-inset-top)) 18px calc(25px + env(safe-area-inset-bottom)); }
  .project-view .mobile-back { margin-bottom: 14px; }
  .project-view h1 { font-size: 36px; }
  .project-view > p { font-size: 15px; }
  .context-preview span { font-size: 10px; }
  .context-preview p { font-size: 14px; }

  .chat-title-wrap > span { font-size: 10px; }
  #chat-title { font-size: 19px; }
  .message { grid-template-columns: 32px minmax(0, 1fr); padding: 12px 9px; }
  .message-avatar { width: 32px; height: 32px; }
  .message.user .message-content { width: 100%; }
  .message-content > header strong { font-size: 12px; }
  .copy-message { width: 34px; height: 34px; min-width: 34px; min-height: 34px; padding: 0; }
  .save-message-file { min-height: 36px; padding-inline: 7px; font-size: 11px; }
  .markdown-body { font-size: 15px; line-height: 1.58; }
  .markdown-body code, .code-block pre code { font-size: 13px; }
  .code-block > summary { min-height: 46px; font-size: 11px; }
  .code-block > summary small, .code-block button { font-size: 10px; }
  .empty-chat p { font-size: 14px; line-height: 1.45; }
  .prompt-chips button { min-height: 44px; padding: 10px 14px; font-size: 13px; }
  .composer textarea { min-height: 52px; font-size: 16px; }
  .composer-bottom { grid-template-columns: minmax(0, 1fr) 46px; }
  .composer-tools { grid-template-columns: 44px minmax(0, 1.15fr) minmax(106px, .85fr); }
  .composer-tools.auto-mode { grid-template-columns: 44px minmax(0, 1fr); }
  .composer-attach-button, .codex-run-controls .composer-attach-button { width: 44px; height: 48px; min-width: 44px; }
  .composer-model-line, .reasoning-line, .codex-run-controls .composer-model-line, .codex-run-controls .composer-model-line + .composer-model-line { height: 48px; grid-template-rows: 12px 23px; }
  .composer-model-line .control-caption { font-size: 10px; line-height: 11px; }
  .composer-model-line select, .reasoning-line select, .codex-run-controls .composer-model-line select, .codex-run-controls .composer-model-line + .composer-model-line select { height: 23px; font-size: 16px; }
  #send-button { width: 46px; height: 48px; font-size: 21px; }
  .pending-file { width: 100%; max-width: 100%; min-height: 50px; grid-template-columns: 36px minmax(0, 1fr) 36px; }
  .pending-preview, .pending-preview > i, .pending-preview > img { width: 36px; height: 36px; }
  .pending-file strong { font-size: 12px; }
  .pending-file small { font-size: 10px; }
  .pending-file button { width: 36px; height: 36px; font-size: 18px; }
  .message-file { min-height: 44px; font-size: 12px; }
  .message-image b { font-size: 12px; }
  .message-image small { font-size: 11px; }

  .modal { width: calc(100vw - 10px); max-height: calc(100dvh - 10px); border-radius: 12px; }
  .modal > form:first-child { padding: 20px 16px; }
  .modal header { padding-bottom: 15px; }
  .modal h2 { font-size: 27px; }
  .modal label, .modal legend, .project-modal label, .project-modal legend { font-size: 14px; }
  .modal label > input, .modal label > textarea, .input-action-row input, .input-action-row select, .account-policy-form input, .account-policy-form select, .account-policy-form textarea { min-height: 48px; font-size: 16px; }
  .modal label > small, .project-modal label > small { font-size: 12px; line-height: 1.4; }
  .settings-note p, .settings-connection { font-size: 13px; }
  .settings-server-control { align-items: stretch; flex-direction: column; }
  .settings-server-control strong { font-size: 14px; }
  .settings-server-control span { font-size: 12px; }
  .settings-server-control .button { width: 100%; }
  .input-action-row { grid-template-columns: 1fr; }
  .project-modal { overflow-y: auto; }
  .project-modal-header { position: sticky; top: 0; z-index: 2; }
  .project-modal label > input { height: 48px; }
  .project-modal #project-description { height: 76px; }
  .project-modal #project-instructions { height: 118px; }
  .project-modal .color-options { flex-wrap: wrap; gap: 10px; }
  .project-modal .color-options i { width: 34px; height: 34px; }
  .project-modal-actions .button { min-height: 46px; font-size: 13px; }
  .password-fields input { min-height: 48px; font-size: 16px; }
  .account-management-head > small { font-size: 12px; line-height: 1.4; }
  .account-row { min-height: 66px; grid-template-columns: auto minmax(0, 1fr) auto; }
  .account-row strong { font-size: 14px; }
  .account-row small { font-size: 11px; line-height: 1.35; white-space: normal; }
  .account-row > b { font-size: 10px; }
  .account-row > button { width: 44px; height: 44px; }
  .account-row .account-edit { grid-column: 2; width: 100%; min-height: 40px; font-size: 12px; }
  .account-row .account-delete { grid-column: 3; grid-row: 1 / span 2; }
  .api-mode-options { display: grid; gap: 5px; }
  .api-mode-options label, .inline-check { min-height: 40px; font-size: 13px !important; }
  .api-mode-options input, .inline-check input, .model-checkbox-grid input { width: 20px; height: 20px; }
  .account-model-policy { align-items: stretch; flex-direction: column; }
  .account-model-policy strong { font-size: 14px; }
  .model-checkbox-grid { max-height: 230px; gap: 2px; font-size: 13px; }
  .model-checkbox-grid label { min-height: 40px; }

  .image-editor-hint { font-size: 12px; }
  .image-edit-tools label, .image-edit-prompt { font-size: 13px; }
  .image-edit-tools .button, .image-edit-actions .button { min-height: 44px; font-size: 13px; }
  .image-edit-prompt textarea { min-height: 88px; font-size: 16px; }

  .codex-page-header { min-height: 50px; grid-template-columns: 44px minmax(82px, auto) minmax(0, 1fr) 44px; }
  .codex-page-header .codex-page-back, .codex-refresh-compact { width: 44px; min-height: 44px; }
  .codex-page-title strong { font-size: 16px; }
  .codex-status { min-height: 40px; font-size: 11px; }
  .codex-workspace-header { min-height: 38px; }
  .codex-workspace-header strong { font-size: 15px; }
  .codex-workspace-header span { font-size: 11px; }
  .codex-no-project span, .codex-thread-empty span { font-size: 11px; }
  .codex-no-project p, .codex-thread-empty p { font-size: 14px; }
  .codex-followup-form textarea { min-height: 50px; font-size: 16px; }
  .codex-run-controls { grid-template-columns: 44px minmax(0, 1.15fr) minmax(106px, .85fr); }
  .codex-run-controls .button { min-height: 46px; font-size: 14px; }
  .codex-thread-header { min-height: auto; padding: 8px; grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "tree title" "actions actions"; }
  .codex-mobile-tree-button { grid-area: tree; min-height: 44px; padding: 0 8px; font-size: 0; }
  .codex-mobile-tree-button::before { content: "←"; font-size: 18px; }
  .codex-thread-header > div:nth-child(2) { grid-area: title; }
  .codex-thread-header > div:last-child { grid-area: actions; display: grid; grid-template-columns: 1fr 1fr; }
  .codex-thread-header span { font-size: 10px; }
  .codex-thread-header h2 { font-size: 17px; }
  .codex-thread-header .button { min-height: 44px; font-size: 12px; }
  .codex-load-older { min-height: 44px; font-size: 12px; }
  .codex-turn > header { font-size: 10px; }
  .codex-item { font-size: 14px; }
  .codex-item.commandExecution, .codex-item.fileChange, .codex-item.mcpToolCall, .codex-item.collabAgentToolCall { font-size: 12px; }
  .codex-item > strong, .codex-item > summary strong { font-size: 10px; }
  .codex-item > summary span { font-size: 10px; }
  .codex-attachment { width: 100%; max-width: 100%; min-height: 48px; }
  .codex-attachment b { font-size: 12px; }
  .codex-attachment small { font-size: 11px; }
  .codex-work-summary { padding: 11px; }
  .codex-work-summary > header strong { font-size: 14px; }
  .codex-work-summary > header span { font-size: 11px; }
  .codex-work-summary-body h3 { font-size: 11px; }

  .toast-region { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; font-size: 14px; line-height: 1.4; }
  .server-update-notice { top: calc(7px + env(safe-area-inset-top)); left: 7px; right: 7px; width: auto; padding: 11px 12px; grid-template-columns: 1fr; gap: 3px; transform: none; }
  .server-update-notice strong { font-size: 14px; white-space: normal; }
  .server-update-notice span { font-size: 12px; }
}

/* Phone layout: keep touch targets, but give the conversation most of the viewport. */
@media (max-width: 520px) {
  .app-shell, .projects-panel, .workspace { height: 100dvh; }

  .button { min-height: 44px; padding-inline: 13px; font-size: 13px; }
  .projects-panel { padding: calc(5px + env(safe-area-inset-top)) 8px calc(5px + env(safe-area-inset-bottom)); }
  .brand { min-height: 42px; padding: 0 6px 4px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; font-size: 24px; }
  .brand strong { font-size: 18px; }
  .brand small { display: none; }
  .panel-section-title { min-height: 40px; padding: 3px 6px; }
  .panel-section-title span { font-size: 11px; }
  .archive-projects-toggle { min-height: 34px; padding-inline: 8px; font-size: 11px; }
  .panel-section-title .icon-button { width: 38px; height: 38px; min-width: 38px; min-height: 38px; }
  .project-nav-item { min-height: 50px; padding: 6px 7px; }
  .project-nav-item i { width: 34px; height: 34px; flex-basis: 34px; }
  .project-nav-item strong { font-size: 14px; }
  .project-nav-item small { font-size: 11px; }

  /* Once a project is selected, the phone panel is a chat picker. Avoid
     repeating the full brand, projects heading and selected project card. */
  .app-shell.project-open:not(.codex-open) .brand {
    min-height: 40px;
    padding: 0 7px;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .app-shell.project-open:not(.codex-open) .brand::before { content: "←"; color: var(--accent); font-size: 18px; }
  .app-shell.project-open:not(.codex-open) .brand::after { content: "Все проекты"; color: white; font-size: 14px; font-weight: 750; }
  .app-shell.project-open:not(.codex-open) .brand > * { display: none; }
  .app-shell.project-open:not(.codex-open) .panel-section-title,
  .app-shell.project-open:not(.codex-open) .projects-list { display: none; }
  .app-shell.project-open:not(.codex-open) .sidebar-chats { margin-top: 3px; padding-top: 3px; }
  .app-shell.project-open:not(.codex-open) .chats-header { min-height: 38px; padding: 0 7px 2px; }
  .app-shell.project-open:not(.codex-open) .chats-heading h2 { font-size: 15px; }
  .app-shell.project-open:not(.codex-open) .sidebar-tabs { margin: 0 2px 3px; padding: 2px; gap: 2px; }
  .app-shell.project-open:not(.codex-open) .sidebar-tabs button { min-height: 36px; padding-inline: 8px; font-size: 12px; }
  .app-shell.project-open:not(.codex-open) .sidebar-new-chat b { font-size: 16px; }
  .app-shell.project-open:not(.codex-open) .chats-header .icon-button { width: 38px; height: 38px; min-width: 38px; min-height: 38px; }
  .app-shell.project-open:not(.codex-open) .chats-label { padding: 2px 8px 4px; font-size: 9px; }
  .app-shell.project-open:not(.codex-open) .chat-list-item,
  .app-shell.project-open:not(.codex-open) .chat-open { min-height: 50px; }
  .app-shell.project-open:not(.codex-open) .chat-open { padding: 7px 9px; }
  .app-shell.project-open:not(.codex-open) .chat-open span { font-size: 13px; }
  .app-shell.project-open:not(.codex-open) .chat-open small { font-size: 10px; }
  .app-shell.project-open:not(.codex-open) .chat-delete { width: 38px; height: 38px; }
  .app-shell.project-open:not(.codex-open) .files-header { min-height: 40px; }
  .app-shell.project-open:not(.codex-open) .files-header .icon-button { width: 38px; height: 38px; min-width: 38px; min-height: 38px; }
  .app-shell.project-open:not(.codex-open) .project-folder-row { min-height: 31px; padding-block: 7px 4px; }
  .app-shell.project-open:not(.codex-open) .project-file-row { min-height: 44px; grid-template-columns: minmax(0, 1fr) 38px 38px; }
  .app-shell.project-open:not(.codex-open) .project-file-open { min-height: 44px; padding-block: 6px; }
  .app-shell.project-open:not(.codex-open) .project-file-delete,
  .app-shell.project-open:not(.codex-open) .project-file-download { width: 38px; height: 38px; }

  .sidebar-footer { min-height: 44px; padding: 2px 0 0; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; }
  .connection-pill { min-height: 40px; padding: 0; justify-content: center; }
  .connection-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .sidebar-footer-row { min-height: 40px; padding: 0; grid-template-columns: minmax(0, 1fr) 38px 38px; border: 0; background: transparent; box-shadow: none; }
  .sidebar-user { min-height: 38px; padding: 1px 4px; }
  .sidebar-user > i { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }
  .sidebar-user strong { font-size: 12px; }
  .sidebar-user small { display: none; }
  .sidebar-footer-action { width: 38px; height: 38px; min-width: 38px; min-height: 38px; }

  .admin-nav-buttons { margin: 5px 2px; grid-template-columns: 1fr 1fr; gap: 4px; }
  .admin-nav-buttons .codex-nav-button { min-height: 46px; padding: 5px 7px; grid-template-columns: 28px minmax(0, 1fr); gap: 6px; }
  .admin-nav-buttons .codex-nav-button > i { width: 28px; height: 28px; font-size: 16px; }
  .admin-nav-buttons .codex-nav-button strong { font-size: 11px; }
  .admin-nav-buttons .codex-nav-button small, .admin-nav-buttons .codex-nav-button > b { display: none; }

  .codex-sidebar-tree > header { min-height: 52px; }
  .codex-sidebar-tree > header strong { font-size: 16px; }
  #codex-sidebar-summary { font-size: 11px; }
  .codex-sidebar-filters label { min-height: 32px; }
  .codex-tree-project-button { min-height: 50px; padding-block: 6px; }
  .codex-tree-project-button strong { font-size: 14px; }
  .codex-tree-project-button small { font-size: 10px; }
  .codex-tree-project-new, .codex-tree-project-archive, .codex-tree-archive { width: 38px; min-width: 38px; flex-basis: 38px; }
  .codex-tree-thread { min-height: 46px; padding-block: 6px; }
  .codex-tree-thread strong { font-size: 13px; }

  .dashboard-view { padding: calc(18px + env(safe-area-inset-top)) 14px calc(22px + env(safe-area-inset-bottom)); }
  .dashboard-header h1 { font-size: clamp(31px, 9vw, 37px); }
  .dashboard-section { margin-top: 32px; }
  .section-heading h2 { font-size: 23px; }

  .automations-view { padding: calc(6px + env(safe-area-inset-top)) 7px calc(10px + env(safe-area-inset-bottom)); }
  .automations-header { grid-template-columns: 36px minmax(0, 1fr); grid-template-rows: 36px 36px; grid-template-areas: "back heading" "actions actions"; align-items: center; gap: 5px 7px; padding: 0 2px 7px; }
  .automations-back { grid-area: back; width: 36px; min-width: 36px; min-height: 36px; height: 36px; border-radius: 7px; font-size: 16px; }
  .automations-heading { grid-area: heading; min-width: 0; }
  .automations-header .eyebrow, .automations-header p { display: none; }
  .automations-header h1 { margin: 0; overflow: hidden; font: 750 22px/1.1 "Segoe UI Variable", "Segoe UI", sans-serif; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
  .automations-header-actions { grid-area: actions; grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr) 36px auto; align-items: center; gap: 5px; }
  .automations-header-actions > #automations-count { grid-column: auto; margin: 0 auto 0 0; font-size: 10px; }
  .automations-header-actions .button { min-height: 36px; height: 36px; padding-inline: 9px; font-size: 11px; white-space: nowrap; }
  #automations-refresh { width: 36px; min-width: 36px; padding: 0; overflow: hidden; font-size: 0; }
  #automations-refresh::before { content: "↻"; font-size: 17px; line-height: 1; }
  #automation-new { min-width: 104px; }
  .automations-note { display: none; }
  .automations-list { margin-top: 8px; gap: 8px; }
  .automation-card { padding: 10px; border-radius: 8px; }.automation-card-main { margin-top: 8px; }.automation-card-main h2 { font-size: 18px; }.automation-card-main p { margin-top: 5px; line-height: 1.4; -webkit-line-clamp: 2; }
  .automation-card dl { margin-top: 9px; padding-top: 8px; gap: 5px; }.automation-card dl > div { grid-template-columns: 54px minmax(0, 1fr); gap: 6px; }.automation-card dd { font-size: 11px; }.automation-card > footer { padding-top: 9px; grid-template-columns: 1fr 1fr 38px; }.automation-card > footer .button, .automation-edit-icon { min-height: 36px; height: 36px; }
  .automation-modal > form:first-child { padding: 15px 12px; }.automation-modal h2 { font-size: 23px; }
  .automation-model-fields, .automation-schedule-row { grid-template-columns: 1fr; }.automation-schedule-row > label:first-child { grid-column: auto; }
  .automation-weekdays { gap: 4px; }.automation-weekdays label { min-height: 32px; padding-inline: 7px; }
  .automation-modal-actions { grid-template-columns: 1fr 1fr; }.automation-modal-actions #automation-delete { grid-column: 1 / -1; }.automation-modal-actions > span { display: none; }

  .chat-header { min-height: 62px; padding: calc(7px + env(safe-area-inset-top)) 9px 7px; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .chat-header .mobile-back { grid-column: auto; width: 44px; min-width: 44px; margin: 0; justify-content: center; overflow: hidden; color: transparent; font-size: 0; }
  .chat-header .mobile-back::before { content: "←"; color: #4f5b53; font-size: 18px; }
  .chat-title-wrap { min-width: 0; }
  #chat-title { max-width: 100%; font-size: 17px; }
  .chat-ai-status { min-height: 28px; margin-left: 0; padding: 3px 7px; gap: 5px; font-size: 10px; }.chat-ai-status i { width: 6px; height: 6px; }
  .message { grid-template-columns: 30px minmax(0, 1fr); gap: 7px; padding: 10px 7px; }
  .message-avatar { width: 30px; height: 30px; }
  .markdown-body { font-size: 14px; line-height: 1.55; }
  .composer-wrap { padding: 5px 5px calc(5px + env(safe-area-inset-bottom)); }
  .composer textarea { min-height: 45px; padding: 10px 10px 4px; }
  .composer-bottom { min-height: 47px; padding: 3px 4px 5px; }
  .composer-attach-button { height: 44px; }
  .composer-model-line, .reasoning-line { height: 44px; grid-template-rows: 11px 20px; }
  .composer-model-line select, .reasoning-line select { height: 20px; font-size: 16px; }
  #send-button { height: 44px; }

  .modal { width: calc(100vw - 8px); max-height: calc(100dvh - 8px); }
  .modal > form:first-child { padding: 17px 14px; }
  .modal h2 { font-size: 24px; }
  .modal label, .modal legend, .project-modal label, .project-modal legend { font-size: 13px; }

  .codex-view.thread-selected { padding: 0; background: #fbfaf6; }
  .codex-view.thread-selected .codex-project-workspace { height: 100%; margin: 0; }
  .codex-view.thread-selected .codex-task-layout { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .codex-view.thread-selected .codex-thread-detail, .codex-view.thread-selected #codex-thread-content { height: 100%; }

  .codex-thread-header { min-height: 0; padding: calc(4px + env(safe-area-inset-top)) 6px 5px; grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-areas: "tree title actions"; gap: 6px; align-items: center; overflow: visible; background: rgba(251,250,246,.98); }
  .codex-mobile-tree-button { grid-area: tree; width: 38px; min-width: 38px; min-height: 38px; height: 38px; padding: 0; border-radius: 7px; }
  .codex-thread-header > div:nth-child(2) { min-width: 0; overflow: hidden; }
  .codex-thread-header span { display: block; overflow: hidden; color: #747d76; font-size: 8px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
  .codex-thread-header .codex-thread-status { min-height: 20px; padding: 2px 6px; display: inline-flex; font-size: 8.5px; line-height: 1.1; }
  .codex-thread-status::before { width: 6px; height: 6px; flex-basis: 6px; }
  .codex-thread-header h2 { max-width: 100%; margin: 2px 0 0; display: block; overflow: hidden; font: 600 14px/1.15 "Segoe UI Variable", "Segoe UI", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
  .codex-thread-header > div:last-child { grid-area: actions; display: flex; gap: 4px; }
  .codex-thread-header .button { width: auto; min-width: 46px; min-height: 38px; height: 38px; padding: 0 7px; font-size: 0; }
  .codex-thread-header .button::after { content: attr(data-mobile-label); font-size: 11px; }
  .codex-thread-header #codex-interrupt-button:disabled { display: none; }
  .codex-load-older { min-height: 36px; margin-top: 5px; padding-inline: 11px; font-size: 0; }
  .codex-load-older::after { content: attr(data-mobile-label); font-size: 11px; }

  .codex-activity { padding: 8px 7px 12px; scrollbar-gutter: auto; }
  .codex-turn { margin-bottom: 12px; padding-bottom: 10px; }
  .codex-turn > header { font-size: 9px; }
  .codex-item { margin-top: 6px; padding: 9px 10px; border-radius: 7px; font-size: 13px; line-height: 1.5; }
  .codex-item.userMessage { width: 94%; }
  .codex-item .markdown-body { font-size: 13.5px; line-height: 1.48; }
  .codex-item .markdown-body p { margin-bottom: 8px; }
  .codex-item .markdown-body > br { display: none; }
  .codex-item.commandExecution, .codex-item.fileChange, .codex-item.mcpToolCall, .codex-item.collabAgentToolCall { font-size: 11px; }
  .codex-item > summary { min-height: 42px; }
  .codex-item > strong, .codex-item > summary strong { font-size: 9px; }
  .codex-technical-group { margin-top: 6px; }
  .codex-technical-group > summary { min-height: 38px; padding: 6px 9px; gap: 7px; }
  .codex-technical-group > summary strong { font-size: 9px; }
  .codex-technical-group > summary b { min-width: 20px; padding-inline: 5px; font-size: 9px; }
  .codex-technical-group > summary span { font-size: 8px; }
  .codex-technical-items { padding: 0 5px 5px; }
  .codex-file-change-overview { min-height: 34px; padding: 4px 6px; }
  .codex-file-change > summary { min-height: 40px; padding: 4px 6px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px; }
  .codex-file-change > summary em { display: none; }
  .codex-diff-line { grid-template-columns: 32px 32px minmax(360px, 1fr); }
  .codex-diff-line > span { padding-inline: 4px; }
  .codex-diff-line code { padding-inline: 6px; }
  .codex-item.agentMessage > strong { min-height: 34px; padding-right: 40px; }
  .codex-copy-response { top: 5px; width: 34px; height: 34px; min-width: 34px; min-height: 34px; padding: 0; opacity: 1; }
  .codex-attachment { min-height: 44px; }
  .codex-work-summary { margin-top: 10px; padding: 9px; border-radius: 8px; }
  .codex-work-summary .codex-attachment.image.generated img { height: 168px; }

  .codex-followup-form { margin: 0; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(96px, .76fr) 52px; grid-auto-rows: auto; gap: 6px; border-width: 1px 0 0; border-radius: 0; background: rgba(255,255,255,.98); box-shadow: 0 -7px 22px rgba(23,33,29,.08); }
  .codex-followup-form textarea { grid-column: 1 / 4; grid-row: 1; height: 52px; min-height: 52px; max-height: 112px; padding: 9px 10px; border: 1px solid #d2d5cd; border-radius: 9px; background: #fbfbf8; font-size: 16px; line-height: 1.35; }
  .codex-run-controls { display: contents; }
  .codex-run-controls .composer-attach-button { grid-column: 1; grid-row: 2; width: 44px; min-width: 44px; height: 46px; }
  .codex-run-controls .codex-model-control { grid-column: 2; grid-row: 2; }
  .codex-run-controls .codex-effort-control { grid-column: 3 / 5; grid-row: 2; }
  .codex-run-controls .composer-model-line, .codex-run-controls .composer-model-line + .composer-model-line { width: 100%; min-width: 0; height: 46px; padding: 4px 8px 3px; grid-template-rows: 11px 22px; }
  .codex-run-controls .composer-model-line select, .codex-run-controls .composer-model-line + .composer-model-line select { height: 22px; font-size: 16px; }
  .codex-pending-attachments { grid-column: 1 / -1; grid-row: 3; padding: 0; }
  .codex-run-controls #codex-composer-submit { grid-column: 4; grid-row: 1; width: 52px; min-width: 52px; min-height: 52px; margin: 0; padding: 0; border-radius: 9px; font-size: 0; }
  .codex-run-controls #codex-composer-submit::after { content: "↑"; font-size: 24px; line-height: 1; }
  .codex-run-controls #codex-composer-submit.sending::after { width: 18px; height: 18px; content: ""; border: 2px solid rgba(255,255,255,.38); border-top-color: white; border-radius: 50%; animation: codexSendSpin .75s linear infinite; }
  .codex-run-controls #codex-composer-submit.accepted::after { content: "✓"; font-size: 21px; animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
