:root {
  color-scheme: dark;
  --bg: #171717;
  --sidebar: #241d1f;
  --sidebar-soft: #2d2628;
  --surface: #202020;
  --surface-raised: #2a2a2a;
  --surface-soft: #181818;
  --input: #303030;
  --line: #383838;
  --line-strong: #474747;
  --text: #f4f4f4;
  --muted: #9d9d9d;
  --muted-strong: #c5c5c5;
  --accent: #4d8dff;
  --accent-strong: #7aaaee;
  --danger: #ff6b5f;
  --warning: #ff8f3d;
  --ok: #57c785;
  --radius: 8px;
  --sidebar-width: 292px;
  --rail-width: 360px;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

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

button {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary,
button.ghost {
  background: transparent;
  color: var(--muted-strong);
}

button.secondary:hover,
button.ghost:hover {
  border-color: #565656;
  background: #313131;
  color: var(--text);
}

button.compact {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--input);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #686868;
  box-shadow: 0 0 0 1px #686868;
}

input::placeholder,
textarea::placeholder {
  color: #858585;
}

textarea {
  resize: vertical;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

label {
  color: var(--muted);
  font-size: 11px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.controller-auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 34% 28%, rgba(77, 141, 255, 0.14), transparent 32%),
    radial-gradient(circle at 72% 74%, rgba(255, 143, 61, 0.09), transparent 30%),
    var(--bg);
}

.controller-auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(32, 32, 32, 0.86);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  padding: 34px;
}

.auth-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-raised);
  color: var(--accent-strong);
  font-size: 28px;
}

.controller-auth-copy {
  display: grid;
  gap: 6px;
}

.controller-auth-copy p {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.controller-auth-copy h1 {
  font-size: 30px;
  line-height: 1.04;
}

.controller-auth-copy span,
.controller-auth-error {
  color: var(--muted);
}

.controller-auth-form {
  display: grid;
  gap: 10px;
}

.controller-auth-form button {
  min-height: 42px;
}

.controller-auth-error {
  color: var(--danger);
  font-size: 13px;
}

.codex-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  min-width: 0;
}

body.debug-mode .codex-shell {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--rail-width);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #332b2d;
  background:
    linear-gradient(180deg, rgba(61, 38, 37, 0.45), rgba(27, 25, 26, 0.2)),
    var(--sidebar);
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden auto;
  padding: 8px 10px 12px 7px;
  scrollbar-gutter: stable;
  scrollbar-color: #5b5556 transparent;
}

.sidebar-section {
  padding: 0;
  min-height: 0;
  margin-bottom: 22px;
}

.chat-section {
  display: flex;
  flex-direction: column;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
  margin-bottom: 5px;
  padding: 0 0 0 0;
}

