:root {
  color-scheme: light;
  --lm-primary: #536de6;
  --lm-primary-hover: #4258c8;
  --lm-primary-soft: rgba(83, 109, 230, 0.12);
  --lm-shell: #444653;
  --lm-nav: #111725;
  --lm-nav-secondary: #232939;
  --lm-nav-hover: #2d3766;
  --lm-page: #e0dfe5;
  --lm-page-alt: #f1f3f8;
  --lm-surface: #ffffff;
  --lm-text-strong: #222b45;
  --lm-text: #444653;
  --lm-text-label: #555d73;
  --lm-text-muted: #7b809a;
  --lm-border-input: #cfd3dc;
  --lm-border: #d8dce6;
  --lm-divider: #e6e8ef;
  --lm-success: #28a745;
  --lm-warning: #ffc107;
  --lm-warning-indicator: #d58a2b;
  --lm-danger: #dc3545;
  --lm-radius-control: 8px;
  --lm-radius-button: 10px;
  --lm-radius-block: 12px;
  --lm-radius-dialog: 16px;
  --lm-radius-card: 18px;
  --lm-shadow-card: 0 10px 26px rgba(20, 27, 60, 0.08);
  --lm-shadow-float: 0 20px 48px rgba(15, 23, 42, 0.18);
  --lm-duration-fast: 180ms;
  --lm-duration-normal: 300ms;
  --chat-content-max: 920px;
  --chat-shell-max: 960px;
  --workspace-dock-width: 400px;
  --workspace-dock-top: 58px;
  --bg: var(--lm-page-alt);
  --panel: var(--lm-surface);
  --panel-strong: #edf0f7;
  --panel-soft: #f7f8fb;
  --text: var(--lm-text);
  --muted: var(--lm-text-muted);
  --line: var(--lm-border);
  --accent: var(--lm-primary);
  --accent-strong: var(--lm-primary-hover);
  --danger: var(--lm-danger);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.workspace-restore-view { display:grid; place-items:center; min-height:100dvh; padding:24px; background:var(--bg); color:var(--text); }
.workspace-restore-card { width:min(100%,420px); padding:32px 24px; border:1px solid var(--line); border-radius:var(--lm-radius-card); background:var(--panel); text-align:center; }
.workspace-restore-card > i { color:var(--accent); font-size:22px; }
.workspace-restore-card h1 { margin:16px 0 8px; font-size:20px; }
.workspace-restore-card p { margin:0 0 18px; color:var(--muted); font-size:14px; line-height:1.7; }
@media (prefers-reduced-motion:reduce) { .workspace-restore-card .fa-spin { animation:none; } }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
textarea,
select,
:where(.tools-panel a.tool-button) {
  font: inherit;
}

button,
:where(.tools-panel a.tool-button) {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--lm-radius-button);
  background: var(--panel-strong);
  color: var(--lm-text-label);
  padding: 0 14px;
  cursor: pointer;
  transition:
    background-color var(--lm-duration-fast) ease,
    border-color var(--lm-duration-fast) ease,
    color var(--lm-duration-fast) ease,
    box-shadow var(--lm-duration-fast) ease;
}

button:hover:not(:disabled) {
  border-color: var(--lm-primary);
  background: var(--lm-primary-soft);
  color: var(--lm-primary-hover);
}

button:active:not(:disabled),
:where(.tools-panel a.tool-button):active {
  filter: brightness(0.96);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
:where(.tools-panel a.tool-button):focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--lm-primary-soft);
  outline-offset: 2px;
  border-color: var(--lm-primary);
}

.app-shell {
  height: 100dvh;
  min-height: 100vh;
}

.onboarding-view,
.login-view {
  min-height: 100%;
  padding: calc(24px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom));
}

.onboarding-view {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(83, 109, 230, 0.08), transparent 48%),
    var(--lm-page);
}

.onboarding-card {
  width: min(432px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--lm-radius-block);
  background: rgba(68, 70, 83, 0.97);
  color: #ffffff;
  box-shadow: var(--lm-shadow-float);
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: var(--lm-radius-block);
  background: var(--accent);
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding-card h1,
.project-picker-header h1 {
  margin: 0;
  color: var(--lm-text-strong);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}

.onboarding-card h1 {
  color: #ffffff;
  font-size: 34px;
  font-weight: 600;
}

.onboarding-copy {
  margin: 12px 0 28px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--lm-text-label);
  font-size: 14px;
  font-weight: 600;
}

.token-input,
.project-name-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--lm-border-input);
  border-radius: var(--lm-radius-control);
  background: var(--lm-surface);
  color: var(--lm-text-strong);
  padding: 0 12px;
}

.onboarding-card .field-label {
  color: #ffffff;
}

.onboarding-card .eyebrow {
  color: #aebcff;
}

.onboarding-card .field-hint {
  color: rgba(255, 255, 255, 0.64);
}

.onboarding-card .token-input {
  height: 44px;
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--lm-nav-secondary);
  color: #ffffff;
}

.onboarding-card .token-input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.auth-method-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: -8px 0 22px;
  padding: 4px;
  border-radius: var(--lm-radius-button);
  background: rgba(17, 23, 37, 0.55);
}

.auth-method-tab {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
}

.auth-method-tab[aria-selected="true"] {
  background: var(--lm-primary);
  color: #ffffff;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-form .field-label:not(:first-child) {
  margin-top: 14px;
}

.auth-form .primary-button {
  margin-top: 20px;
}

.auth-form .field-hint + .primary-button {
  margin-top: 0;
}

.auth-link-button {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border-color: transparent;
  background: transparent;
  color: #b9c5ff;
  font-size: 13px;
}

.auth-link-button:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.field-hint {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.primary-button {
  border-color: var(--lm-primary);
  background: var(--lm-primary);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--lm-primary-hover);
  background: var(--lm-primary-hover);
  color: #ffffff;
}

.onboarding-card .primary-button {
  width: 100%;
  min-height: 44px;
}

.onboarding-status {
  min-height: 20px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  text-align: center;
}

.onboarding-status[data-state="error"] {
  color: var(--danger);
}

.login-view {
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background:
    linear-gradient(var(--lm-shell) 0 80px, transparent 80px),
    var(--lm-page);
}

.login-panel {
  width: min(880px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 64px 0 auto;
  padding-bottom: 24px;
}

.project-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-radius: var(--lm-radius-card);
  background: var(--lm-surface);
  box-shadow: var(--lm-shadow-card);
}

.project-picker-header p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.project-picker-header code {
  color: var(--lm-text-strong);
}

.project-picker-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.quiet-button {
  flex: 0 0 auto;
  border-color: var(--lm-primary);
  background: var(--lm-surface);
  color: var(--lm-primary);
}

.workdir-panel {
  padding: 18px 22px;
  border: 0;
  border-radius: var(--lm-radius-card);
  background: var(--lm-surface);
  box-shadow: var(--lm-shadow-card);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  color: var(--lm-text-strong);
  font-size: 18px;
  font-weight: 700;
}

.section-heading p {
  display: block;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.selection-hint {
  color: var(--muted);
  font-size: 12px;
}

.selection-hint[data-selected="true"] {
  color: var(--accent);
}

.workdir-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.workdir-list:empty::after {
  content: "暂无可选项目";
  display: block;
  padding: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.workdir-choice {
  position: relative;
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  border-color: var(--lm-border);
  background: var(--lm-page-alt);
  text-align: left;
  overflow-wrap: anywhere;
}

.workdir-choice[data-selected="true"] {
  border-color: var(--accent);
  background: var(--lm-primary-soft);
}

.workdir-choice[data-selected="true"]::after {
  content: "✓";
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--accent);
  transform: translateY(-50%);
}

.create-project-choice {
  border-style: dashed;
  border-color: var(--lm-primary);
  background: var(--lm-surface);
  color: var(--accent);
  font-weight: 700;
}

.create-project-choice::before {
  content: "+";
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.project-dialog {
  position: fixed;
  top: 50%;
  left: calc((100vw - var(--codex-relay-browser-width, 0px)) / 2);
  right: auto;
  bottom: auto;
  width: min(440px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--lm-radius-dialog);
  background: var(--lm-surface);
  color: var(--text);
  box-shadow: var(--lm-shadow-float);
  transform: translate(-50%, -50%);
}

.project-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.project-dialog-card {
  padding: 22px 24px 24px;
}

.project-import:not([hidden]) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  color: var(--lm-text-muted);
  font-size: 13px;
}

.project-import select {
  min-width: 180px;
  padding: 8px;
  border: 1px solid var(--lm-border-input);
  border-radius: var(--lm-radius-control);
  background: var(--lm-surface);
  color: var(--lm-text-strong);
}

#shareProjectDialog select,
#shareProjectDialog input {
  box-sizing: border-box;
  width: 100%;
  margin: 6px 0 14px;
  padding: 9px;
}

#shareProjectDialog { max-height: calc(100dvh - 24px); overflow-y: auto; }
.share-project-local {
  min-width: 0; margin: 4px 0 14px; padding: 10px 12px;
  border: 1px solid var(--lm-border-input); border-radius: var(--lm-radius-control);
}
.share-project-local legend { padding: 0 5px; font-size: 13px; }
.share-project-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
#shareProjectDialog .share-project-check input[type="checkbox"] {
  flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; padding: 0;
}
.share-project-local .field-hint { margin: 6px 0; overflow-wrap: anywhere; }
.share-project-local-summary { overflow-wrap: anywhere; color: var(--lm-text-muted); }
.share-project-row > span { min-width: 0; }
.share-project-row > button { flex-shrink: 0; }

.share-project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--lm-divider);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -24px 20px;
  padding: 0 24px 18px;
  border-bottom: 1px solid var(--lm-divider);
}

.dialog-heading h2 {
  margin: 0;
  color: var(--lm-text-strong);
  font-size: 18px;
  font-weight: 700;
}

.dialog-close {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
}

.dialog-close:hover:not(:disabled) {
  background: var(--lm-primary-soft);
  color: var(--lm-primary);
}

.dialog-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-action-button {
  min-height: 36px;
  border-color: var(--lm-primary);
  background: var(--lm-surface);
  color: var(--lm-primary);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 20px -24px -24px;
  padding: 16px 24px;
  border-top: 1px solid var(--lm-divider);
  background: rgba(255, 255, 255, 0.92);
}

