:root {
  color-scheme: light;
  --sidebar-width: 284px;
  --composer-offset: 124px;
  --queue-offset: 0px;
  --keyboard-offset: 0px;
  --composer-left: var(--sidebar-width);
  --app-bg: #ffffff;
  --sidebar-bg: #f7f7f4;
  --sidebar-hover: #ececea;
  --sidebar-active: #e4e4e0;
  --surface: #ffffff;
  --surface-subtle: #f6f6f3;
  --surface-code: #101114;
  --surface-code-soft: #17191d;
  --text: #191919;
  --text-soft: #5f5f5a;
  --text-faint: #8b8b84;
  --line: #deded8;
  --line-strong: #c9c9c2;
  --accent: #111111;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #31c85b;
  --ok-rgb: 49, 200, 91;
  --work-blue: #1d7af2;
  --work-blue-rgb: 29, 122, 242;
  --read-cyan: #009fb8;
  --read-cyan-rgb: 0, 159, 184;
  --edit-green: #20b15a;
  --edit-green-rgb: 32, 177, 90;
  --search-violet: #6b6ff2;
  --search-violet-rgb: 107, 111, 242;
  --reconnect-orange: #c86d14;
  --reconnect-orange-rgb: 200, 109, 20;
  --think-gold: #a87500;
  --think-gold-rgb: 168, 117, 0;
  --answer: #191919;
  --info: #256a9c;
  --overlay: rgba(20, 20, 20, 0.24);
  --composer-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 60px rgba(20, 20, 20, 0.18);
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #20211f;
  --sidebar-bg: #1b1c19;
  --sidebar-hover: #292a26;
  --sidebar-active: #33342f;
  --surface: #232420;
  --surface-subtle: #2c2d28;
  --surface-code: #1b1c1a;
  --surface-code-soft: #242522;
  --text: #f0f0ea;
  --text-soft: #bab9ad;
  --text-faint: #848377;
  --line: #31322d;
  --line-strong: #4a4b43;
  --accent: #f0f0ea;
  --accent-text: #111210;
  --danger: #ffb4ab;
  --ok: #6ff28f;
  --ok-rgb: 111, 242, 143;
  --work-blue: #7db7ff;
  --work-blue-rgb: 125, 183, 255;
  --read-cyan: #67e8f9;
  --read-cyan-rgb: 103, 232, 249;
  --edit-green: #6ff28f;
  --edit-green-rgb: 111, 242, 143;
  --search-violet: #a7a7ff;
  --search-violet-rgb: 167, 167, 255;
  --reconnect-orange: #ffbf7d;
  --reconnect-orange-rgb: 255, 191, 125;
  --think-gold: #fff1a8;
  --think-gold-rgb: 255, 241, 168;
  --answer: #f7f7f2;
  --info: #86bde8;
  --overlay: rgba(0, 0, 0, 0.54);
  --composer-bg: rgba(32, 33, 31, 0.94);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

html.app-fullscreen-root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html:fullscreen,
html:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: var(--app-bg);
  overflow: hidden;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--app-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.wake-keeper-video {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  z-index: 1;
}

body.app-fullscreen {
  --composer-left: 0px;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

html:fullscreen body,
html:-webkit-full-screen body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

@media (display-mode: standalone) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .workspace,
  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
  }

  .thread-topbar {
    padding-top: env(safe-area-inset-top, 0px);
  }
}

body.app-fullscreen .app-shell {
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
}

body.app-fullscreen.sidebar-collapsed .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.app-fullscreen .sidebar,
body.app-fullscreen .sidebar-expand-control {
  display: none;
}

body.app-fullscreen .restore-chrome-button {
  display: none;
}

body.app-fullscreen.sidebar-collapsed .sidebar-expand-control {
  display: none;
}

body.app-fullscreen .codex-main {
  grid-column: 1 / -1;
  width: 100vw;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
}

body.app-fullscreen .app-shell,
body.app-fullscreen .workspace,
body.app-fullscreen .login-panel {
  height: 100dvh;
  min-height: 100dvh;
}

body.app-fullscreen .thread-topbar {
  position: relative;
  top: auto;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}

body.app-fullscreen .thread-messages {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: calc(34px + var(--composer-offset) + env(safe-area-inset-bottom, 0px));
}