.sidebar-heading h2 {
  color: #8f898b;
  font-size: 14px;
  font-weight: 500;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #a9a3a5;
  padding: 0;
  font-size: 0;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.icon-button span {
  display: block;
  font-size: 20px;
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
  line-height: 1;
}

.sidebar-symbol {
  display: block;
  width: 18px;
  color: #a5a0a2;
  font-size: 17px;
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
  line-height: 1;
  text-align: center;
}

.project-path-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.list,
.event-list,
.approval-list,
.thread-items {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list {
  gap: 1px;
  margin-top: 0;
  overflow: visible;
  scrollbar-color: #595959 transparent;
}

.project-list {
  max-height: none;
}

.project-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.project-row-wrap {
  position: relative;
  min-width: 0;
}

.chat-list {
  flex: 1 1 auto;
  max-height: none;
}

.list-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  height: auto;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 420;
}

.list-item:hover,
.list-item.selected {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
}

.thread-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.row-content {
  min-width: 0;
}

.row-title-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.item-title,
.project-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-meta-inline,
.row-age {
  color: #8f898b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.row-live-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.live-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(197, 197, 197, 0.28);
  border-top-color: var(--muted-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.list-item.running .item-title {
  color: var(--text);
}

.project-meta-inline:empty,
.row-age:empty {
  display: none;
}

.item-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 430;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list .list-item {
  min-height: 32px;
}

.project-row {
  padding-right: 34px;
}

.project-row-action {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  padding: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.project-row-wrap:hover .project-row-action,
.project-row-wrap:focus-within .project-row-action {
  opacity: 1;
  pointer-events: auto;
}

.project-row-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.project-row-action:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.project-row-action .material-symbols-rounded {
  font-size: 16px;
}

.project-list .item-title,
.project-list .project-name {
  font-size: 14px;
}

.nested-thread {
  grid-template-columns: minmax(0, 1fr) auto;
  width: calc(100% - 25px);
  min-height: 30px;
  margin-left: 25px;
  padding-left: 7px;
}

.nested-thread .item-title {
  font-weight: 500;
}

.project-show-more {
  width: calc(100% - 25px);
  min-height: 28px;
  margin-left: 25px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 7px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
}

.project-show-more:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.sidebar-footer {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 7px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.bridge-mini {
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  padding: 0;
}

.bridge-mini-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  min-width: 0;
  min-height: 30px;
  padding: 0 8px;
  list-style: none;
}

.bridge-mini-title::-webkit-details-marker {
  display: none;
}

.bridge-mini[open] .bridge-mini-title {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bridge-mini-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}

.bridge-mini-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  padding: 8px;
}

.bridge-mini-actions button {
  min-height: 28px;
  padding: 0 5px;
  font-size: 11px;
}

.settings-footer {
  position: relative;
}

.settings-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 10px;
  font-size: 14px;
  text-align: left;
}

.settings-button:hover,
.settings-footer.open .settings-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.settings-button .material-symbols-rounded {
  color: var(--muted);
  font-size: 19px;
}

.settings-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: min(340px, calc(100vw - 18px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #202020;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
  padding: 10px;
}

.settings-panel-header {
  padding: 4px 4px 10px;
}

.settings-panel-header h2 {
  color: var(--text);
  font-size: 14px;
}

.settings-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 8px;
  text-align: left;
  white-space: normal;
}

.settings-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.settings-row > .material-symbols-rounded {
  color: var(--muted);
  font-size: 19px;
}

.settings-row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.settings-row-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.settings-row-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.settings-state-pill {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 650;
}

.settings-row[aria-pressed="true"] .settings-state-pill {
  border-color: rgba(77, 141, 255, 0.35);
  background: rgba(77, 141, 255, 0.12);
  color: #c8d9ff;
}

.settings-dropdown {
  position: relative;
}

.settings-dropdown.open {
  z-index: 2;
}

.settings-chevron {
  transition: transform 160ms ease;
}

.settings-row[aria-expanded="true"] .settings-chevron {
  transform: rotate(180deg);
}

.settings-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 39px;
  z-index: 4;
  display: grid;
  gap: 4px;
  max-height: min(260px, calc(100vh - 180px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #2a2a2a;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
  padding: 6px;
}

.settings-menu-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-strong);
  padding: 6px 8px;
  text-align: left;
}

.settings-menu-item:hover,
.settings-menu-item.selected {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.settings-menu-item:disabled {
  cursor: default;
  opacity: 1;
}

.settings-menu-item:disabled:hover {
  background: transparent;
  color: var(--muted-strong);
}

.settings-menu-item .material-symbols-rounded {
  color: var(--muted);
  font-size: 17px;
}

.settings-menu-item span span,
.settings-menu-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-menu-item small {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 18px 32px;
}

.thread-header > div:first-child {
  min-width: 0;
}

.thread-header h2 {
  max-width: min(720px, 70vw);
  color: var(--text);
  font-size: 20px;
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-actions {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

body.debug-mode .thread-actions {
  display: flex;
}

.conversation-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 14px 22px;
}

.conversation-title {
  display: none;
}

.thread-items {
  width: min(100%, 880px);
  min-height: 0;
  margin: 0 auto;
  gap: 14px;
  overflow: auto;
  padding: 6px 0 18px;
  scrollbar-color: #555 transparent;
}

.thread-items.conversation-items {
  gap: 18px;
}

.history-pagination {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}

.history-load-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-raised) 76%, transparent);
  color: var(--muted-strong);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 13px;
}