.commit-dialog {
  width: min(520px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
}

.file-browser-dialog {
  width: min(860px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  overflow: hidden;
}

.file-browser-card {
  display: flex;
  min-height: min(620px, calc(100dvh - 26px));
  max-height: min(760px, calc(100dvh - 26px));
  flex-direction: column;
  transition: border-color var(--lm-duration-fast) ease, box-shadow var(--lm-duration-fast) ease;
}

.file-browser-card.upload-drop-active {
  border: 1px dashed color-mix(in srgb, var(--accent) 48%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
}

.file-browser-heading {
  margin-bottom: 16px;
}

.file-browser-pathbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.file-browser-pathbar .file-breadcrumbs {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

.file-browser-path-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.file-browser-path-actions button {
  min-height: 34px;
  padding: 0 9px;
  border-color: var(--lm-border-input);
  background: var(--lm-surface);
  color: var(--lm-text-label);
}

.file-browser-path-actions button > i {
  color: var(--lm-primary);
}

.file-browser-path-actions button[data-state="compressing"] > i {
  color: var(--lm-danger);
}

.file-breadcrumbs {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.file-breadcrumbs button {
  min-height: 32px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.file-breadcrumbs button[aria-current="page"] {
  color: var(--lm-text-strong);
  cursor: default;
}

.file-breadcrumb-separator {
  color: var(--muted);
}

.file-sort-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.file-browser-sort-controls {
  margin: -2px 0 10px;
}

.file-sort-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--lm-text-muted);
  font-size: 12px;
}

.file-sort-field select {
  min-height: 34px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--lm-border-input);
  border-radius: var(--lm-radius-control);
  background: var(--lm-surface);
  color: var(--lm-text-label);
  cursor: pointer;
}

.file-sort-direction {
  min-height: 34px;
  padding: 0 11px;
  border-color: var(--lm-border-input);
  background: var(--lm-surface);
  color: var(--lm-text-label);
  font-size: 12px;
}

.file-sort-direction > [aria-hidden="true"] {
  color: var(--lm-primary);
}

.file-list-heading,
.file-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 160px;
  gap: 12px;
  align-items: center;
}

.file-list-heading {
  padding: 9px 12px;
  border: 1px solid var(--lm-divider);
  border-bottom: 0;
  border-radius: var(--lm-radius-control) var(--lm-radius-control) 0 0;
  background: var(--lm-page-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.file-list {
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--lm-radius-control) var(--lm-radius-control);
  background: var(--panel-soft);
}

.file-list[data-state="loading"],
.file-list[data-state="empty"],
.file-list[data-state="error"] {
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.file-entry {
  width: 100%;
  min-height: 46px;
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.file-entry:last-child {
  border-bottom: 0;
}

.file-entry:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--lm-page-alt);
  color: var(--lm-text);
}

.file-entry[aria-selected="true"] {
  background: var(--lm-primary-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.file-entry-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.file-entry-icon {
  flex: 0 0 auto;
  width: 22px;
  color: var(--accent);
  font-size: 17px;
  text-align: center;
}

.file-entry-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-entry-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.file-browser-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.file-browser-status[data-state="error"] {
  color: var(--danger);
}

.file-upload-progress {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.file-upload-progress[hidden] {
  display: none;
}

.file-upload-progress-copy {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.file-upload-progress-copy span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-upload-progress-copy span:last-child {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.file-upload-progress progress {
  display: block;
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

.project-downloads { position:fixed; inset:auto 16px 16px auto; margin:0; box-sizing:border-box; width:min(390px, calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow:auto; overscroll-behavior:contain; padding:12px 14px; border:1px solid var(--lm-border); border-radius:12px; color:var(--lm-text); background:var(--lm-surface); box-shadow:0 6px 28px #0002; z-index:1000; font-size:12px; }
.project-downloads[hidden] { display:none!important; }
.project-downloads summary { cursor:pointer; font-size:13px; font-weight:600; min-height:24px; box-sizing:border-box; padding:2px 38px 2px 0; }
.project-downloads ol { list-style:none; margin:8px 0 0; padding:0; max-height:min(390px, 45dvh); overflow:auto; overscroll-behavior:contain; }
.project-downloads li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 8px; padding:10px 0; border-top:1px solid var(--lm-border); }
.project-downloads li[hidden] { display:none; }
.project-downloads strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; align-self:center; }
.project-downloads .download-status,.project-downloads .download-detail,.project-downloads progress { grid-column:1 / -1; }
.project-downloads .download-detail { color:var(--lm-text-muted); font-size:11px; line-height:1.6; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.project-downloads progress,.cloud-download-progress { display:block; width:100%; height:8px; accent-color:var(--accent); }
.project-downloads progress[hidden],.cloud-download-progress[hidden] { display:none; }
.project-downloads button { border:1px solid var(--lm-border); border-radius:6px; padding:4px 9px; background:var(--lm-surface); color:var(--lm-text); font:inherit; cursor:pointer; }
.project-downloads button[hidden] { display:none; }
.project-downloads .download-clear { margin-top:8px; }
.project-downloads .download-close { position:absolute; top:8px; right:8px; display:grid; place-items:center; width:28px; height:28px; min-width:28px; min-height:28px; padding:0; font-size:23px; line-height:1; }
.project-downloads .download-close:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.project-downloads li[data-download-status=failed] .download-status { color:var(--danger); }
.cloud-download-progress { flex-basis:100%; margin:2px 0; }
@media (max-width:600px) { .project-downloads { inset:auto 12px 12px auto; width:calc(100vw - 24px); } }
.project-upload-queue { min-width:0; margin-top:8px; color:var(--lm-text); font-size:12px; }
.project-upload-queue[hidden] { display:none!important; }
.project-upload-queue summary { cursor:pointer; line-height:1.6; overflow-wrap:anywhere; }
.project-upload-queue ol { margin:6px 0 0; padding:0; list-style:none; max-height:210px; overflow:auto; overscroll-behavior:contain; }
.project-upload-queue li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 8px; padding:9px 2px; border-top:1px solid var(--lm-border); }
.project-upload-queue li strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; }
.upload-queue-state { font-size:11px; white-space:nowrap; }
.upload-queue-location,.upload-queue-detail,.upload-queue-note { color:var(--lm-text-muted); font-size:11px; line-height:1.5; overflow-wrap:anywhere; }
.upload-queue-location,.upload-queue-detail { grid-column:1 / -1; }
.upload-queue-note { margin:6px 0; }
.upload-queue-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.project-upload-queue li .upload-queue-actions { grid-column:1 / -1; margin-top:0; }
.upload-queue-actions button { border:1px solid var(--lm-border); border-radius:6px; padding:4px 8px; background:var(--lm-surface); color:var(--lm-text); font:inherit; font-size:11px; cursor:pointer; }
.workspace-files-footer > .project-upload-queue { margin-top:0; }
.workspace-files-footer .project-upload-queue ol { max-height:180px; }
.workspace-files-footer .project-upload-queue button { min-height:26px; font-size:11px; padding:3px 7px; }
.project-upload-queue li[data-upload-status=failed] .upload-queue-state,.project-upload-queue li[data-upload-status=uncertain] .upload-queue-state { color:var(--danger); }

.file-browser-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-preview-dialog {
  width: min(1120px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
  max-width: calc(100vw - var(--codex-relay-browser-width, 0px) - 24px);
  height: min(820px, calc(100vh - 24px));
  height: min(820px, calc(100dvh - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

#filePreviewDialog .file-preview-card {
  display: flex;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 0;
  flex-direction: column;
}

#filePreviewDialog .file-preview-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  flex: 0 0 auto;
  margin: 0;
  padding: 16px;
}

.file-preview-heading-copy {
  min-width: 0;
}

#filePreviewType { margin: 0 0 4px; }
.file-preview-actions { position: relative; min-width: 0; flex: none; gap: 6px; }
#filePreviewDialog .file-preview-actions > button,
.file-preview-more > summary { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 44px; min-height: 44px; }
.file-preview-more { position: static; flex: none; }
.file-preview-more > summary { padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel); cursor: pointer; list-style: none; font-size: 24px; line-height: 1; }
.file-preview-more > summary::-webkit-details-marker { display: none; }
.file-preview-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-preview-menu { position: absolute; z-index: 10; top: calc(100% + 6px); right: 0; width: min(280px, calc(100vw - 40px)); max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); overflow: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px #0002; background: var(--panel); }
#filePreviewDialog .file-preview-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; min-width: 0; padding: 10px; border: 0; text-align: left; white-space: normal; color: var(--text); background: transparent; }
.file-preview-menu button:hover { background: var(--panel-soft); }
.file-preview-menu strong { font-size: 13px; }
.file-preview-menu small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.file-preview-more[hidden], .file-preview-menu [hidden] { display: none !important; }

.file-preview-heading-copy h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; min-width: 0; }
.file-preview-info .file-preview-meta { flex: 1 1 140px; min-width: 0; margin: 0; }
.file-preview-transport { display: inline-flex; flex: 0 0 auto; align-items: center; max-width: 100%; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--panel-soft); font-size: 12px; line-height: 1.5; white-space: nowrap; }
.file-preview-transport[hidden] { display: none; }
.file-preview-transport[data-transport="loading"] { color: var(--muted); }

.file-preview-meta {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--lm-text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-body {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  border-radius: 0 0 var(--lm-radius-block) var(--lm-radius-block);
  background: #f7f8fb;
}

.file-preview-body[data-state="loading"],
.file-preview-body[data-state="error"] {
  align-items: center;
  justify-content: center;
}

.file-preview-body[data-state="error"] {
  color: var(--lm-danger);
}

.file-preview-body[data-state="source"] {
  align-items: flex-start;
  background: #111725;
}

.file-preview-message {
  display: flex;
  max-width: 520px;
  align-items: center;
  gap: 10px;
  padding: 24px;
  color: inherit;
  font-size: 14px;
  text-align: center;
}

.file-preview-body[data-state="html"] { overflow: hidden; }
.file-preview-html { display:flex; flex-direction:column; width:100%; min-width:0; min-height:0; background:var(--lm-surface); }
.file-preview-html-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; flex:none; padding:10px 16px; border-bottom:1px solid var(--lm-divider); }
.file-preview-html-modes { display:flex; gap:4px; }
.file-preview-html-modes button { padding:7px 12px; border:1px solid transparent; border-radius:7px; background:transparent; color:var(--lm-text-label); font:inherit; font-size:13px; cursor:pointer; }
.file-preview-html-modes button[aria-selected="true"] { background:var(--lm-primary-soft); color:var(--lm-primary); }
.file-preview-html-modes button:focus-visible { outline:2px solid var(--lm-primary); outline-offset:2px; }
.file-preview-html-status { min-width:0; color:var(--lm-text-muted); font-size:12px; overflow-wrap:anywhere; }
.file-preview-html-page { display:flex; flex:1; min-height:0; }
.file-preview-html-frame { display:block; width:100%; height:100%; flex:1; border:0; background:white; color-scheme:light; }
.file-preview-html .file-preview-html-source { flex:1; min-height:0; width:100%; overflow:auto; }
.file-preview-html [hidden] { display:none !important; }

.file-preview-code {
  min-width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 20px 22px;
  align-self: flex-start;
  color: #dce3f5;
  background: #111725;
  font-family: Consolas, "Cascadia Code", "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}

.file-preview-code.file-preview-code-wrap {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}
.file-preview-code-wrap code { white-space: inherit; overflow-wrap: inherit; }
.file-preview-text-toolbar {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 4px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}
.file-preview-text-toolbar[hidden] { display: none; }
.file-preview-wrap-option { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; cursor: pointer; }
.file-preview-wrap-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.file-preview-text-toolbar > button { min-height: 44px; }
.file-preview-text-status { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }

.file-preview-markdown {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px 34px 52px;
  color: var(--lm-text);
  background: var(--lm-surface);
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.message-markdown {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.message-markdown > :last-child {
  margin-bottom: 0;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 1.6em 0 0.65em;
  color: var(--lm-text-strong);
  line-height: 1.3;
}

.markdown-content h1,
.markdown-content h2 {
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--lm-divider);
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre,
.markdown-content table {
  margin: 0 0 1em;
}

.markdown-content blockquote {
  padding: 8px 14px;
  border-left: 4px solid var(--lm-primary);
  background: var(--lm-primary-soft);
  color: var(--lm-text-label);
}

.markdown-content pre {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: var(--lm-radius-control);
  color: #dce3f5;
  background: #111725;
}

.markdown-code-block {
  position: relative;
  min-width: 0;
  margin: 0 0 1em;
}

.markdown-content .markdown-code-block pre {
  margin: 0;
  padding-top: 40px;
}

.markdown-code-copy-button {
  position: absolute;
  top: 6px;
  right: 8px;
  display: inline-flex;
  min-height: 28px;
  gap: 5px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  user-select: none;
}

.markdown-code-copy-button:hover:not(:disabled) {
  border-color: currentColor;
  background: rgba(127, 132, 146, 0.12);
  color: var(--muted);
}

.markdown-code-copy-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.markdown-code-copy-button[data-copied="true"] {
  color: var(--lm-success);
}

.markdown-content code {
  padding: 0.14em 0.38em;
  border-radius: 4px;
  background: #edf0f7;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.9em;
}

.markdown-content pre code {
  padding: 0;
  background: transparent;
}

.markdown-content a {
  color: var(--lm-primary);
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
}

.markdown-content th,
.markdown-content td {
  padding: 8px 10px;
  border: 1px solid var(--lm-divider);
  text-align: left;
}

.markdown-content th {
  background: var(--lm-page-alt);
}

.file-preview-image,
.file-preview-video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
}

.file-preview-image {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 18px;
}

.file-preview-body[data-state="image"] { overflow: hidden; }

.file-preview-image-toolbar { display: flex; align-items: center; flex-wrap: wrap; flex: none; gap: 6px 10px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.file-preview-image-toolbar[hidden] { display: none; }
.file-preview-image-toolbar button { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.file-preview-image-toolbar button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--panel-soft); }
.file-preview-image-status { min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.file-preview-body[data-state="image"][data-image-scale="actual"] { display: block; overflow: auto; padding: 18px; overscroll-behavior: contain; }
.file-preview-body[data-image-scale="actual"] .file-preview-image { flex: none; max-width: none; max-height: none; min-width: 0; min-height: 0; padding: 0; border: 0; margin: auto; }
.file-preview-body[data-image-scale="fit"] .file-preview-image { cursor: zoom-in; }
.file-preview-body[data-image-scale="actual"] .file-preview-image { cursor: zoom-out; }

@media (max-width: 620px), (max-height: 480px) {
  .file-preview-dialog {
    top: 8px;
    top: max(8px, env(safe-area-inset-top));
    width: min(1120px, calc(100vw - var(--codex-relay-browser-width, 0px) - 16px));
    max-width: calc(100vw - var(--codex-relay-browser-width, 0px) - 16px);
    height: calc(100vh - 16px);
    height: calc(100vh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    transform: translateX(-50%);
  }
  #filePreviewDialog .file-preview-heading { gap: 6px; padding: 12px; }
  #filePreviewDialog .file-preview-heading h2 { font-size: 16px; }
  .file-preview-actions { gap: 4px; }
  #filePreviewDownloadBtn { width: 44px; padding: 0; }
  .file-preview-action-label { display: none; }
  .file-preview-image { padding: 8px; }
  .file-preview-image-toolbar { padding: 6px 12px; }
  .file-preview-body[data-state="image"][data-image-scale="actual"] { padding: 8px; }
}

.composer-image-preview-dialog {
  width: min(960px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
  height: min(760px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

.composer-image-preview-card {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.composer-image-preview-heading { flex: 0 0 auto; }
.composer-image-preview-heading h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer-image-preview-body {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  align-items: flex-start;
  overflow: auto;
  border-radius: var(--lm-radius-block);
  background: var(--lm-page-alt);
}

.composer-image-preview-body img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

.image-annotation-stage { position: relative; flex: 0 0 auto; margin: auto; }
.image-annotation-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.image-annotation-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; padding-bottom: 12px; flex: 0 0 auto; }
.image-annotation-tools, .image-annotation-options, .image-annotation-colors, .image-annotation-history, .image-annotation-actions { display: flex; align-items: center; gap: 6px; }
.image-annotation-options { flex-wrap: wrap; gap: 8px 12px; }
.image-annotation-toolbar button, .image-annotation-footer button, .image-annotation-text-editor button { min-height: 34px; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.image-annotation-tools button { display: inline-flex; align-items: center; gap: 5px; }
.image-annotation-tools svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.image-annotation-toolbar button[aria-pressed="true"] { border-color: var(--lm-primary); background: var(--lm-primary-soft); color: var(--lm-primary-hover); }
.image-annotation-colors button { position: relative; width: 28px; min-height: 28px; padding: 0; border-radius: 50%; background: var(--lm-surface); }
.image-annotation-colors button::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--annotation-color); }
.image-annotation-colors button[aria-pressed="true"] { outline: 2px solid var(--lm-primary); outline-offset: 1px; }
.image-annotation-width { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.image-annotation-width select { width: auto; min-height: 32px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.image-annotation-history { border-left: 1px solid var(--line); padding-left: 10px; }
.image-annotation-history button:not(:last-child) { font-size: 20px; line-height: 1; padding: 0 9px; }
.image-annotation-text-editor { display: flex; align-items: center; flex: 0 0 auto; gap: 8px; padding-bottom: 10px; }
.image-annotation-text-editor textarea { flex: 1; min-width: 0; resize: vertical; max-height: 90px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 13px; }
.image-annotation-footer { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; gap: 10px; padding-top: 12px; }
.image-annotation-footer p { margin: 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.image-annotation-footer p[data-error="true"] { color: var(--lm-danger); }
.composer-attachment-annotated { position: absolute; left: 2px; bottom: 2px; padding: 2px 5px; border-radius: 4px; background: var(--lm-surface); color: var(--lm-text); font-size: 10px; pointer-events: none; }
@media (max-width: 600px) {
  .composer-image-preview-card { padding: 12px; }
  .composer-image-preview-heading { margin-bottom: 12px; }
  .image-annotation-tools { width: 100%; gap: 4px; }
  .image-annotation-tools button { flex: 1; flex-direction: column; gap: 3px; padding: 6px 4px; }
  .image-annotation-options { gap: 8px; }
  .image-annotation-history { padding-left: 6px; gap: 4px; }
  .image-annotation-toolbar { gap: 8px; padding-bottom: 10px; }
  .image-annotation-footer { align-items: stretch; flex-direction: column; gap: 8px; }
  .image-annotation-actions { justify-content: flex-end; }
  .image-annotation-text-editor { flex-wrap: wrap; gap: 6px; }
  .image-annotation-text-editor textarea { flex-basis: 100%; }
}

.file-preview-video {
  width: 100%;
  background: #111725;
}

.session-manager-dialog {
  width: min(760px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  overflow: hidden;
}

.session-manager-card {
  display: flex;
  max-height: min(760px, calc(100dvh - 26px));
  flex-direction: column;
}

.session-manager-heading {
  margin-bottom: 16px;
}

.session-manager-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.session-manager-list {
  min-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--lm-radius-block);
  background: var(--panel-soft);
}

.session-manager-list[data-state="loading"],
.session-manager-list[data-state="empty"],
.session-manager-list[data-state="error"] {
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.session-manager-entry {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.session-manager-entry:last-child {
  border-bottom: 0;
}

.session-manager-entry:hover {
  background: var(--lm-page-alt);
}

.session-manager-entry input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.session-manager-entry-content,
.session-manager-entry-heading {
  display: flex;
  min-width: 0;
}

.session-manager-entry-content {
  flex-direction: column;
  gap: 6px;
}

.session-manager-entry-heading {
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.session-manager-entry-heading strong {
  margin-right: 2px;
  overflow-wrap: anywhere;
}

.session-manager-badge {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

.session-manager-badge[data-connected="true"],
.session-manager-badge.current {
  border-color: rgba(40, 167, 69, 0.45);
  color: var(--lm-success);
}

.session-manager-workdir,
.session-manager-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-manager-status {
  min-height: 18px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.session-manager-status[data-state="success"] {
  color: var(--lm-success);
}

.session-manager-status[data-state="error"] {
  color: var(--danger);
}

.session-manager-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.danger-button {
  border-color: var(--lm-danger);
  background: var(--lm-danger);
  color: #ffffff;
}

.danger-button:hover:not(:disabled) {
  border-color: var(--lm-danger);
  background: #bd2130;
  color: #ffffff;
}

.danger-button.icon-button > [aria-hidden="true"] {
  color: #ffffff;
}

.command-dialog {
  width: min(620px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
  max-height: min(720px, calc(100dvh - 24px));
}

.command-dialog-heading {
  margin-bottom: 16px;
}

.command-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(60dvh, 520px);
  overflow-y: auto;
}

.command-option {
  display: flex;
  min-width: 0;
  min-height: 64px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  padding: 10px 12px;
  border-color: var(--lm-divider);
  border-radius: var(--lm-radius-block);
  background: var(--lm-page-alt);
  text-align: left;
}

.command-option code {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.command-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.commit-message-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.commit-message-heading .field-label {
  margin: 0;
}

.summary-button {
  min-height: 34px;
  border-color: var(--lm-primary);
  background: var(--lm-surface);
  color: var(--accent);
}

.commit-message-input {
  min-height: 120px;
  resize: vertical;
}

.project-name-input {
  flex: 1 1 auto;
  min-width: 0;
}

.project-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--lm-border);
  border-radius: 10px;
  background: var(--lm-page);
  cursor: pointer;
}

.project-option input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.project-option span {
  display: grid;
  gap: 3px;
}

.project-option small {
  color: var(--muted);
  line-height: 1.4;
}

.account-settings-identity {
  margin: 10px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.account-management-view {
  height: 100%;
  overflow-y: auto;
  padding: 48px 24px calc(48px + env(safe-area-inset-bottom));
  background: var(--lm-page);
}

.account-management-panel {
  width: min(1040px, 100%);
  margin: 0 auto;
}

.account-management-header,
.account-management-card {
  border-radius: var(--lm-radius-card);
  background: var(--lm-surface);
  box-shadow: var(--lm-shadow-card);
}

.account-management-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px;
  margin-bottom: 18px;
}

.account-management-header h1 {
  margin: 8px 0 0;
  color: var(--lm-text-strong);
  font-size: clamp(28px, 4vw, 38px);
}

.account-management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.account-management-grid-single { grid-template-columns: minmax(0, 1fr); }

.account-profile-card { grid-column: 1 / -1; }

.account-profile-editor { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 1fr); gap: 20px 32px; align-items: center; }
.account-profile-editor:disabled { opacity: .6; }
.account-profile-editor > legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.account-avatar-editor { display: flex; gap: 18px; align-items: center; min-width: 0; }
.account-avatar-preview { flex: 0 0 88px; width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--panel-soft); border: 1px solid var(--lm-border-input); font-size: 30px; color: var(--lm-text-strong); }
.account-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.account-avatar-controls { min-width: 0; }
.account-avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-avatar-actions button { white-space: nowrap; }
.account-nickname-field { min-width: 0; }
.account-nickname-field label { display: block; margin-bottom: 8px; font-weight: 600; }
.account-nickname-field input { box-sizing: border-box; width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--lm-border-input); border-radius: 10px; background: var(--panel-soft); color: var(--lm-text-strong); font: inherit; }
.account-profile-save { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.account-button-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: 0 0 26px; }
.toolbar > #accountSettingsBtn[data-avatar="true"] { padding: 3px; }
#accountSettingsBtn > img[hidden], #accountSettingsPickerBtn > img[hidden], .account-avatar-preview > [hidden] { display: none; }
#accountSettingsBtn > #accountToolbarIcon[hidden], #accountSettingsPickerBtn > #accountPickerIcon[hidden] { display: none; }

.account-profile-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0 0 20px;
}

.account-profile-fields dt,
.account-credit-grid dt {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.account-profile-fields dd,
.account-credit-grid dd {
  margin: 0;
  color: var(--lm-text-strong);
  overflow-wrap: anywhere;
}

.account-portal-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--lm-primary);
  border-radius: var(--lm-radius-control);
  font-weight: 600;
  text-decoration: none;
}

.account-header-actions,
.account-payment-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.account-header-actions { justify-content: flex-end; }
.account-payment-actions { margin: 0 0 16px; }
.account-payment-actions .account-portal-link:not(.primary-button) { color: var(--lm-text-strong); border-color: var(--lm-border-input); }

@media (max-width: 760px) {
  #accountSettingsPage .account-management-header { flex-wrap: wrap; }
  .account-header-actions { justify-content: flex-start; }
}

.account-credit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.account-credit-grid > div {
  padding: 16px 12px;
  border: 1px solid var(--lm-divider);
  border-radius: var(--lm-radius-control);
  background: var(--panel-soft);
}

.account-credit-grid dd { font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; }

#accountSettingsBtn > span { display: none; }

@media (max-width: 760px) {
  .account-management-grid { grid-template-columns: minmax(0, 1fr); }
  .account-profile-fields { grid-template-columns: minmax(0, 1fr); }
  .account-profile-editor { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .account-avatar-editor { gap: 12px; }
  .account-avatar-preview { flex-basis: 72px; width: 72px; height: 72px; }
}

@media (max-width: 480px) {
  .account-credit-grid { grid-template-columns: minmax(0, 1fr); }
  .account-credit-grid > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .account-credit-grid dt { margin-bottom: 0; }
  .account-portal-link { padding: 9px 12px; }
}

.account-management-card {
  min-width: 0;
  padding: 28px 32px;
}

.account-management-card h2 {
  margin: 8px 0 24px;
  color: var(--lm-text-strong);
  font-size: 22px;
}

.account-card-heading,
.account-management-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-management-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

#accountBillingSummary {
  margin: 0 0 12px;
  color: var(--lm-text-strong);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
}

#accountBillingPeriod,
.account-billing-note {
  line-height: 1.6;
}

.account-billing-note {
  color: var(--muted);
  font-size: 13px;
}

.account-ledger-details {
  border-top: 1px solid var(--lm-divider);
  margin-top: 28px;
  padding-top: 20px;
}

.account-ledger-details summary {
  color: var(--lm-text-strong);
  font-weight: 600;
  cursor: pointer;
}

.account-ledger-details ul {
  max-height: 260px;
  overflow-y: auto;
  padding-left: 20px;
  line-height: 1.7;
}

.project-search-input,
#projectNameInput,
#projectDescriptionInput {
  width: 100%;
  border: 1px solid var(--lm-border-input);
  border-radius: var(--lm-radius-control);
  background: var(--lm-surface);
  color: var(--lm-text-strong);
  padding: 11px 13px;
}

.project-search-input { margin: 0 0 16px; }

.project-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--lm-border);
  border-radius: 8px;
  flex-wrap: wrap;
}

.project-list-icon,
.managed-project-icon {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  object-fit: contain;
  background: var(--lm-primary-soft);
}

.project-list-copy { display: grid; gap: 3px; min-width: 0; }
.project-local-location { display: grid; gap: 4px; min-width: 0; max-width: 100%; color: var(--muted); font-size: 12px; text-align: left; }
.project-local-location .project-local-computer { font-weight: 500; overflow-wrap: anywhere; }
.project-local-location .project-local-directory { font-family: var(--font-mono, monospace); overflow-wrap: anywhere; user-select: text; }
.project-local-location time { font-size: 10px; opacity: .8; }
.project-list-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.project-management-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.project-management-list { display: grid; gap: 8px; max-height: min(65vh, 720px); overflow-y: auto; }
#projectManagementPage .project-management-grid { grid-template-columns: minmax(0, 1fr); }
.project-management-navigation { display: flex; flex-wrap: wrap; gap: 8px; }
.project-management-navigation button { white-space: nowrap; }
#projectManagementHelp { overflow-wrap: anywhere; }
.managed-project-choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; text-align: left; background: var(--lm-page-alt); }
.managed-project-choice[aria-pressed="true"] { border-color: var(--lm-primary); background: var(--lm-primary-soft); }
.managed-project-icon { display: grid; place-items: center; color: var(--lm-primary); font-weight: 700; }
.managed-project-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.project-management-empty { color: var(--muted); }
.project-editor-name { margin: 0 0 18px; color: var(--lm-text-strong); font-weight: 700; overflow-wrap: anywhere; }
.project-icon-editor { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.project-icon-preview { width: 96px; height: 96px; flex: none; display: grid; place-items: center; border: 1px solid var(--lm-border); border-radius: 18px; background: var(--lm-page-alt); color: var(--lm-primary); font-size: 32px; font-weight: 700; overflow: hidden; }
.project-icon-preview img { width: 100%; height: 100%; object-fit: contain; }
.project-icon-editor > div:last-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.project-icon-editor small { flex-basis: 100%; color: var(--muted); }
.project-icon-upload { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--lm-primary); border-radius: var(--lm-radius-button); color: var(--lm-primary); cursor: pointer; }
#projectDescriptionInput { resize: vertical; min-height: 120px; margin-top: 8px; }
.project-description-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.project-description-heading .field-label { margin: 0; }
.project-description-heading > div { display: flex; flex-wrap: wrap; gap: 6px; }
.project-description-heading button { padding: 6px 10px; font-size: 12px; }
#projectSummaryStatus:empty { display: none; }
#projectDescriptionInput[readonly] { opacity: .75; cursor: progress; }
#projectNameInput { margin-top: 8px; }
.project-directory-hint { display: block; margin: 6px 0 20px; color: var(--muted); overflow-wrap: anywhere; }

.account-settings-fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.account-settings-fieldset legend {
  margin-bottom: 10px;
  color: var(--lm-text-strong);
  font-weight: 600;
}

.create-project-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.create-project-status[data-state="success"] {
  color: var(--lm-success);
}

.create-project-status[data-state="error"] {
  color: var(--danger);
}

.login-status {
  flex: 1;
  min-height: 22px;
  text-align: left;
}

.console-view {
  position: fixed;
  inset: 0 var(--codex-relay-browser-width, 0px) 0 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--lm-page);
}

/* The workspace scrolls inside its chat, client and file panes. Keep the
   outer page from moving those panes separately from the fixed file dock. */
body:has(.console-view:not([hidden])) {
  overflow: hidden;
}

.toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 64px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--lm-shell);
  color: #ffffff;
}

.tools-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  max-height: calc(100dvh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--lm-nav-secondary);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.icon-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.tool-button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  justify-content: flex-start;
  padding: 8px 10px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.4;
}

.tools-panel a.tool-button {
  text-decoration: none;
}

.tool-button:hover:not(:disabled) {
  border-color: rgba(142, 160, 255, 0.72);
  background: var(--lm-nav-hover);
  color: #ffffff;
}

.toolbar > .icon-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.toolbar > .icon-button:hover:not(:disabled) {
  border-color: rgba(142, 160, 255, 0.72);
  background: var(--lm-nav-hover);
  color: #ffffff;
}

.tool-button > [aria-hidden="true"],
.icon-button > [aria-hidden="true"] {
  width: 18px;
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.toolbar .tool-button > [aria-hidden="true"],
.toolbar > .icon-button > [aria-hidden="true"] {
  color: #9cafff;
}

.project-identity {
  min-width: 0;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.project-title {
  min-width: 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.svn-project-copy {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  padding: 0;
}

.toolbar-model-picker {
  min-height: 32px;
  display: inline-flex;
  flex: 0 1 170px;
  min-width: 0;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--lm-divider);
  border-radius: var(--lm-radius-control);
  background: #ffffff;
  color: var(--lm-text-muted);
}

.toolbar-model-picker select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--lm-text);
  cursor: pointer;
}

.toolbar-model-picker select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.toolbar-effort-picker select {
  width: 100%;
}

.toolbar-effort-picker {
  flex-basis: 138px;
}

.fast-mode-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--lm-divider);
  border-radius: var(--lm-radius-control);
  background: #fff;
  color: var(--lm-text-muted);
  cursor: pointer;
  font-weight: 700;
}
.toolbar-speed-picker { flex:0 0 112px; width:112px; min-width:112px; }
.toolbar-speed-picker select { font-weight:600; }
.fast-mode-button.is-active { border-color: #e7a21a; background: #fff4d6; color: #9a6500; }
.fast-mode-button:disabled { cursor: not-allowed; opacity: .55; }

.session-control-button {
  min-height: 24px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid #8bcda2;
  border-radius: 999px;
  background: #eaf8ef;
  color: #17653a;
  cursor: default;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.session-control-button:disabled {
  cursor: default;
  opacity: 1;
}

.session-control-button[data-role="viewer"] {
  border-color: #dfbd72;
  background: #fff6dc;
  color: #765000;
  cursor: pointer;
}

.session-control-button[data-role="viewer"]:hover {
  border-color: #c99c3e;
  background: #ffedb7;
  color: #5e4000;
}

.session-manager-open {
  margin-left: auto;
  border: 1px solid rgba(83, 109, 230, .28);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(83, 109, 230, .08);
  color: var(--lm-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.session-manager-open:hover {
  background: rgba(83, 109, 230, .16);
}

.status {
  min-width: 98px;
  color: var(--lm-text-muted);
  font-size: 12px;
  text-align: right;
}

.status[data-connected="true"] {
  color: var(--lm-success);
}

.toolbar .status {
  color: rgba(255, 255, 255, 0.64);
}

.toolbar .status[data-connected="true"] {
  color: #7cdb91;
}

.action-status {
  min-width: 72px;
}

.runtime-status-bar {
  width: 100%;
  max-width: var(--chat-content-max);
  min-height: 24px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 4px auto 0;
  color: var(--lm-text-muted);
  font-size: 11px;
  overflow-x: auto;
  scrollbar-width: none;
}

.runtime-status-bar::-webkit-scrollbar {
  display: none;
}

.runtime-status-bar .status {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--lm-text-muted);
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.runtime-status-bar .runtime-connection-status {
  flex: 0 0 auto;
  font-weight: 700;
}

.runtime-status-bar .runtime-connection-status[data-connected="true"] {
  color: #1d7545;
}

.runtime-status-bar .codex-quota-status {
  flex: 0 0 auto;
}

.runtime-status-bar .token-usage-status {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.runtime-status-bar .token-usage-status:disabled {
  cursor: default;
  opacity: 0.65;
}

.runtime-status-bar .token-usage-status:not(:disabled):hover {
  color: var(--lm-primary);
}

.token-usage-dialog {
  width: min(520px, calc(100vw - var(--codex-relay-browser-width, 0px) - 24px));
}

.token-usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.token-usage-table th,
.token-usage-table td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--lm-divider);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.token-usage-table th:first-child {
  text-align: left;
}

.token-usage-table thead th {
  color: var(--lm-text-muted);
  font-weight: 600;
}

.token-usage-note {
  margin: 16px 0 0;
  color: var(--lm-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.runtime-status-bar .codex-quota-status::before {
  width: 1px;
  height: 14px;
  flex: 0 0 1px;
  margin-right: 1px;
  background: var(--lm-divider);
  content: "";
}

.runtime-status-bar .codex-quota-status[data-state="healthy"] {
  color: #1d7545;
}

.runtime-status-bar .codex-quota-status[data-state="warning"] {
  color: #a15c00;
}

.runtime-status-bar .codex-quota-status[data-state="critical"] {
  color: var(--lm-danger);
  font-weight: 700;
}

.runtime-status-bar .action-status {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.runtime-status-bar .action-status::before {
  width: 1px;
  height: 14px;
  flex: 0 0 1px;
  margin-right: 1px;
  background: var(--lm-divider);
  content: "";
}

.runtime-status-bar .action-status > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-panel {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--lm-nav-secondary);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
}

textarea {
  display: block;
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid var(--lm-border-input);
  border-radius: var(--lm-radius-control);
  background: var(--lm-surface);
  color: var(--lm-text-strong);
  padding: 10px 12px;
}

#commandInput {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--lm-nav);
  color: #f3f5fb;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
}

#commandInput::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.send-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.send-row button {
  flex: 1 1 86px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
}

.send-row button:hover:not(:disabled) {
  border-color: rgba(156, 175, 255, 0.72);
  background: var(--lm-nav-hover);
  color: #ffffff;
}

.send-row .icon-button > [aria-hidden="true"] {
  color: #9cafff;
}

#sendBtn {
  border-color: var(--lm-primary);
  background: var(--lm-primary);
  color: #ffffff;
}

#sendBtn > [aria-hidden="true"] {
  color: #ffffff;
}

#sendBtn:hover:not(:disabled) {
  border-color: var(--lm-primary-hover);
  background: var(--lm-primary-hover);
  color: #ffffff;
}

/* Conversation-first workspace. The xterm instance remains available only as a
   passive diagnostic view so normal operation always happens through the composer. */
.console-view {
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #f7f7f8;
}

.toolbar {
  min-height: 46px;
  flex-wrap: nowrap;
  gap: 6px;
  padding: calc(4px + env(safe-area-inset-top)) 12px 4px;
  border-bottom-color: var(--lm-divider);
  background: rgba(255, 255, 255, 0.96);
  color: var(--lm-text-strong);
  box-shadow: 0 1px 8px rgba(20, 27, 60, 0.04);
  backdrop-filter: blur(12px);
}

/* Expanded tools must stay above the fixed file and client panels. */
.toolbar:has(.tools-panel:not([hidden])) {
  z-index: 20;
}

.toolbar .tools-panel {
  right: auto;
  left: 50%;
  width: calc(100% - 32px);
  max-width: var(--chat-shell-max);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 14px 14px;
  transform: translateX(-50%);
}

.toolbar .project-title {
  min-height: 32px;
  max-width: 100%;
  overflow: hidden;
  color: var(--lm-text-strong);
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar .project-identity {
  flex: 1 1 auto;
  overflow: hidden;
}

.toolbar .svn-project-copy {
  color: var(--lm-text-muted);
}

.toolbar .svn-project-copy:hover:not(:disabled) {
  border-color: var(--lm-divider);
  background: var(--panel-soft);
  color: var(--lm-primary);
}

.toolbar .status {
  display: inline-flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 5px;
  color: var(--lm-text-muted);
  white-space: nowrap;
}

.toolbar .status[data-connected="true"] {
  color: var(--lm-success);
}

.toolbar > .icon-button {
  min-height: 34px;
  padding-right: 9px;
  padding-left: 9px;
  border-color: var(--lm-divider);
  background: #ffffff;
  color: var(--lm-text);
}

.toolbar > .icon-button:hover:not(:disabled) {
  border-color: var(--lm-border-input);
  background: var(--panel-soft);
  color: var(--lm-text-strong);
}

.toolbar > .icon-button > [aria-hidden="true"] {
  color: var(--lm-text-muted);
}

.view-mode-switch {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--lm-divider);
  border-radius: var(--lm-radius-button);
  background: var(--panel-soft);
}

.view-mode-button {
  min-height: 30px;
  flex: 0 0 auto;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--lm-text-muted);
  font-size: 12px;
  box-shadow: none;
}

.view-mode-button > [aria-hidden="true"] {
  color: inherit;
}

.view-mode-button[aria-pressed="true"] {
  background: #ffffff;
  color: var(--lm-text-strong);
  box-shadow: 0 1px 5px rgba(20, 27, 60, 0.1);
}

.view-mode-button:hover:not(:disabled) {
  border: 0;
  background: #ffffff;
  color: var(--lm-text-strong);
}

/* Only the compact toolbar hides labels; the expanded tool menu shows names. */
#toggleSvnBtn {
  width: 46px;
  min-width: 46px;
  font-size: 12px;
  font-weight: 600;
}

.toolbar > .icon-button > span,
.toolbar .view-mode-button > span,
.toolbar > .fast-mode-button > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.toolbar > .icon-button,
.toolbar > .fast-mode-button,
.toolbar .view-mode-button {
  width: 34px;
  min-width: 34px;
  flex-shrink: 0;
  padding-inline: 0;
  justify-content: center;
  gap: 0;
}

.toolbar-effort-picker {
  flex-basis: 112px;
}

.conversation {
  width: 100%;
  max-width: var(--chat-shell-max);
  min-height: 0;
  justify-self: center;
  overflow-y: auto;
  padding: 28px 20px 40px 38px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.conversation-rail {
  position: fixed;
  z-index: 8;
  top: 50%;
  left: 2px;
  display: flex;
  max-height: min(46vh, 360px);
  flex-direction: column;
  align-items: center;
  padding: 8px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 999px;
  opacity: 0.62;
  scrollbar-width: none;
  transform: translateY(-50%);
  transition:
    opacity var(--lm-duration-fast) ease,
    background-color var(--lm-duration-fast) ease;
}

.conversation-rail::-webkit-scrollbar {
  display: none;
}

.conversation-rail:hover,
.conversation-rail:focus-within {
  background: rgba(255, 255, 255, 0.72);
  opacity: 1;
}

.conversation-rail-marker {
  display: grid;
  width: 24px;
  min-width: 24px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  place-items: center;
  background: transparent;
  box-shadow: none;
}

.conversation-rail-marker::before {
  content: "";
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #aeb2be;
  transition:
    width var(--lm-duration-fast) ease,
    height var(--lm-duration-fast) ease,
    background-color var(--lm-duration-fast) ease;
}

.conversation-rail-marker:hover:not(:disabled),
.conversation-rail-marker:focus-visible {
  border: 0;
  background: transparent;
}

.conversation-rail-marker:hover::before,
.conversation-rail-marker:focus-visible::before {
  width: 14px;
  background: var(--lm-text-label);
}

.conversation-rail-marker.is-active::before {
  width: 16px;
  height: 3px;
  background: var(--lm-primary);
}

.conversation-empty {
  display: grid;
  justify-items: center;
  max-width: 520px;
  margin: clamp(72px, 18vh, 170px) auto 0;
  color: var(--lm-text-muted);
  text-align: center;
}

.conversation-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid var(--lm-divider);
  border-radius: 50%;
  background: #ffffff;
  color: var(--lm-text-label);
  font-size: 19px;
  box-shadow: var(--lm-shadow-card);
}

.conversation-empty strong {
  color: var(--lm-text-strong);
  font-size: 17px;
}

.conversation-empty p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.65;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-message[data-role="user"] {
  align-items: flex-end;
}

.chat-message[data-role="assistant"],
.chat-message[data-role="system"] {
  align-items: flex-start;
}

.message-bubble {
  max-width: min(78%, 760px);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message[data-role="user"] .message-bubble {
  padding: 12px 16px;
  border-radius: 18px 18px 5px 18px;
  background: #e9eaec;
  color: #25272b;
  line-height: 1.6;
}

.chat-message[data-role="assistant"] .message-bubble {
  max-width: 100%;
  color: #272a31;
  font-size: 15px;
  line-height: 1.75;
}

.execution-details {
  width: min(100%, 820px);
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #dde0e7;
  border-radius: 10px;
  background: rgba(248, 249, 251, 0.88);
}

.execution-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 11px;
  color: #606574;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.execution-summary::marker {
  color: #9297a5;
}

.execution-summary-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8a91a2;
}

.execution-details[data-state="working"] .execution-summary-indicator {
  background: #6078d8;
  animation: message-pulse 1.1s ease-in-out infinite;
}

.execution-details[data-state="failed"] .execution-summary-indicator {
  background: #c45858;
}

.execution-details[data-state="partial-failure"] .execution-summary-indicator {
  background: var(--lm-warning-indicator);
}

.execution-summary-label {
  font-weight: 600;
}

.execution-summary-count {
  margin-left: auto;
  color: #9297a5;
}

.execution-list {
  display: grid;
  gap: 8px;
  padding: 0 9px 9px;
}

.execution-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e4e9;
  border-radius: 8px;
  background: #fff;
}

.execution-item-header {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #515665;
  font-size: 12px;
}

.execution-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.execution-item-status {
  margin-left: auto;
  color: #858b99;
  white-space: nowrap;
}

.execution-item[data-state="working"] .execution-item-status {
  color: #526bc8;
}

.execution-item[data-state="failed"] .execution-item-status {
  color: #b54242;
}

.execution-item-title,
.execution-item-detail,
.execution-item-output {
  margin: 7px 0 0;
  overflow: auto;
  color: #323642;
  font: 12px/1.55 Consolas, "Courier New", monospace;
  overflow-wrap: normal;
  white-space: pre-wrap;
}

.execution-item-detail {
  color: #747987;
}

.execution-item-output {
  max-height: 260px;
  padding: 8px;
  border-radius: 6px;
  background: #171b25;
  color: #e7eaf2;
}

.execution-item-meta {
  margin-top: 6px;
  color: #9297a5;
  font-size: 11px;
  text-align: right;
}

.chat-message[data-role="assistant"][data-status="working"] .message-bubble:empty::before {
  content: "Codex 正在处理";
  color: var(--lm-text-muted);
}

.chat-message[data-role="assistant"][data-status="working"] .message-bubble::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--lm-text-muted);
  animation: message-pulse 1.1s ease-in-out infinite;
}

