:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --surface: #111827;
  --surface-2: #172033;
  --surface-3: #202a3d;
  --border: rgba(255,255,255,.09);
  --text: #f4f7fb;
  --muted: #9aa7ba;
  --accent: #9b87f5;
  --accent-2: #68d4c4;
  --danger: #fb7185;
  --shadow: 0 22px 70px rgba(0,0,0,.32);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --surface-3: #e8edf5;
  --border: rgba(15,23,42,.10);
  --text: #101828;
  --muted: #667085;
  --accent: #6d5bd0;
  --accent-2: #148a7e;
  --shadow: 0 20px 55px rgba(25,35,55,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { position: fixed; inset: 0; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 60%, transparent) transparent; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-shell { position: fixed; inset: 0; display: grid; grid-template-columns: 300px minmax(0,1fr); width: 100%; height: 100dvh; min-height: 0; overflow: hidden; }
.sidebar { height: 100%; min-height: 0; overflow: hidden; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px 12px; z-index: 20; }
.brand-row { flex: none; display: flex; align-items: center; gap: 11px; padding: 2px 4px 16px; }
.brand-copy { min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 750; background: radial-gradient(circle at 30% 28%, #d9d2ff, var(--accent) 48%, #413178 100%); color: #121027; box-shadow: 0 0 28px rgba(155,135,245,.32); }
.brand-mark.large { width: 58px; height: 58px; margin: 0 auto; font-size: 22px; }
.brand-name { font-weight: 700; letter-spacing: .01em; }
.brand-version { color: var(--muted); font-size: 12px; margin-top: 2px; }

.primary-button, .ghost-button, .nav-button, .starter, .conversation-open, .conversation-menu-button, .project-badge { border: 0; cursor: pointer; transition: background .18s ease, transform .18s ease, border-color .18s ease, opacity .18s ease; }
.primary-button { background: var(--text); color: var(--bg); min-height: 44px; border-radius: 13px; padding: 0 16px; font-weight: 700; }
.primary-button:hover { transform: translateY(-1px); }
.new-chat { flex: none; width: 100%; text-align: left; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.sidebar-dialogs { min-height: 0; flex: 1 1 auto; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; margin-top: 8px; }
.sidebar-section-header { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; padding: 15px 10px 8px; }
.sidebar-count { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); text-align: center; letter-spacing: 0; }
.conversation-list { min-height: 0; height: 100%; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 0 2px 8px 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.conversation-row { display: grid; grid-template-columns: minmax(0,1fr) 34px; align-items: center; gap: 2px; border-radius: 10px; }
.conversation-row.active, .conversation-row:hover { background: var(--surface-2); }
.conversation-open { min-width: 0; text-align: left; color: var(--muted); background: transparent; border-radius: 10px; padding: 10px 8px 10px 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-row.active .conversation-open, .conversation-row:hover .conversation-open { color: var(--text); }
.conversation-empty { color: var(--muted); font-size: 13px; padding: 18px 10px; line-height: 1.5; }
.sidebar-footer { flex: none; border-top: 1px solid var(--border); padding-top: 8px; display: grid; gap: 2px; background: var(--surface); }
.nav-button { width: 100%; display: flex; justify-content: space-between; background: transparent; padding: 9px 11px; border-radius: 10px; color: var(--muted); }
.nav-button:hover { background: var(--surface-2); color: var(--text); }

.main-area { position: relative; min-width: 0; min-height: 0; height: 100%; overflow: hidden; display: grid; grid-template-rows: 64px minmax(0,1fr); background: radial-gradient(circle at 50% -20%, rgba(155,135,245,.10), transparent 38%), var(--bg); }
.topbar { min-width: 0; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); backdrop-filter: blur(18px); background: color-mix(in srgb, var(--bg) 78%, transparent); z-index: 10; }
.status-block { min-width: 0; flex: 1; }
.status-title-row { min-width: 0; display: flex; align-items: center; gap: 9px; }
.status-title { min-width: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 10px currentColor; }
.status-dot.ok { background: #34d399; }
.status-dot.error { background: var(--danger); }
.project-badge { max-width: 220px; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { flex: none; display: flex; align-items: center; gap: 7px; }
.icon-button, .ghost-button { border: 1px solid var(--border); background: var(--surface); border-radius: 11px; min-height: 38px; padding: 0 12px; }
.ghost-button.compact { min-height: 34px; padding: 0 10px; font-size: 13px; }
.danger-text { color: var(--danger); }
.icon-button { min-width: 38px; padding: 0; font-size: 20px; }
.menu-button { display: none; }

.chat-view { position: relative; min-height: 0; height: 100%; overflow: hidden; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.message-stream { min-height: 0; height: 100%; overflow-x: hidden; overflow-y: auto; padding: 28px max(20px, calc((100% - 820px)/2)); scroll-behavior: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
.message-stream::-webkit-scrollbar, .conversation-list::-webkit-scrollbar, .panel-view::-webkit-scrollbar, .project-chat-list::-webkit-scrollbar { width: 10px; }
.message-stream::-webkit-scrollbar-track, .conversation-list::-webkit-scrollbar-track, .panel-view::-webkit-scrollbar-track, .project-chat-list::-webkit-scrollbar-track { background: transparent; }
.message-stream::-webkit-scrollbar-thumb, .conversation-list::-webkit-scrollbar-thumb, .panel-view::-webkit-scrollbar-thumb, .project-chat-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 48%, transparent); border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; }
.message-stream::-webkit-scrollbar-thumb:hover, .conversation-list::-webkit-scrollbar-thumb:hover, .panel-view::-webkit-scrollbar-thumb:hover, .project-chat-list::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 72%, transparent); border: 3px solid transparent; background-clip: padding-box; }
.welcome-card { max-width: 720px; margin: min(14vh, 110px) auto 0; text-align: center; }
.welcome-orbit { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 50%; border: 1px solid rgba(155,135,245,.5); box-shadow: inset 0 0 35px rgba(155,135,245,.16), 0 0 55px rgba(155,135,245,.16); position: relative; }
.welcome-orbit::before { content: ""; position: absolute; width: 95px; height: 28px; border: 1px solid rgba(104,212,196,.38); border-radius: 50%; transform: rotate(-16deg); }
.welcome-orbit span { font-size: 28px; font-weight: 750; color: var(--accent); }
.welcome-card h1 { font-size: clamp(28px, 5vw, 44px); margin: 0 0 12px; letter-spacing: -.03em; }
.welcome-card > p { color: var(--muted); line-height: 1.6; margin: 0 auto 28px; max-width: 600px; }
.starter-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.starter { background: var(--surface); border: 1px solid var(--border); color: var(--text); min-height: 72px; border-radius: 16px; padding: 13px; }
.starter:hover { background: var(--surface-2); transform: translateY(-2px); }
.message { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 12px; max-width: 820px; margin: 0 auto 26px; }
.message-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 750; background: var(--surface-3); }
.message.assistant .message-avatar { background: linear-gradient(145deg, var(--accent), #493a91); color: #fff; }
.message-body { min-width: 0; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; padding-top: 4px; }
.message-meta { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.message.pending .message-body { color: var(--muted); }
.typing { display: inline-flex; gap: 5px; align-items: center; height: 24px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100% { transform: scale(.65); opacity:.45; } 40% { transform: scale(1); opacity:1; } }

.composer-wrap { position: relative; min-height: 0; padding: 10px max(18px, calc((100% - 820px)/2)) max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 72%, transparent); }
.scroll-bottom-button { position: absolute; left: 50%; top: -38px; z-index: 5; width: 36px; height: 36px; display: grid; place-items: center; transform: translateX(-50%); border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: var(--shadow); cursor: pointer; font-size: 18px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 10px 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.composer textarea { resize: none; flex: 1; max-height: 180px; min-height: 26px; background: transparent; border: 0; outline: 0; color: var(--text); line-height: 1.5; padding: 7px 0 4px; }
.composer textarea::placeholder { color: var(--muted); }
.send-button { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; cursor: pointer; background: var(--text); color: var(--bg); font-size: 20px; font-weight: 800; }
.send-button:disabled { opacity: .35; cursor: default; }
.composer-note { text-align: center; color: var(--muted); font-size: 11px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel-view { min-height: 0; height: 100%; overflow-y: auto; overscroll-behavior-y: contain; padding: 30px max(22px, calc((100% - 980px)/2)); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.panel-header h2 { margin: 0 0 7px; font-size: 28px; }
.panel-header p { margin: 0; color: var(--muted); }
.panel-content { padding: 22px 0 60px; display: grid; gap: 12px; }
.data-card, .project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.data-card h3, .project-card h3 { margin: 0 0 8px; font-size: 16px; }
.data-card p, .project-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.data-list { display: grid; gap: 8px; }
.data-item { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 13px 15px; line-height: 1.5; }
.code-box, .path-box { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; font-size: 12px; }
.action-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.project-create-form { display: grid; grid-template-columns: minmax(160px, .8fr) minmax(240px, 1.4fr) auto; gap: 9px; align-items: start; }
.project-create-form input, .project-create-form textarea { width: 100%; min-height: 44px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 12px; padding: 11px 13px; outline: none; }
.project-create-form textarea { resize: vertical; min-height: 44px; max-height: 130px; }
.project-grid { display: grid; gap: 12px; }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project-count { color: var(--muted); font-size: 12px; background: var(--surface-2); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.project-chat-list { max-height: 300px; overflow-y: auto; margin-top: 13px; border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 5px; }
.project-chat-button { width: 100%; text-align: left; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text); padding: 10px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-chat-button:hover { background: var(--surface-3); }

.login-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(4,7,13,.86); backdrop-filter: blur(18px); }
.login-overlay.hidden { display: none; }
.login-card { width: min(430px,100%); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { margin: 18px 0 9px; }
.login-card p { color: var(--muted); line-height: 1.55; margin: 0 0 20px; }
.login-card input { width: 100%; height: 48px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 0 14px; outline: 0; margin-bottom: 12px; }
.login-card .primary-button { width: 100%; }
.error-text { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 150; max-width: min(440px, calc(100% - 40px)); background: var(--surface); border: 1px solid var(--border); padding: 13px 16px; border-radius: 13px; box-shadow: var(--shadow); }
.mobile-only { display: none; }

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px,88vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-button, .mobile-only { display: inline-grid; place-items: center; }
  .brand-row .mobile-only { margin-left: auto; }
  .topbar { padding: 0 10px; }
  .topbar-actions { gap: 4px; }
  .project-badge { max-width: 100px; }
  .message-stream { padding: 22px 10px 22px 14px; scrollbar-gutter: auto; }
  .composer-wrap { padding-left: 10px; padding-right: 10px; }
  .starter-grid { grid-template-columns: 1fr; }
  .welcome-card { margin-top: 8vh; }
  .panel-view { padding: 22px 15px; }
  .panel-header { flex-direction: column; }
  .project-create-form { grid-template-columns: 1fr; }
  .composer-note { display: none; }
}

/* PWA layout build 2.0.0-alpha.4.0 */

/* Conversation actions build 2.0.0-alpha.4.0 */
.current-chat-menu { font-size: 22px; letter-spacing: .08em; }
.conversation-menu-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  opacity: .35;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.conversation-row:hover .conversation-menu-button,
.conversation-row.active .conversation-menu-button,
.conversation-menu-button:focus-visible { opacity: 1; }
.conversation-menu-button:hover { background: var(--surface-3); color: var(--text); }
.project-chat-row { display: grid; grid-template-columns: minmax(0,1fr) 34px; gap: 4px; align-items: center; }
.project-menu-button { opacity: .7; }

.conversation-context-menu {
  position: fixed;
  z-index: 220;
  width: min(270px, calc(100vw - 20px));
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.context-menu-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.context-menu-item:hover,
.context-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item:disabled { opacity: .5; cursor: default; }
.context-menu-divider { height: 1px; margin: 5px 4px; background: var(--border); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 230;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 6, 12, .68);
  backdrop-filter: blur(10px);
}
.modal-card {
  width: min(440px, 100%);
  max-height: min(620px, calc(100dvh - 36px));
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}
.modal-card h3 { margin: 0 0 7px; }
.modal-card > p { margin: 0 0 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-picker-list { display: grid; gap: 7px; margin-bottom: 14px; }
.project-picker-button {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 11px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.project-picker-button:hover:not(:disabled) { background: var(--surface-3); }
.project-picker-button:disabled { opacity: .55; cursor: default; }
.muted-text { color: var(--muted); }

@media (max-width: 640px) {
  .conversation-context-menu.mobile-sheet {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    border-radius: 18px;
    padding: 10px;
  }
  .context-menu-item { min-height: 48px; font-size: 16px; }
}

/* Codex Bridge build 2.0.0-alpha.4.0 */
.codex-task-form { display: grid; gap: 12px; }
.codex-task-form input,
.codex-task-form textarea,
.codex-task-form select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 13px;
  outline: none;
}
.codex-task-form textarea { resize: vertical; min-height: 150px; max-height: 360px; line-height: 1.5; }
.field-label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.codex-permission-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.codex-status-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.status-pill.ok, .status-pill.completed { color: #34d399; background: color-mix(in srgb, #34d399 12%, var(--surface-2)); }
.status-pill.running, .status-pill.claimed { color: #60a5fa; background: color-mix(in srgb, #60a5fa 12%, var(--surface-2)); }
.status-pill.waiting, .status-pill.queued, .status-pill.cancel_requested { color: #fbbf24; background: color-mix(in srgb, #fbbf24 12%, var(--surface-2)); }
.status-pill.failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface-2)); }
.status-pill.cancelled { color: var(--muted); }
.status-pill.safe { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, var(--surface-2)); }
.codex-run-list { display: grid; gap: 12px; }
.codex-run-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.codex-run-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.codex-run-header h3 { margin: 0 0 6px; font-size: 16px; }
.codex-run-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.codex-result, .codex-prompt-preview { margin: 13px 0 0; color: var(--muted); line-height: 1.55; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.panel-subheading { margin: 16px 0 0; }
.codex-run-modal { width: min(760px, 100%); }
.codex-output { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 270px; overflow-y: auto; padding: 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); font-family: inherit; line-height: 1.5; }
.codex-event-list { display: grid; gap: 6px; margin: 13px 0; max-height: 250px; overflow-y: auto; }
.codex-event-row { padding: 8px 10px; border-left: 2px solid var(--border); color: var(--muted); font-size: 13px; line-height: 1.45; }

@media (max-width: 640px) {
  .codex-run-header { flex-direction: column; }
  .codex-task-modal { width: 100%; }
}

/* Alpha 0.4.1 UX and management */
.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-grid;
  place-items: center;
  vertical-align: -3px;
}
.ui-icon svg { width: 100%; height: 100%; display: block; }
.nav-label { min-width: 0; display: inline-flex; align-items: center; gap: 10px; }
.nav-button { align-items: center; gap: 12px; }
.ghost-button, .primary-button, .context-menu-item, .project-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.context-menu-item, .project-picker-button { justify-content: flex-start; }
.current-chat-menu, #globalMenuButton { font-size: 0; }
.current-chat-menu::after, #globalMenuButton::after { content: "⋯"; font-size: 22px; letter-spacing: .08em; line-height: 1; }
.always-visible { opacity: 1; }
.mini-icon-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.mini-icon-button:hover, .mini-icon-button:focus-visible { background: var(--surface-3); color: var(--text); outline: none; }
.danger-button { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, var(--border)); }
.danger-button:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

.card-header-actions { flex: none; display: flex; align-items: center; gap: 7px; }
.project-card-copy { min-width: 0; flex: 1; }
.project-card-copy h3 { overflow-wrap: anywhere; }
.path-row { display: flex; align-items: center; gap: 9px; }
.path-row > span:not(.ui-icon) { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.compact-chronology { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.chronology-item, .meta-chip { display: inline-flex; align-items: center; gap: 4px; }
.chronology-item .ui-icon, .meta-chip .ui-icon { width: 14px; height: 14px; flex-basis: 14px; }
.meta-chip { min-height: 27px; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.diff-summary-line { margin-top: 12px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }

.stack-form { display: grid; gap: 13px; }
.stack-form input, .stack-form textarea, .stack-form select,
.confirm-field input, .field-label input, .field-label textarea, .field-label select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 13px;
  outline: none;
}
.stack-form input:focus, .stack-form textarea:focus, .stack-form select:focus,
.confirm-field input:focus, .field-label input:focus, .field-label textarea:focus, .field-label select:focus {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.danger-options, .checkbox-list { display: grid; gap: 9px; margin: 10px 0 14px; }
.radio-option, .checkbox-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  cursor: pointer;
}
.radio-option input, .checkbox-option input { margin-top: 3px; accent-color: var(--accent); }
.radio-option span { display: grid; gap: 4px; }
.radio-option small { color: var(--muted); line-height: 1.45; }
.danger-option { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.confirm-field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; margin-top: 12px; }
.warning-box {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, #fbbf24 34%, var(--border));
  border-radius: 13px;
  background: color-mix(in srgb, #fbbf24 8%, var(--surface-2));
  color: color-mix(in srgb, #fbbf24 78%, var(--text));
  line-height: 1.45;
}
.source-box { display: grid; gap: 9px; padding: 13px; border-radius: 13px; background: var(--surface-2); }
.source-box pre, .technical-log { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.source-box p { margin: 0; color: var(--muted); }

.panel-toolbar, .section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-toolbar > p { margin: 0; }
.updates-banner {
  position: sticky;
  top: 4px;
  z-index: 8;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 9px 14px;
  cursor: pointer;
  backdrop-filter: blur(16px);
}

.memory-list, .background-job-list { display: grid; gap: 11px; }
.memory-card, .background-job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
}
.memory-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.memory-text { margin: 0; color: var(--text); line-height: 1.58; font-size: 16px; }
.memory-meta, .relation-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.relation-list .meta-chip { color: var(--accent-2); }

.status-pill.needs_review { color: #fbbf24; background: color-mix(in srgb, #fbbf24 14%, var(--surface-2)); }
.needs-review-card { border-color: color-mix(in srgb, #fbbf24 38%, var(--border)); box-shadow: inset 3px 0 0 color-mix(in srgb, #fbbf24 70%, transparent); }
.codex-result-panel, .workspace-diff-card {
  margin-bottom: 13px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}
.codex-result-panel h4, .workspace-diff-card h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; }
.codex-result-panel .codex-output { padding: 0; background: transparent; max-height: none; }
.codex-details-section { margin-top: 10px; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: color-mix(in srgb, var(--surface-2) 72%, transparent); }
.codex-details-section > summary { cursor: pointer; padding: 12px 13px; font-weight: 650; list-style-position: inside; }
.codex-details-section > :not(summary) { margin: 0 13px 13px; }
.technical-event-list, .timeline-list { display: grid; gap: 1px; }
.timeline-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-marker { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--accent); }
.timeline-marker .ui-icon { width: 15px; height: 15px; }
.timeline-text { line-height: 1.48; overflow-wrap: anywhere; }
.timeline-row time { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.technical-event-list .timeline-text { font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.technical-event-list .timeline-marker { color: var(--muted); }

.system-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 11px; }
.brand-concepts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.brand-concept { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 13px; align-items: center; padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.brand-concept img { width: 82px; height: 82px; object-fit: contain; border-radius: 16px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.brand-concept p { margin-top: 5px; }

.context-menu-item { gap: 10px; }
.context-menu-item .ui-icon { color: var(--muted); }
.context-menu-item.danger .ui-icon { color: var(--danger); }
.context-menu-divider { margin: 6px 4px; }
.modal-card.codex-run-modal { width: min(820px, 100%); }
.modal-card.codex-run-modal > p { white-space: normal; }

@media (max-width: 820px) {
  .brand-concepts { grid-template-columns: 1fr; }
  .system-grid { grid-template-columns: 1fr 1fr; }
  .project-card-header, .codex-run-header, .memory-card-header { align-items: flex-start; }
}

@media (max-width: 640px) {
  .system-grid { grid-template-columns: 1fr; }
  .project-card-header, .codex-run-header { flex-direction: column; }
  .card-header-actions { width: 100%; justify-content: flex-end; }
  .panel-toolbar, .section-heading-row { align-items: stretch; }
  .panel-toolbar .ghost-button, .section-heading-row .ghost-button { width: 100%; }
  .brand-concept { grid-template-columns: 66px minmax(0, 1fr); }
  .brand-concept img { width: 66px; height: 66px; }
  .modal-card { padding: 15px; }
  .codex-details-section > summary { min-height: 48px; display: flex; align-items: center; }
}

.brand-logo { object-fit: cover; padding: 0; background: #0f1420; }
.brand-logo.large { font-size: 0; }