.history-load-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
}

.history-load-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.empty-state {
  margin: 16vh auto 0;
  color: var(--muted);
  font-size: 13px;
}

.workspace.new-chat-mode {
  grid-template-rows: clamp(128px, 30vh, 285px) auto auto minmax(0, 1fr);
}

.workspace.new-chat-mode .thread-header {
  display: none;
}

.workspace.new-chat-mode .conversation-pane {
  grid-template-rows: minmax(0, 1fr);
  padding: 0 22px;
}

.workspace.new-chat-mode .thread-items.empty-thread {
  justify-content: center;
  padding: 0;
}

.workspace.new-chat-mode .empty-state {
  margin: 0;
  color: var(--text);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
}

.thread-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 13px 14px;
}

.thread-item pre {
  max-height: 46vh;
  overflow: auto;
  color: #dedede;
}

.thread-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.summary-cell {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 8px;
}

.summary-label {
  color: var(--muted);
  font-size: 10px;
}

.summary-value {
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row {
  display: flex;
  width: 100%;
  min-width: 0;
}

.turn-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.message-row.user {
  align-items: flex-end;
  justify-content: flex-end;
}

.message-row.user.has-attachments {
  flex-direction: column;
  gap: 8px;
}

.message-row.assistant,
.message-row.tool {
  justify-content: flex-start;
}

.message-bubble,
.assistant-message,
.tool-card,
.activity-row {
  max-width: min(100%, 760px);
  min-width: 0;
}

.message-bubble {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(76%, 620px);
  border-radius: 18px;
  background: #2c2c2c;
  color: var(--text);
  padding: 12px 14px;
}

.message-attribution {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.assistant-message {
  color: #f1f1f1;
  font-size: 14px;
  line-height: 1.58;
  padding: 4px 0;
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.markdown-content {
  white-space: normal;
  overflow-wrap: anywhere;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre {
  margin: 0 0 10px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 14px 0 8px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
}

.markdown-content h1 {
  font-size: 20px;
}

.markdown-content h2 {
  font-size: 17px;
}

.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-size: 15px;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 22px;
}

.markdown-content li + li {
  margin-top: 3px;
}

.markdown-content blockquote {
  border-left: 2px solid var(--line-strong);
  color: var(--muted-strong);
  padding-left: 12px;
}

.markdown-content a {
  color: #9fc4ff;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content code {
  border: 1px solid #383838;
  border-radius: 5px;
  background: #191919;
  padding: 1px 5px;
  color: #f0f0f0;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.markdown-code {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #343434;
  border-radius: 7px;
  background: #141414;
  padding: 10px;
}

.markdown-code code {
  border: 0;
  background: transparent;
  padding: 0;
  white-space: pre;
}

.message-image {
  display: block;
  max-width: min(100%, 360px);
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.message-image-thumb {
  display: block;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202020;
}

.message-image-thumb:hover {
  border-color: var(--line-strong);
}

.message-image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tool-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #202020;
  color: var(--muted-strong);
  padding: 11px 12px;
}

.tool-card.failed {
  border-color: rgba(255, 107, 95, 0.36);
  background: rgba(255, 107, 95, 0.07);
}

.file-change-flap {
  padding: 0;
  overflow: hidden;
}

.file-change-flap > summary {
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.file-change-flap > summary::-webkit-details-marker {
  display: none;
}

.file-change-flap .tool-action {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.file-change-body {
  border-top: 1px solid var(--line);
  padding: 0 12px 11px;
}

.work-summary {
  width: min(100%, 760px);
  color: var(--muted-strong);
}

.work-summary > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  user-select: none;
}

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

.work-summary > summary::after {
  content: "chevron_right";
  color: var(--muted);
  font-family: "Material Symbols Rounded";
  font-size: 18px;
  line-height: 1;
}

.work-summary[open] > summary::after {
  content: "expand_more";
}

.work-summary.active > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 1.2s ease-in-out infinite;
}

.work-summary-label {
  color: var(--muted-strong);
  font-weight: 560;
}

.work-summary.active .work-summary-label,
.work-summary.active .work-summary-body > :last-child .activity-title,
.work-summary.active .work-summary-body > :last-child.activity-message,
.work-summary.active .work-summary-body > :last-child .thinking-label {
  background:
    linear-gradient(
      105deg,
      var(--muted) 0%,
      var(--muted-strong) 28%,
      var(--text) 46%,
      var(--muted-strong) 64%,
      var(--muted) 100%
    );
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: active-text-shimmer 1.65s ease-in-out infinite;
}

.work-summary-meta {
  color: var(--muted);
  font-size: 12px;
}

.work-summary-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-left: 0;
}

.activity-message {
  color: #f1f1f1;
  font-size: 14px;
  line-height: 1.58;
  padding: 2px 0;
}

.activity-row {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.activity-row > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  user-select: none;
}

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

.activity-row > summary::after {
  content: "chevron_right";
  flex: 0 0 auto;
  color: var(--muted);
  font-family: "Material Symbols Rounded";
  font-size: 16px;
  line-height: 1;
  opacity: 0.7;
}

.activity-row[open] > summary::after {
  content: "expand_more";
}

.activity-row.text-only {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
}

.activity-row.failed .activity-title {
  color: #ff8f86;
}

.activity-row.active .activity-icon {
  animation: pulse 1.2s ease-in-out infinite;
}

.activity-icon {
  flex: 0 0 auto;
  width: 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.activity-title {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.activity-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 0 23px;
}

.activity-command {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #181818;
  padding: 8px;
}

.activity-command-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-strong);
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.activity-command-title span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-command-title span:last-child {
  flex: 0 0 auto;
  color: var(--muted);
}

.todo-list-activity {
  display: grid;
  gap: 6px;
}

.todo-list-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted-strong);
}