.chat-message[data-role="system"] {
  width: 100%;
}

.chat-message[data-role="system"] .message-bubble {
  max-width: 100%;
  padding: 9px 12px;
  border-left: 3px solid var(--lm-border-input);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.6);
  color: var(--lm-text-muted);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 7px 2px 0;
  color: #9498a7;
  font-size: 11px;
}

.message-identity {
  color: var(--lm-text-label);
  font-weight: 700;
}

.message-state {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid #cfd5ec;
  border-radius: 999px;
  background: #f3f5ff;
  color: #5064bd;
  font-size: 11px;
  font-weight: 700;
}

.message-state-indicator {
  display: inline-grid;
  width: 12px;
  height: 12px;
  place-items: center;
}

.message-state[data-state="working"] .message-state-indicator {
  border: 2px solid rgba(83, 109, 230, 0.22);
  border-top-color: #536de6;
  border-radius: 50%;
  animation: status-spin 0.8s linear infinite;
}

.message-state[data-state="complete"] {
  border-color: #cce7d7;
  background: #eff9f3;
  color: #257548;
}

.message-state[data-state="complete"] .message-state-indicator::before {
  content: "✓";
  font-size: 12px;
  line-height: 1;
}

.message-state[data-state="failed"] {
  border-color: #f2c9c9;
  background: #fff1f1;
  color: #b43636;
}

