:root {
  color-scheme: dark;
  --bg: #111111;
  --sidebar: #171717;
  --surface: #1c1c1c;
  --surface-raised: #232323;
  --surface-hover: #292929;
  --line: #303030;
  --line-strong: #414141;
  --text: #f2f2f2;
  --text-soft: #d0d0d0;
  --muted: #949494;
  --muted-low: #6f6f6f;
  --green: #65c68b;
  --blue: #79a8ff;
  --yellow: #e5b85b;
  --red: #ef8585;
  --purple: #b89bf4;
  --sidebar-width: 292px;
  --inspector-width: 304px;
  --ui-font: "Inter", "SF Pro Text", "Segoe UI Variable Text", "Segoe UI",
    "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC",
    "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Zen Hei", system-ui,
    -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-family: var(--ui-font);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.boot-screen,
.login-screen {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
}

.boot-screen {
  grid-auto-flow: column;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.login-screen {
  background: #121212;
}

.login-panel {
  display: grid;
  width: min(100%, 390px);
  gap: 24px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
}

.login-panel h1 {
  margin: 4px 0 8px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0;
}

.login-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.codex-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: url("./icon.svg") center / contain no-repeat;
  color: transparent;
  font-size: 0;
}

.login-mark {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

.empty-mark {
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
}

.kicker {
  margin: 0;
  color: var(--muted-low);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #151515;
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus,
.composer-shell:focus-within {
  border-color: #666;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 6%);
}

.form-error {
  min-height: 18px;
  margin: -14px 0 -8px;
  color: var(--red);
  font-size: 12px;
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  border-color: #ededed;
  background: #ededed;
  color: #151515;
}

.button-primary:hover {
  background: #fff;
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text-soft);
}

.button-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.button-danger-quiet {
  border-color: rgb(239 133 133 / 30%);
  background: rgb(239 133 133 / 8%);
  color: #f3aaaa;
}

.button-full {
  width: 100%;
}

.icon-button,
.mini-button,
.send-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.mini-button {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.mini-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.app-shell {
  display: grid;
  height: 100dvh;
  min-height: 0;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 0;
  overflow: hidden;
  background: var(--bg);
  transition: grid-template-columns 160ms ease;
}

.app-shell.inspector-open {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--inspector-width);
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.sidebar-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand strong {
  font-size: 13px;
  font-weight: 650;
}

.brand span:last-child {
  color: var(--muted-low);
  font-size: 10px;
}

.new-task-button {
  display: grid;
  min-height: 38px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin: 3px 12px 12px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.new-task-button:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.new-task-button kbd {
  color: var(--muted-low);
  font-family: inherit;
  font-size: 9px;
}

.search-field {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  margin: 0 12px 13px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #131313;
  color: var(--muted-low);
}

.search-field:focus-within {
  border-color: var(--line-strong);
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 11px;
}

.search-field input::placeholder {
  color: var(--muted-low);
}

.sidebar-section-header {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px 4px 16px;
  color: var(--muted-low);
  font-size: 10px;
  font-weight: 650;
}

.sidebar-section-header > div {
  display: flex;
  align-items: center;
  gap: 4px;
}

.archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 9px;
}

.archive-toggle input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #ddd;
}

.project-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
  scrollbar-color: #444 transparent;
  scrollbar-width: thin;
}

.project-group {
  margin-bottom: 5px;
}

.project-header {
  display: grid;
  width: 100%;
  min-height: 32px;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.project-header:hover {
  background: #202020;
  color: var(--text-soft);
}

.project-chevron {
  color: var(--muted-low);
  transition: transform 120ms ease;
}

.project-header.expanded .project-chevron {
  transform: rotate(90deg);
}

.project-name-text {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-host {
  display: none;
}

.project-count {
  min-width: 18px;
  color: var(--muted-low);
  font-size: 9px;
  text-align: right;
}

.project-threads {
  display: grid;
  gap: 1px;
  padding: 2px 0 5px 10px;
}

.thread-item {
  display: grid;
  width: 100%;
  min-height: 48px;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.thread-item:hover {
  background: #202020;
}

.thread-item.active {
  border-color: #353535;
  background: #262626;
}

.thread-item-top,
.thread-item-bottom {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.thread-item-title {
  overflow: hidden;
  flex: 1;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-item-time {
  flex: none;
  color: var(--muted-low);
  font-size: 9px;
}

.thread-status-dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: #565656;
}

.thread-status-dot.running {
  background: var(--green);
  box-shadow: 0 0 0 3px rgb(101 198 139 / 10%);
}

.thread-status-dot.archived {
  background: var(--yellow);
}

.thread-item-meta {
  overflow: hidden;
  color: var(--muted-low);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-projects {
  padding: 20px 10px;
  color: var(--muted-low);
  font-size: 11px;
  text-align: center;
}

.sidebar-footer {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-top: 1px solid var(--line);
}

.connector-status {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.connector-status > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.connector-status strong,
.connector-status span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connector-status strong {
  font-size: 10px;
  font-weight: 600;
}

.connector-status span:last-child {
  color: var(--muted-low);
  font-size: 9px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #626262;
}

.status-dot.online {
  background: var(--green);
}

.main-panel {
  position: relative;
  display: flex;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  min-width: 0;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(17 17 17 / 94%);
  backdrop-filter: blur(12px);
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar h2 {
  overflow: hidden;
  margin: 0 0 3px;
  font-size: 13px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: var(--muted-low);
  font-size: 9px;
}

.session-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-separator {
  flex: none;
  opacity: 0.5;
}

.meta-chip {
  flex: none;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.running-indicator {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  padding: 0 8px;
  border: 1px solid rgb(101 198 139 / 24%);
  border-radius: 5px;
  color: var(--green);
  font-size: 9px;
}

.running-indicator::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s ease-in-out infinite;
}

.offline-banner {
  padding: 7px 14px;
  border-bottom: 1px solid rgb(229 184 91 / 22%);
  background: rgb(229 184 91 / 8%);
  color: #e3c27d;
  font-size: 10px;
  text-align: center;
}

.empty-workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  padding: 32px 20px;
}

.empty-workspace-content {
  width: min(100%, 500px);
  text-align: center;
}

.empty-workspace h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 620;
}

.empty-workspace p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.workspace-summary {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 30px;
  color: var(--muted-low);
  font-size: 10px;
}

.workspace-summary strong {
  color: var(--text-soft);
  font-size: 12px;
}

.conversation {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #444 transparent;
  scrollbar-width: thin;
}

.timeline {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 30px 28px 20px;
}

.timeline.timeline-reveal {
  animation: timeline-fade-in 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.load-older-history {
  display: block;
  min-height: 31px;
  margin: 0 auto 22px;
  padding: 0 13px;
  border: 1px solid #e0e3e7;
  border-radius: 999px;
  background: #fff;
  color: #737980;
  cursor: pointer;
  font-size: 10.5px;
}

.load-older-history:hover:not(:disabled) {
  border-color: #cfd4da;
  background: #f8f9fa;
  color: #30343a;
}

.load-older-history:disabled {
  cursor: wait;
  opacity: 0.6;
}

@keyframes timeline-fade-in {
  from {
    opacity: 0;
    transform: translate3d(0, 7px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline.timeline-reveal {
    animation: none;
  }
}

.history-loader,
.empty-conversation {
  padding: 36px 20px;
  color: var(--muted-low);
  font-size: 11px;
  text-align: center;
}

.message {
  width: 100%;
  margin: 0 0 18px;
}

.message-user {
  display: flex;
  justify-content: flex-end;
}

.user-bubble {
  max-width: min(78%, 680px);
  padding: 10px 13px;
  border: 1px solid #393939;
  border-radius: 8px;
  background: #262626;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-card {
  padding: 2px 0;
}

.assistant-label {
  margin-bottom: 8px;
  color: var(--muted-low);
  font-size: 9px;
  font-weight: 700;
}

.assistant-text {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.assistant-text p {
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.assistant-text p:last-child {
  margin-bottom: 0;
}

.assistant-text .katex,
.activity-rich-text .katex,
.file-markdown .katex {
  max-width: 100%;
  color: inherit;
  font-size: 1.04em;
  white-space: nowrap;
}

.assistant-text .katex-display,
.activity-rich-text .katex-display,
.file-markdown .katex-display {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 15px 0;
  padding: 5px 2px 8px;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.assistant-text .katex-display > .katex,
.activity-rich-text .katex-display > .katex,
.file-markdown .katex-display > .katex {
  min-width: max-content;
}

.assistant-text .katex-error,
.activity-rich-text .katex-error,
.file-markdown .katex-error {
  color: #b42318;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.streaming-cursor {
  display: inline-block;
  width: 6px;
  height: 15px;
  margin-left: 3px;
  transform: translateY(2px);
  border-radius: 1px;
  background: var(--text-soft);
  animation: codex-cursor 0.9s steps(2, end) infinite;
}

@keyframes codex-cursor {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

.assistant-text strong {
  color: var(--text);
}

.assistant-text a {
  color: var(--blue);
  text-decoration: none;
}

.assistant-text a:hover {
  text-decoration: underline;
}

.assistant-text h3,
.assistant-text h4,
.assistant-text h5,
.assistant-text h6 {
  margin: 20px 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.assistant-text code,
.inline-code {
  padding: 2px 4px;
  border-radius: 4px;
  background: #282828;
  color: #e0e0e0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.code-block,
.approval-command {
  max-width: 100%;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d0d0d;
  color: #d2d2d2;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-block-frame {
  overflow: hidden;
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d0d0d;
}

.code-block-frame .code-block {
  max-height: 480px;
  border: 0;
  border-radius: 0;
}

.code-block-toolbar {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-low);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.code-copy {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  padding: 0;
}

.code-copy:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.code-copy:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.code-copy-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.code-copy[data-state="success"] {
  color: var(--green);
}

.code-copy[data-state="error"] {
  color: var(--red);
}

.markdown-list {
  margin: 8px 0 14px;
  padding-left: 21px;
}

.markdown-list li {
  margin: 4px 0;
}

.markdown-table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  font-size: 11px;
}

.markdown-table th,
.markdown-table td {
  padding: 7px 8px;
  border: 1px solid var(--line);
  text-align: left;
}

.markdown-table th {
  background: var(--surface);
  color: var(--text);
}

.event-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #151515;
}

.event-card summary {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.event-card summary::-webkit-details-marker {
  display: none;
}

.event-card summary::before {
  content: "›";
  color: var(--muted-low);
  transition: transform 120ms ease;
}

.event-card[open] summary::before {
  transform: rotate(90deg);
}

.event-summary-main {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-badge {
  color: var(--muted-low);
  font-size: 9px;
  text-transform: uppercase;
}

.event-body {
  padding: 0 10px 10px;
}

.file-change-list,
.todo-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-change-list li,
.todo-list li {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-soft);
  font-size: 11px;
}

.file-kind {
  flex: none;
  color: var(--yellow);
  font-size: 9px;
}

.file-path {
  min-width: 0;
  overflow: hidden;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-list li.completed {
  color: var(--muted-low);
}

.todo-list li.in-progress {
  color: var(--text);
}

.tool-meta {
  display: grid;
  gap: 7px;
}

.tool-meta code {
  overflow: auto;
  padding: 8px;
  border-radius: 5px;
  background: #0e0e0e;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  white-space: pre-wrap;
}

.search-card,
.error-card {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 11px;
}

.search-card {
  border-color: rgb(121 168 255 / 24%);
  background: rgb(121 168 255 / 6%);
}

.error-card {
  border-color: rgb(239 133 133 / 26%);
  background: rgb(239 133 133 / 7%);
  color: #efaaaa;
}

.diff-block {
  overflow: auto;
  max-height: 460px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0d0d0d;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.5;
}

.diff-line {
  display: block;
  min-width: max-content;
  padding: 0 9px;
  white-space: pre;
}

.diff-line.add {
  background: rgb(101 198 139 / 11%);
  color: #a6dfbd;
}

.diff-line.remove {
  background: rgb(239 133 133 / 10%);
  color: #efadad;
}

.diff-line.header {
  color: var(--blue);
}

.composer {
  position: relative;
  z-index: 8;
  padding: 10px 18px max(14px, env(safe-area-inset-bottom));
  background: var(--bg);
}

.composer-shell {
  width: min(100%, 900px);
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgb(0 0 0 / 22%);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 62px;
  max-height: 190px;
  resize: none;
  padding: 14px 14px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 13px;
  line-height: 1.55;
}

.composer textarea::placeholder {
  color: var(--muted-low);
}

.composer-toolbar {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 7px 7px 10px;
}

.composer-options,
.composer-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.composer-options select {
  max-width: 150px;
  min-height: 26px;
  padding: 0 22px 0 7px;
  border: 0;
  border-radius: 5px;
  background: #292929;
  color: var(--muted);
  outline: none;
  font-size: 9px;
}

.connection-label,
.composer-hint {
  color: var(--muted-low);
  font-size: 9px;
}

.send-button {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 6px;
}

.send-button {
  background: #ededed;
  color: #151515;
  font-size: 15px;
  font-weight: 750;
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.inspector {
  position: relative;
  z-index: 15;
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #151515;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.app-shell.inspector-open .inspector {
  opacity: 1;
  pointer-events: auto;
}

.inspector-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 15px;
  border-bottom: 1px solid var(--line);
}

.inspector-header strong {
  font-size: 12px;
  font-weight: 620;
}

.inspector-scroll {
  min-height: 0;
  overflow-y: auto;
}

.inspector-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.inspector-section h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title-row h3 {
  margin: 0;
}

.detail-list {
  display: grid;
  gap: 11px;
  margin: 0;
}

.detail-list > div {
  display: grid;
  gap: 3px;
}

.detail-list dt {
  color: var(--muted-low);
  font-size: 9px;
}

.detail-list dd {
  overflow: hidden;
  margin: 0;
  color: var(--text-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.tool-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.tool-summary p {
  margin: 0;
  color: var(--muted-low);
  font-size: 10px;
  line-height: 1.5;
}

.tool-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 10px;
}

.tool-stat strong {
  color: var(--text-soft);
  font-size: 11px;
}

.connection-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 62%);
  backdrop-filter: blur(5px);
}

.modal {
  display: grid;
  width: min(100%, 480px);
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #1b1b1b;
  box-shadow: 0 24px 70px rgb(0 0 0 / 48%);
}

.modal-compact {
  width: min(100%, 420px);
}

.approval-modal {
  width: min(100%, 620px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal h3 {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 620;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.approval-actions {
  flex-wrap: wrap;
}

.approval-reason {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.approval-command {
  max-height: 330px;
}

.approval-questions {
  display: grid;
  gap: 14px;
}

.approval-question {
  display: grid;
  gap: 8px;
}

.approval-question strong {
  font-size: 11px;
  font-weight: 620;
}

.approval-options {
  display: grid;
  gap: 6px;
}

.approval-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
}

.approval-option:hover {
  background: var(--surface-raised);
}

.approval-option input {
  margin: 2px 0 0;
  accent-color: #ddd;
}

.approval-question > input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #111;
  color: var(--text);
  outline: none;
}

.toast-stack {
  position: fixed;
  z-index: 120;
  right: 16px;
  bottom: 16px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 8px;
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #252525;
  color: var(--text-soft);
  box-shadow: 0 12px 34px rgb(0 0 0 / 35%);
  font-size: 11px;
  line-height: 1.45;
}

.toast.error {
  border-color: rgb(239 133 133 / 36%);
  color: #efaaaa;
}

.mobile-only,
.mobile-scrim {
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .app-shell.inspector-open {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .inspector {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(var(--inspector-width), calc(100vw - 28px));
    transform: translateX(100%);
    box-shadow: -20px 0 50px rgb(0 0 0 / 32%);
    transition:
      transform 160ms ease,
      opacity 120ms ease;
  }

  .app-shell.inspector-open .inspector {
    transform: translateX(0);
  }
}

/* Inline running duration in the task list */
.thread-item-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.thread-item-meta.running {
  color: #18815e;
}

.thread-running-label {
  flex: none;
  color: #16845f;
  font-weight: 560;
}

.thread-duration-separator {
  flex: none;
  color: #a1a7ae;
}

.thread-running-duration {
  flex: none;
  color: #838a92;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 760px) {
  :root {
    --sidebar-width: min(320px, calc(100vw - 34px));
  }

  .app-shell,
  .app-shell.inspector-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .mobile-only {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    transform: translateX(-102%);
    box-shadow: 18px 0 50px rgb(0 0 0 / 40%);
    transition: transform 160ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-scrim {
    position: fixed;
    z-index: 45;
    inset: 0;
    background: rgb(0 0 0 / 55%);
  }

  .mobile-scrim.open {
    display: block;
  }

  .topbar {
    min-height: 54px;
    padding: 7px 10px;
  }

  .thread-action {
    display: none !important;
  }

  .timeline {
    padding: 22px 14px 16px;
  }

  .message {
    margin-bottom: 15px;
  }

  .user-bubble {
    max-width: 88%;
    font-size: 12px;
  }

  .assistant-text {
    font-size: 12px;
  }

  .composer {
    padding: 8px 8px max(9px, env(safe-area-inset-bottom));
  }

  .composer-toolbar {
    align-items: flex-end;
  }

  .composer-options {
    flex-wrap: wrap;
  }

  .composer-options select {
    max-width: 118px;
  }

  .composer-hint,
  .connection-label {
    display: none;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal,
  .modal-compact,
  .approval-modal {
    width: 100%;
    max-height: 86dvh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .approval-actions .button {
    flex: 1;
  }
}

.process-group {
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid #e5e7ea;
  border-radius: 10px;
  background: #fafafa;
}

.process-group > summary {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #50545b;
  cursor: pointer;
  font-size: 11.5px;
  list-style: none;
}

.process-group > summary::-webkit-details-marker {
  display: none;
}

.process-group > summary::before {
  color: #9ba0a8;
  content: "›";
  transform-origin: center;
  transition: transform 140ms ease;
}

.process-group[open] > summary::before {
  transform: rotate(90deg);
}

.process-group-title {
  flex: 1;
}

.process-group-count {
  color: #979ca4;
  font-size: 10px;
}

.process-group-body {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.process-group-body > .message {
  margin: 0;
}

.process-group-body .event-card {
  background: #fff;
}

.native-select-hidden {
  display: none !important;
}

.custom-select {
  position: relative;
  min-width: 0;
  width: 100%;
}

.custom-select-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid #dedfe3;
  border-radius: 9px;
  background: #fff;
  color: #33363b;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.custom-select-button:hover,
.custom-select.open .custom-select-button {
  border-color: #c8cbd1;
  background: #fafafa;
}

.custom-select-button svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: #8d929a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transition: transform 130ms ease;
}

.custom-select.open .custom-select-button svg {
  transform: rotate(180deg);
}

.custom-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-menu {
  position: absolute;
  z-index: 72;
  top: calc(100% + 6px);
  left: 0;
  display: none;
  width: 100%;
  max-height: 286px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #dfe1e5;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 36px rgb(28 32 38 / 14%);
}

.custom-select.open .custom-select-menu {
  display: block;
}

.custom-select-option {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  padding: 0 28px 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #42464d;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.custom-select-option:hover {
  background: #f1f2f4;
}

.custom-select-option.selected {
  background: #f3f4f6;
  color: #202124;
  font-weight: 600;
}

.custom-select-option.selected::after {
  position: absolute;
  right: 9px;
  color: #555a62;
  content: "✓";
  font-size: 11px;
}

.custom-select-compact {
  width: auto;
  max-width: 160px;
}

.custom-select-compact .custom-select-button {
  width: auto;
  min-height: 32px;
  gap: 5px;
  padding: 0 6px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: #777c84;
  font-size: 13px;
}

.custom-select-compact .custom-select-button:hover,
.custom-select-compact.open .custom-select-button {
  border-color: transparent;
  background: #eff0f2;
}

.custom-select-compact .custom-select-label {
  max-width: 122px;
}

.custom-select-compact .custom-select-menu {
  top: auto;
  right: 0;
  bottom: calc(100% + 8px);
  left: auto;
  width: 270px;
}

@media (max-width: 760px) {
  .custom-select-compact {
    max-width: 124px;
  }

  .custom-select-compact .custom-select-label {
    max-width: 92px;
  }

.custom-select-compact .custom-select-menu {
    width: min(270px, calc(100vw - 32px));
  }
}

.project-header,
.project-header.expanded {
  background: transparent;
}

.project-header:hover {
  background: #ececef;
}

.project-group + .project-group {
  margin-top: 2px;
}

.project-count {
  background: transparent;
  color: #a4a8af;
  font-variant-numeric: tabular-nums;
}

.project-threads {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid #e1e3e6;
}

.thread-item {
  margin: 1px 0;
  padding: 6px 8px;
}

.thread-item.active {
  background: #e8e9ec;
}

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

.mini-button svg,
.project-add-thread-button svg,
.project-delete-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #52565d;
  cursor: pointer;
  font-size: 12px;
}

.checkbox-field input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #202124;
}

.form-hint {
  margin: -5px 0 0;
  color: #8d929a;
  font-size: 11px;
  line-height: 1.55;
}

.button-danger {
  border-color: #d95656;
  background: #d95656;
  color: #fff;
}

.button-danger:hover {
  background: #c94848;
}

.project-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 7px;
}

.project-header-row:hover {
  background: #ececef;
}

.project-header-row .project-header,
.project-header-row .project-header:hover,
.project-header-row .project-header.expanded {
  background: transparent;
}

.project-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  padding-right: 2px;
}

.project-add-thread-button,
.project-delete-button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #a0a4ab;
  cursor: pointer;
}

.project-add-thread-button {
  opacity: 0.62;
}

.project-add-thread-button:hover {
  background: #dedfe2;
  color: #25282c;
  opacity: 1;
}

.project-delete-button {
  opacity: 0;
}

.project-header-row:hover .project-add-thread-button,
.project-add-thread-button:focus-visible {
  opacity: 1;
}

.project-header-row:hover .project-delete-button,
.project-delete-button:focus-visible {
  opacity: 1;
}

.project-delete-button:hover {
  background: #dedfe2;
  color: #b94040;
}

@media (hover: none), (max-width: 760px) {
  .project-add-thread-button,
  .project-delete-button {
    opacity: 1;
  }
}

/* Codex desktop-inspired light theme */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --sidebar: #f5f5f6;
  --surface: #ffffff;
  --surface-raised: #f3f4f6;
  --surface-hover: #e9eaed;
  --line: #e7e8eb;
  --line-strong: #d9dbe0;
  --text: #202124;
  --text-soft: #3c4043;
  --muted: #6f747c;
  --muted-low: #9a9fa7;
  --green: #18a56f;
  --blue: #3478e5;
  --yellow: #c58a16;
  --red: #d94c4c;
  --purple: #8257c8;
  --sidebar-width: 292px;
  --inspector-width: 304px;
  font-family: var(--ui-font);
}

html,
body {
  background: #fff;
  color: var(--text);
}

.boot-screen,
.login-screen {
  background: #f6f7f8;
}

.boot-screen {
  color: #666b73;
}

.login-panel {
  border: 1px solid #e3e5e8;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(24 27 32 / 8%);
}

.login-panel h1,
.brand strong,
.topbar h2 {
  color: #202124;
}

.login-copy,
.brand span:last-child {
  color: #858a92;
}

.codex-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: url("./icon.svg") center / contain no-repeat;
}

.login-mark {
  width: 38px;
  height: 38px;
}

.empty-mark {
  width: 34px;
  height: 34px;
  margin-bottom: 15px;
}

.kicker {
  color: #989da5;
}

.field {
  color: #555a62;
}

.field input,
.field select {
  border-color: #dedfe3;
  border-radius: 9px;
  background: #fff;
  color: #25262a;
}

.field input:focus,
.field select:focus,
.composer-shell:focus-within {
  border-color: #b8bcc4;
  box-shadow: 0 0 0 3px rgb(30 32 36 / 5%);
}

.button {
  border-radius: 9px;
}

.button-primary {
  border-color: #202124;
  background: #202124;
  color: #fff;
}

.button-primary:hover {
  background: #000;
}

.button-secondary {
  border-color: #dde0e4;
  background: #fff;
  color: #3e4248;
}

.button-secondary:hover {
  background: #f3f4f6;
}

.icon-button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #666b73;
  font-size: 15px;
}

.icon-button:hover,
.mini-button:hover {
  background: #e9eaed;
  color: #202124;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.sidebar {
  border-right: 1px solid #ececef;
  background: #f5f5f6;
}

.sidebar-header {
  min-height: 58px;
  padding: 13px 14px 10px 16px;
}

.brand {
  gap: 8px;
}

.brand strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand span:last-child {
  display: none;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}

.new-task-button {
  min-height: 34px;
  margin: 3px 10px 9px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #303338;
}

.new-task-button:hover {
  background: #e9eaed;
  color: #1f2023;
}

.new-task-button > span:nth-child(2) {
  font-size: 13px;
  font-weight: 600;
}

.new-task-button kbd {
  color: #a0a4ab;
  font-size: 10px;
}

.new-task-icon {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  color: #787d85;
  font-size: 15px;
}

.search-field {
  min-height: 34px;
  margin: 0 10px 10px;
  border-color: #dedfe3;
  border-radius: 8px;
  background: #fff;
  color: #8e939b;
}

.search-field.collapsed {
  display: none;
}

.sidebar-section-header {
  min-height: 31px;
  padding: 0 15px;
  color: #959aa2;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-transform: none;
}

.sidebar-section-header .archive-toggle {
  display: none;
}

.project-list {
  padding: 0 8px 16px;
}

.project-group {
  margin-bottom: 1px;
}

.project-header {
  min-height: 32px;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 7px;
  color: #303338;
}

.project-header:hover,
.project-header.expanded {
  background: #ececef;
}

.project-chevron {
  width: 12px;
  color: #a0a4ab;
  font-size: 14px;
}

.project-name-text {
  font-size: 13px;
  font-weight: 600;
}

.project-host {
  display: none;
}

.project-count {
  min-width: 18px;
  padding: 1px 5px;
  background: #e7e8eb;
  color: #8c9199;
  font-size: 9px;
}

.project-threads {
  gap: 0;
  padding: 0 0 4px 20px;
}

.thread-item {
  min-height: 33px;
  gap: 2px;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  color: #42464d;
}

.thread-item:hover {
  background: #ececef;
}

.thread-item.active {
  border-color: transparent;
  background: #e5e6e9;
  color: #25262a;
}

.thread-item-title {
  font-size: 12px;
  font-weight: 450;
}

.thread-item-time {
  color: #a0a4ab;
}

.thread-item-meta {
  color: #969ba3;
}

.thread-status-dot {
  width: 6px;
  height: 6px;
  background: #b5b9c0;
}

.thread-status-dot.running {
  background: var(--green);
  box-shadow: none;
}

.thread-status-dot.archived {
  background: #c6a66b;
}

.empty-projects {
  color: #8d929a;
}

.sidebar-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid #e4e5e8;
  gap: 6px;
}

.sidebar-footer .connector-status {
  flex: 1;
}

.runtime-statistics {
  position: relative;
  flex: none;
}

.runtime-statistics-button {
  color: #777e88;
}

.runtime-statistics-button.counting {
  color: #2e8568;
}

.runtime-statistics-panel {
  position: absolute;
  z-index: 60;
  right: -34px;
  bottom: calc(100% + 12px);
  display: flex;
  width: min(268px, calc(var(--sidebar-width, 292px) - 24px));
  flex-direction: column;
  gap: 6px;
  padding: 17px 18px 14px;
  border: 1px solid #e4e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 36px rgb(28 36 48 / 12%), 0 2px 6px rgb(28 36 48 / 4%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 140ms ease, transform 160ms ease, visibility 140ms;
}

.runtime-statistics::before {
  position: absolute;
  right: -8px;
  bottom: 100%;
  left: -8px;
  height: 14px;
  content: "";
}

.runtime-statistics.open .runtime-statistics-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.runtime-statistics-heading {
  margin-bottom: 7px;
  color: #353b43;
  font-size: 12px;
  font-weight: 600;
}

.runtime-statistics-label {
  color: #858b94;
  font-size: 11px;
}

.runtime-statistics-value {
  color: #262d35;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.runtime-statistics-activity {
  margin-bottom: 6px;
  color: #8c929a;
  font-size: 10px;
}

.runtime-statistics-activity.counting {
  color: #2e8568;
}

.runtime-statistics-note,
.runtime-statistics-start {
  color: #9399a2;
  font-size: 10px;
  line-height: 1.65;
}

.runtime-statistics-start {
  padding-top: 8px;
  border-top: 1px solid #f0f1f3;
}

.connector-status {
  min-height: 36px;
  padding: 6px 7px;
  border-radius: 7px;
}

.connector-status:hover {
  background: #ececef;
}

.connector-status strong {
  color: #474b52;
  font-size: 11px;
  font-weight: 550;
}

.connector-status span:last-child {
  color: #969ba3;
  font-size: 9px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #b9bdc4;
}

.status-dot.online {
  background: var(--green);
  box-shadow: none;
}

.main-panel {
  background: #fff;
}

.topbar {
  min-height: 57px;
  padding: 7px 18px;
  border-bottom: 1px solid #ececef;
  background: rgb(255 255 255 / 94%);
  box-shadow: none;
  backdrop-filter: blur(16px);
}

.topbar h2 {
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 650;
}

.session-meta {
  gap: 5px;
  color: #9a9fa7;
  font-size: 9px;
}

.meta-chip {
  border-color: #e2e4e8;
  background: #f4f5f6;
  color: #777c84;
}

.topbar-actions {
  gap: 3px;
}

.running-indicator,
.turn-state {
  min-height: 27px;
  padding: 0 9px;
  border-color: #cfe9dd;
  background: #f0faf5;
  color: #16875f;
  font-size: 10px;
}

.running-indicator::before,
.turn-state::before {
  background: #18a56f;
}

.offline-banner {
  border-color: #f0ddb7;
  background: #fff9ed;
  color: #8d681d;
}

.welcome-panel,
.empty-workspace {
  background: #fff;
}

.welcome-content h1 {
  color: #202124;
  font-weight: 620;
}

.welcome-content > p:not(.eyebrow),
.feature-grid span,
.catalog-stats span {
  color: #7c8189;
}

.feature-grid,
.workspace-summary {
  border-color: #e6e7ea;
  background: #eef0f2;
}

.feature-grid > div {
  background: #fafafa;
}

.conversation {
  background: #fff;
}

.history-loader {
  border-color: #ececef;
  background: rgb(255 255 255 / 94%);
  color: #8c9199;
}

.timeline {
  width: min(100%, 870px);
  padding: 28px 36px 24px;
}

.message {
  margin-bottom: 20px;
}

.user-bubble {
  max-width: min(76%, 640px);
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: #f0f1f3;
  color: #373a3f;
  font-size: 13px;
  line-height: 1.6;
}

.assistant-card {
  padding: 0;
}

.assistant-label {
  display: none;
}

.assistant-text {
  color: #303338;
  font-size: 13.5px;
  line-height: 1.72;
}

.assistant-text p {
  margin-bottom: 11px;
}

.assistant-text a,
.message-link {
  color: #256ac9;
}

.assistant-text h3,
.assistant-text h4,
.assistant-text h5,
.assistant-text h6 {
  color: #202124;
}

.markdown-heading {
  margin: 18px 0 8px;
  font-size: 14px;
}

.inline-code {
  border-color: #e3e5e8;
  background: #f3f4f6;
  color: #373a3f;
}

.event-card {
  overflow: hidden;
  border-color: #e5e7ea;
  border-radius: 10px;
  background: #fafafa;
}

.event-card summary {
  min-height: 40px;
  color: #50545b;
}

.event-card summary::before {
  color: #9ba0a8;
}

.event-badge {
  background: #eceef1;
  color: #7e838b;
}

.event-body {
  padding: 0 11px 11px;
}

.code-block,
.approval-command {
  border-color: #e2e4e8;
  border-radius: 7px;
  background: #f5f6f7;
  color: #383b40;
}

.code-block-frame {
  border-color: #e2e4e8;
  background: #f7f8f9;
}

.code-block-toolbar {
  border-color: #e5e7ea;
  color: #92979f;
}

.code-copy {
  color: #6f747c;
}

.code-copy:hover {
  background: #e9eaed;
  color: #303338;
}

.markdown-table th,
.markdown-table td {
  border-color: #e2e4e8;
}

.markdown-table th {
  background: #f4f5f6;
  color: #565b63;
}

.diff-block {
  border-color: #e2e4e8;
  background: #fff;
  color: #4b4f56;
}

.diff-line.add {
  background: #eef8f2;
  color: #257851;
}

.diff-line.remove {
  background: #fff1f1;
  color: #a94b4b;
}

.diff-line.header {
  color: #4b6fa8;
}

.search-card {
  border-color: #dbe5f6;
  background: #f3f7fd;
  color: #42638f;
}

.error-card {
  border-color: #f1d7d7;
  background: #fff6f6;
  color: #a34b4b;
}

.todo-list li.completed {
  color: #969ba3;
}

.streaming-cursor {
  background: #5b5f66;
}

.composer {
  z-index: 12;
  padding: 8px 24px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgb(255 255 255 / 0%), #fff 20%);
}

.composer-shell {
  width: min(100%, 780px);
  min-height: 100px;
  padding: 12px 12px 9px;
  border-color: #dfe1e5;
  border-radius: 16px;
  background: #fff;
  box-shadow:
    0 8px 24px rgb(30 35 42 / 6%),
    0 1px 2px rgb(30 35 42 / 4%);
}

.composer textarea {
  min-height: 44px;
  padding: 4px 5px 9px;
  color: #292b2f;
  font-size: 14px;
  line-height: 1.55;
}

.composer textarea::placeholder {
  color: #a1a5ac;
}

.composer-toolbar {
  min-height: 32px;
  align-items: center;
  gap: 8px;
}

.composer-leading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.composer-add {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #555a62;
  cursor: pointer;
  line-height: 0;
  padding: 0;
}

.composer-add:hover {
  background: #efeff1;
}

.composer-add svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.65;
}

.permission-pill {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #5f656d;
  font-size: 10px;
  white-space: nowrap;
}

.permission-pill .permission-icon {
  display: grid;
  width: 16px;
  height: 16px;
  flex: none;
  place-items: center;
}

.permission-pill .permission-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.permission-pill[data-permission="full"] {
  background: #fff4e8;
  color: #b75b18;
  font-weight: 650;
}

.composer-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.composer-options select {
  max-width: 150px;
  min-height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #777c84;
  font-size: 11px;
}

.composer-options select:hover {
  background: #f0f1f3;
}

.connection-label {
  overflow: hidden;
  color: #989da5;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-hint {
  color: #a2a6ad;
  font-size: 9px;
}

.send-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #202124;
  color: #fff;
  font-size: 18px;
}

.send-button:hover {
  background: #000;
}

.send-button:disabled {
  background: #c6c9ce;
}

.inspector {
  position: fixed;
  z-index: 32;
  top: 75px;
  right: 22px;
  display: none;
  width: min(var(--inspector-width), calc(100vw - 36px));
  max-height: calc(100dvh - 108px);
  overflow: hidden;
  border: 1px solid #e1e3e7;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(32 35 40 / 8%);
}

.app-shell.inspector-open .inspector {
  display: flex;
  flex-direction: column;
}

.inspector-header {
  min-height: 43px;
  padding: 0 12px 0 15px;
  border-bottom: 0;
}

.inspector-header strong {
  font-size: 13px;
  font-weight: 600;
}

.inspector-scroll {
  overflow-y: auto;
  padding: 0 12px 13px;
}

.inspector-section {
  padding: 13px 0;
  border-top: 1px solid #ececef;
}

.inspector-section h3 {
  color: #8b9098;
  font-size: 10px;
  font-weight: 550;
}

.detail-list {
  gap: 9px;
}

.detail-list dt {
  color: #a0a4ab;
}

.detail-list dd {
  color: #52565d;
  font-size: 11px;
}

.tool-summary {
  gap: 6px;
}

.tool-stat {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid #e6e7ea;
  border-radius: 7px;
  background: #fff;
}

.tool-stat span,
.tool-stat strong {
  color: #646971;
  font-size: 10px;
  font-weight: 500;
}

.connection-row {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: #5e636b;
}

.modal {
  border-color: #e2e4e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 60px rgb(24 28 34 / 14%);
}

.modal-layer {
  background: rgb(28 31 36 / 28%);
  backdrop-filter: blur(2px);
}

.modal-header h3 {
  color: #202124;
}

.approval-reason {
  color: #555a62;
}

.toast {
  border-color: #e0e2e6;
  background: #fff;
  color: #4d5158;
  box-shadow: 0 10px 28px rgb(24 28 34 / 12%);
}

.toast.error {
  border-color: #f0d9d9;
  color: #a44747;
}

@media (max-width: 760px) {
  :root {
    --sidebar-width: min(86vw, 310px);
  }

  .sidebar {
    background: #f5f5f6;
    box-shadow: 20px 0 46px rgb(20 24 30 / 12%);
  }

  .topbar {
    min-height: 54px;
    padding: 6px 10px;
  }

  .timeline {
    padding: 20px 14px 16px;
  }

  .user-bubble {
    max-width: 88%;
    font-size: 13px;
  }

  .assistant-text {
    font-size: 13px;
  }

  .composer {
    padding: 7px 9px max(9px, env(safe-area-inset-bottom));
  }

  .composer-shell {
    min-height: 92px;
    padding: 10px 9px 7px;
    border-radius: 14px;
  }

  .composer-toolbar {
    align-items: flex-end;
  }

  .composer-hint,
  .connection-label {
    display: none;
  }

  .composer-options {
    min-width: 0;
    flex: 1;
  }

  .composer-options select {
    max-width: 110px;
  }

  .inspector {
    top: 62px;
    right: 10px;
    max-height: calc(100dvh - 78px);
  }
}

/* Readability and interaction refinements */
.assistant-text code,
.inline-code,
.tool-meta code,
.event-body code {
  border: 1px solid #e1e3e7;
  border-radius: 5px;
  background: #f1f2f4;
  color: #3f4349;
}

.code-block,
.approval-command,
.code-block-frame .code-block {
  background: #f4f5f6;
  color: #373a3f;
}

.event-card summary {
  font-size: 11.5px;
}

.event-badge {
  font-size: 10px;
}

.topbar-actions .icon-button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.topbar-actions .icon-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.permission-control {
  position: relative;
  flex: none;
}

.permission-button {
  min-width: 98px;
  min-height: 30px;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  background: #fff;
  color: #5d636b;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 650;
}

.permission-button:hover,
.permission-button[aria-expanded="true"] {
  background: #f4f5f6;
  color: #30343a;
}

.permission-button[data-permission="full"] {
  background: #fff4e8;
  color: #b75b18;
}

.permission-button[data-permission="full"]:hover,
.permission-button[data-permission="full"][aria-expanded="true"] {
  background: #ffead5;
  color: #a94e10;
}

.permission-button .permission-icon {
  display: grid;
  width: 17px;
  height: 17px;
  flex: none;
  place-items: center;
}

.permission-button #permission-label {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
}

.permission-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.permission-button > svg:last-child {
  width: 12px;
  height: 12px;
  stroke-width: 1.7;
}

.permission-menu {
  position: absolute;
  z-index: 50;
  bottom: calc(100% + 9px);
  left: 0;
  width: 300px;
  max-height: min(340px, calc(var(--app-height, 100dvh) - 104px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #dfe1e5;
  border-radius: 13px;
  background: #fff;
  box-shadow:
    0 18px 48px rgb(28 32 38 / 14%),
    0 2px 8px rgb(28 32 38 / 6%);
  scrollbar-width: thin;
}

.permission-menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px 8px;
}

.permission-menu-heading strong {
  color: #34383e;
  font-size: 11px;
  font-weight: 600;
}

.permission-menu-heading span {
  color: #a0a5ac;
  font-size: 9px;
  white-space: nowrap;
}

.permission-option {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 20px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #373a3f;
  cursor: pointer;
  text-align: left;
}

.permission-option:hover {
  background: #f2f3f5;
}

.permission-option-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #747b84;
}

.permission-option-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.permission-option-copy {
  display: grid;
  gap: 2px;
}

.permission-option strong {
  font-size: 12px;
  font-weight: 600;
}

.permission-option small {
  color: #8b9098;
  font-size: 10px;
}

.permission-option[data-permission="full"] {
  color: #b75b18;
}

.permission-option[data-permission="full"] .permission-option-icon {
  color: #c3611a;
}

.permission-option[data-permission="full"] small {
  color: #c87942;
}

.permission-option[data-permission="full"]:hover,
.permission-option[data-permission="full"].active {
  background: #fff6ed;
}

.permission-option:not([data-permission="full"]).active {
  background: #f5f6f7;
}

.permission-check {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  visibility: hidden;
  color: #202124;
}

.permission-check svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.permission-option[data-permission="full"] .permission-check {
  color: #b75b18;
}

.permission-option.active .permission-check {
  visibility: visible;
}

.composer-options select {
  min-height: 32px;
  font-size: 13px;
}

.connection-label {
  font-size: 11.5px;
}

.composer-hint {
  font-size: 11px;
}

.send-button {
  width: 36px;
  height: 36px;
  font-size: 19px;
}

@media (max-width: 760px) {
  .permission-menu {
    left: 0;
    width: min(300px, calc(100vw - 30px));
  }

  .composer-options select {
    max-width: 124px;
    font-size: 12.5px;
  }
}

.project-header-row.no-actions {
  grid-template-columns: minmax(0, 1fr);
}

/* Compact Codex-style turn activity */
html,
body,
.app-shell,
.main-panel,
.sidebar {
  height: var(--app-height, 100dvh);
  min-height: 0;
}

body {
  overscroll-behavior: none;
}

.conversation {
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: 24px;
}

.turn-block {
  width: 100%;
  margin: 0 0 28px;
}

.turn-block:last-child {
  margin-bottom: 10px;
}

.turn-block > .message:last-child {
  margin-bottom: 0;
}

.final-answer {
  margin-top: 16px;
  padding: 0;
}

.final-answer .assistant-text {
  color: #2c2f33;
  font-size: 14px;
  line-height: 1.72;
}

.commentary-message {
  margin: 0;
}

.process-group {
  margin: 3px 0 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.process-group > summary {
  display: grid;
  min-height: 34px;
  grid-template-columns: 18px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 8px;
  padding: 2px 2px;
  color: #4f545b;
  cursor: pointer;
  list-style: none;
}

.process-group > summary::-webkit-details-marker {
  display: none;
}

.process-group > summary::before {
  content: none;
}

.process-status-icon {
  position: relative;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  color: #70757d;
  font-size: 10px;
}

.process-running .process-status-icon {
  border: 1.5px solid #d2d5d9;
  border-top-color: #4f545b;
  animation: activity-spin 0.85s linear infinite;
}

.process-completed .process-status-icon {
  background: #eef0f2;
}

.process-completed .process-status-icon::before {
  color: #555b63;
  content: "✓";
  font-size: 10px;
  font-weight: 700;
}

.process-interrupted .process-status-icon {
  background: #f0f1f2;
}

.process-interrupted .process-status-icon::before {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: #8a8f96;
  content: "";
}

.process-failed .process-status-icon {
  background: #fff0f0;
  color: #c84f4f;
}

.process-failed .process-status-icon::before {
  content: "!";
  font-weight: 750;
}

.process-heading {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.process-group-title {
  color: #4b5057;
  font-size: 12px;
  font-weight: 600;
}

.process-group-subtitle {
  overflow: hidden;
  color: #969ba2;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-duration {
  color: #858a92;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.process-chevron {
  color: #a3a7ad;
  font-size: 15px;
  line-height: 1;
  transition: transform 140ms ease;
}

.process-group[open] .process-chevron {
  transform: rotate(90deg);
}

.process-group-body {
  position: relative;
  display: grid;
  gap: 0;
  margin: 3px 0 2px 7px;
  padding: 3px 0 4px 19px;
}

.process-group-body::before {
  position: absolute;
  top: 0;
  bottom: 2px;
  left: 0;
  width: 1px;
  background: #e2e4e7;
  content: "";
}

.activity-entry {
  position: relative;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.activity-entry > summary,
.activity-entry-row {
  display: grid;
  min-height: 29px;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 3px 4px 3px 0;
  color: #666b73;
  cursor: default;
  font-size: 11px;
  list-style: none;
}

details.activity-entry > summary {
  cursor: pointer;
}

.activity-entry > summary::-webkit-details-marker {
  display: none;
}

.activity-dot {
  position: relative;
  z-index: 1;
  width: 6px;
  height: 6px;
  border: 1px solid #b9bdc3;
  border-radius: 50%;
  background: #fff;
}

.activity-entry.current .activity-dot {
  border-color: #656a72;
  background: #656a72;
  box-shadow: 0 0 0 3px rgb(94 99 107 / 9%);
  animation: activity-pulse 1.25s ease-in-out infinite;
}

.activity-entry-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-entry-meta {
  color: #a0a4ab;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.activity-entry-body {
  min-width: 0;
  padding: 2px 5px 9px 17px;
}

.activity-rich-text {
  color: #646971;
  font-size: 11.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.activity-rich-text p {
  margin: 0 0 7px;
}

.activity-rich-text p:last-child {
  margin-bottom: 0;
}

.activity-code {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #e6e7e9;
  border-radius: 7px;
  background: #f7f7f8;
  color: #555a61;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.activity-code-error {
  border-color: #f0d2d2;
  background: #fff8f8;
  color: #b34b4b;
}

.activity-tool-body,
.activity-file-body {
  display: grid;
  gap: 7px;
}

.activity-file-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  color: #686d74;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  list-style: none;
}

.activity-plan {
  font-size: 11px;
}

.activity-truncated {
  padding: 4px 0 5px 17px;
  color: #a0a4ab;
  font-size: 10px;
}

.running-indicator {
  font-variant-numeric: tabular-nums;
}

.topbar-duration {
  min-width: 22px;
}

@keyframes activity-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes activity-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* iPhone browser and installed PWA layout */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    height: var(--app-height, 100dvh);
  }

  .app-shell,
  .main-panel {
    width: 100%;
    height: var(--app-height, 100dvh);
  }

  .topbar {
    min-height: calc(52px + env(safe-area-inset-top));
    padding:
      max(7px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      7px
      max(10px, env(safe-area-inset-left));
  }

  .sidebar-header {
    min-height: calc(58px + env(safe-area-inset-top));
    padding:
      calc(10px + env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      10px
      max(16px, env(safe-area-inset-left));
  }

  .sidebar-footer {
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }

  .conversation {
    scroll-padding-bottom: calc(116px + env(safe-area-inset-bottom));
  }

  .timeline {
    padding:
      18px
      max(13px, env(safe-area-inset-right))
      12px
      max(13px, env(safe-area-inset-left));
  }

  .turn-block {
    margin-bottom: 22px;
  }

  .user-bubble {
    max-width: 90%;
    padding: 9px 11px;
    font-size: 14px;
    line-height: 1.55;
  }

  .final-answer .assistant-text {
    font-size: 14px;
    line-height: 1.68;
  }

  .process-group {
    margin: 1px 0 9px;
  }

  .process-group > summary {
    min-height: 32px;
    grid-template-columns: 17px minmax(0, 1fr) auto 12px;
    gap: 6px;
  }

  .process-group-subtitle {
    max-width: 58vw;
    font-size: 10px;
  }

  .process-duration {
    font-size: 10px;
  }

  .process-group-body {
    margin-left: 7px;
    padding-left: 16px;
  }

  .activity-entry > summary,
  .activity-entry-row {
    min-height: 28px;
    font-size: 10.5px;
  }

  .activity-entry-body {
    padding-left: 15px;
  }

  .composer {
    padding:
      7px
      max(9px, env(safe-area-inset-right))
      max(9px, env(safe-area-inset-bottom))
      max(9px, env(safe-area-inset-left));
  }

  .composer textarea,
  .field input,
  .field select,
  .approval-question > input {
    font-size: 16px;
  }

  .composer textarea {
    min-height: 54px;
    max-height: min(168px, 32vh);
  }

  .composer-toolbar {
    gap: 6px;
  }

  .composer-leading {
    min-width: 0;
  }

  .composer-options {
    flex-wrap: nowrap;
    overflow: visible;
  }

  .custom-select-compact {
    max-width: 112px;
  }

  .custom-select-compact .custom-select-label {
    max-width: 78px;
  }

  .modal-layer {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
  }

  .modal,
  .modal-compact,
  .approval-modal {
    max-height: calc(var(--app-height, 100dvh) - env(safe-area-inset-top) - 10px);
  }

  .toast-stack {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
}

body.keyboard-open .composer {
  padding-bottom: 7px;
}

body.standalone-app .sidebar,
body.standalone-app .main-panel {
  height: var(--app-height, 100dvh);
}

/* Composer attachments */
.visually-hidden {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

.composer-attachment-control {
  position: relative;
  display: flex;
}

.attachment-menu {
  position: absolute;
  z-index: 80;
  bottom: calc(100% + 9px);
  left: 0;
  display: grid;
  width: 258px;
  gap: 3px;
  padding: 5px;
  border: 1px solid #dfe1e5;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 14px 38px rgb(28 32 38 / 14%);
}

.attachment-menu > button {
  display: grid;
  min-height: 52px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #383c42;
  cursor: pointer;
  text-align: left;
}

.attachment-menu > button:hover {
  background: #f2f3f5;
}

.attachment-menu-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #e1e3e6;
  border-radius: 7px;
  color: #6f747c;
  font-size: 14px;
}

.attachment-menu > button > span:last-child {
  display: grid;
  gap: 2px;
}

.attachment-menu strong {
  font-size: 12px;
  font-weight: 600;
}

.attachment-menu small {
  color: #8e939b;
  font-size: 10px;
}

.attachment-tray {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 10px 0;
  scrollbar-width: thin;
}

.attachment-item {
  position: relative;
  display: grid;
  min-width: 190px;
  max-width: 240px;
  min-height: 48px;
  grid-template-columns: 36px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 5px 5px 5px 6px;
  border: 1px solid #e0e2e5;
  border-radius: 9px;
  background: #fafafa;
}

.attachment-item > img,
.attachment-file-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.attachment-item > img {
  object-fit: cover;
  background: #eceef0;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  background: #eceef0;
  color: #6d7279;
  font-size: 15px;
}

.attachment-info {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.attachment-info strong,
.attachment-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-info strong {
  color: #41454b;
  font-size: 10.5px;
  font-weight: 600;
}

.attachment-info small {
  color: #90959c;
  font-size: 9px;
}

.attachment-remove,
.attachment-retry {
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.attachment-remove {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #92979e;
  font-size: 15px;
}

.attachment-remove:hover {
  background: #e7e8ea;
  color: #41454b;
}

.attachment-retry {
  padding: 4px 5px;
  color: #b84c4c;
  font-size: 9px;
}

.attachment-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #e5e7e9;
}

.attachment-progress > span {
  display: block;
  height: 100%;
  background: #555b63;
  transition: width 120ms ease;
}

.attachment-error {
  border-color: #efcdcd;
  background: #fffafa;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.message-attachment {
  display: inline-flex;
  max-width: 240px;
  min-height: 25px;
  align-items: center;
  overflow: hidden;
  padding: 0 8px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 6px;
  color: inherit;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .assistant-text .katex-display,
  .activity-rich-text .katex-display,
  .file-markdown .katex-display {
    margin: 12px 0;
    padding-bottom: 7px;
    text-align: left;
  }

  .attachment-menu {
    position: fixed;
    right: max(9px, env(safe-area-inset-right));
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: max(9px, env(safe-area-inset-left));
    width: auto;
  }

  body.keyboard-open .attachment-menu {
    position: absolute;
    right: auto;
    bottom: calc(100% + 9px);
    left: 0;
    width: min(258px, calc(100vw - 26px));
  }

  .attachment-tray {
    padding: 7px 8px 0;
  }

  .attachment-item {
    min-width: 168px;
    max-width: 205px;
  }
}

/* Mobile composition tuned against iPhone Safari/PWA screenshots */
.composer-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.composer-options {
  min-width: 0;
  justify-content: flex-end;
}

.composer-actions {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.local-file-reference {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  padding: 1px 5px;
  border: 1px solid #e2e4e7;
  border-radius: 5px;
  background: #f3f4f6;
  color: #555a62;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
  line-height: 1.45;
  text-overflow: ellipsis;
  vertical-align: 1px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .topbar {
    min-height: calc(54px + env(safe-area-inset-top));
    gap: 6px;
    padding:
      max(6px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      6px
      max(8px, env(safe-area-inset-left));
  }

  .topbar h2 {
    margin-bottom: 1px;
    font-size: 15px;
    line-height: 1.25;
  }

  .session-meta {
    max-width: calc(100vw - 150px);
    gap: 4px;
    font-size: 9.5px;
  }

  .session-meta #host-name,
  .session-meta .meta-separator,
  .session-meta #thread-model {
    display: none;
  }

  .topbar-actions {
    gap: 1px;
  }

  .topbar-actions .icon-button {
    width: 34px;
    height: 34px;
  }

  .running-indicator {
    min-width: 0;
    padding: 0 7px;
    font-size: 0;
  }

  .running-indicator .topbar-duration {
    font-size: 10px;
  }

  .timeline {
    padding:
      16px
      max(14px, env(safe-area-inset-right))
      14px
      max(14px, env(safe-area-inset-left));
  }

  .final-answer .assistant-text {
    font-size: 15px;
    line-height: 1.68;
  }

  .assistant-text p {
    margin-bottom: 10px;
  }

  .markdown-list {
    margin: 7px 0 12px;
    padding-left: 20px;
  }

  .markdown-table {
    display: block;
    overflow-x: auto;
  }

  .composer {
    padding:
      6px
      max(8px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .composer-shell {
    min-height: 0;
    padding: 8px 9px 8px;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgb(30 35 42 / 7%);
  }

  .composer textarea {
    min-height: 44px;
    padding: 3px 4px 7px;
    line-height: 1.5;
  }

  .composer-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "leading actions"
      "options options";
    gap: 5px 8px;
    padding: 0;
  }

  .composer-leading {
    grid-area: leading;
    width: 100%;
    gap: 5px;
  }

  .composer-options {
    display: grid;
    width: 100%;
    grid-area: options;
    grid-template-columns: minmax(0, 1.3fr) minmax(104px, 0.8fr);
    gap: 6px;
  }

  .composer-options .custom-select-compact {
    width: 100%;
    max-width: none;
  }

  .composer-options .custom-select-compact .custom-select-button {
    width: 100%;
    min-height: 29px;
    justify-content: space-between;
    padding: 0 8px;
    border: 1px solid #e5e7ea;
    border-radius: 7px;
    background: #fafafa;
  }

  .composer-options .custom-select-compact .custom-select-label {
    max-width: none;
    flex: 1;
    font-size: 11px;
  }

  .composer-options .custom-select-compact .custom-select-menu {
    right: 0;
    left: 0;
    width: 100%;
  }

  .composer-actions {
    grid-area: actions;
    align-self: center;
  }

  .composer-hint {
    display: none;
  }

  .composer-add {
    width: 30px;
    height: 30px;
  }

  .composer-add svg {
    width: 18px;
    height: 18px;
  }

  .permission-button {
    min-width: 0;
    min-height: 29px;
    padding: 0 8px;
    font-size: 11px;
  }

  .send-button {
    width: 34px;
    height: 34px;
  }

  body.keyboard-open .composer {
    padding-bottom: 6px;
  }

  body.keyboard-open .composer-shell {
    box-shadow: none;
  }
}

@media (max-width: 390px) {
  .session-meta {
    max-width: calc(100vw - 132px);
  }

  .composer-options {
    grid-template-columns: minmax(0, 1.2fr) minmax(96px, 0.8fr);
  }

  .permission-button {
    padding: 0 6px;
  }

  .final-answer .assistant-text {
    font-size: 14.5px;
  }
}

/* Server file explorer */
:root {
  --inspector-width: 382px;
}

.inspector {
  min-width: 0;
  padding: 0;
  background: #fafafa;
}

.app-shell.inspector-open .inspector {
  display: flex;
  flex-direction: column;
}

.inspector-header {
  min-height: 60px;
  flex: none;
  border-bottom: 1px solid #eceef1;
}

.file-panel-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.file-panel-title strong {
  color: #282b30;
  font-size: 13px;
  font-weight: 650;
}

.file-panel-title span {
  overflow: hidden;
  color: #969ba3;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-header-actions,
.file-preview-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.file-navigation {
  display: flex;
  min-height: 40px;
  flex: none;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-bottom: 1px solid #f0f1f3;
  background: #fff;
}

.file-navigation .icon-button {
  width: 27px;
  height: 27px;
  flex: none;
  font-size: 13px;
}

.file-navigation .icon-button:disabled {
  cursor: default;
  opacity: 0.28;
}

.file-breadcrumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.file-breadcrumbs::-webkit-scrollbar {
  display: none;
}

.file-breadcrumb {
  flex: none;
  max-width: 132px;
  overflow: hidden;
  padding: 3px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #777c84;
  cursor: pointer;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-breadcrumb:hover {
  background: #efeff1;
  color: #292c31;
}

.file-breadcrumb.current {
  color: #292c31;
  font-weight: 600;
}

.file-breadcrumb-separator {
  flex: none;
  color: #c1c4c9;
  font-size: 10px;
}

.file-commandbar {
  display: grid;
  min-height: 43px;
  flex: none;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #fff;
}

.file-command-button {
  min-height: 29px;
  padding: 0 7px;
  border: 1px solid #e1e3e6;
  border-radius: 7px;
  background: #fff;
  color: #62676f;
  cursor: pointer;
  font-size: 9.5px;
  white-space: nowrap;
}

.file-command-button:hover {
  background: #f3f4f5;
  color: #272a2f;
}

.file-search {
  display: flex;
  min-width: 0;
  min-height: 29px;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid #e5e7ea;
  border-radius: 7px;
  background: #f8f8f9;
  color: #a0a4aa;
}

.file-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: #35383d;
  outline: none;
  font-size: 10px;
}

.file-browser {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-rows: minmax(140px, 42%) minmax(0, 1fr);
  background: #fff;
}

.file-list {
  min-height: 0;
  overflow-y: auto;
  padding: 5px 7px 8px;
  border-bottom: 1px solid #e7e9ec;
  scrollbar-width: thin;
}

.file-list-state {
  padding: 24px 10px;
  color: #9a9fa7;
  font-size: 10px;
  text-align: center;
}

.file-entry {
  display: grid;
  min-width: 0;
  min-height: 31px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 6px;
}

.file-entry:hover,
.file-entry.active {
  background: #eef0f2;
}

.file-entry-main {
  display: grid;
  min-width: 0;
  min-height: 31px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #4c5158;
  cursor: pointer;
  text-align: left;
}

.file-entry-icon {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: #8b9199;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.file-entry.directory .file-entry-icon {
  color: #8c6a24;
  font-size: 15px;
}

.file-entry-name {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-entry-actions {
  display: flex;
  padding-right: 3px;
  opacity: 0;
}

.file-entry:hover .file-entry-actions,
.file-entry:focus-within .file-entry-actions {
  opacity: 1;
}

.file-entry-action {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #81868e;
  cursor: pointer;
  font-size: 12px;
}

.file-entry-action:hover {
  background: #dfe2e5;
  color: #35393e;
}

.file-entry-action svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.file-entry-action.danger:hover {
  background: #f7dddd;
  color: #b63f3f;
}

.file-preview {
  display: flex;
  min-height: 0;
  flex-direction: column;
  background: #fff;
}

.file-preview-header {
  display: flex;
  min-height: 48px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px 5px 11px;
  border-bottom: 1px solid #f0f1f3;
}

.file-preview-title {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.file-preview-title strong,
.file-preview-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-title strong {
  color: #303338;
  font-family: var(--ui-font);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
}

.file-preview-title span {
  color: #979ca4;
  font-size: 8.5px;
}

.file-preview-actions .icon-button {
  width: 27px;
  height: 27px;
  font-size: 13px;
}

.file-text-action {
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid #dfe1e5;
  border-radius: 6px;
  background: #fff;
  color: #41454a;
  cursor: pointer;
  font-size: 9.5px;
}

.file-text-action:disabled {
  cursor: default;
  opacity: 0.42;
}

.file-preview-body {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.file-empty {
  display: grid;
  height: 100%;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: #a0a5ac;
  text-align: center;
}

.file-empty > span {
  font-size: 24px;
}

.file-empty p {
  margin: 0;
  font-size: 10px;
}

.file-editor,
.file-binary {
  width: 100%;
  height: 100%;
  margin: 0;
  resize: none;
  padding: 11px 12px;
  border: 0;
  background: #fff;
  color: #35393e;
  outline: none;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.58;
  tab-size: 2;
  white-space: pre;
}

.file-binary {
  overflow: auto;
  color: #8b9098;
  white-space: pre-wrap;
}

.file-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  background:
    linear-gradient(45deg, #f5f5f6 25%, transparent 25%),
    linear-gradient(-45deg, #f5f5f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f5f5f6 75%),
    linear-gradient(-45deg, transparent 75%, #f5f5f6 75%);
  background-color: #fff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

@media (min-width: 1181px) {
  .app-shell.inspector-open {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--inspector-width);
  }

  .inspector {
    position: relative;
    z-index: 15;
    top: auto;
    right: auto;
    display: none;
    width: auto;
    max-height: none;
    border: 0;
    border-left: 1px solid #e5e7ea;
    border-radius: 0;
    box-shadow: none;
  }

  .app-shell.inspector-open .inspector {
    display: flex;
  }
}

@media (max-width: 1180px) {
  .inspector {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, calc(100vw - 18px));
    max-height: none;
    border-radius: 14px 0 0 14px;
  }
}

@media (max-width: 760px) {
  .inspector {
    z-index: 60;
    top: env(safe-area-inset-top);
    right: 0;
    bottom: env(safe-area-inset-bottom);
    width: min(100vw, 470px);
    height: auto;
    border-radius: 0;
  }

  .inspector-header {
    min-height: 55px;
    padding:
      7px
      max(10px, env(safe-area-inset-right))
      7px
      max(12px, env(safe-area-inset-left));
  }

  .file-commandbar {
    grid-template-columns: auto auto auto minmax(70px, 1fr);
    padding-right: max(9px, env(safe-area-inset-right));
    padding-left: max(9px, env(safe-area-inset-left));
  }

  .file-browser {
    grid-template-rows: minmax(150px, 38%) minmax(0, 1fr);
  }

  .file-entry-actions {
    opacity: 1;
  }

  .file-entry {
    min-height: 36px;
  }

  .file-entry-main {
    min-height: 36px;
  }

  .file-entry-name {
    font-size: 12.5px;
  }

  .file-editor {
    font-size: 11px;
  }
}

.send-button.stop-mode {
  background: #202124;
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.send-button.stop-mode:hover {
  background: #000;
}

.send-button.stop-mode:disabled {
  background: #c6c9ce;
  color: #fff;
  opacity: 0.72;
}

.activity-prose > .activity-entry-row {
  min-height: 24px;
  padding-bottom: 1px;
  cursor: default;
}

.activity-prose > .activity-entry-body {
  padding: 0 4px 11px 17px;
}

.activity-prose .activity-rich-text {
  color: #555a62;
  font-size: 12.5px;
  line-height: 1.66;
}

.activity-prose .activity-rich-text p {
  margin-bottom: 9px;
}

.activity-prose .activity-rich-text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .activity-prose > .activity-entry-body {
    padding-right: 2px;
    padding-left: 15px;
  }

  .activity-prose .activity-rich-text {
    font-size: 13px;
    line-height: 1.65;
  }
}

/* Codex-like work summary: prose stays visible, operations stay compact. */
.process-group > summary {
  min-height: 36px;
  gap: 7px;
}

.process-completed > summary,
.process-interrupted > summary {
  grid-template-columns: minmax(0, 1fr) auto 14px;
}

.process-completed .process-status-icon,
.process-interrupted .process-status-icon {
  display: none;
}

.process-group-title {
  color: #3e4248;
  font-size: 13px;
  font-weight: 600;
}

.process-duration {
  color: #8d9299;
  font-size: 11px;
}

.process-group-body {
  margin: 2px 0 3px;
  padding: 1px 0 3px;
  gap: 0;
}

.process-group-body::before {
  display: none;
}

.activity-prose {
  margin: 2px 0 1px;
}

.activity-prose > .activity-entry-body {
  padding: 3px 0 10px;
}

.activity-prose .activity-rich-text {
  color: #373b40;
  font-size: 13.5px;
  line-height: 1.7;
}

.activity-prose .activity-rich-text p {
  margin-bottom: 11px;
}

.activity-prose .activity-rich-text p:last-child {
  margin-bottom: 0;
}

.activity-entry:not(.activity-prose) {
  margin: 1px 0;
}

.activity-entry:not(.activity-prose) > summary,
.activity-entry:not(.activity-prose) > .activity-entry-row {
  min-height: 30px;
  color: #767b83;
}

.activity-entry:not(.activity-prose) .activity-dot {
  width: 7px;
  height: 7px;
  border-color: #c4c7cc;
  background: #fff;
}

@media (max-width: 760px) {
  .process-group > summary {
    min-height: 35px;
  }

  .process-group-title {
    font-size: 13px;
  }

  .process-duration {
    font-size: 10.5px;
  }

  .activity-prose > .activity-entry-body {
    padding: 2px 0 10px;
  }

  .activity-prose .activity-rich-text {
    font-size: 14px;
    line-height: 1.68;
  }
}

.operation-group {
  margin: 2px 0;
  border: 0;
  background: transparent;
}

.operation-group > summary {
  display: grid;
  min-height: 30px;
  grid-template-columns: 18px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 6px;
  padding: 2px 1px;
  color: #747981;
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.operation-group > summary::-webkit-details-marker {
  display: none;
}

.operation-group-icon {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid #e1e3e6;
  border-radius: 5px;
  color: #8e939b;
  font-size: 10px;
}

.operation-group-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-group-count {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #f0f1f3;
  color: #9a9fa6;
  font-size: 9px;
  text-align: center;
}

.operation-group-chevron {
  color: #a2a6ad;
  font-size: 14px;
  transition: transform 130ms ease;
}

.operation-group[open] .operation-group-chevron {
  transform: rotate(90deg);
}

.operation-group-body {
  display: grid;
  padding: 2px 0 5px 15px;
}

.operation-group-body .operation-row {
  margin: 0;
}

.operation-group-body .activity-entry-row {
  min-height: 27px;
}

.operation-row {
  cursor: default;
}

.operation-row > summary {
  grid-template-columns: 10px minmax(0, 1fr) auto 10px;
  border-radius: 6px;
  cursor: pointer;
}

.operation-row > summary:hover {
  background: #f7f7f8;
}

.operation-row > summary::-webkit-details-marker {
  display: none;
}

.operation-row-chevron {
  color: #b0b4ba;
  font-size: 12px;
  transition: transform 130ms ease;
}

.operation-row[open] .operation-row-chevron {
  transform: rotate(90deg);
}

.operation-row > .activity-entry-body {
  padding: 2px 4px 9px 16px;
}

.operation-row .activity-file-list li {
  display: flex;
  align-items: center;
  min-height: 24px;
  font-size: 10.5px;
}

@media (max-width: 760px) {
  .operation-group > summary {
    min-height: 32px;
    font-size: 11.5px;
  }

  .operation-group-body {
    padding-left: 12px;
  }
}

/* Compact vertical rhythm for Codex-style process output */
.process-group {
  margin: 1px 0 8px;
}

.process-group > summary {
  min-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}

.process-group-body {
  margin: 0;
  padding: 0 0 1px;
}

.activity-prose {
  margin: 0;
}

.activity-prose > .activity-entry-body {
  padding: 1px 0 7px;
}

.activity-prose .activity-rich-text {
  line-height: 1.62;
}

.activity-prose .activity-rich-text p {
  margin-bottom: 7px;
}

.activity-entry:not(.activity-prose) {
  margin: 0;
}

.activity-entry:not(.activity-prose) > summary,
.activity-entry:not(.activity-prose) > .activity-entry-row {
  min-height: 25px;
  padding-top: 1px;
  padding-bottom: 1px;
}

.operation-group {
  margin: 0;
}

.operation-group > summary {
  min-height: 26px;
  padding-top: 0;
  padding-bottom: 0;
}

.operation-group-body {
  padding: 0 0 2px 12px;
}

.operation-group-body .activity-entry-row {
  min-height: 23px;
}

.operation-row > .activity-entry-body {
  padding-top: 0;
  padding-bottom: 6px;
}

.activity-truncated {
  padding-top: 1px;
  padding-bottom: 3px;
}

.final-answer {
  margin-top: 11px;
}

@media (max-width: 760px) {
  .process-group > summary {
    min-height: 29px;
  }

  .activity-prose > .activity-entry-body {
    padding-bottom: 8px;
  }

  .activity-prose .activity-rich-text {
    line-height: 1.6;
  }

  .activity-entry:not(.activity-prose) > summary,
  .activity-entry:not(.activity-prose) > .activity-entry-row {
    min-height: 26px;
  }

  .operation-group > summary {
    min-height: 29px;
  }
}

/* Codex-style single-line processed summary */
.process-group > summary,
.process-completed > summary,
.process-interrupted > summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 7px 1px 6px;
  border-bottom: 1px solid #eceef1;
}

.process-completed > summary,
.process-interrupted > summary {
  grid-template-columns: none;
}

.process-heading {
  display: flex;
  min-width: 0;
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
}

.process-group-title,
.process-duration {
  color: #767b83;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.25;
}

.process-duration {
  font-variant-numeric: tabular-nums;
}

.process-chevron {
  flex: none;
  margin-left: 0;
  color: #a1a5ac;
  font-size: 15px;
}

.process-running .process-status-icon {
  width: 15px;
  height: 15px;
  flex: none;
}

@media (max-width: 760px) {
  .process-group > summary,
  .process-completed > summary,
  .process-interrupted > summary {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .process-group-title,
  .process-duration {
    font-size: 13.5px;
  }
}

/* Rendered Markdown and highlighted source preview */
.file-rendered {
  width: 100%;
  height: 100%;
  overflow: auto;
  margin: 0;
  padding: 14px 16px;
  background: #fff;
  color: #35393e;
}

.file-markdown {
  font-size: 12.5px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.file-markdown > :first-child {
  margin-top: 0;
}

.file-markdown > :last-child {
  margin-bottom: 0;
}

.file-markdown h1,
.file-markdown h2,
.file-markdown h3,
.file-markdown h4,
.file-markdown h5,
.file-markdown h6 {
  margin: 1.25em 0 0.55em;
  color: #25282c;
  font-weight: 650;
  line-height: 1.35;
}

.file-markdown h1 {
  padding-bottom: 0.35em;
  border-bottom: 1px solid #e8eaed;
  font-size: 1.7em;
}

.file-markdown h2 {
  padding-bottom: 0.25em;
  border-bottom: 1px solid #eef0f2;
  font-size: 1.35em;
}

.file-markdown h3 {
  font-size: 1.16em;
}

.file-markdown p {
  margin: 0 0 0.9em;
}

.file-markdown a {
  color: #3478e5;
  text-decoration: none;
}

.file-markdown a:hover {
  text-decoration: underline;
}

.file-markdown ul,
.file-markdown ol {
  margin: 0.55em 0 0.95em;
  padding-left: 1.55em;
}

.file-markdown li + li {
  margin-top: 0.2em;
}

.file-markdown blockquote {
  margin: 0.9em 0;
  padding: 0.25em 0 0.25em 1em;
  border-left: 3px solid #d8dbe0;
  color: #72777f;
}

.file-markdown hr {
  margin: 1.4em 0;
  border: 0;
  border-top: 1px solid #e7e9ec;
}

.file-markdown img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.8em 0;
  border-radius: 6px;
}

.file-markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 1em 0;
  border-collapse: collapse;
  font-size: 11.5px;
}

.file-markdown th,
.file-markdown td {
  padding: 6px 9px;
  border: 1px solid #e2e4e7;
  text-align: left;
}

.file-markdown th {
  background: #f5f6f7;
  font-weight: 600;
}

.file-markdown code {
  padding: 1.5px 4px;
  border: 1px solid #e8eaed;
  border-radius: 4px;
  background: #f5f6f7;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.91em;
}

.file-markdown pre {
  overflow: auto;
  margin: 0.9em 0;
  padding: 11px 12px;
  border: 1px solid #e5e7ea;
  border-radius: 7px;
  background: #f8f8f9;
  line-height: 1.55;
}

.file-markdown pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 10.5px;
  white-space: pre;
}

.file-markdown input[type="checkbox"] {
  margin: 0 5px 0 0;
  accent-color: #555b63;
}

.file-code {
  padding: 12px 13px;
  color: #35393e;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.58;
  tab-size: 2;
  white-space: pre;
}

.file-code code,
.file-code code.hljs {
  display: block;
  min-width: max-content;
  padding: 0;
  background: transparent;
}

@media (max-width: 760px) {
  .file-rendered {
    padding: 12px;
  }

  .file-markdown {
    font-size: 13px;
    line-height: 1.68;
  }

  .file-code {
    font-size: 11px;
  }
}

/* Desktop drag-and-drop attachment target */
.composer-shell {
  position: relative;
}

.composer-drop-overlay {
  position: absolute;
  z-index: 20;
  inset: 4px;
  display: none;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1.5px dashed #b8bdc4;
  border-radius: 11px;
  background: rgb(250 250 251 / 96%);
  color: #555a62;
  pointer-events: none;
  text-align: center;
}

.composer-drop-overlay strong {
  font-size: 13px;
  font-weight: 600;
}

.composer-drop-overlay span {
  color: #92979f;
  font-size: 10px;
}

.composer-shell.drop-active .composer-drop-overlay {
  display: grid;
}

/* Unified operation icons */
.activity-type-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #858a92;
}

.activity-type-icon svg {
  width: 15px;
  height: 15px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.activity-icon-create {
  color: #4f8d72;
}

.activity-icon-delete {
  color: #b85b5b;
}

.activity-icon-command {
  color: #737982;
}

.activity-icon-tool {
  color: #806cab;
}

.activity-entry:not(.activity-prose) > summary,
.activity-entry:not(.activity-prose) > .activity-entry-row {
  grid-template-columns: 18px minmax(0, 1fr) auto;
}

.operation-row > summary {
  grid-template-columns: 18px minmax(0, 1fr) auto 10px;
}

.operation-group-icon.activity-type-icon {
  width: 18px;
  height: 18px;
  border: 1px solid #e1e3e6;
  border-radius: 5px;
  background: #fafafa;
}

.operation-group-icon.activity-type-icon svg {
  width: 13px;
  height: 13px;
}

@media (min-width: 761px) {
  .composer {
    padding: 5px 18px 8px;
  }

  .composer-shell {
    min-height: 0;
    padding: 7px 10px 6px;
    border-radius: 13px;
  }

  .composer textarea {
    min-height: 28px;
    max-height: 150px;
    padding: 2px 4px 1px;
    line-height: 1.45;
  }

  .composer-toolbar {
    min-height: 28px;
    gap: 6px;
  }

  .composer-leading {
    gap: 6px;
  }

  .composer-add {
    width: 25px;
    height: 25px;
    border-radius: 7px;
  }

  .composer-add svg {
    width: 16px;
    height: 16px;
  }

  .permission-pill,
  .permission-button {
    min-height: 25px;
    padding: 0 7px;
    font-size: 10.5px;
  }

  .composer-options .custom-select-compact .custom-select-button {
    min-height: 27px;
    font-size: 12px;
  }

  .composer-hint {
    font-size: 8.5px;
  }

  .send-button {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .composer-drop-overlay {
    inset: 3px;
    border-radius: 10px;
  }
}

/* Draggable desktop side panels */
.panel-resize-handle {
  position: absolute;
  z-index: 35;
  top: 0;
  bottom: 0;
  display: none;
  width: 9px;
  cursor: col-resize;
  touch-action: none;
}

.panel-resize-handle::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 48px;
  border-radius: 999px;
  background: #cfd3d9;
  content: "";
  opacity: 0.52;
  transform: translate(-50%, -50%);
  transition:
    height 140ms ease,
    background-color 140ms ease,
    opacity 140ms ease;
}

.panel-resize-handle:hover::after,
.panel-resize-handle:focus-visible::after,
.panel-resize-handle.resizing::after {
  height: 76px;
  background: #9aa0a8;
  opacity: 1;
}

.panel-resize-handle:focus-visible {
  outline: none;
}

.sidebar-resize-handle {
  right: 0;
}

.inspector-resize-handle {
  left: 0;
}

.panel-resizing,
.panel-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.panel-resizing .app-shell {
  transition: none;
}

@media (min-width: 761px) {
  .sidebar-resize-handle {
    display: block;
  }
}

@media (min-width: 1181px) {
  .inspector-resize-handle {
    display: block;
  }
}

@media (max-width: 760px) {
  .app-shell {
    --sidebar-width: min(86vw, 310px) !important;
    --inspector-width: min(100vw, 470px) !important;
  }
}

/* User message attachments */
button.message-attachment {
  border-color: #dfe2e5;
  background: #fff;
  color: #4c5158;
  cursor: pointer;
}

button.message-attachment:hover {
  border-color: #c9cdd2;
  background: #fafafa;
}

.message-attachment-image {
  display: block;
  width: fit-content;
  max-width: min(190px, 100%);
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.message-attachment-image:hover {
  box-shadow: none;
  opacity: 0.94;
}

.message-attachment-image:disabled {
  cursor: progress;
}

.message-attachment-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 190px;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}

.message-attachment-image-error {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 10px;
  color: #8b9098;
  font-size: 10px;
}

.message-attachment-image.unavailable {
  cursor: default;
}

/* Full image preview */
.image-preview-layer {
  z-index: 130;
  background: rgb(18 20 23 / 82%);
}

.image-preview-dialog {
  display: flex;
  width: min(94vw, 1120px);
  height: min(90dvh, 860px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 13px;
  background: #17191c;
  box-shadow: 0 24px 80px rgb(0 0 0 / 42%);
}

.image-preview-header {
  display: flex;
  min-height: 52px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  color: #eceef1;
}

.image-preview-header .kicker {
  color: #747a82;
}

.image-preview-header h3 {
  margin: 2px 0 0;
  color: #f2f3f4;
  font-size: 13px;
  font-weight: 550;
}

.image-preview-header .icon-button {
  color: #bfc3c8;
}

.image-preview-header .icon-button:hover {
  background: rgb(255 255 255 / 8%);
  color: #fff;
}

.image-preview-stage {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  overflow: auto;
  padding: 18px;
}

.image-preview-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

@media (max-width: 760px) {
  .message-attachment-image img {
    max-width: 180px;
    max-height: 170px;
  }

  .image-preview-layer {
    align-items: stretch;
    padding: 0;
  }

  .image-preview-dialog {
    width: 100vw;
    height: var(--app-height, 100dvh);
    border: 0;
    border-radius: 0;
  }

  .image-preview-header {
    min-height: calc(52px + env(safe-area-inset-top));
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  .image-preview-stage {
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Scroll-to-bottom control */
.scroll-to-bottom {
  position: absolute;
  z-index: 14;
  top: -40px;
  right: max(18px, calc((100% - 780px) / 2 + 12px));
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid #e1e3e7;
  border-radius: 50%;
  background: rgb(255 255 255 / 96%);
  color: #5e636b;
  box-shadow:
    0 5px 16px rgb(30 35 42 / 10%),
    0 1px 2px rgb(30 35 42 / 6%);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.scroll-to-bottom:hover {
  border-color: #cfd3d8;
  background: #fff;
  color: #202124;
}

.scroll-to-bottom.scrolling {
  pointer-events: none;
  animation: scroll-button-spring 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-to-bottom.scrolling svg {
  animation: scroll-arrow-spring 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes scroll-button-spring {
  0% {
    transform: scale(1);
  }

  28% {
    transform: scale(0.9);
  }

  62% {
    transform: scale(1.035);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes scroll-arrow-spring {
  0%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-2px);
  }

  64% {
    transform: translateY(2px);
  }

  82% {
    transform: translateY(-1px);
  }
}

.scroll-to-bottom svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

@media (max-width: 760px) {
  .scroll-to-bottom {
    top: -37px;
    right: max(12px, env(safe-area-inset-right));
    width: 29px;
    height: 29px;
  }

  .scroll-to-bottom svg {
    width: 15px;
    height: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-to-bottom.scrolling,
  .scroll-to-bottom.scrolling svg {
    animation: none;
  }
}

/* Archived task visibility and permanent deletion */
.sidebar-section-header .archive-toggle {
  display: inline-flex !important;
  min-height: 24px;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border: 1px solid #e2e4e7;
  border-radius: 999px;
  background: #fff;
  color: #8b9098;
  font-size: 9px;
  white-space: nowrap;
}

.sidebar-section-header .archive-toggle:has(input:checked) {
  border-color: #d9dce0;
  background: #eef0f2;
  color: #4c5158;
}

.sidebar-section-header .archive-toggle input {
  width: 11px;
  height: 11px;
  margin: 0;
  accent-color: #4f545b;
}

.delete-thread-action {
  color: #8f949b;
}

.delete-thread-action:hover {
  background: #fff0f0;
  color: #b84b4b;
}

@media (max-width: 760px) {
  .delete-thread-action:not(.hidden) {
    display: inline-grid !important;
  }

  .sidebar-section-header .archive-toggle {
    min-height: 23px;
    padding: 0 5px;
  }
}

/* Refined process spinner and project counters */
.process-running .process-status-icon {
  width: 15px;
  height: 15px;
  border: 0;
  background: transparent;
  animation: none;
}

.process-running .process-status-icon::before {
  position: absolute;
  inset: 1px;
  border: 1.5px solid #e0e2e5;
  border-top-color: #777c84;
  border-radius: 50%;
  content: "";
  transform-origin: 50% 50%;
  animation: activity-spin 0.9s linear infinite;
  animation-delay: var(--spinner-delay, 0ms);
  backface-visibility: hidden;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .process-running .process-status-icon::before {
    animation: none !important;
    border-color: #dfe1e4;
    border-top-color: #7d828a;
  }
}

.project-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #e9eaed;
  color: #8c9198;
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  justify-self: end;
}

@media (max-width: 760px) {
  .project-count {
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    font-size: 9.5px;
  }
}

/* Desktop-only turn index inspired by the Codex conversation rail */
.turn-index {
  --turn-index-card-top: 20px;
  position: absolute;
  z-index: 9;
  top: 50%;
  left: 2px;
  display: none;
  transform: translateY(-50%);
  pointer-events: none;
}

.turn-index-list {
  display: grid;
  gap: 1px;
  padding: 3px 20px 3px 4px;
  pointer-events: auto;
}

.turn-index-entry {
  position: relative;
  display: flex;
  width: 34px;
  height: 12px;
  align-items: center;
  animation: turn-index-entry-in 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--turn-index-delay, 0ms);
}

.turn-index-mark {
  position: relative;
  display: flex;
  width: 34px;
  height: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  outline: none;
}

.turn-index-line {
  display: block;
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: #d5d8dc;
  transform: scaleX(1);
  transform-origin: left center;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease,
    transform 190ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.turn-index-mark:hover .turn-index-line {
  background: #9ca1a8;
  transform: scaleX(1.18);
}

.turn-index-mark.active .turn-index-line {
  background: #303338;
  transform: scaleX(1.55);
}

.turn-index-mark:focus-visible .turn-index-line {
  box-shadow: 0 0 0 3px rgb(73 79 88 / 14%);
}

.turn-index-card {
  position: absolute;
  top: 0;
  left: 40px;
  display: grid;
  width: 316px;
  max-width: calc(100vw - 340px);
  gap: 4px;
  padding: 13px 15px 14px;
  border: 1px solid rgb(35 39 45 / 9%);
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 16px 42px rgb(28 33 40 / 13%),
    0 2px 8px rgb(28 33 40 / 6%);
  color: #777c84;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-5px, var(--turn-index-card-top));
  transform-origin: left center;
  visibility: hidden;
  transition:
    opacity 80ms ease,
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 180ms;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.turn-index.preview-visible .turn-index-card {
  opacity: 1;
  transform: translate(0, var(--turn-index-card-top));
  visibility: visible;
  transition-delay: 0ms;
}

.turn-index-card-meta {
  overflow: hidden;
  color: #999ea5;
  font-size: 9px;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-index-card-title {
  display: -webkit-box;
  overflow: hidden;
  color: #292c31;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.48;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.turn-index-card-summary {
  display: -webkit-box;
  overflow: hidden;
  color: #747981;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

@keyframes turn-index-entry-in {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (min-width: 900px) {
  .turn-index:not(.hidden) {
    display: block;
  }
}

@media (max-width: 899px) {
  .turn-index {
    display: none !important;
  }
}

/* Codex-style collapsible desktop sidebar */
.sidebar-toggle {
  flex: none;
  margin-left: -5px;
}

.sidebar-toggle[aria-expanded="false"] {
  background: #eceef1;
  color: #2f3237;
}

.topbar {
  transition: padding-left 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app-shell {
  transition: grid-template-columns 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar {
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 160ms ease,
    visibility 0s linear;
}

@media (min-width: 761px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }

  .app-shell.sidebar-collapsed .sidebar {
    border-right-color: transparent;
    border-right-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-14px);
    visibility: hidden;
    transition:
      transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 140ms ease,
      visibility 0s linear 220ms;
  }

  .app-shell.sidebar-collapsed .topbar {
    padding-left: 10px;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .app-shell.sidebar-collapsed.inspector-open {
    grid-template-columns: 0 minmax(0, 1fr);
  }
}

@media (min-width: 1181px) {
  .app-shell.sidebar-collapsed.inspector-open {
    grid-template-columns: 0 minmax(0, 1fr) var(--inspector-width);
  }
}

@media (max-width: 760px) {
  .sidebar-toggle {
    display: none !important;
  }
}

/* Unified desktop conversation actions */
@media (min-width: 761px) {
  .topbar-actions {
    gap: 2px;
  }

  .topbar-actions .icon-button,
  .topbar-actions .icon-button:hover,
  .topbar-actions .icon-button:active {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: #737880;
  }

  .topbar-actions .icon-button:hover {
    background: #eceef1;
    color: #292c31;
  }

  .topbar-actions .icon-button:active {
    background: #e4e6e9;
  }

  .topbar-actions .icon-button svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.65;
  }

  .archive-thread-action,
  .archive-thread-action:hover,
  .archive-thread-action.archived,
  .delete-thread-action,
  .delete-thread-action:hover {
    border: 0;
    background: transparent;
    color: #737880;
  }
}

/* Only the automatic drag-to-collapse transition is intentionally slower. */
.app-shell.auto-collapse-left,
.app-shell.auto-collapse-right {
  transition: grid-template-columns 460ms cubic-bezier(0.4, 0, 0.2, 1);
}

.app-shell.auto-collapse-left .sidebar {
  transition:
    transform 460ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 300ms ease,
    visibility 0s linear 460ms;
}

/* Refined file inspector */
.file-panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.file-panel-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border: 1px solid #dfe6ef;
  border-radius: 10px;
  background: linear-gradient(145deg, #f3f7fd, #e9eff7);
  box-shadow:
    0 3px 8px rgb(45 62 83 / 8%),
    inset 0 1px 0 rgb(255 255 255 / 90%);
  color: #607795;
}

.file-panel-icon svg,
.file-command-button svg,
.file-search svg,
.file-entry-icon svg,
.file-empty-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.inspector-header {
  padding: 12px 12px 12px 14px;
  border-bottom: 1px solid #e9ecef;
  background: linear-gradient(180deg, #fff, #fafbfc);
}

.file-panel-title strong {
  font-size: 13.5px;
  letter-spacing: -0.01em;
}

.file-panel-title span {
  width: fit-content;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f0f2f5;
  color: #858b94;
  font-size: 8.5px;
}

.file-header-actions {
  gap: 4px;
}

.file-header-actions .icon-button {
  width: 29px;
  height: 29px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.file-header-actions .icon-button:hover {
  border-color: #e2e5e9;
  background: #f3f5f7;
}

.file-navigation {
  min-height: 44px;
  gap: 6px;
  padding: 7px 11px;
  border-bottom: 1px solid #eceff2;
  background: #fbfcfd;
}

.file-navigation .icon-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f3f6;
  color: #69717c;
}

.file-navigation .icon-button:hover:not(:disabled) {
  background: #e8ebef;
  color: #30353c;
}

.file-navigation-refresh {
  margin-left: auto;
}

.file-breadcrumb {
  padding: 4px 6px;
  border-radius: 6px;
}

.file-breadcrumb.current {
  background: #edf1f6;
}

.file-commandbar {
  min-height: 47px;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid #eef0f3;
  background: #f8f9fb;
}

.file-command-button {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border-color: #dde1e6;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #fafbfc);
  box-shadow:
    0 1px 2px rgb(30 35 42 / 5%),
    inset 0 1px 0 #fff;
  font-size: 10px;
}

.file-command-button svg {
  width: 14px;
  height: 14px;
  color: #77808b;
}

.file-command-button:hover {
  border-color: #cfd5dc;
  background: #fff;
  box-shadow: 0 3px 8px rgb(31 38 47 / 7%);
}

.file-search {
  min-height: 31px;
  padding: 0 9px;
  border-color: #e0e4e9;
  border-radius: 9px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgb(31 38 47 / 4%);
}

.file-search svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: #969ca5;
}

.file-browser {
  background: #f4f6f8;
}

.file-list {
  padding: 8px;
  border-bottom: 1px solid #e8ebef;
  background: #fff;
}

.file-entry {
  min-height: 34px;
  margin: 1px 0;
  border-radius: 9px;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.file-entry-main {
  min-height: 34px;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 6px;
  padding: 0 7px;
}

.file-entry-icon {
  width: 24px;
  height: 24px;
  border: 1px solid #e7eaee;
  border-radius: 7px;
  background: #f5f7f9;
  color: #768394;
}

.file-entry-icon svg {
  width: 15px;
  height: 15px;
}

.file-entry.directory .file-entry-icon {
  border-color: #eee1c9;
  background: #fbf5e9;
  color: #9a742d;
}

.file-entry:hover {
  background: #f3f6f9;
  box-shadow: 0 2px 7px rgb(31 38 47 / 5%);
}

.file-entry.active {
  background: linear-gradient(90deg, #edf3fb, #f4f7fb);
  box-shadow:
    inset 0 0 0 1px #dce7f5,
    0 2px 8px rgb(54 82 120 / 6%);
}

.file-entry-name {
  font-size: 11.5px;
}

.file-preview {
  margin: 8px;
  overflow: hidden;
  border: 1px solid #e3e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 6px 18px rgb(31 38 47 / 6%),
    0 1px 3px rgb(31 38 47 / 4%);
}

.file-preview-header {
  min-height: 51px;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid #eceff2;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}

.file-preview-title strong {
  font-size: 11px;
}

.file-preview-title span {
  color: #9298a1;
  font-size: 9px;
}

.file-preview-body {
  background: #fcfdfe;
}

.file-empty {
  gap: 10px;
}

.file-empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid #e2e6eb;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f1f4f7);
  box-shadow:
    0 7px 18px rgb(33 40 48 / 7%),
    inset 0 1px 0 #fff;
  color: #84909d;
}

.file-empty-icon svg {
  width: 25px;
  height: 25px;
  stroke-width: 1.35;
}

.file-empty p {
  font-size: 10.5px;
}

.file-editor,
.file-binary {
  background: #fcfdfe;
}

@media (min-width: 1181px) {
  .inspector {
    display: flex;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-left: 1px solid #e5e7ea;
    border-radius: 0;
    background: #fafafa;
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    transform: translateX(18px);
    visibility: hidden;
    transition:
      opacity 220ms ease,
      transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 220ms ease,
      visibility 0s linear 240ms;
  }

  .app-shell.inspector-open .inspector {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .app-shell.auto-collapse-right .inspector {
    transition:
      opacity 300ms ease,
      transform 460ms cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0s linear 460ms;
  }
}

@media (max-width: 1180px) {
  .inspector {
    display: flex;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    visibility: hidden;
    transition:
      opacity 220ms ease,
      transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 240ms;
  }

  .app-shell.inspector-open .inspector {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }
}

/* The preview belongs to the file panel instead of floating as a second card. */
.file-list {
  border-bottom: 0;
}

.file-preview {
  margin: 0;
  overflow: hidden;
  border: 0;
  border-top: 1px solid #e7eaee;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.file-preview-header {
  border-bottom-color: #eef0f3;
  background: #fff;
}

.file-preview-body {
  background: #fff;
}

/* Codex-style project hierarchy */
.project-list {
  padding: 1px 9px 14px;
}

.project-group {
  margin: 0;
}

.project-header-row {
  min-height: 35px;
}

.project-header {
  min-height: 35px;
  grid-template-columns: 21px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  color: #34383e;
}

.project-header:hover {
  background: #ebedef;
}

.project-header.expanded {
  background: transparent;
}

.project-chevron.project-folder-icon {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  transform: none;
  color: #6d747d;
}

.project-header.expanded .project-chevron.project-folder-icon {
  transform: none;
}

.project-folder-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.project-name-text {
  font-size: 12.5px;
  font-weight: 600;
}

.project-meta {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.project-running-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #1e9d6f;
  box-shadow: 0 0 0 3px rgb(30 157 111 / 9%);
}

.project-count {
  display: inline;
  min-width: 0;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9a9fa7;
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1;
  text-align: right;
}

.project-threads {
  gap: 1px;
  margin: 1px 0 6px;
  padding: 0 0 0 29px;
  border-left: 0;
}

.thread-item {
  min-height: 32px;
  gap: 1px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  color: #4c5158;
}

.thread-item:hover {
  background: #eceef0;
}

.thread-item.active {
  background: #e7e9ec;
  box-shadow: inset 2px 0 #5a6069;
  color: #24272b;
}

.thread-item-top {
  gap: 8px;
}

.thread-item-title {
  font-size: 12px;
  font-weight: 460;
}

.thread-item-time {
  color: #a3a8af;
  font-size: 9px;
}

.thread-item-bottom {
  min-height: 15px;
  padding-left: 1px;
  gap: 5px;
}

.thread-status-dot {
  width: 6px;
  height: 6px;
}

.thread-item-meta {
  font-size: 9.5px;
}

/* Extensible inspector tabs and inherited temporary side chat */
.inspector-tabbar {
  display: flex;
  min-height: 46px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 5px 10px;
  border-bottom: 1px solid #e6e9ed;
  background: #f8f9fa;
}

.inspector-tabs {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.inspector-tabs::-webkit-scrollbar {
  display: none;
}

.side-chat-tabs {
  display: contents;
}

.side-chat-tab-wrap {
  position: relative;
  display: inline-flex;
  min-width: 0;
  flex: none;
  align-items: center;
}

.side-chat-tab {
  max-width: 146px;
}

.side-chat-tab-icon {
  display: inline-grid;
  width: 15px;
  height: 15px;
  flex: none;
  place-items: center;
}

.side-chat-tab-icon svg {
  width: 15px;
  height: 15px;
}

.side-chat-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-tab-add {
  display: grid;
  width: 29px;
  height: 29px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7f858d;
  cursor: pointer;
}

.inspector-tab-add:hover {
  background: #eceef1;
  color: #30343a;
}

.inspector-tab-add svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.inspector-tab {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7c828b;
  cursor: pointer;
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}

.inspector-tab:hover {
  background: #eef0f2;
  color: #3d4249;
}

.inspector-tab.active {
  background: #fff;
  box-shadow:
    0 1px 3px rgb(30 36 44 / 9%),
    inset 0 0 0 1px #e0e3e7;
  color: #292d32;
}

.inspector-tab svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.inspector-tab-close {
  width: 29px;
  height: 29px;
  flex: none;
}

.inspector-pane {
  min-height: 0;
  flex: 1;
}

.file-pane,
.side-chat-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.file-pane {
  position: relative;
}

.file-drop-overlay {
  position: absolute;
  z-index: 12;
  inset: 8px;
  display: grid;
  place-content: center;
  place-items: center;
  gap: 8px;
  border: 1.5px dashed #7f9fc8;
  border-radius: 14px;
  background: rgb(247 250 255 / 94%);
  color: #365a86;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition:
    opacity 120ms ease,
    transform 160ms ease;
}

.file-pane.drop-active .file-drop-overlay {
  opacity: 1;
  transform: scale(1);
}

.file-drop-overlay strong {
  font-size: 13px;
  font-weight: 650;
}

.file-drop-overlay > span:last-child {
  max-width: min(92%, 520px);
  overflow: hidden;
  color: #72859d;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #e7effa;
}

.file-drop-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.file-command-button.uploading {
  cursor: wait;
  opacity: 0.55;
}

.side-chat-pane {
  background: #fff;
}

.side-chat-conversation {
  min-height: 0;
  flex: 1;
}

.side-chat-pane > .composer {
  flex: none;
}

.side-chat-header {
  display: flex;
  min-height: 54px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid #eceef1;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}

.side-chat-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.side-chat-heading strong,
.side-chat-heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-chat-heading strong {
  color: #292d32;
  font-size: 12px;
  font-weight: 650;
}

.side-chat-heading span {
  color: #969ca4;
  font-size: 9px;
}

.side-chat-header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}

.side-chat-recovery-note {
  margin: 0 0 18px;
  padding: 9px 11px;
  border: 1px solid #eadfc9;
  border-radius: 9px;
  background: #fffaf0;
  color: #78684b;
  font-size: 10px;
  line-height: 1.55;
}

.side-chat-empty,
.side-chat-loading,
.side-chat-ready {
  display: grid;
  min-height: 100%;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: #969ca4;
  font-size: 10px;
  text-align: center;
}

.side-chat-empty strong {
  color: #4a4f56;
  font-size: 12px;
}

.side-chat-empty .button {
  min-height: 31px;
  margin-top: 6px;
  font-size: 10px;
}

.side-chat-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 5px;
  place-items: center;
  border: 1px solid #e0e4e8;
  border-radius: 15px;
  background: linear-gradient(145deg, #fff, #f1f4f7);
  box-shadow: 0 7px 18px rgb(33 40 48 / 6%);
  color: #7d8996;
}

.side-chat-empty-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

@media (max-width: 760px) {
  .inspector-tabbar {
    min-height: 44px;
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .side-chat-tab {
    max-width: 120px;
  }
}

/* Composer depth and context-window usage */
.composer-shell {
  border: 1px solid #e1e4e8;
  background: #fff;
  box-shadow:
    0 14px 38px rgb(27 33 41 / 7%),
    0 4px 12px rgb(27 33 41 / 4%),
    inset 0 1px 0 rgb(255 255 255 / 92%);
  transition:
    border-color 160ms ease,
    box-shadow 180ms ease;
}

.composer-shell:focus-within {
  border-color: #d1d6dc;
  box-shadow:
    0 18px 44px rgb(27 33 41 / 9%),
    0 5px 14px rgb(27 33 41 / 5%),
    0 0 0 3px rgb(39 45 54 / 3%);
}

.composer-shell {
  container-type: inline-size;
}

@media (min-width: 761px) {
  @container (max-width: 310px) {
    .composer-toolbar {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas:
        "leading actions"
        "options options";
      gap: 5px 8px;
      padding: 0;
    }

    .composer-leading {
      width: 100%;
      grid-area: leading;
    }

    .composer-options {
      display: grid;
      width: 100%;
      grid-area: options;
      grid-template-columns: minmax(0, 1.3fr) minmax(104px, 0.8fr);
      gap: 6px;
    }

    .composer-actions {
      grid-area: actions;
    }

    .composer-options .custom-select-compact {
      width: 100%;
      max-width: none;
    }

    .composer-options .custom-select-compact .custom-select-button {
      width: 100%;
      min-height: 29px;
      justify-content: space-between;
      padding: 0 8px;
      border: 1px solid #e5e7ea;
      border-radius: 7px;
      background: #fafafa;
    }

    .composer-options .custom-select-compact .custom-select-label {
      max-width: none;
      flex: 1;
      font-size: 11px;
    }

    .composer-options .custom-select-compact .custom-select-menu {
      right: 0;
      left: 0;
      width: 100%;
    }
  }
}

.context-usage {
  --context-angle: 0deg;
  --context-color: #747c86;
  position: relative;
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #858b94;
  cursor: help;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.context-usage:hover,
.context-usage:focus-visible {
  background: #f1f3f5;
  color: #4d535b;
  outline: none;
}

.context-usage-ring {
  position: relative;
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--context-color) var(--context-angle), #e5e8eb 0);
}

.context-usage-ring::after {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.context-usage-tooltip {
  position: absolute;
  right: -4px;
  bottom: calc(100% + 12px);
  display: grid;
  width: max-content;
  min-width: 210px;
  max-width: 270px;
  gap: 7px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #202124;
  box-shadow: 0 10px 28px rgb(20 24 30 / 22%);
  color: #f4f5f6;
  font-size: 11px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(5px);
  visibility: hidden;
  transition:
    opacity 120ms ease,
    transform 150ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 150ms;
}

.context-usage-tooltip::after {
  position: absolute;
  right: 14px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #202124;
  content: "";
  transform: rotate(45deg);
}

.context-usage-tooltip strong {
  color: #d8dbe0;
  font-size: 11px;
  font-weight: 650;
}

.context-usage-tooltip > span {
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.context-usage:hover .context-usage-tooltip,
.context-usage:focus-visible .context-usage-tooltip {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  transition-delay: 0s;
}

@media (max-width: 760px) {
  body.keyboard-open .composer-shell {
    box-shadow: none;
  }

  .context-usage-tooltip {
    right: -42px;
    max-width: calc(100vw - 42px);
  }
}

/* File browser splitter: the active pixel height is clamped in app.js. */
.file-browser {
  grid-template-rows:
    var(--file-list-height, 42%)
    var(--file-splitter-height, 9px)
    minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
}

.file-list {
  min-height: 0;
  border-bottom: 0;
}

.file-splitter {
  position: relative;
  z-index: 3;
  display: grid;
  width: 100%;
  height: 9px;
  flex: none;
  place-items: center;
  border-top: 1px solid #eceff2;
  border-bottom: 1px solid #e5e9ed;
  background: linear-gradient(180deg, #fbfcfd, #f3f5f7);
  cursor: row-resize;
  outline: none;
  touch-action: none;
  user-select: none;
}

.file-splitter::before {
  width: 30px;
  height: 2px;
  border-radius: 999px;
  background: #c8cdd4;
  content: "";
  transition:
    width 120ms ease,
    background-color 120ms ease;
}

.file-splitter::after {
  position: absolute;
  inset: -5px 0;
  content: "";
}

.file-splitter:hover::before,
.file-splitter:focus-visible::before,
.file-splitter.dragging::before {
  width: 42px;
  background: #808892;
}

.file-splitter:focus-visible {
  box-shadow: inset 0 0 0 2px rgb(66 123 192 / 24%);
}

.file-splitter.dragging {
  background: #eef2f6;
}

body.file-splitter-dragging {
  cursor: row-resize;
  user-select: none;
}

body.file-splitter-dragging * {
  cursor: row-resize !important;
}

.file-preview {
  min-height: 0;
  border-top: 0;
}

/* Fullscreen server file viewer */
body.file-fullscreen-open {
  overflow: hidden;
}

.file-fullscreen-layer {
  z-index: 140;
  padding: clamp(12px, 3vw, 34px);
  background: rgb(24 27 31 / 58%);
  backdrop-filter: blur(9px);
}

.file-fullscreen-dialog {
  display: flex;
  width: min(96vw, 1440px);
  height: min(92dvh, 1040px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgb(15 19 24 / 13%);
  border-radius: 15px;
  background: #fff;
  box-shadow:
    0 34px 100px rgb(10 14 18 / 32%),
    0 8px 24px rgb(10 14 18 / 16%);
  outline: none;
}

.file-fullscreen-header {
  display: flex;
  min-height: 58px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 10px 8px 17px;
  border-bottom: 1px solid #e7eaee;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}

.file-fullscreen-heading {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
}

.file-fullscreen-heading .kicker {
  grid-column: 1 / -1;
  margin: 0;
  color: #9a9fa7;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.file-fullscreen-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #25282d;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-fullscreen-heading span {
  min-width: 0;
  overflow: hidden;
  color: #8e949c;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-fullscreen-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
}

.file-fullscreen-actions .file-text-action {
  min-height: 29px;
  padding: 0 11px;
  border-color: #dce0e5;
  border-radius: 7px;
  font-size: 10px;
}

.file-fullscreen-actions .file-text-action.primary {
  border-color: #262a30;
  background: #262a30;
  color: #fff;
}

.file-fullscreen-actions .file-text-action.primary:hover {
  background: #15181c;
}

.file-fullscreen-actions .file-text-action.primary:disabled {
  border-color: #d9dde2;
  background: #d9dde2;
  color: #fff;
  opacity: 0.72;
}

.file-fullscreen-actions .icon-button {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #666d76;
}

.file-fullscreen-actions .icon-button:hover {
  border-color: #e0e4e8;
  background: #f2f4f6;
  color: #272b30;
}

.file-fullscreen-actions svg {
  width: 17px;
  height: 17px;
}

.file-fullscreen-body {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: #fff;
}

.file-fullscreen-state {
  display: grid;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 32px;
  color: #8d939b;
  text-align: center;
}

.file-fullscreen-state strong {
  color: #34383e;
  font-size: 14px;
  font-weight: 620;
}

.file-fullscreen-state > span:last-child {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 10.5px;
  line-height: 1.55;
}

.file-fullscreen-spinner {
  width: 23px;
  height: 23px;
  margin-bottom: 4px;
  border: 2px solid #e1e5e9;
  border-top-color: #6f7781;
  border-radius: 50%;
  animation: file-fullscreen-spin 700ms linear infinite;
}

@keyframes file-fullscreen-spin {
  to {
    transform: rotate(360deg);
  }
}

.file-fullscreen-message-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 5px;
  place-items: center;
  border: 1px solid #e1e5e9;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f1f4f7);
  color: #79838e;
}

.file-fullscreen-message-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.file-fullscreen-rendered {
  height: 100%;
  padding: clamp(18px, 2.4vw, 30px);
}

#file-fullscreen-markdown {
  width: min(100%, 1060px);
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.76;
}

#file-fullscreen-highlight {
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
}

#file-fullscreen-highlight code,
#file-fullscreen-highlight code.hljs {
  font-size: inherit;
}

.file-fullscreen-editor {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  resize: none;
  padding: 20px clamp(18px, 2.4vw, 30px);
  border: 0;
  background: #fcfdfe;
  color: #282c31;
  outline: none;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}

.file-fullscreen-editor::selection {
  background: #cfe0f6;
}

.file-fullscreen-image-stage {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(45deg, #f4f5f6 25%, transparent 25%),
    linear-gradient(-45deg, #f4f5f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f4f5f6 75%),
    linear-gradient(-45deg, transparent 75%, #f4f5f6 75%);
  background-color: #fff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.file-fullscreen-image-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 5px;
  box-shadow: 0 10px 30px rgb(20 25 30 / 12%);
}

.file-fullscreen-binary {
  width: min(100%, 620px);
  height: 100%;
  margin: 0 auto;
  overflow: auto;
  padding: clamp(32px, 8vh, 90px) 28px;
  color: #707780;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .file-browser {
    grid-template-rows:
      var(--file-list-height, 38%)
      var(--file-splitter-height, 9px)
      minmax(0, 1fr);
  }

  .file-splitter::before {
    width: 36px;
  }

  .file-fullscreen-layer {
    align-items: stretch;
    padding: 0;
    background: #fff;
    backdrop-filter: none;
  }

  .file-fullscreen-dialog {
    width: 100vw;
    height: var(--app-height, 100dvh);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .file-fullscreen-header {
    min-height: calc(55px + env(safe-area-inset-top));
    padding:
      calc(7px + env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      7px
      max(13px, env(safe-area-inset-left));
  }

  .file-fullscreen-heading {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .file-fullscreen-heading .kicker {
    display: none;
  }

  .file-fullscreen-heading strong {
    font-size: 11.5px;
  }

  .file-fullscreen-heading span {
    font-size: 8.5px;
  }

  .file-fullscreen-actions {
    gap: 2px;
  }

  .file-fullscreen-actions .file-text-action {
    min-height: 31px;
    padding: 0 9px;
  }

  .file-fullscreen-actions .icon-button {
    width: 32px;
    height: 32px;
  }

  .file-fullscreen-rendered {
    padding: 18px 16px max(24px, env(safe-area-inset-bottom));
  }

  #file-fullscreen-markdown {
    font-size: 13.5px;
    line-height: 1.72;
  }

  #file-fullscreen-highlight {
    padding: 15px 12px max(20px, env(safe-area-inset-bottom));
    font-size: 11.5px;
  }

  .file-fullscreen-editor {
    padding:
      15px
      12px
      max(20px, env(safe-area-inset-bottom));
    font-size: 12px;
  }

  .file-fullscreen-image-stage {
    padding: 10px 10px max(12px, env(safe-area-inset-bottom));
  }

  .file-fullscreen-binary {
    padding: 28px 18px max(24px, env(safe-area-inset-bottom));
  }
}

/* Single-row iPhone composer with one combined permission/model/reasoning control. */
@media (max-width: 760px) {
  .composer {
    padding:
      5px
      max(7px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(7px, env(safe-area-inset-left));
  }

  .composer-shell {
    min-height: 0;
    padding: 7px 8px 6px;
    border-radius: 15px;
    box-shadow:
      0 8px 24px rgb(30 35 42 / 6%),
      0 1px 2px rgb(30 35 42 / 4%);
  }

  .composer textarea {
    min-height: 36px;
    max-height: min(144px, 28vh);
    padding: 2px 3px 4px;
    line-height: 1.45;
  }

  .composer-toolbar {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0;
  }

  .composer-leading {
    display: contents;
  }

  .composer-attachment-control {
    order: 1;
    flex: none;
  }

  .permission-control {
    order: 2;
    flex: none;
    min-width: 0;
  }

  .composer-add {
    width: 30px;
    height: 30px;
    margin-right: 4px;
    border-radius: 9px;
  }

  .permission-button {
    min-width: 0;
    min-height: 30px;
    gap: 4px;
    padding: 0 6px;
    border-radius: 9px 0 0 9px;
    background: #f6f7f8;
    font-size: 10.5px;
  }

  .permission-button .permission-icon {
    width: 16px;
    height: 16px;
  }

  .permission-button #permission-label {
    overflow: hidden;
    max-width: 50px;
    text-overflow: ellipsis;
  }

  .permission-button > svg:last-child {
    width: 10px;
    height: 10px;
  }

  .permission-button[data-permission="full"] {
    background: #fff1e3;
  }

  .composer-actions {
    order: 4;
    flex: none;
    gap: 3px;
  }

  .context-usage {
    min-height: 30px;
    gap: 4px;
    padding: 0 4px;
    color: #747b84;
    font-size: 10.5px;
    font-weight: 600;
  }

  .context-usage-ring {
    width: 16px;
    height: 16px;
  }

  .send-button {
    width: 34px;
    height: 34px;
  }

  .composer-options {
    display: flex;
    min-width: 0;
    height: 30px;
    flex: 1 1 auto;
    order: 3;
    gap: 0;
    margin-right: 4px;
    padding: 0;
    border-radius: 0 9px 9px 0;
    background: #f6f7f8;
  }

  .composer-options .custom-select-compact {
    width: auto;
    height: 30px;
    min-width: 0;
    max-width: none;
    flex: 1 1 0;
  }

  .composer-options .custom-select-compact:last-child {
    flex: 0 1 58px;
  }

  .composer-options .custom-select-compact + .custom-select-compact {
    border-left: 1px solid #e1e4e8;
  }

  .composer-options .custom-select-compact .custom-select-button {
    width: 100%;
    height: 30px;
    min-height: 28px;
    padding: 0 5px;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 10.5px;
  }

  .composer-options .custom-select-compact:last-child .custom-select-button {
    border-radius: 0 9px 9px 0;
  }

  .composer-options .custom-select-compact .custom-select-label {
    max-width: none;
    min-width: 0;
    flex: 1;
    font-size: 0;
    text-overflow: ellipsis;
  }

  .composer-options .custom-select-compact .custom-select-label::after {
    overflow: hidden;
    content: attr(data-compact-label);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .composer-options .custom-select-compact .custom-select-button:hover,
  .composer-options .custom-select-compact.open .custom-select-button {
    background: #eef0f2;
  }

  .composer-options .custom-select-compact:first-child .custom-select-menu {
    right: auto;
    left: 0;
    width: min(230px, calc(100vw - 28px));
  }

  .composer-options .custom-select-compact:last-child .custom-select-menu {
    right: 0;
    left: auto;
    width: min(230px, calc(100vw - 28px));
  }

  .composer-options .custom-select-compact .custom-select-menu {
    width: min(230px, calc(100vw - 28px));
  }

  body.keyboard-open .composer textarea {
    min-height: 34px;
    max-height: min(124px, 24vh);
  }
}

@media (max-width: 360px) {
  .permission-button {
    gap: 3px;
    padding: 0 5px;
    font-size: 10px;
  }

  .permission-button #permission-label {
    width: auto;
    max-width: none;
    font-size: 0;
  }

  .permission-button #permission-label::after {
    content: attr(data-short-label);
    font-size: 10px;
  }

  .composer-options .custom-select-compact:last-child {
    flex-basis: 52px;
  }

  .composer-options .custom-select-compact:first-child .custom-select-menu {
    width: 190px;
  }

  .permission-menu {
    left: -42px;
    width: calc(100vw - 20px);
  }

  .context-usage {
    padding-right: 2px;
    padding-left: 2px;
  }

  #context-usage-percent {
    display: none;
  }
}