.todo-list-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.todo-list-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thinking-item,
.status-notice {
  padding: 2px 0;
  color: var(--muted-strong);
}

.thinking-label,
.status-notice-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.thinking-text,
.status-notice-body {
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

.context-compaction-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 760px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
}

.context-compaction-divider::before,
.context-compaction-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.context-compaction-divider span {
  flex: 0 0 auto;
}

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-title {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.tool-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-text,
.tool-output,
.diff-output,
.details-block pre {
  margin-top: 9px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #343434;
  border-radius: 7px;
  background: #141414;
  color: #dedede;
  padding: 9px;
}

.command-text {
  color: #f0f0f0;
}

.tool-output,
.diff-output {
  color: #d2d2d2;
}

.diff-viewer {
  margin-top: 10px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #343434;
  border-radius: 7px;
  background: #141414;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.diff-line {
  display: grid;
  grid-template-columns: 52px 52px 22px minmax(max-content, 1fr);
  min-width: max-content;
  color: #d9d9d9;
}

.diff-line-number,
.diff-line-marker,
.diff-line-code {
  min-height: 21px;
  white-space: pre;
}

.diff-line-number {
  padding: 2px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  color: #8e8e8e;
  text-align: right;
  user-select: none;
}

.diff-line-marker {
  padding: 2px 0;
  color: #8e8e8e;
  text-align: center;
  user-select: none;
}

.diff-line-code {
  padding: 2px 12px 2px 6px;
}

.diff-line-context:nth-child(2n) {
  background: rgba(255, 255, 255, 0.015);
}

.diff-line-added {
  background: rgba(50, 172, 96, 0.2);
  color: #eafff1;
}

.diff-line-added .diff-line-number,
.diff-line-added .diff-line-marker {
  background: rgba(50, 172, 96, 0.16);
  color: #62e194;
}

.diff-line-deleted {
  background: rgba(235, 87, 87, 0.2);
  color: #fff0ef;
}

.diff-line-deleted .diff-line-number,
.diff-line-deleted .diff-line-marker {
  background: rgba(235, 87, 87, 0.16);
  color: #ff8179;
}

.diff-line-hunk {
  background: rgba(99, 132, 255, 0.12);
  color: #9fb8ff;
}

.diff-line-hunk .diff-line-number,
.diff-line-hunk .diff-line-marker {
  background: rgba(99, 132, 255, 0.08);
  color: #7f95d9;
}

.diff-line-metadata {
  color: #8f9ab3;
}

.diff-line-metadata .diff-line-number,
.diff-line-metadata .diff-line-marker {
  color: #626a78;
}

.diff-line-section {
  display: block;
  min-width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #1f1f1f;
}

.diff-line-section:first-child {
  border-top: 0;
}

.diff-section-label {
  padding: 7px 10px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 650;
}

.diff-token-keyword {
  color: #c792ea;
}

.diff-token-string {
  color: #ecc48d;
}

.diff-token-number {
  color: #82aaff;
}

.diff-token-comment {
  color: #7f8490;
}

.diff-token-operator {
  color: #89ddff;
}

.details-block {
  margin-top: 9px;
}

.details-block summary {
  cursor: pointer;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.file-change {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.file-change:first-of-type {
  margin-top: 8px;
}

.file-change summary {
  cursor: pointer;
  list-style: none;
}

.file-change summary::-webkit-details-marker {
  display: none;
}

.file-change-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-change-path {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-change-kind {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.diff-stats {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 5px;
  margin-left: 7px;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 650;
}

.diff-additions {
  color: #40d489;
}

.diff-deletions {
  color: #ff6259;
}

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

  50% {
    opacity: 1;
  }
}

@keyframes active-text-shimmer {
  0% {
    background-position: 130% 50%;
  }

  100% {
    background-position: -130% 50%;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .work-summary.active .work-summary-label,
  .work-summary.active .work-summary-body > :last-child .activity-title,
  .work-summary.active .work-summary-body > :last-child.activity-message,
  .work-summary.active .work-summary-body > :last-child .thinking-label {
    animation: none;
    background: none;
    color: var(--muted-strong);
  }
}

@keyframes voice-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.24);
  }

  100% {
    box-shadow: 0 0 0 9px rgba(255, 255, 255, 0);
  }
}

.composer {
  width: min(100% - 44px, 880px);
  margin: 0 auto 7px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  overflow: visible;
}

.composer.voice-recording {
  border-color: rgba(255, 255, 255, 0.22);
}

.composer-file-changes[hidden] {
  display: none;
}

.composer-file-changes {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  border-radius: 17px 17px 0 0;
  background: #242424;
}

.composer-file-changes .file-change-flap {
  max-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.composer-file-changes .file-change-flap > summary {
  min-height: 38px;
  padding: 9px 12px;
}

.composer-file-changes .file-change-body {
  max-height: min(38vh, 360px);
  overflow: auto;
  background: #202020;
}

.composer.drag-over {
  border-color: rgba(122, 162, 238, 0.86);
  box-shadow:
    0 0 0 1px rgba(122, 162, 238, 0.28),
    0 18px 55px rgba(0, 0, 0, 0.35);
}

.composer textarea {
  min-height: 70px;
  max-height: 210px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px 16px 4px;
  color: var(--text);
}

.composer textarea:focus {
  box-shadow: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px 10px;
}

.composer-controls,
.composer-submit {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.composer-controls {
  flex: 1 1 auto;
}

.attachment-picker {
  position: relative;
  flex: 0 0 auto;
}

.attachment-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.attachment-button:hover,
.attachment-picker.open .attachment-button {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.voice-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.voice-button:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

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

.voice-button.recording {
  background: rgba(255, 255, 255, 0.92);
  color: #1f1f1f;
}

.voice-button.recording::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.24);
  animation: voice-ring 1.4s ease-out infinite;
}

.voice-button .material-symbols-rounded {
  position: relative;
  z-index: 1;
}

.attachment-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  min-width: 185px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(42, 42, 42, 0.97);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  padding: 6px;
}

.attachment-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 430;
}

.attachment-menu-item:hover {
  background: rgba(255, 255, 255, 0.09);
}

.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px 0;
}