.message-state[data-state="failed"] .message-state-indicator::before { content: "!"; }

.message-state[data-state="interrupted"] {
  border-color: #ead8ab;
  background: #fff8e8;
  color: #805b1c;
}

.message-state[data-state="interrupted"] .message-state-indicator::before { content: "■"; }

.message-time {
  color: #9498a7;
}

.message-copy-button {
  display: inline-flex;
  min-height: 24px;
  gap: 5px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #7f8492;
  font: inherit;
  cursor: pointer;
}

.message-copy-button:hover:not(:disabled) {
  border-color: #dfe2e8;
  background: #f4f5f7;
  color: #4e5360;
}

.message-copy-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.message-copy-button[data-copied="true"] {
  color: #3d7b56;
}

.turn-divider {
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--lm-divider);
}

.workspace-files-panel {
  position: fixed;
  z-index: 8;
  top: var(--workspace-dock-top);
  right: var(--codex-relay-browser-width, 0px);
  bottom: 0;
  display: grid;
  width: var(--workspace-dock-width);
  max-width: calc(100vw - var(--codex-relay-browser-width, 0px) - 24px);
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: visible;
  border-left: 1px solid var(--lm-divider);
  background: #ffffff;
  box-shadow: -14px 0 34px rgba(20, 27, 60, 0.1);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition:
    visibility var(--lm-duration-fast) ease,
    opacity var(--lm-duration-fast) ease,
    transform var(--lm-duration-fast) ease;
}