body.app-fullscreen .composer-zone {
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

@supports (-webkit-touch-callout: none) {
  input,
  textarea {
    font-size: 16px;
  }
}

input {
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

textarea {
  min-height: 54px;
  max-height: 180px;
  resize: none;
  padding: 13px 14px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(25, 25, 25, 0.06);
}

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

.sidebar {
  min-width: 0;
  width: var(--sidebar-width);
  display: grid;
  grid-template-rows: auto minmax(130px, 1fr) auto;
  gap: 14px;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  overflow: hidden;
  transition: transform 180ms ease, opacity 180ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed {
  --composer-left: 0px;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
  opacity: 0;
  pointer-events: none;
}

body.auth-screen {
  --composer-left: 0px;
}

body.auth-screen .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.auth-screen .sidebar,
body.auth-screen .sidebar-expand-control,
body.auth-screen .restore-chrome-button {
  display: none !important;
}

body.auth-screen .codex-main {
  grid-column: 1 / -1;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px;
}

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

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

.brand-title-line {
  min-width: 0;
}

.theme-toggle-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  font-size: 14px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
}

.brand-title {
  font-size: 15px;
  font-weight: 750;
}

.brand-subtitle {
  color: var(--text-soft);
  font-size: 12px;
}

.sidebar-actions,
.section-row,
.section-actions,
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-actions {
  justify-content: flex-end;
  gap: 6px;
}

.sidebar-collapse-control {
  position: fixed;
  z-index: 31;
  top: auto;
  bottom: calc(98px + env(safe-area-inset-bottom, 0px));
  left: calc(var(--sidebar-width) - 15px);
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

body.sidebar-collapsed .sidebar-collapse-control {
  display: none;
}

.sidebar-expand-control {
  position: fixed;
  z-index: 30;
  top: auto;
  bottom: calc(98px + env(safe-area-inset-bottom, 0px));
  left: 10px;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  display: none;
  align-items: center;
  justify-content: center;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
  font-size: 22px;
  line-height: 1;
}

body.sidebar-collapsed .sidebar-expand-control {
  display: inline-flex;
}

.restore-chrome-button {
  position: fixed;
  z-index: 42;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: max(10px, env(safe-area-inset-left, 0px));
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  padding: 4px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.restore-chrome-button.is-visible {
  display: inline-flex;
}

.restore-chrome-button img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

body.sidebar-collapsed:not(.app-fullscreen) .restore-chrome-button {
  display: inline-flex;
}

.connection-pill {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.connection-pill.is-ok {
  border-color: rgba(var(--ok-rgb), 0.25);
  color: var(--ok);
}

.connection-pill.is-error {
  border-color: rgba(179, 38, 30, 0.26);
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
}

.icon-button,
.mini-button,
.stop-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.icon-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  font-size: 16px;
}

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

.mini-icon-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.folder-add-button {
  width: 32px;
  min-width: 32px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
}

.folder-add-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 12px;
  margin-top: 4px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
}

.folder-add-icon::before {
  content: "";
  position: absolute;
  left: -1.4px;
  top: -6px;
  width: 9px;
  height: 5px;
  border: 1.4px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: var(--surface);
}

.folder-add-icon::after {
  content: "+";
  position: absolute;
  right: -8px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 13px;
  text-align: center;
}

.stop-button,
.desktop-link-button {
  min-width: 68px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.desktop-link-trace {
  max-width: min(220px, 28vw);
  min-height: 16px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-link-trace:empty {
  display: none;
}

.desktop-link-trace.is-busy {
  color: var(--text-soft);
}

.desktop-link-trace.is-ok {
  color: var(--ok);
}

.desktop-link-trace.is-error {
  color: var(--danger);
}

.desktop-link-button {
  min-width: 112px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-soft);
  gap: 7px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.desktop-link-button::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--danger);
}

.desktop-link-button.is-linked {
  border-color: rgba(var(--ok-rgb), 0.26);
  color: var(--ok);
}

.desktop-link-button.is-linked::before {
  background: var(--ok);
}

.desktop-link-button.is-error {
  border-color: rgba(179, 38, 30, 0.26);
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
}

.desktop-link-button.is-error::before {
  background: var(--danger);
}

.desktop-link-button.is-busy::before {
  background: var(--text-faint);
  animation: pulse 1.2s ease-in-out infinite;
}

.desktop-link-button:disabled {
  opacity: 1;
  background: var(--surface-subtle);
  color: var(--text-faint);
}

.stop-button::before {
  content: "";
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 2px;
  background: currentColor;
}

.stop-button:disabled {
  opacity: 1;
  background: var(--surface-subtle);
  color: var(--text-faint);
}

.stop-button.is-available,
.stop-button.is-external {
  border-color: rgba(179, 38, 30, 0.24);
  color: var(--danger);
}

.stop-button.is-available {
  background: rgba(179, 38, 30, 0.08);
}

.stop-button.is-external {
  background: var(--surface);
}

.sidebar-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.section-row {
  padding: 0 6px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.section-title-inline {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.fullscreen-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
}

.fullscreen-button.is-active {
  border-color: rgba(var(--ok-rgb), 0.28);
  color: var(--ok);
}

.fullscreen-icon {
  position: relative;
  width: 15px;
  height: 15px;
  display: block;
  margin: auto;
  transform-origin: center;
}

.fullscreen-icon::before,
.fullscreen-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(currentColor, currentColor) left top / 6px 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) left top / 1.6px 6px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 6px 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 1.6px 6px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 6px 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 1.6px 6px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 6px 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 1.6px 6px no-repeat;
}

.fullscreen-button.is-active .fullscreen-icon {
  transform: scale(0.88);
}

.nav-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
}

.project-button,
.session-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.nav-list .project-button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.nav-list .project-button.is-dragging {
  opacity: 0.72;
  background: var(--sidebar-active);
  cursor: grabbing;
}

.project-button:hover,
.session-button:hover {
  background: var(--sidebar-hover);
}

.project-button.is-active,
.session-button.is-active {
  background: var(--sidebar-active);
}

.project-name,
.session-title {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.project-copy {
  min-width: 0;
}

.project-drag-handle {
  width: 22px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: var(--text-soft);
  cursor: grab;
  touch-action: none;
  user-select: none;
  font-size: 16px;
  font-weight: 750;
  line-height: 1;
}

.project-drag-handle:active {
  cursor: grabbing;
  color: var(--text);
}

body.is-project-dragging {
  user-select: none;
}

.project-badge {
  min-width: 44px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(var(--ok-rgb), 0.22);
  border-radius: 999px;
  color: var(--ok);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.project-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.project-status-dot.is-running {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.project-path,
.session-meta {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-form {
  display: grid;
  gap: 12px;
}

.path-form label {
  display: grid;
  gap: 6px;
}

.path-form label span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.compact .project-button {
  min-height: 38px;
}

.found-trigger {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-soft);
  padding: 0 10px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
}

.found-trigger span:first-child {
  font-weight: 750;
}

.found-trigger span:last-child {
  min-width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
}

.found-trigger:disabled {
  opacity: 0.7;
}

.sidebar-logout-button {
  width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(179, 38, 30, 0.32);
  background: transparent;
  color: var(--danger);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sidebar-logout-button:hover {
  background: rgba(179, 38, 30, 0.08);
}

.project-dialog {
  width: min(430px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 16px;
  box-shadow: var(--shadow);
}

.project-dialog::backdrop {
  background: var(--overlay);
}

.fullscreen-help-dialog {
  max-width: calc(100vw - 24px);
}

.fullscreen-help-body {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.fullscreen-help-body p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.install-url {
  max-height: 72px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--text-soft);
  padding: 8px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cert-link {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
}

.found-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(680px, 72vh);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  color: var(--text);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: auto auto 0;
}

.found-dialog[open] {
  animation: sheet-up 150ms ease-out;
}

.found-dialog::backdrop {
  background: var(--overlay);
}

.found-list {
  max-height: calc(min(680px, 72vh) - 82px);
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
  margin-top: 12px;
}

.found-list .project-button {
  min-height: 44px;
  border: 1px solid transparent;
}

.found-list .project-button:hover {
  border-color: var(--line);
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.dialog-header h2 {
  margin: 0;
  font-size: 17px;
}

.dialog-header p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.codex-main {
  min-width: 0;
  min-height: 0;
}

.login-panel {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px;
}

.login-card h1 {
  margin: 0 0 16px;
  text-align: center;
  font-size: 20px;
}

.login-card-auth {
  display: grid;
  justify-items: stretch;
  gap: 12px;
  box-shadow: var(--shadow);
}

.login-card-auth .brand-mark {
  justify-self: center;
}

.login-subtitle {
  margin: -8px 0 4px;
  color: var(--text-soft);
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}

.login-token-label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.login-token-label input {
  min-height: 42px;
  font-size: 14px;
}

.login-button {
  width: 100%;
  min-height: 42px;
}

.login-message {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--text-soft);
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
}

.login-message[data-tone="error"] {
  color: var(--danger);
}

.login-message[data-tone="ok"] {
  color: var(--ok);
}

.login-message[data-tone="pending"] {
  color: var(--info);
}

.waiting-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.login-card-auth .waiting-orbit {
  margin-top: 6px;
  justify-self: center;
}

.waiting-orbit {
  position: relative;
  width: 46px;
  height: 46px;
  margin: 2px 0 4px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.waiting-orbit::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid transparent;
  border-top-color: var(--ok);
  border-right-color: rgba(var(--ok-rgb), 0.35);
  border-radius: 50%;
  animation: waiting-spin 1.05s linear infinite;
}

.waiting-orbit span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  opacity: 0.35;
  transform: translate(-50%, -50%);
  animation: waiting-dot 1.2s ease-in-out infinite;
}

.waiting-orbit span:nth-child(1) {
  margin-left: -10px;
}

.waiting-orbit span:nth-child(2) {
  animation-delay: 0.15s;
}

.waiting-orbit span:nth-child(3) {
  margin-left: 10px;
  animation-delay: 0.3s;
}

.waiting-copy {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.waiting-copy p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

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

@keyframes waiting-dot {
  0%,
  100% {
    opacity: 0.28;
    transform: translate(-50%, -50%) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.danger-ghost-button {
  margin-right: auto;
  border-color: var(--danger);
  color: var(--danger);
}

.workspace {
  height: 100vh;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 54px minmax(0, 1fr) auto;
}

.workspace > * {
  min-width: 0;
  max-width: 100%;
}

.is-hidden {
  display: none;
}

.thread-topbar {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
}

.project-detail {
  min-width: 0;
  flex: 1 1 220px;
}

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

.project-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 730;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-chip {
  max-width: min(42vw, 520px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  padding: 3px 8px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted {
  color: var(--text-soft);
  font-size: 13px;
}

.thread-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.session-strip {
  min-width: 0;
  max-width: min(34vw, 420px);
  height: 32px;
  flex: 0 1 min(34vw, 420px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 0;
  padding: 0;
}

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

.session-strip .session-button {
  width: auto;
  min-width: 70px;
  max-width: 112px;
  min-height: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 3px 7px;
  border-radius: 999px;
}

.session-strip .session-button.is-active {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

.session-strip .session-title {
  max-width: 96px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 720;
  line-height: 1.1;
}

.session-strip .session-meta {
  margin-top: 0;
  color: var(--text-faint);
  font-size: 9px;
  line-height: 1.1;
}

.session-strip .empty-state {
  color: var(--text-faint);
  font-size: 10px;
  white-space: nowrap;
}

.thread-messages {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  padding: 24px clamp(14px, 3vw, 40px) calc(34px + var(--composer-offset) + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: calc(var(--composer-offset) + 42px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.thread-pair,
.message,
.activity-step,
.execution-output,
.file-change-row,
.answer-highlight,
.code-block {
  scroll-margin-bottom: calc(var(--composer-offset) + 42px + env(safe-area-inset-bottom, 0px));
}

.thread-pair {
  width: min(1080px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto 18px;
  border-left: 2px solid transparent;
  padding-left: 0;
}

.thread-pair.is-selected {
  border-left-color: rgba(var(--ok-rgb), 0.45);
  padding-left: 10px;
}

.message {
  width: min(1040px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
}

.message-avatar {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
}

.message.assistant .message-avatar {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--text-soft);
}

.message.codex-running-message {
  margin-top: -2px;
  margin-bottom: 18px;
}

.message.codex-running-message .message-avatar {
  border-color: rgba(var(--work-blue-rgb), 0.28);
  background: rgba(var(--work-blue-rgb), 0.1);
  color: var(--work-blue);
}

.message.codex-running-message.is-reading .message-avatar {
  border-color: rgba(var(--read-cyan-rgb), 0.3);
  background: rgba(var(--read-cyan-rgb), 0.12);
  color: var(--read-cyan);
}

.message.codex-running-message.is-editing .message-avatar {
  border-color: rgba(var(--edit-green-rgb), 0.32);
  background: rgba(var(--edit-green-rgb), 0.12);
  color: var(--edit-green);
}

.message.codex-running-message.is-searching .message-avatar {
  border-color: rgba(var(--search-violet-rgb), 0.32);
  background: rgba(var(--search-violet-rgb), 0.12);
  color: var(--search-violet);
}

.message.codex-running-message.is-thinking .message-avatar {
  border-color: rgba(var(--think-gold-rgb), 0.34);
  background: rgba(var(--think-gold-rgb), 0.14);
  color: var(--think-gold);
}

.message.codex-running-message.is-reconnecting .message-avatar {
  border-color: rgba(var(--reconnect-orange-rgb), 0.34);
  background: rgba(var(--reconnect-orange-rgb), 0.12);
  color: var(--reconnect-orange);
}

.message.codex-running-message .message-body {
  align-self: center;
}

.message.codex-running-message .activity-list {
  margin: 0;
}

.message-body {
  min-width: 0;
}

.message-label {
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
}

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

.answer-highlight {
  color: var(--answer);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.answer-highlight[data-copy-text],
.file-change-row[data-copy-text] {
  cursor: copy;
  -webkit-tap-highlight-color: rgba(var(--ok-rgb), 0.16);
}

.answer-highlight[data-copy-text]:active,
.file-change-row[data-copy-text]:active,
.answer-highlight.is-copied,
.file-change-row.is-copied {
  border-color: rgba(var(--ok-rgb), 0.42);
  background: rgba(var(--ok-rgb), 0.08);
}

.is-streaming-answer .answer-highlight:last-child::after,
.is-streaming-answer .code-block:last-child code::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  border-radius: 1px;
  background: currentColor;
  vertical-align: -0.16em;
  opacity: 0.7;
  animation: stream-caret 0.9s steps(2, end) infinite;
}

@keyframes stream-caret {
  50% {
    opacity: 0.18;
  }
}

.answer-highlight + .answer-highlight {
  margin-top: 8px;
}

.answer-highlight code {
  border: 1px solid rgba(var(--ok-rgb), 0.18);
  border-radius: 5px;
  background: rgba(var(--ok-rgb), 0.08);
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 0.92em;
}

.code-block {
  width: min(920px, 100%);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-code);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.code-block-label {
  min-height: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface-code-soft);
  color: var(--text-soft);
  padding: 7px 12px 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  text-transform: lowercase;
}

.code-block pre {
  max-width: 100%;
  margin: 0;
  overflow: auto;
  padding: 13px 14px;
}

.code-block code {
  color: #f0f0ea;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.code-token.keyword {
  color: #82aaff;
  font-weight: 750;
}

.code-token.string {
  color: #9bdc8c;
}

.code-token.number {
  color: #ffc777;
}

.code-token.comment {
  color: #7f8ea3;
  font-style: italic;
}

.code-token.function {
  color: #7fdbff;
}

.subtle {
  color: var(--text-soft);
}

.activity-list {
  display: grid;
  gap: 4px;
  margin: 2px 0 12px;
}

.activity-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.activity-step > span {
  position: relative;
  z-index: 1;
}

.activity-step.is-active {
  color: var(--text-soft);
  padding: 2px 8px;
}

.activity-step.is-working {
  --activity-rgb: var(--work-blue-rgb);
  --activity-color: var(--work-blue);
  border: 1px solid rgba(var(--activity-rgb), 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    rgba(var(--activity-rgb), 0.12);
  color: var(--text);
  padding: 3px 10px 3px 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 18px rgba(var(--activity-rgb), 0.14);
}

.activity-step.is-reading {
  --activity-rgb: var(--read-cyan-rgb);
  --activity-color: var(--read-cyan);
}

.activity-step.is-editing {
  --activity-rgb: var(--edit-green-rgb);
  --activity-color: var(--edit-green);
}

.activity-step.is-searching {
  --activity-rgb: var(--search-violet-rgb);
  --activity-color: var(--search-violet);
}

.activity-step.is-thinking {
  --activity-rgb: var(--think-gold-rgb);
  --activity-color: var(--think-gold);
}

.activity-step.is-reconnecting {
  --activity-rgb: var(--reconnect-orange-rgb);
  --activity-color: var(--reconnect-orange);
}

.activity-step.is-reading,
.activity-step.is-editing,
.activity-step.is-searching,
.activity-step.is-thinking,
.activity-step.is-reconnecting {
  border: 1px solid rgba(var(--activity-rgb), 0.36);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    rgba(var(--activity-rgb), 0.12);
  color: var(--text);
  padding: 3px 10px 3px 8px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 18px rgba(var(--activity-rgb), 0.16);
}

body[data-theme="dark"] .activity-step.is-working,
body[data-theme="dark"] .activity-step.is-reading,
body[data-theme="dark"] .activity-step.is-editing,
body[data-theme="dark"] .activity-step.is-searching,
body[data-theme="dark"] .activity-step.is-thinking,
body[data-theme="dark"] .activity-step.is-reconnecting {
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
    rgba(var(--activity-rgb), 0.16);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 22px rgba(var(--activity-rgb), 0.24);
}

.activity-step.is-active::after {
  content: "";
  position: absolute;
  top: -45%;
  bottom: -45%;
  left: 0;
  width: 48%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(var(--ok-rgb), 0.08) 28%,
    rgba(var(--ok-rgb), 0.34) 50%,
    rgba(var(--ok-rgb), 0.08) 72%,
    transparent 100%
  );
  filter: blur(3px);
  transform: translate3d(-135%, 0, 0) skewX(-18deg);
  will-change: transform;
  animation: thinking-sweep 1.75s ease-in-out infinite;
  pointer-events: none;
}

.activity-step.is-working::after {
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(var(--activity-rgb), 0.1) 24%,
    rgba(255, 255, 255, 0.72) 48%,
    rgba(var(--activity-rgb), 0.22) 62%,
    transparent 100%
  );
  filter: blur(2px);
}

.activity-step.is-reading::after,
.activity-step.is-editing::after,
.activity-step.is-searching::after,
.activity-step.is-thinking::after,
.activity-step.is-reconnecting::after {
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(var(--activity-rgb), 0.12) 24%,
    rgba(255, 255, 255, 0.74) 48%,
    rgba(var(--activity-rgb), 0.24) 62%,
    transparent 100%
  );
  filter: blur(2px);
}

.activity-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-faint);
}

.activity-step.is-active .activity-dot {
  background: var(--ok);
  animation: pulse 1.2s ease-in-out infinite;
}

.activity-step.is-working .activity-dot {
  background: var(--activity-color);
  box-shadow: 0 0 10px rgba(var(--activity-rgb), 0.85);
}

.activity-step.is-reading .activity-dot,
.activity-step.is-editing .activity-dot,
.activity-step.is-searching .activity-dot,
.activity-step.is-thinking .activity-dot,
.activity-step.is-reconnecting .activity-dot {
  background: var(--activity-color);
  box-shadow: 0 0 10px rgba(var(--activity-rgb), 0.85);
}

@keyframes thinking-sweep {
  from {
    transform: translate3d(-135%, 0, 0) skewX(-18deg);
  }
  to {
    transform: translate3d(245%, 0, 0) skewX(-18deg);
  }
}

.status-line {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 0;
  color: var(--text-soft);
  padding: 0;
  font-size: 11px;
  font-weight: 500;
}

.terminal-output {
  width: min(920px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 8px auto 0;
  overflow: auto;
  border: 1px solid #25272c;
  border-radius: var(--radius);
  background: var(--surface-code);
  color: #e9eaec;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.terminal-output.is-muted {
  border-color: transparent;
  background: transparent;
  color: var(--text-soft);
  opacity: 0.86;
  padding: 0;
}

.process-details {
  width: min(920px, 100%);
  margin: -4px auto 18px;
  color: var(--text-soft);
}

.process-details summary {
  cursor: pointer;
  user-select: none;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
}

.process-details[open] summary {
  color: var(--text-soft);
}

.execution-message {
  margin-top: -6px;
  margin-bottom: 16px;
}

.execution-message .message-avatar {
  background: var(--surface-subtle);
  color: var(--text-soft);
}

.execution-message.is-live .message-avatar {
  border-color: rgba(var(--ok-rgb), 0.42);
  color: var(--ok);
}

.execution-message.is-live.is-working .message-avatar {
  border-color: rgba(var(--work-blue-rgb), 0.32);
  background: rgba(var(--work-blue-rgb), 0.1);
  color: var(--work-blue);
}

.execution-message.is-live.is-reading .message-avatar {
  border-color: rgba(var(--read-cyan-rgb), 0.34);
  background: rgba(var(--read-cyan-rgb), 0.12);
  color: var(--read-cyan);
}

.execution-message.is-live.is-editing .message-avatar {
  border-color: rgba(var(--edit-green-rgb), 0.34);
  background: rgba(var(--edit-green-rgb), 0.12);
  color: var(--edit-green);
}

.execution-message.is-live.is-searching .message-avatar {
  border-color: rgba(var(--search-violet-rgb), 0.34);
  background: rgba(var(--search-violet-rgb), 0.12);
  color: var(--search-violet);
}

.execution-message.is-live.is-thinking .message-avatar {
  border-color: rgba(var(--think-gold-rgb), 0.34);
  background: rgba(var(--think-gold-rgb), 0.14);
  color: var(--think-gold);
}

.execution-message.is-live.is-reconnecting .message-avatar {
  border-color: rgba(var(--reconnect-orange-rgb), 0.34);
  background: rgba(var(--reconnect-orange-rgb), 0.12);
  color: var(--reconnect-orange);
}

.execution-message .activity-list {
  margin: 4px 0 10px;
}

.execution-output {
  width: 100%;
  max-height: none !important;
  margin: 2px 0 0;
  padding-left: 14px !important;
  border-left: 2px solid var(--line) !important;
  border-radius: 0;
  font-size: 12px;
  line-height: 1.55;
  overflow: visible;
}

.execution-message.is-live .execution-output {
  border-left-color: rgba(var(--ok-rgb), 0.38) !important;
}

.file-change-panel {
  width: min(1040px, 100%);
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 5px;
  margin: -8px auto 18px;
  padding-left: 42px;
}

.file-change-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: min(560px, 100%);
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 4px 8px 4px 5px;
}

.file-change-kind {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(37, 106, 156, 0.1);
  color: var(--info);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.file-change-kind.is-added {
  background: rgba(var(--ok-rgb), 0.12);
  color: var(--ok);
}

.file-change-kind.is-deleted {
  background: rgba(179, 38, 30, 0.1);
  color: var(--danger);
}

.file-change-path {
  min-width: 0;
  overflow: hidden;
  color: var(--info);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-change-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.file-change-added {
  color: var(--ok);
}

.file-change-deleted {
  color: var(--danger);
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--composer-offset) + 20px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  transform: translate(-50%, 8px);
  border: 1px solid rgba(var(--ok-rgb), 0.28);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ok);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  opacity: 0;
  padding: 9px 13px;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.copy-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-thread,
.empty-state {
  color: var(--text-soft);
  font-size: 13px;
}

.empty-thread {
  width: min(860px, 100%);
  margin: 20vh auto 0;
  text-align: center;
}

.composer-zone {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-top: 1px solid var(--line);
  background: var(--composer-bg);
  padding: 10px clamp(12px, 2.5vw, 32px) 14px;
  z-index: 30;
  backdrop-filter: blur(12px);
}

body.keyboard-open .composer-zone {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: max(var(--keyboard-offset), env(safe-area-inset-bottom, 0px));
  left: var(--composer-left);
  width: auto;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
}

body.keyboard-open .thread-messages {
  padding-bottom: calc(
    40px + var(--composer-offset) + var(--keyboard-offset) + env(safe-area-inset-bottom, 0px)
  );
  scroll-padding-bottom: calc(
    var(--composer-offset) + var(--keyboard-offset) + 52px + env(safe-area-inset-bottom, 0px)
  );
}

body:not(.keyboard-open) .composer-zone {
  position: static;
  right: auto;
  bottom: auto;
  left: auto;
  width: 100%;
  box-shadow: none;
}

.queue-panel {
  width: min(1120px, 100%);
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 7px;
  margin: 0 auto 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
  box-shadow: 0 -10px 28px rgba(20, 20, 20, 0.08);
}

.queue-panel.is-hidden {
  display: none;
}

.queue-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.queue-panel-toggle {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 2px 0;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.queue-panel-chevron {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1;
}

.queue-panel-title {
  min-width: 0;
}

.queue-panel-count {
  min-width: 22px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(var(--ok-rgb), 0.22);
  border-radius: 999px;
  color: var(--ok);
  font-size: 10px;
}

.queue-panel-list {
  display: grid;
  gap: 5px;
  max-height: min(132px, 24vh);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.queue-panel.is-collapsed {
  gap: 5px;
  padding: 7px 8px;
}

.queue-panel.is-collapsed .queue-panel-summary {
  min-height: 32px;
}

.queue-panel-item {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--text);
  padding: 5px 8px;
  text-align: left;
}

.queue-panel-summary {
  grid-template-columns: 22px minmax(0, 1fr);
}

.queue-panel-index {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(var(--ok-rgb), 0.12);
  color: var(--ok);
  font-size: 10px;
  font-weight: 850;
}

.queue-panel-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.queue-panel-text,
.queue-panel-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-panel-text {
  font-size: 12px;
  font-weight: 700;
}

.queue-panel-meta {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
}

.queue-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.queue-action-button {
  min-width: 34px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.queue-action-button.is-danger {
  border-color: rgba(179, 38, 30, 0.28);
  color: var(--danger);
}

.composer {
  position: relative;
  width: min(1120px, 100%);
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}

.composer textarea {
  max-width: 100%;
  border: 0;
  box-shadow: none;
  padding: 7px 6px 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.file-input {
  display: none;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 3px 7px;
}

.attachment-list:empty {
  display: none;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(260px, 100%);
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  padding: 0 5px 0 9px;
  font-size: 12px;
  font-weight: 650;
}

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

.attachment-size {
  color: var(--text-faint);
  font-weight: 600;
  white-space: nowrap;
}

.attachment-remove {
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  padding: 0;
  line-height: 18px;
}

.attachment-remove:hover {
  background: var(--line);
  color: var(--text);
}

.attachment-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

#runCodexButton {
  min-width: 86px;
}

@media (max-width: 860px) {
  :root {
    --composer-left: 0px;
  }

  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    height: auto;
    grid-template-rows: auto auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 280px;
    transition: transform 180ms ease, opacity 180ms ease, max-height 180ms ease, padding 180ms ease;
  }

  .sidebar-collapse-control {
    top: auto;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: auto;
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .sidebar {
    max-height: 0;
    transform: translateX(-100%);
    border-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
  }

  body.sidebar-collapsed .workspace,
  body.sidebar-collapsed .login-panel {
    min-height: 100vh;
  }

  .nav-list {
    max-height: 168px;
  }

  .workspace,
  .login-panel {
    height: auto;
    min-height: calc(100vh - 280px);
  }

  .workspace {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .thread-topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    flex-wrap: wrap;
    row-gap: 8px;
    background: var(--surface);
    padding: 8px 12px;
  }

  .project-detail {
    min-width: 0;
    flex: 1 1 100%;
  }

  .project-headline {
    flex-wrap: wrap;
  }

  .project-chip {
    max-width: 100%;
  }

  .session-strip {
    max-width: calc(100vw - 178px);
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .thread-actions {
    gap: 6px;
  }

  .desktop-link-trace {
    max-width: calc(100vw - 230px);
    flex: 1 1 100%;
    order: 3;
    text-align: left;
  }

  .desktop-link-button {
    min-width: 96px;
    padding: 0 9px;
    white-space: nowrap;
  }

  .thread-messages {
    min-height: 45vh;
    padding: 18px 14px calc(34px + var(--composer-offset) + env(safe-area-inset-bottom, 0px));
  }

  .message {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 9px;
  }

  .file-change-panel,
  .execution-panel {
    padding-left: 35px;
  }

  .file-change-row {
    width: 100%;
  }

  .message-avatar {
    width: 24px;
    height: 24px;
  }

  .composer-zone {
    position: sticky;
    bottom: 0;
    padding: 8px 10px 10px;
  }

  body.keyboard-open .composer-zone {
    position: fixed;
    bottom: max(var(--keyboard-offset), env(safe-area-inset-bottom, 0px));
    left: 0;
    width: 100%;
  }

  .token-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .composer-footer {
    display: flex;
    align-items: center;
    flex-direction: row;
  }

  .token-row button {
    width: 100%;
  }
}

@media (min-width: 861px) and (max-width: 1120px) {
  .thread-messages {
    padding: 18px 12px calc(34px + var(--composer-offset) + env(safe-area-inset-bottom, 0px));
  }

  .thread-pair.is-selected {
    padding-left: 6px;
  }

  .message {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
  }

  .execution-panel {
    padding-left: 38px;
  }

  .terminal-output {
    padding: 12px;
    font-size: 11px;
    line-height: 1.5;
  }
}

@media (max-width: 480px) {
  :root {
    --composer-left: 0px;
  }

  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body {
    font-size: 13px;
  }

  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  body.sidebar-collapsed .app-shell {
    height: 100dvh;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    gap: 7px;
    width: min(342px, 88vw);
    height: 100dvh;
    max-height: none;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px 8px;
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.24);
  }

  body:not(.sidebar-collapsed)::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 34;
    background: rgba(0, 0, 0, 0.18);
  }

  .brand-row {
    gap: 6px;
    padding: 0 2px;
  }

  .brand-main {
    gap: 7px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-subtitle,
  .connection-pill {
    font-size: 10px;
  }

  .sidebar-actions {
    gap: 4px;
  }

  .icon-button,
  .mini-icon-button {
    width: 28px;
    min-width: 28px;
    min-height: 28px;
  }

  .sidebar-section {
    gap: 6px;
  }

  .section-row {
    gap: 6px;
    align-items: flex-start;
  }

  .section-title-inline {
    min-width: 0;
    gap: 5px;
  }

  .section-actions {
    gap: 5px;
  }

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

  .folder-add-button {
    width: 30px;
    min-width: 30px;
    min-height: 28px;
  }

  .nav-list {
    max-height: none;
    gap: 4px;
  }

  .project-button {
    min-height: 36px;
    gap: 6px;
    padding: 6px;
  }

  .project-drag-handle {
    width: 18px;
    font-size: 13px;
  }

  .project-name {
    font-size: 12px;
  }

  .project-path {
    display: none;
  }

  .found-trigger {
    min-height: 30px;
    margin-top: 0;
    padding: 0 8px;
    font-size: 11px;
  }

  .sidebar-logout-button {
    min-height: 30px;
    font-size: 11px;
  }

  .sidebar-collapse-control {
    position: absolute;
    top: max(8px, env(safe-area-inset-top, 0px));
    bottom: auto;
    right: 10px;
    left: auto;
    z-index: 36;
    display: inline-flex;
    background: var(--surface);
    box-shadow: none;
  }

  .sidebar-expand-control {
    display: none !important;
  }

  .restore-chrome-button {
    display: none;
  }

  body.sidebar-collapsed:not(.app-fullscreen) .restore-chrome-button {
    top: max(8px, env(safe-area-inset-top, 0px));
    left: max(9px, env(safe-area-inset-left, 0px));
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    display: inline-flex;
    border-color: rgba(var(--ok-rgb), 0.22);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
  }

  .restore-chrome-button img {
    width: 28px;
    height: 28px;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(-105%);
    max-height: none;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: 8px;
  }

  .codex-main,
  .workspace,
  .login-panel {
    height: 100dvh;
    min-height: 0;
  }

  body.sidebar-collapsed .codex-main,
  body.sidebar-collapsed .workspace,
  body.sidebar-collapsed .login-panel {
    height: 100dvh;
    min-height: 0;
  }

  .codex-main {
    overflow: hidden;
  }

  .workspace {
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  body.sidebar-collapsed .workspace {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .thread-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 8px;
    align-items: center;
    min-height: calc(48px + env(safe-area-inset-top, 0px));
    padding: max(8px, env(safe-area-inset-top, 0px)) 10px 7px;
  }

  body.sidebar-collapsed .thread-topbar {
    padding-left: max(58px, calc(env(safe-area-inset-left, 0px) + 58px));
  }

  .project-detail {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    flex: none;
    min-width: 0;
  }

  .project-headline {
    min-width: 0;
    gap: 5px;
    flex-wrap: nowrap;
  }

  .project-title {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-chip {
    max-width: 32vw;
    padding: 2px 6px;
    font-size: 10px;
  }

  .project-chip:nth-child(2) {
    display: none;
  }

  .project-chip:nth-child(3) {
    display: none;
  }

  .session-strip {
    display: none;
  }

  .thread-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    gap: 5px;
    justify-self: end;
  }

  .desktop-link-trace {
    grid-column: 1 / -1;
    order: 5;
    max-width: 100%;
    min-height: 14px;
    font-size: 10px;
    line-height: 14px;
    text-align: left;
  }

  .desktop-link-button,
  .stop-button {
    min-width: 64px;
    height: 28px;
    padding: 0 8px;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  .desktop-link-button {
    max-width: none;
  }

  .desktop-link-button::before {
    width: 6px;
    height: 6px;
  }

  .thread-shell {
    overflow: hidden;
  }

  .thread-messages {
    min-height: 0;
    padding: 10px 8px calc(22px + var(--composer-offset) + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: calc(var(--composer-offset) + 34px + env(safe-area-inset-bottom, 0px));
  }

  .thread-pair {
    margin-bottom: 14px;
  }

  .thread-pair.is-selected {
    padding-left: 5px;
  }

  .message {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 7px;
    margin-bottom: 12px;
  }

  .message-avatar {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 9px;
  }

  .message-label {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .message-text,
  .answer-highlight {
    font-size: 13px;
    line-height: 1.45;
  }

  .activity-list {
    gap: 3px;
    margin-bottom: 9px;
  }

  .activity-step {
    min-height: 22px;
    gap: 6px;
    font-size: 11px;
  }

  .activity-step.is-active,
  .activity-step.is-working,
  .activity-step.is-reading,
  .activity-step.is-editing,
  .activity-step.is-searching,
  .activity-step.is-thinking,
  .activity-step.is-reconnecting {
    padding: 2px 8px 2px 7px;
  }

  .execution-panel,
  .file-change-panel {
    padding-left: 29px;
  }

  .execution-output,
  .terminal-output {
    font-size: 10.5px;
    line-height: 1.45;
  }

  .code-block {
    width: 100%;
    margin: 9px 0;
  }

  .code-block-label {
    min-height: 24px;
    padding: 5px 9px 0;
    font-size: 10px;
  }

  .code-block pre {
    padding: 10px;
  }

  .code-block code {
    font-size: 11px;
    line-height: 1.5;
  }

  .file-change-panel {
    gap: 4px;
    margin-bottom: 14px;
  }

  .file-change-row {
    grid-template-columns: 20px minmax(0, 1fr) auto;
    min-height: 26px;
    gap: 6px;
    padding: 4px 6px 4px 4px;
  }

  .file-change-kind {
    width: 17px;
    height: 17px;
    font-size: 9px;
  }

  .file-change-path,
  .file-change-stats {
    font-size: 10.5px;
  }

  .composer-zone {
    position: sticky;
    bottom: 0;
    flex: 0 0 auto;
    display: block;
    padding: 7px 8px max(8px, env(safe-area-inset-bottom, 0px));
  }

  body:not(.keyboard-open) .composer-zone,
  body.sidebar-collapsed:not(.keyboard-open) .composer-zone {
    position: sticky;
    right: auto;
    bottom: 0;
    left: auto;
    width: 100%;
    box-shadow: none;
  }

  body.keyboard-open .composer-zone {
    position: fixed;
    right: 0;
    bottom: max(var(--keyboard-offset), env(safe-area-inset-bottom, 0px));
    left: 0;
    width: 100%;
    padding-bottom: 7px;
  }

  body.keyboard-open .thread-messages {
    padding-bottom: calc(28px + var(--composer-offset) + var(--keyboard-offset) + env(safe-area-inset-bottom, 0px));
  }

  .queue-panel {
    gap: 5px;
    margin-bottom: 6px;
    padding: 6px;
  }

  .queue-panel-header {
    font-size: 10px;
  }

  .queue-panel-list {
    max-height: min(88px, 16dvh);
  }

  .queue-panel-item {
    min-height: 30px;
    grid-template-columns: 19px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 4px 6px;
  }

  .queue-panel-index {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }

  .queue-panel-text {
    font-size: 11px;
  }

  .queue-panel-meta {
    font-size: 9px;
  }

  .queue-action-button {
    min-width: 28px;
    height: 22px;
    min-height: 22px;
    font-size: 9px;
  }

  .composer {
    padding: 6px;
  }

  .composer textarea {
    min-height: 42px;
    max-height: 112px;
    padding: 5px 4px 9px;
    font-size: 16px;
    line-height: 1.35;
  }

  .attachment-list {
    gap: 4px;
    padding-bottom: 5px;
  }

  .attachment-chip {
    max-width: 100%;
    height: 24px;
    font-size: 10px;
  }

  .attachment-button {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  #runCodexButton {
    min-width: 70px;
    min-height: 32px;
    font-size: 12px;
  }

  .found-dialog,
  .project-dialog {
    width: min(360px, calc(100vw - 20px));
    max-height: min(680px, calc(100dvh - 24px));
  }

  .found-list {
    max-height: min(520px, 70dvh);
  }

  .copy-toast {
    bottom: calc(var(--composer-offset) + 12px + env(safe-area-inset-bottom, 0px));
  }
}