.attachment-chip,
.message-attachment-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  background: #252525;
  color: var(--muted-strong);
}

.attachment-chip {
  gap: 7px;
  max-width: min(260px, 100%);
  min-height: 34px;
  border-radius: 17px;
  padding: 4px 5px 4px 8px;
}

.attachment-chip img {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
}

.attachment-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 560;
}

.attachment-chip-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.attachment-chip.failed {
  border-color: rgba(255, 107, 95, 0.38);
  background: rgba(255, 107, 95, 0.08);
  color: #ffb7b2;
}

.attachment-remove {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  min-height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.attachment-remove:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.composer-submit {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.composer-picker {
  position: relative;
  min-width: 0;
}

.picker-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 190px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 6px;
  font-size: 12px;
  font-weight: 650;
}

.composer-submit .picker-button {
  max-width: 220px;
}

.picker-button:hover,
.composer-picker.open .picker-button {
  border-color: #3c3c3c;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.picker-button [data-picker-label] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-picker.danger .picker-button {
  color: var(--warning);
}

.access-picker:not(.danger) .access-icon {
  display: none;
}

.access-icon,
.context-icon,
.model-icon,
.picker-option-icon,
.picker-submenu-chevron,
.select-chevron,
.attachment-button .material-symbols-rounded,
.attachment-menu-item .material-symbols-rounded,
.attachment-chip-icon,
.attachment-remove .material-symbols-rounded,
.project-row-action .material-symbols-rounded,
.branch-create-button .material-symbols-rounded,
.interrupt-button .material-symbols-rounded,
.send-icon-button .material-symbols-rounded {
  display: block;
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
  line-height: 1;
}

.access-icon {
  font-size: 15px;
}

.model-icon {
  color: currentColor;
  font-size: 14px;
}

.context-icon {
  color: var(--muted);
  font-size: 16px;
}

.select-chevron {
  color: currentColor;
  font-size: 14px;
  pointer-events: none;
}

.native-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.picker-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 7px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  max-width: min(320px, 80vw);
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(42, 42, 42, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  padding: 6px;
  scrollbar-color: #5e5e5e transparent;
}

.composer-submit .picker-menu {
  right: 0;
  left: auto;
}

.model-menu {
  min-width: 220px;
  overflow: visible;
}

.picker-heading {
  color: var(--muted);
  padding: 6px 10px 3px;
  font-size: 12px;
  font-weight: 500;
}

.picker-separator {
  height: 1px;
  margin: 5px 4px;
  background: rgba(255, 255, 255, 0.07);
}

.picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 430;
}