.workspace-files-panel.upload-drop-active {
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  box-shadow: -14px 0 34px rgba(20, 27, 60, 0.22);
}

.workspace-dock-resize-handle {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 10px;
  cursor: ew-resize;
  touch-action: none;
}

.workspace-dock-resize-handle::after {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 3px;
  height: 48px;
  border-radius: 999px;
  background: var(--lm-border-input);
  content: "";
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity var(--lm-duration-fast) ease;
}

.workspace-files-panel:hover .workspace-dock-resize-handle::after,
.workspace-dock-resize-handle:focus-visible::after,
.workspace-files-panel[data-resizing="true"] .workspace-dock-resize-handle::after {
  opacity: 1;
}

.workspace-files-panel[data-resizing="true"] {
  transition: none;
  user-select: none;
}

.workspace-files-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 9px 16px;
  border-bottom: 1px solid var(--lm-divider);
}

.workspace-files-header > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.workspace-files-header strong {
  color: var(--lm-text-strong);
  font-size: 14px;
}

.workspace-files-header span {
  color: var(--lm-text-muted);
  font-size: 11px;
}

.workspace-files-header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.workspace-files-header-actions button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--lm-text-muted);
}

.workspace-files-header-actions button:hover:not(:disabled) {
  border-color: var(--lm-divider);
  background: var(--panel-soft);
  color: var(--lm-text-strong);
}

.workspace-file-pathbar {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  border-bottom: 1px solid var(--lm-divider);
}

.workspace-file-path-copy,
.workspace-file-path-download {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  margin-left: 8px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--lm-text-muted);
}

.workspace-file-path-copy:hover:not(:disabled),
.workspace-file-path-download:hover:not(:disabled) {
  border-color: var(--lm-divider);
  background: var(--panel-soft);
  color: var(--lm-primary);
}

.workspace-file-path-download {
  margin-left: 2px;
}

.workspace-file-path-download[data-state="compressing"] {
  color: var(--lm-danger);
}

.workspace-file-breadcrumbs {
  display: flex;
  min-width: 0;
  min-height: 41px;
  flex: 1 1 auto;
  align-items: center;
  gap: 2px;
  padding: 5px 12px 5px 4px;
  overflow-x: auto;
  white-space: nowrap;
}

.workspace-file-breadcrumbs button {
  min-height: 30px;
  padding: 0 6px;
  border-color: transparent;
  background: transparent;
  color: var(--lm-primary);
  font-size: 12px;
}

.workspace-file-breadcrumbs button[aria-current="page"] {
  color: var(--lm-text-strong);
  cursor: default;
}

.workspace-file-breadcrumbs .file-breadcrumb-separator {
  font-size: 11px;
}

.workspace-file-sort-controls {
  justify-content: stretch;
  gap: 6px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--lm-divider);
  background: var(--panel-soft);
}

.workspace-file-sort-controls .file-sort-field {
  min-width: 0;
  flex: 1 1 auto;
}

.workspace-file-sort-controls .file-sort-field select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
}

.workspace-file-sort-controls .file-sort-direction {
  min-height: 32px;
  flex: 0 0 auto;
}

.workspace-file-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.workspace-file-list[data-state="loading"],
.workspace-file-list[data-state="empty"],
.workspace-file-list[data-state="error"] {
  display: grid;
  padding: 28px 18px;
  place-items: center;
  color: var(--lm-text-muted);
  font-size: 12px;
  text-align: center;
}