.picker-option-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.picker-option-label span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-option-icon {
  flex: 0 0 auto;
  color: var(--muted-strong);
  font-size: 15px;
}

.picker-option:hover,
.picker-option.selected {
  background: rgba(255, 255, 255, 0.09);
}

.picker-option.selected::after {
  content: "check";
  margin-left: 18px;
  color: var(--text);
  font-family: "Material Symbols Rounded";
  font-size: 18px;
  font-weight: normal;
  line-height: 1;
}

.picker-submenu-group {
  position: relative;
}

.picker-submenu-trigger {
  width: 100%;
}

.picker-submenu-chevron {
  margin-left: 18px;
  color: var(--muted);
  font-size: 18px;
}

.picker-submenu {
  position: absolute;
  top: auto;
  right: calc(100% + 7px);
  bottom: 0;
  left: auto;
  display: none;
  min-width: 210px;
  max-width: min(300px, 70vw);
  max-height: 320px;
  overflow: auto;
}

.picker-submenu.has-nested-submenu {
  overflow: visible;
}

.composer-submit .picker-menu .picker-submenu {
  right: calc(100% + 7px);
  left: auto;
}

.picker-submenu-group.open > .picker-submenu {
  display: flex;
}

.queued-followups {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 0;
}

.queued-followup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #242424;
  color: var(--muted-strong);
  padding: 7px 10px;
}