.workspace-file-list[data-state="error"] {
  color: var(--lm-danger);
}

.workspace-file-entry {
  display: grid;
  width: 100%;
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: 0;
  border-bottom: 1px solid var(--lm-divider);
  border-radius: 0;
  background: #ffffff;
  text-align: left;
}

.workspace-file-entry:hover:not(:disabled) {
  border-color: var(--lm-divider);
  background: var(--panel-soft);
  color: var(--lm-text);
}

.workspace-file-entry[aria-selected="true"] {
  background: var(--lm-primary-soft);
  box-shadow: inset 3px 0 var(--lm-primary);
}

.workspace-file-entry .file-entry-name {
  gap: 7px;
}

.workspace-file-entry .file-entry-icon {
  width: 20px;
  font-size: 15px;
}

.workspace-file-entry .file-entry-meta {
  max-width: 92px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
}

.workspace-files-footer {
  container: workspace-file-footer / inline-size;
  display: grid;
  min-height: 74px;
  gap: 7px;
  padding: 9px 12px 10px;
  border-top: 1px solid var(--lm-divider);
  background: var(--panel-soft);
}

.workspace-files-footer > span {
  min-width: 0;
  overflow: hidden;
  color: var(--lm-text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-files-footer > .file-upload-progress {
  display: grid;
  margin-top: 0;
}

.workspace-files-footer > .file-upload-progress[hidden] {
  display: none;
}

.workspace-files-footer > .file-upload-progress .file-upload-progress-copy {
  font-size: 11px;
}

.workspace-files-footer > .workspace-files-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 7px;
}

.workspace-files-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.workspace-files-footer button i {
  flex-shrink: 0;
  margin-right: 5px;
}

@container workspace-file-footer (max-width: 360px) {
  .workspace-files-actions button {
    padding-inline: 6px;
  }

  .workspace-files-actions button > span {
    display: none;
  }

  .workspace-files-actions button > i {
    margin-right: 0;
  }
}

@media (min-width: 960px) and (min-height: 640px) {
  .workspace-files-panel[data-open="true"] {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
}

@keyframes message-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes status-spin {
  to {
    transform: rotate(360deg);
  }
}

.terminal-mode-view {
  position: relative;
  display: grid;
  width: 100%;
  max-width: var(--chat-content-max);
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  justify-self: center;
  overflow: hidden;
  background: var(--lm-nav);
  color-scheme: dark;
}

.terminal-pane {
  min-height: 0;
  padding: 8px 12px;
  overflow: hidden;
  overscroll-behavior-y: contain;
  pointer-events: auto;
  user-select: text;
  touch-action: pan-y;
}

.terminal-pane .xterm {
  height: 100%;
}

.terminal-pane .xterm-viewport {
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.terminal-pane .xterm-screen {
  touch-action: pan-y;
}

.terminal-jump-bottom {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: 14px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-color: rgba(156, 175, 255, 0.58);
  background: rgba(35, 41, 57, 0.94);
  color: #ffffff;
  font-size: 12px;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.terminal-jump-bottom:hover:not(:disabled) {
  border-color: #9cafff;
  background: #2d3766;
  color: #ffffff;
}

.input-panel {
  position: relative;
  z-index: 1;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--lm-divider);
  background: rgba(247, 247, 248, 0.96);
  box-shadow: 0 -10px 28px rgba(20, 27, 60, 0.04);
  backdrop-filter: blur(12px);
}

.history-load-more {
  display: block;
  margin: 0 auto 24px;
  padding: 8px 16px;
  border: 1px solid var(--lm-border);
  border-radius: 999px;
  background: var(--lm-surface);
  color: var(--lm-text-strong);
  cursor: pointer;
}

.history-load-more[hidden] {
  display: none;
}

.history-load-more:disabled {
  opacity: 0.6;
  cursor: wait;
}

.conversation-jump-bottom {
  position: absolute;
  z-index: 5;
  right: 20px;
  bottom: calc(100% + 12px);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid #cbd5f6;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #344db2;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(30, 43, 90, 0.18);
  backdrop-filter: blur(8px);
}

.conversation-jump-bottom:hover:not(:disabled) {
  border-color: #879cf0;
  background: #f0f3ff;
}

@media (max-width: 800px) {
  .conversation-jump-bottom { right: 14px; bottom: calc(100% + 8px); }
}

.turn-status-bar {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  width: fit-content;
  max-width: min(var(--chat-content-max), 100%);
  min-height: 24px;
  margin: 0 max(0px, calc((100% - var(--chat-content-max)) / 2)) 4px;
  padding: 3px 8px;
  border: 1px solid #ccd4f4;
  border-radius: 999px;
  background: #f2f5ff;
  color: #334aab;
  box-shadow: 0 3px 10px rgba(58, 79, 172, 0.06);
}

.turn-status-bar[hidden] {
  display: none;
}

.turn-status-indicator {
  display: inline-grid;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  place-items: center;
}

.turn-status-bar[data-state="working"] .turn-status-indicator {
  border: 2px solid rgba(83, 109, 230, 0.2);
  border-top-color: #536de6;
  border-radius: 50%;
  animation: status-spin 0.8s linear infinite;
}

.turn-status-bar[data-state="complete"] {
  border-color: #c5e6d2;
  background: #eff9f3;
  color: #226d43;
}

.turn-status-bar[data-state="complete"] .turn-status-indicator::before {
  content: "✓";
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 50%;
  background: #2c8a57;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
}

.turn-status-bar[data-state="error"] {
  border-color: #efc4c4;
  background: #fff3f3;
  color: #a43a3a;
}

.turn-status-bar[data-state="error"] .turn-status-indicator::before {
  content: "!";
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 50%;
  background: #c84b4b;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
}

.turn-status-copy {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  min-width: 0;
  max-width: calc(100vw - 70px);
}

.turn-status-copy strong {
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.turn-status-copy span {
  color: inherit;
  font-size: 10px;
  opacity: 0.78;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-panel > .composer,
.input-panel > .chat-steer-status,
.input-panel > .chat-prompt-queue,
.input-panel > .send-row {
  width: 100%;
  max-width: var(--chat-content-max);
  margin-right: auto;
  margin-left: auto;
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 4px 6px 5px;
  border: 1px solid #d9dadd;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 5px 18px rgba(20, 27, 60, 0.08);
}

.composer-toolbar {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

.composer-attachments {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 8px 6px;
  scrollbar-width: thin;
}

.composer-attachments[hidden] {
  display: none;
}

.composer-editor-actions {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  padding: 0 0 2px 5px;
}

.composer-editor-actions[hidden] { display: none; }

.composer-editor-button {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--lm-text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.composer-editor-button i { color: var(--lm-primary); }
.composer-editor-button:hover:not(:disabled) { border: 0; background: var(--lm-primary-soft); color: var(--lm-text-strong); }
.composer-editor-button:disabled { opacity: .55; }

.composer-attachment {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  margin: 0;
  border: 1px solid #d9dadd;
  border-radius: 12px;
  background: #f1f2f4;
}

.composer-attachment-preview {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: zoom-in;
}

.composer-attachment-preview:hover,
.composer-attachment-preview:focus-visible {
  outline: 2px solid var(--lm-primary);
  outline-offset: -2px;
}

.composer-attachment-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.composer-attachment-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--lm-text-muted);
  font-size: 12px;
}

.composer-attachment[data-state="preparing"]::after,
.composer-attachment[data-state="uploading"]::after,
.composer-attachment[data-state="failed"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(24, 27, 35, 0.22);
  pointer-events: none;
}

.composer-attachment-status {
  position: absolute;
  z-index: 1;
  right: 6px;
  bottom: 6px;
  left: 6px;
  overflow: hidden;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

.composer-attachment-retry {
  position: absolute;
  z-index: 2;
  top: 23px;
  left: 12px;
  right: 12px;
  min-height: 24px;
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  background: var(--lm-surface, #fff);
  color: var(--lm-text, #222);
  font-size: 11px;
}

.composer-attachment-remove {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: 4px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(24, 27, 35, 0.72);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.composer-attachment-remove:hover:not(:disabled) {
  border-color: #ffffff;
  background: rgba(24, 27, 35, 0.92);
  color: #ffffff;
}

.skill-autocomplete {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  max-height: min(360px, 48vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--lm-border);
  border-radius: 14px;
  background: var(--lm-surface);
  box-shadow: var(--lm-shadow-float);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.skill-option {
  display: grid;
  width: 100%;
  min-height: 0;
  grid-template-columns: minmax(130px, 0.36fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}

.skill-option:hover:not(:disabled),
.skill-option.is-active {
  border: 0;
  background: var(--lm-primary-soft);
  color: var(--lm-text-strong);
}

.skill-option-name {
  overflow: hidden;
  color: var(--lm-primary-hover);
  font-family: Consolas, Menlo, Monaco, monospace;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-option-description {
  display: -webkit-box;
  overflow: hidden;
  color: var(--lm-text-muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.skill-autocomplete-empty {
  margin: 0;
  padding: 12px;
  color: var(--lm-text-muted);
  font-size: 12px;
  text-align: center;
}

#commandInput {
  width: 100%;
  min-height: 42px;
  max-height: 140px;
  padding: 5px 8px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--lm-text-strong);
  font-family: inherit;
  line-height: 1.4;
}

#commandInput:focus-visible {
  outline: 0;
  border: 0;
}

#commandInput::placeholder {
  color: #a0a3ad;
  font-size: 13px;
}

.composer-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

.composer-action-button,
.composer-send {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
}

.composer-action-button {
  background: transparent;
  color: #6f737d;
}

.composer-action-button:hover:not(:disabled) {
  border: 0;
  background: #eef0f4;
  color: var(--lm-text-strong);
}

.composer-send {
  background: #303238;
  color: #ffffff;
}

.composer-send > i {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  line-height: 1;
}

/* An icon change must not show the old brand SVG beside the new glyph. */
.composer-send > i:not(.brand-function-icon) > svg,
.composer-send > i.brand-function-icon::before {
  display: none;
}

.composer-send:hover:not(:disabled) {
  border: 0;
  background: #17191d;
  color: #ffffff;
}

.voice-input-button[data-state="connecting"],
.voice-input-button[data-state="processing"] {
  background: var(--lm-primary-soft);
  color: var(--lm-primary);
}

.voice-input-button[data-state="recording"] {
  background: rgba(220, 53, 69, 0.12);
  color: var(--lm-danger);
  animation: voice-input-pulse 1.4s ease-in-out infinite;
}

@keyframes voice-input-pulse {
  50% {
    box-shadow: 0 0 0 5px rgba(220, 53, 69, 0.1);
  }
}

.send-row {
  gap: 4px;
  margin-top: 4px;
}

.send-row button {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--lm-text-muted);
  font-size: 12px;
}

.send-row button[hidden] {
  display: none;
}

.send-row button:hover:not(:disabled) {
  border-color: var(--lm-divider);
  background: #ffffff;
  color: var(--lm-text-strong);
}

.send-row .icon-button > [aria-hidden="true"] {
  color: var(--lm-text-muted);
}

.send-row .stop-action > [aria-hidden="true"] {
  color: var(--lm-danger);
}

.chat-steer-status {
  margin: 0 4px 6px;
  padding: 6px 10px;
  border-left: 3px solid currentColor;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  max-height: 72px;
  overflow-y: auto;
}

.chat-steer-status[data-state="accepted"] { color: var(--lm-success); }
.chat-steer-status[data-state="error"] { color: var(--danger); }

@media (max-width: 620px) {
  .skill-option {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 1100px) {
  .toolbar > .icon-button > span,
  .toolbar .view-mode-button > span,
  .toolbar .status > span {
    display: none;
  }

  .toolbar .status {
    width: 32px;
    min-width: 32px;
    flex: 0 0 32px;
    justify-content: center;
    padding: 0;
  }

  .toolbar > .icon-button {
    width: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    padding: 0;
  }

  .view-mode-button {
    width: 32px;
    min-width: 32px;
    padding: 0;
  }

  .toolbar-model-picker {
    padding: 0 6px;
  }

  .toolbar-model-picker > i {
    display: none;
  }

  .toolbar-model-picker select {
    width: 100%;
  }

  .toolbar-effort-picker select {
    width: 100%;
  }

}

@media (max-width: 900px) {
  .login-panel {
    width: min(760px, 100%);
  }

  .workdir-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  html,
  body {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .app-shell,
  .console-view {
    height: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .onboarding-view,
  .login-view,
  .account-management-view {
    height: 100%;
    overflow-y: auto;
    padding-right: 16px;
    padding-left: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .account-management-view { padding-top: 24px; }
  .account-management-header,
  .account-management-card { padding: 22px 18px; }
  .account-management-grid { grid-template-columns: 1fr; }
  .project-management-grid { grid-template-columns: 1fr; }
  .project-management-list { max-height: 34vh; }

  .onboarding-card {
    padding: 28px 24px;
  }

  .onboarding-card h1 {
    font-size: 28px;
  }

  .login-view {
    background:
      linear-gradient(var(--lm-shell) 0 56px, transparent 56px),
      var(--lm-page);
  }

  .login-panel {
    margin-top: 40px;
  }

  .project-picker-header,
  .workdir-panel {
    padding: 18px 16px;
  }

  .project-picker-header {
    flex-direction: column;
  }

  .project-picker-actions {
    width: 100%;
  }

  .project-picker-actions .quiet-button {
    flex: 1 1 0;
    align-self: flex-start;
  }

  .workdir-list {
    grid-template-columns: 1fr;
  }

  .project-dialog-card {
    padding: 18px 16px;
  }

  .dialog-heading {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .dialog-actions {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .file-browser-dialog {
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .file-browser-card {
    height: auto;
    min-height: 100%;
    max-height: none;
    overflow: visible;
  }

  .file-list {
    flex: 0 0 auto;
    min-height: 180px;
    overflow: visible;
  }

  .file-preview-heading .header-action-button span {
    display: none;
  }

  .file-preview-markdown {
    padding: 22px 18px 42px;
  }

  .file-preview-code {
    padding: 16px;
    font-size: 12px;
  }

  .file-list-heading,
  .file-entry {
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .file-list-heading span:last-child,
  .file-entry .file-entry-meta:last-child {
    display: none;
  }

  .file-browser-actions {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-browser-pathbar {
    flex-wrap: wrap;
  }

  .file-browser-pathbar .file-breadcrumbs {
    flex-basis: 100%;
  }

  .session-manager-card {
    max-height: calc(100dvh - 26px);
    padding: 18px 14px;
  }

  .session-manager-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .command-list {
    grid-template-columns: 1fr;
  }

  .status {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
  }

  .project-identity {
    flex: 1 1 auto;
    flex-basis: auto;
  }

  .toolbar .status {
    display: none;
  }

  .toolbar {
    position: sticky;
    z-index: 20;
    top: 0;
    align-self: start;
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  .toolbar .project-identity {
    flex: 1 1 auto;
    min-width: 0;
  }

  .toolbar .project-title {
    width: 100%;
  }

  .toolbar .tools-panel {
    width: calc(100% - 24px);
    padding-right: 12px;
    padding-left: 12px;
  }

  .conversation {
    padding-right: 12px;
    padding-left: 30px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .view-mode-switch {
    flex: 0 0 auto;
  }

  .view-mode-button {
    flex: 0 0 32px !important;
  }

  .input-panel {
    padding-top: 5px;
    padding-right: 12px;
    padding-bottom: calc(5px + env(safe-area-inset-bottom));
    padding-left: 12px;
  }

  .runtime-status-bar {
    flex-wrap: nowrap;
  }

  .terminal-jump-bottom {
    right: 14px;
    bottom: 12px;
    min-height: 44px;
    padding-right: 15px;
    padding-left: 15px;
    font-size: 13px;
  }

  .tools-panel button,
  .send-row button {
    flex: 1 1 auto;
  }
}

@media (max-width: 620px) {
  .toolbar {
    gap: 3px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .toolbar .project-identity {
    display: none;
  }

  .toolbar-model-picker,
  .toolbar-effort-picker {
    flex: 1 1 40px;
    min-width: 34px;
    padding: 0 3px;
  }

  .fast-mode-button {
    width: 32px;
    min-width: 32px;
    justify-content: center;
    padding: 0;
  }

  .fast-mode-button span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.composer-send[data-mode="steer"] { background: #68728d; }

.chat-prompt-queue{margin:0 auto 6px;padding:7px 10px;border:1px solid var(--lm-divider);border-radius:12px;background:rgba(255,255,255,.94);box-shadow:0 3px 12px rgba(20,27,60,.05)}.chat-prompt-queue-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--lm-text-muted);font-size:11px}.chat-prompt-queue-heading>span{display:flex;align-items:center;gap:7px}.chat-prompt-queue-heading b{display:inline-grid;min-width:18px;height:18px;place-items:center;padding:0 5px;border-radius:999px;background:#edf0ff;color:#536de6;font-size:10px}.chat-prompt-queue-heading button{min-height:24px;padding:2px 8px;border:1px solid #dce2f4;border-radius:7px;background:#f7f8ff;color:#5364bf;font-size:10px}.chat-prompt-queue-heading button:hover:not(:disabled){background:#edf0ff}.chat-prompt-queue-items{display:grid;gap:3px;max-height:88px;overflow:auto;margin:5px 0 0;padding:0;list-style:none}.chat-prompt-queue-items:empty{display:none}.chat-prompt-queue-items li{display:flex;min-width:0;align-items:center;gap:8px;padding:3px 1px;color:var(--lm-text-strong);font-size:11px}.chat-prompt-queue-number{display:grid;width:18px;height:18px;flex:0 0 18px;place-items:center;border-radius:6px;background:#f0f2f7;color:var(--lm-text-muted);font-size:10px}.chat-prompt-queue-preview{display:flex;min-width:0;flex:1;align-items:center;gap:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-prompt-queue-attachment{flex:0 0 auto;color:var(--lm-text-muted);font-size:10px}.chat-prompt-queue-remove{display:grid;width:24px;min-width:24px;height:24px;min-height:24px;place-items:center;padding:0;border:0;border-radius:6px;background:transparent;color:var(--lm-text-muted)}.chat-prompt-queue-remove:hover{background:#f3f4f7;color:var(--danger)}.queue-prompt-button{width:32px;min-width:32px;height:32px;min-height:32px;color:#5364bf}
.file-browser-actions [hidden],
.workspace-files-actions [hidden] {
  display: none;
}

.file-link-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 170px;
  padding: 4px;
  border: 1px solid var(--lm-divider);
  border-radius: 8px;
  background: var(--lm-surface, #fff);
  box-shadow: 0 8px 24px rgba(20, 27, 60, .16);
}
.file-link-context-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--lm-text-strong);
  text-align: left;
  cursor: pointer;
}
.file-link-context-menu button:hover,
.file-link-context-menu button:focus-visible { background: var(--lm-hover, #f1f3f8); }

/* Keep model controls compact when the toolbar wraps. */
#modelPicker { flex: 0 1 240px; width: 240px; max-width: 100%; }
@media (max-width: 900px) {
  .toolbar { flex-wrap: wrap; }
  #modelPicker { flex-basis: 210px; width: 210px; min-width: 0; }
}
@media (max-width: 620px) {
  #modelPicker { flex-basis: 184px; width: 184px; }
  .toolbar-effort-picker { flex: 0 1 104px; min-width: 90px; }
}
@media (max-width: 360px) {
  #modelPicker { flex-basis: 150px; width: 150px; font-size: 12px; }
}

/* Name the two busy-chat actions instead of relying on unfamiliar icons. */
.composer-actions #queuePromptBtn,
.local-send-group #sendBtn.chat-steer-send {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: auto; min-width: 0; padding: 0 9px; font-size: 12px; white-space: nowrap;
}
.composer-actions #queuePromptBtn { border-radius: 8px; }
#chatSendActionLabel[hidden] { display: none; }
@media (max-width: 480px) {
  .composer-actions #queuePromptBtn > i,
  .local-send-group #sendBtn.chat-steer-send > i { display: none; }
  .composer-actions #queuePromptBtn,
  .local-send-group #sendBtn.chat-steer-send { padding-inline: 8px; }
}

/* Native Codex context compaction status; never overlays the draft. */
.context-compaction-status { flex: 0 0 auto; margin: 4px 12px; font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; opacity: .85; }
.context-compaction-status[data-state="failed"] { color: var(--error-color, #b54632); }