.queued-followup.sending {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.queued-followup.failed {
  border-color: rgba(255, 90, 90, 0.45);
}

.queued-followup-body {
  min-width: 0;
}

.queued-followup-meta {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.queued-followup-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.queued-cancel-button {
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 7px;
  font-size: 12px;
}

.queued-cancel-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.message-attachment-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: min(76%, 620px);
}

.message-attachment-chip {
  gap: 6px;
  max-width: 240px;
  min-height: 30px;
  border-radius: 15px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 560;
}

.message-attachment-chip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-icon {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 17px;
}

.send-icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  border-color: transparent;
  background: #f2f2f2;
  color: #151515;
  padding: 0;
}

.send-icon-button:hover {
  background: #ffffff;
  color: #111111;
}

.send-icon-button .material-symbols-rounded {
  font-size: 21px;
}

.send-icon-button.stop-mode .material-symbols-rounded {
  font-size: 20px;
  font-variation-settings:
    "FILL" 1,
    "wght" 600,
    "GRAD" 0,
    "opsz" 24;
}

.interrupt-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-color: transparent;
  border-radius: 50%;
  background: #f2f2f2;
  color: #151515;
  padding: 0;
}

.interrupt-button:hover {
  background: #ffffff;
  color: #111111;
}

.interrupt-button .material-symbols-rounded {
  font-size: 18px;
}

.workspace-context-row {
  display: flex;
  align-items: center;
  gap: 15px;
  width: min(100% - 44px, 880px);
  min-height: 24px;
  margin: 0 auto 14px;
  color: var(--muted-strong);
  font-size: 12px;
}

.context-picker .picker-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  max-width: 220px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 5px;
  font-size: 12px;
  font-weight: 560;
}

.context-picker .picker-button:hover,
.context-picker.open .picker-button {
  border-color: #3c3c3c;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.branch-context {
  position: relative;
  min-width: 0;
}

.branch-context .picker-button {
  cursor: pointer;
}

.branch-menu {
  min-width: 300px;
  max-width: min(360px, 85vw);
  max-height: 360px;
  overflow: visible;
}

.branch-search {
  min-height: 34px;
  margin-bottom: 5px;
  border-color: transparent;
  background: transparent;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
}

.branch-search:focus {
  border-color: transparent;
  box-shadow: none;
}

.branch-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow: auto;
  scrollbar-color: #5e5e5e transparent;
}

.branch-option {
  width: 100%;
}

.branch-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.branch-create-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 430;
}

.branch-create-button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.branch-create-button .material-symbols-rounded {
  color: var(--muted);
  font-size: 16px;
}

#branchLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.right-rail {
  display: none;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 50px 12px 14px 0;
  background: var(--bg);
}

body.debug-mode .right-rail {
  display: flex;
}

.rail-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px;
}

.rail-card:first-child {
  flex: 1 1 auto;
  min-height: 0;
}

.event-list {
  gap: 8px;
  min-height: 0;
  max-height: calc(100vh - 245px);
  overflow: auto;
  scrollbar-color: #555 transparent;
}

.event-item,
.approval-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111111;
  padding: 10px;
}

.event-item pre {
  margin-top: 8px;
  color: #d7d7d7;
}

.event-item .item-title,
.approval-item .item-title {
  color: var(--text);
}

.event-item .item-meta,
.approval-item .item-meta {
  color: var(--muted);
}

.approval-list {
  gap: 8px;
  margin-bottom: 10px;
}

.approval-item {
  border-color: rgba(255, 143, 61, 0.35);
  background: rgba(255, 143, 61, 0.08);
}

.approval-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.approval-actions button {
  min-height: 30px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(87, 199, 133, 0.3);
  border-radius: 7px;
  background: rgba(87, 199, 133, 0.12);
  color: #9ae5b7;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

.pill.error {
  border-color: rgba(255, 107, 95, 0.35);
  background: rgba(255, 107, 95, 0.1);
  color: var(--danger);
}

.pill.ok {
  border-color: rgba(87, 199, 133, 0.35);
  background: rgba(87, 199, 133, 0.12);
  color: #9ae5b7;
}

.pill.draft {
  border-color: rgba(157, 157, 157, 0.3);
  background: rgba(157, 157, 157, 0.1);
  color: var(--muted-strong);
}

.pill.loading {
  border-color: rgba(77, 141, 255, 0.35);
  background: rgba(77, 141, 255, 0.12);
  color: #b8d0ff;
}

.raw-rpc {
  flex: 0 0 auto;
}

.raw-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.raw-grid textarea {
  min-height: 76px;
}

#rpcResult {
  margin-top: 10px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111111;
  padding: 10px;
  color: #dedede;
}

@media (max-width: 1260px) {
  :root {
    --rail-width: 320px;
    --sidebar-width: 260px;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .codex-shell {
    grid-template-columns: var(--sidebar-width) minmax(420px, 1fr);
    height: 100vh;
    min-width: calc(var(--sidebar-width) + 420px);
    min-height: 0;
  }

  body.debug-mode .codex-shell {
    grid-template-columns: var(--sidebar-width) minmax(420px, 1fr);
    min-width: calc(var(--sidebar-width) + 420px);
  }

  .sidebar {
    max-height: 100vh;
    border-right: 1px solid #332b2d;
  }

  .right-rail {
    display: none;
  }

  body.debug-mode .right-rail {
    display: none;
  }

  .workspace {
    min-height: 0;
  }

  .project-list,
  .chat-list,
  .thread-items,
  .event-list {
    max-height: none;
  }
}

@media (max-width: 680px) {
  body {
    overflow-x: hidden;
  }

  .codex-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    min-width: 0;
    min-height: 100vh;
  }

  body.debug-mode .codex-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    min-width: 0;
  }

  .sidebar {
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid #332b2d;
  }

  .sidebar-scroll {
    padding-bottom: 8px;
  }

  .sidebar-footer {
    position: sticky;
    bottom: 0;
  }

  .workspace {
    min-height: 58vh;
  }

  .thread-header,
  .thread-actions,
  .thread-summary {
    grid-template-columns: 1fr;
  }

  .thread-header {
    align-items: stretch;
    flex-direction: column;
  }

  body.debug-mode .thread-actions {
    display: grid;
  }

  .conversation-pane,
  .thread-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .composer {
    width: calc(100% - 28px);
  }

  .workspace-context-row {
    width: calc(100% - 28px);
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-controls,
  .composer-submit {
    width: 100%;
  }

  .composer-submit {
    justify-content: space-between;
  }

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

  .composer-submit .model-picker {
    flex: 1 1 auto;
  }

  .composer-submit .picker-button {
    width: 100%;
  }

  .workspace-context-row {
    flex-wrap: wrap;
    gap: 7px;
  }

}
