:root {
  color-scheme: dark;
  --composer-shell-height: 110px;
  --composer-height: 56px;
  --workspace-sidebar-width: 520px;
  --bg: #171717;
  --terminal-bg: #0f0f0f;
  --panel: rgba(35, 35, 35, 0.92);
  --border: rgba(255, 255, 255, 0.11);
  --text: #ececec;
  --muted: #a3a3a3;
  --accent: #d8d8d8;
  --soft-accent: #10a37f;
  --danger: #fca5a5;
  --control-bg: rgba(255, 255, 255, 0.045);
  --control-hover: rgba(255, 255, 255, 0.075);
  --control-active: rgba(255, 255, 255, 0.1);
  --control-border: rgba(255, 255, 255, 0.12);
  --control-border-hover: rgba(255, 255, 255, 0.2);
  --ansi-black: #8a8a8a;
  --ansi-red: #fca5a5;
  --ansi-green: #86efac;
  --ansi-yellow: #fde68a;
  --ansi-blue: #c7d2fe;
  --ansi-magenta: #e9d5ff;
  --ansi-cyan: #a7f3d0;
  --ansi-white: #f4f4f5;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

body.drag-file .composer {
  border-color: rgba(16, 163, 127, 0.36);
  background: rgba(42, 42, 42, 0.94);
  box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.1);
}

body.drag-file .attach-button {
  color: var(--soft-accent);
  border-color: rgba(16, 163, 127, 0.3);
}

body.opera-sidebar-surface {
  --composer-shell-height: 102px;
  --composer-height: 54px;
  background: var(--terminal-bg);
}

.hidden { display: none !important; }

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

.login-card {
  justify-self: center;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  justify-items: stretch;
  gap: 14px;
  margin: 0 auto;
  background: rgba(33, 33, 33, 0.94);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.34);
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

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

.login-brand img,
.workspace-brand img {
  flex: 0 0 auto;
  border-radius: 11px;
  box-shadow: 0 0 22px rgba(16, 163, 127, 0.18);
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.login-card input,
.login-card button {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
}

.login-card button {
  cursor: pointer;
  background: rgba(255,255,255,0.08);
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.app {
  height: 100dvh;
  overflow: hidden;
}

.workspace-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  width: min(560px, 100vw);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: rgba(28, 28, 28, 0.98);
  box-shadow: 24px 0 80px rgba(0, 0, 0, 0.42);
}

.app.workspace-sidebar-docked .workspace-sidebar {
  width: min(var(--workspace-sidebar-width), calc(100vw - 420px));
  min-width: 320px;
  max-width: 760px;
  background: #1c1c1c;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.08);
}

.workspace-sidebar-resizer {
  display: none;
}

.app.workspace-sidebar-docked .workspace-sidebar-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -5px;
  z-index: 2;
  width: 10px;
  display: block;
  cursor: ew-resize;
  touch-action: none;
}

.app.workspace-sidebar-docked .workspace-sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  right: 4px;
  width: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.app.workspace-sidebar-docked .workspace-sidebar-resizer:hover::after,
.app.workspace-sidebar-docked .workspace-sidebar-resizer:focus-visible::after,
body.workspace-sidebar-resizing .workspace-sidebar-resizer::after {
  background: rgba(16, 163, 127, 0.72);
  box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.18), 0 0 18px rgba(16, 163, 127, 0.22);
}

body.workspace-sidebar-resizing,
body.workspace-sidebar-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}

.workspace-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

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

.workspace-brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--text);
}

.workspace-sidebar-title {
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
}

.workspace-app-version {
  min-width: 0;
  font-size: 11px;
  font-weight: 520;
  line-height: 1.2;
  color: rgba(180, 180, 180, 0.74);
}

.workspace-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.workspace-project-group {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.workspace-project-head {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 0 8px;
  cursor: grab;
  user-select: none;
}

.workspace-project-head:active,
.workspace-item:active {
  cursor: grabbing;
}

.workspace-project-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.workspace-project-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.2;
}

.workspace-project-copy-path-button {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
}

.workspace-project-copy-path-button:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.24);
}

.workspace-project-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.workspace-project-items {
  position: relative;
  display: grid;
  gap: 8px;
}

.workspace-project-linked .workspace-project-items::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 21px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(16, 163, 127, 0.42) 12%, rgba(16, 163, 127, 0.42) 88%, transparent);
  pointer-events: none;
}

.workspace-project-dragging,
.workspace-item-dragging {
  opacity: 0.48;
}

.workspace-project-drag-over .workspace-project-head {
  border-radius: 8px;
  background: rgba(16, 163, 127, 0.12);
  outline: 1px solid rgba(16, 163, 127, 0.34);
}

.workspace-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 56px;
  padding: 8px 8px 8px 9px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: grab;
}

.workspace-item-menu-open {
  z-index: 60;
}

.workspace-item-active {
  border-color: rgba(16, 163, 127, 0.74);
  background:
    linear-gradient(90deg, rgba(16, 163, 127, 0.2), rgba(16, 163, 127, 0.1) 42%, rgba(255, 255, 255, 0.045));
  box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.18) inset, 0 10px 28px rgba(0, 0, 0, 0.24);
}

.workspace-item-active::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--soft-accent);
  box-shadow: 0 0 18px rgba(16, 163, 127, 0.45);
  pointer-events: none;
}

.workspace-item-drag-over {
  border-color: rgba(16, 163, 127, 0.52);
  background: rgba(16, 163, 127, 0.11);
  transform: translateY(1px);
}

.workspace-main {
  min-width: 0;
  min-height: 34px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: inherit;
}

.workspace-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.workspace-item-active .workspace-name {
  color: #ffffff;
  font-weight: 760;
}

.workspace-name-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-badge-row {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-left: 32px;
}

.workspace-badge {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
  font-size: 11px;
  font-weight: 560;
  line-height: 1.15;
}

.workspace-agent-badge {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.workspace-agent-inline-badge {
  flex: 0 1 auto;
  max-width: 96px;
  padding: 2px 7px;
  font-size: 10px;
}

.workspace-mode-plan-badge {
  border-color: rgba(250, 204, 21, 0.62);
  background: rgba(250, 204, 21, 0.18);
  color: #fde68a;
}

.workspace-auto-quality-badge {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.workspace-status-dot {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.workspace-status-working {
  color: var(--soft-accent);
  border-color: rgba(16, 163, 127, 0.64);
  background: var(--soft-accent);
  box-shadow: 0 0 16px rgba(16, 163, 127, 0.36);
}

.workspace-status-choice {
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.7);
  background: #fde68a;
  box-shadow: 0 0 18px rgba(253, 230, 138, 0.42);
}

.workspace-status-idle {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.28);
}

.workspace-status-stopped {
  background: transparent;
}

.workspace-actions-shell {
  position: relative;
  display: flex;
  justify-content: end;
  gap: 6px;
}

.workspace-copy-name-button,
.workspace-prompt-button,
.workspace-action-menu-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  line-height: 1;
}

.workspace-copy-name-button,
.workspace-prompt-button {
  width: 30px;
  color: var(--muted);
  font-size: 15px;
}

.workspace-copy-name-button:hover,
.workspace-prompt-button:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.26);
}

.workspace-action-menu-button[aria-expanded="true"] {
  border-color: rgba(16, 163, 127, 0.48);
  background: rgba(16, 163, 127, 0.12);
}

.workspace-actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 250px;
  max-height: min(620px, calc(100vh - 140px));
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: #242424;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.58);
}

.workspace-action {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.workspace-action:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.workspace-action.active {
  border-color: rgba(16, 163, 127, 0.48);
  background: rgba(16, 163, 127, 0.14);
}

.workspace-choice-action {
  justify-content: space-between;
  gap: 12px;
}

.workspace-action-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-action-text-only span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-action-state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.workspace-action-icon {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
}

.workspace-action-group {
  display: grid;
  gap: 4px;
}

.workspace-action-group summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  list-style: none;
}

.workspace-action:focus-visible,
.workspace-copy-name-button:focus-visible,
.workspace-action-menu-button:focus-visible,
.workspace-action-group summary:focus-visible {
  outline: 2px solid rgba(16, 163, 127, 0.65);
  outline-offset: 2px;
}

.workspace-action-group summary::-webkit-details-marker {
  display: none;
}

.workspace-action-group summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--muted);
}

.workspace-action-group[open] summary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
}

.workspace-action-group[open] summary::after {
  transform: rotate(180deg);
}

.workspace-action-group-body {
  display: grid;
  gap: 4px;
  padding: 2px 0 2px 8px;
}

.workspace-action-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--control-border);
}

.workspace-action-caption {
  padding: 2px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.workspace-action-danger {
  color: var(--danger, #ef4444);
}

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

.workspace-create-form input,
.workspace-create-form select,
.workspace-create-form button {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.workspace-create-form input,
.workspace-create-form select {
  padding: 0 10px;
}

.workspace-create-form select {
  cursor: pointer;
  color-scheme: dark;
  background: rgba(255, 255, 255, 0.055);
}

.workspace-create-form select option {
  background: #1e1e1e;
  color: #f4f4f5;
}

.workspace-create-form select option:checked {
  background: #24584f;
  color: #ffffff;
}

.workspace-project-picker {
  grid-column: 1 / -1;
  position: relative;
  min-width: 0;
}

.workspace-project-picker-button {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.workspace-project-picker-button:hover,
.workspace-project-picker-button[aria-expanded="true"] {
  border-color: rgba(16, 163, 127, 0.32);
  background: rgba(255, 255, 255, 0.075);
}

.workspace-project-picker-copy,
.workspace-project-picker-option {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.workspace-project-picker-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: stretch;
  gap: 4px;
}

.workspace-project-picker-name,
.workspace-project-picker-option-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-project-picker-path,
.workspace-project-picker-option-path {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-project-picker-chevron {
  color: var(--muted);
  font-size: 15px;
}

.workspace-project-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 90;
  max-height: min(54vh, 430px);
  overflow: auto;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--control-border);
  border-radius: 14px;
  background: rgba(22, 22, 22, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.workspace-project-picker-option {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.workspace-project-picker-option:hover,
.workspace-project-picker-option:focus-visible {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.workspace-project-picker-option.selected {
  border-color: rgba(16, 163, 127, 0.4);
  background: rgba(16, 163, 127, 0.2);
}

.workspace-project-picker-archive {
  width: 34px;
  min-width: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(248, 113, 113, 0.82);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.workspace-project-picker-archive:hover,
.workspace-project-picker-archive:focus-visible {
  border-color: rgba(248, 113, 113, 0.26);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  outline: none;
}

.workspace-create-form .workspace-project-select,
.workspace-create-form .workspace-new-project-input,
.workspace-create-form .workspace-path-input {
  grid-column: 1 / -1;
  height: 34px;
  font-size: 12px;
}

.workspace-create-form button {
  padding: 0 12px;
  cursor: pointer;
}

.workspace-create-form > button[type="submit"] {
  grid-column: 3;
  grid-row: 1;
}

.workspace-create-form .workspace-button-sidebar-close {
  grid-area: auto;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.context-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.58);
}

.context-modal.hidden {
  display: none;
}

.context-panel {
  width: min(860px, 100%);
  height: min(680px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.workspace-delete-confirm-panel {
  width: min(420px, calc(100vw - 28px));
  height: auto;
  grid-template-rows: auto auto auto;
}

.workspace-delete-confirm-text {
  color: rgba(236, 236, 236, 0.84);
  font-size: 14px;
  line-height: 1.45;
}

.workspace-delete-confirm-actions {
  gap: 8px;
}

.workspace-delete-confirm-actions button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.workspace-delete-confirm-actions button:hover {
  background: var(--control-hover);
  border-color: var(--control-border-hover);
}

.workspace-delete-confirm-button {
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.38) !important;
  background: rgba(127, 29, 29, 0.42) !important;
}

.workspace-delete-confirm-button:hover {
  border-color: rgba(248, 113, 113, 0.58) !important;
  background: rgba(153, 27, 27, 0.56) !important;
}

.context-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.context-title {
  font-size: 14px;
  font-weight: 600;
}

.context-path {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

#taskJournalPath {
  display: none;
}

.context-editor {
  min-width: 0;
  min-height: 0;
  resize: none;
  padding: 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--terminal-bg);
  color: var(--text);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.context-actions {
  display: flex;
  justify-content: flex-end;
}

.context-actions button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.learning-panel {
  width: min(920px, 100%);
  grid-template-rows: auto minmax(0, 1fr);
}

#platformMemoryModal .learning-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.learning-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.git-checkpoint-note-input {
  min-height: 34px;
  width: min(260px, 42vw);
  min-width: 190px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.git-checkpoint-note-input:focus {
  outline: none;
  border-color: var(--control-border-hover);
  background: rgba(255, 255, 255, 0.055);
}

.learning-head-actions button:not(.icon-button) {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.learning-head-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.learning-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.learning-empty {
  padding: 14px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--terminal-bg);
  color: var(--muted);
  font-size: 13px;
}

.learning-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--terminal-bg);
}

.learning-item-head,
.learning-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.learning-item-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.learning-status {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--control-border);
  color: var(--muted);
  font-size: 11px;
}

.learning-status-accepted {
  color: #9fe6b8;
  border-color: rgba(159, 230, 184, 0.22);
}

.learning-status-rejected {
  color: #f0a2a2;
  border-color: rgba(240, 162, 162, 0.22);
}

.learning-status-applied {
  color: #b8c8ff;
  border-color: rgba(184, 200, 255, 0.22);
}

.learning-status-archived {
  color: #b6b6b6;
  border-color: rgba(182, 182, 182, 0.22);
}

.platform-memory-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 8px;
}

.platform-memory-tools input,
.platform-memory-tools select {
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.platform-memory-tools input {
  padding: 0 11px;
}

.platform-memory-tools select {
  padding: 0 9px;
}

.platform-memory-tools input:focus,
.platform-memory-tools select:focus {
  border-color: var(--accent-soft);
}

.learning-task,
.learning-updated {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-updated {
  margin-right: auto;
}

.learning-prompt {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.learning-note {
  padding: 9px 10px;
  border: 1px solid rgba(159, 230, 184, 0.18);
  border-radius: 7px;
  background: rgba(16, 163, 127, 0.08);
  color: #d8f8e3;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-journal-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

#taskJournalList {
  gap: 6px;
}

.task-journal-item {
  gap: 0;
  padding: 8px 9px;
}

.task-journal-prompt-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: start;
  gap: 8px;
}

.task-journal-copy {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.task-journal-copy:hover,
.task-journal-copy:focus-visible {
  border-color: var(--control-border-hover);
  background: var(--control-hover);
}

.task-journal-prompt-text {
  padding-top: 1px;
  font-size: 14px;
  line-height: 1.48;
}

.task-journal-prompt-preview {
  min-width: 0;
  padding-top: 1px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.38;
  white-space: normal;
  word-break: break-word;
}

.task-journal-expand {
  width: max-content;
  max-width: 100%;
  min-height: 26px;
  margin-top: 6px;
  padding: 0 9px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.task-journal-expand:hover,
.task-journal-expand:focus-visible {
  border-color: var(--control-border-hover);
  background: var(--control-hover);
  color: var(--text);
}

.task-journal-prompt-full {
  max-height: 260px;
  overflow: auto;
  margin: 7px 0 0;
  padding: 9px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font: 13px/1.42 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-journal-item-expanded {
  border-color: rgba(16, 163, 127, 0.22);
}

.task-journal-details,
.task-journal-tech {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.task-journal-details > summary,
.task-journal-tech > summary {
  width: max-content;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.task-journal-prompt {
  max-height: 260px;
}

.learning-result.git-checkpoint-files {
  max-height: 120px;
}

.learning-result {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.learning-item-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.learning-item-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.terminal-shell {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  transition: margin-left 140ms ease;
}

.app.workspace-sidebar-docked .terminal-shell {
  margin-left: min(var(--workspace-sidebar-width), calc(100vw - 420px));
}

.workspace-button {
  grid-area: nav;
  position: relative;
  z-index: 6;
  align-self: end;
  justify-self: start;
  background: rgba(35, 35, 35, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}

.terminal-agent-badge {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  z-index: 7;
  min-width: 52px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  max-width: min(210px, calc(100vw - 28px));
  border: 1px solid rgba(147, 197, 253, 0.5);
  border-radius: 8px;
  background: rgba(35, 35, 35, 0.9);
  color: #dbeafe;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(250, 204, 21, 0.1);
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-plan-badge {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  z-index: 7;
  min-width: 52px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid rgba(250, 204, 21, 0.62);
  border-radius: 8px;
  background: rgba(35, 35, 35, 0.9);
  color: #fde68a;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(250, 204, 21, 0.1);
  pointer-events: none;
}

.terminal-plan-badge.with-agent-badge {
  top: calc(48px + env(safe-area-inset-top));
}

@media (min-width: 901px) {
  .terminal-plan-badge {
    font-weight: 520;
    font-stretch: condensed;
  }
}

@media (min-width: 901px) {
  .terminal-agent-badge {
    font-weight: 520;
    font-stretch: condensed;
  }
}

.terminal-auto-quality-badge {
  border-color: rgba(34, 197, 94, 0.52);
  color: #bbf7d0;
}

.terminal-codex-badge {
  border-color: rgba(96, 165, 250, 0.48);
  color: #bfdbfe;
}

.terminal-side-badge {
  border-color: rgba(45, 212, 191, 0.48);
  color: #99f6e4;
}

.terminal-continue-next-badge {
  border-color: rgba(250, 204, 21, 0.5);
  color: #fde68a;
}

.terminal-auto-quality-button {
  position: absolute;
  right: 0;
  bottom: calc(100% + 3px);
  z-index: 6;
  width: 50px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: rgba(35, 35, 35, 0.92);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  font-stretch: condensed;
  line-height: 0.95;
  transform: translateY(-2px);
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  will-change: background-color, border-color, color, box-shadow;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.terminal-auto-quality-button:hover {
  background: var(--control-hover);
  border-color: var(--control-border-hover);
  color: var(--text);
}

.terminal-auto-quality-button.active {
  border-color: rgba(34, 197, 94, 0.52);
  background: rgba(22, 101, 52, 0.24);
  color: #bbf7d0;
}

.terminal-codex-badge.active {
  border-color: rgba(147, 197, 253, 0.5);
  background: rgba(30, 64, 175, 0.22);
  color: #dbeafe;
}

.terminal-side-badge:hover {
  border-color: rgba(94, 234, 212, 0.48);
  background: rgba(15, 118, 110, 0.18);
  color: #ccfbf1;
}

.terminal-continue-next-badge:hover {
  border-color: rgba(253, 224, 71, 0.54);
  background: rgba(113, 63, 18, 0.22);
  color: #fef3c7;
}

.terminal-auto-quality-button.is-syncing {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 10px 30px rgba(0, 0, 0, 0.22);
}

.terminal-auto-quality-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.terminal-auto-quality-button.terminal-auto-quality-badge {
  right: 0;
}

.terminal-auto-quality-button.terminal-side-badge {
  right: 54px;
}

.terminal-auto-quality-button.terminal-codex-badge {
  right: 108px;
}

.terminal-auto-quality-button.terminal-continue-next-badge {
  right: 162px;
  width: 58px;
}

.terminal-session-button {
  position: relative;
  flex: 0 0 auto;
  z-index: 6;
  background: rgba(35, 35, 35, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}

.session-control-stack {
  position: relative;
  display: inline-grid;
  justify-items: end;
  align-items: end;
}

.active-workspace-shell {
  grid-area: chat;
  position: relative;
  align-self: end;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: min(460px, 100%);
}

.active-workspace-bar {
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.active-workspace-name-button {
  min-width: 0;
  flex: 1 1 auto;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 3px 3px 3px 9px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: rgba(35, 35, 35, 0.8);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.workspace-inline-prompt-button {
  margin-left: auto;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(236, 236, 236, 0.82);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.workspace-inline-prompt-button:hover,
.workspace-inline-prompt-button:focus-visible {
  border-color: var(--control-border-hover);
  background: var(--control-hover);
  color: var(--text);
}

.active-workspace-name-button:hover,
.active-workspace-name-button:focus-visible,
.active-workspace-bar.active .active-workspace-name-button {
  border-color: var(--control-border-hover);
  background: rgba(42, 42, 42, 0.92);
}

.active-workspace-label {
  display: none;
  flex: 0 0 auto;
  color: rgba(236, 236, 236, 0.56);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.active-workspace-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 520;
  font-stretch: condensed;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-quick-menu {
  position: absolute;
  right: 0;
  left: auto;
  bottom: calc(100% + 8px);
  z-index: 8;
  width: min(360px, calc(100vw - 20px));
  max-height: min(56vh, 420px);
  display: grid;
  gap: 4px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(35, 35, 35, 0.98);
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
  overscroll-behavior: contain;
}

.workspace-quick-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.workspace-quick-delete,
.workspace-quick-inline-action {
  min-height: 28px;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.workspace-quick-switch-shell {
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  overflow: hidden;
}

.workspace-quick-switch {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 32px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.workspace-quick-switch-shell:hover,
.workspace-quick-switch-shell:focus-within,
.workspace-quick-item-active .workspace-quick-switch-shell {
  border-color: rgba(16, 163, 127, 0.22);
  background: rgba(16, 163, 127, 0.12);
}

.workspace-quick-name {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 460;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-quick-inline-actions {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 3px;
}

.workspace-quick-inline-action {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-color: var(--control-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(236, 236, 236, 0.82);
  font-size: 13px;
  line-height: 1;
}

.workspace-quick-inline-action:hover,
.workspace-quick-inline-action:focus-visible {
  border-color: var(--control-border-hover);
  background: var(--control-hover);
  color: var(--text);
}

.workspace-quick-delete,
.workspace-quick-delete-spacer {
  width: 28px;
  height: 28px;
}

.workspace-quick-delete {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(246, 246, 246, 0.86);
  font-size: 18px;
  line-height: 1;
}

.workspace-quick-delete:hover {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.32);
  color: #fecaca;
}

.workspace-quick-delete-spacer {
  display: block;
}

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

.notice-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  width: min(560px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 7px 10px;
  border: 1px solid rgba(255, 217, 154, 0.18);
  border-radius: 10px;
  background: rgba(28, 28, 28, 0.96);
  color: #ffd99a;
  font-size: 12px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  z-index: 4;
}

.notice-banner[data-tone="info"] {
  color: var(--soft-accent);
}

.terminal-viewport {
  position: relative;
  min-height: 0;
  overflow: auto;
  margin: 6px 6px 0;
  padding: 10px 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: var(--terminal-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.018),
    inset 0 -24px 48px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.22);
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, 0.36) rgba(255, 255, 255, 0.045);
  scrollbar-width: thin;
}

.terminal-viewport::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.terminal-viewport::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.terminal-viewport::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  background-clip: padding-box;
}

.terminal-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
  background-clip: padding-box;
}

.jump-to-latest {
  position: fixed;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(var(--composer-shell-height) + 5.5cm + env(safe-area-inset-bottom));
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(33, 33, 33, 0.32);
  color: rgba(210, 245, 236, 0.78);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font: 22px/1 inherit;
  font-weight: 500;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.jump-to-latest:hover {
  background: rgba(42, 42, 42, 0.46);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(230, 255, 248, 0.9);
}

.terminal-load-more {
  position: sticky;
  top: 8px;
  z-index: 3;
  display: block;
  margin: 0 auto 8px;
  min-width: 116px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(33, 33, 33, 0.38);
  color: rgba(230, 230, 230, 0.72);
  font: 12px/1 inherit;
  font-weight: 520;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.terminal-load-more:hover {
  background: rgba(42, 42, 42, 0.54);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(245, 245, 245, 0.88);
}

.terminal-load-more:disabled {
  opacity: 0.58;
  cursor: default;
}

.terminal-pre {
  margin: 0;
  min-height: 100%;
  padding: 12px 14px calc(var(--composer-shell-height) + 74px);
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-family:
    "Cascadia Code",
    "Cascadia Mono",
    "Consolas",
    "SFMono-Regular",
    "Liberation Mono",
    monospace;
  font-size: 15px;
  line-height: 1.34;
  font-weight: 300;
  font-stretch: condensed;
  letter-spacing: 0;
  font-variant-ligatures: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: text;
  overflow-x: hidden;
}

.terminal-pre::selection,
.terminal-pre *::selection {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.terminal-line {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  tab-size: 4;
  color: var(--text);
  border-left: 1px solid transparent;
  padding-left: 6px;
}

.terminal-line + .terminal-line {
  margin-top: 0;
}

.terminal-link {
  color: rgba(139, 211, 255, 0.92);
  text-decoration: underline;
  text-decoration-color: rgba(139, 211, 255, 0.42);
  text-underline-offset: 2px;
  cursor: pointer;
}

.terminal-link:hover {
  color: rgba(186, 230, 253, 0.98);
  text-decoration-color: rgba(186, 230, 253, 0.72);
}

.terminal-path-link {
  text-decoration-style: dotted;
}

.terminal-line.prompt {
  color: #d7d7d7;
}

.terminal-line.error {
  color: #fca5a5;
  border-left-color: rgba(252, 165, 165, 0.42);
  background: linear-gradient(90deg, rgba(252, 165, 165, 0.06), transparent 58%);
}

.terminal-line.warning {
  color: #fde68a;
  border-left-color: rgba(253, 230, 138, 0.36);
  background: linear-gradient(90deg, rgba(253, 230, 138, 0.055), transparent 56%);
}

.terminal-line.success {
  color: #86efac;
  border-left-color: rgba(16, 163, 127, 0.38);
  background: linear-gradient(90deg, rgba(16, 163, 127, 0.055), transparent 56%);
}

.terminal-line.system {
  color: #b8b8b8;
  border-left-color: rgba(255, 255, 255, 0.18);
}

.terminal-line.agent {
  color: #d4d4d4;
  border-left-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 54%);
}

.terminal-line.action {
  color: #d0d0d0;
  border-left-color: rgba(255, 255, 255, 0.18);
}

.terminal-line.stage {
  color: #d7f3ea;
  border-left-color: rgba(16, 163, 127, 0.52);
  background: linear-gradient(90deg, rgba(16, 163, 127, 0.08), transparent 58%);
}

.terminal-line.working {
  color: #d7d7d7;
  position: relative;
  border-left-color: rgba(16, 163, 127, 0.42);
  background:
    linear-gradient(
      90deg,
      rgba(16, 163, 127, 0.045) 0%,
      rgba(255, 255, 255, 0.07) 22%,
      rgba(16, 163, 127, 0.045) 44%,
      transparent 68%
    );
  background-size: 240% 100%;
  animation: working-sweep 2.8s linear infinite;
  will-change: background-position;
}

.terminal-line.working::after {
  content: "";
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 0.4ch;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.36;
  vertical-align: -0.14em;
  animation: working-cursor 1.15s steps(2, end) infinite;
}

.terminal-line.trace {
  color: #a8a8a8;
}

.terminal-line.dim {
  color: #7f7f7f;
}

@keyframes working-sweep {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@keyframes working-cursor {
  0%, 46% { opacity: 0.36; }
  47%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-line.working,
  .terminal-line.working::after {
    animation: none;
  }
}

.ansi-bold { font-weight: 600; }
.ansi-dim { opacity: 0.72; }
.ansi-italic { font-style: italic; }
.ansi-underline {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.ansi-fg-black { color: var(--ansi-black); }
.ansi-fg-red { color: var(--ansi-red); }
.ansi-fg-green { color: var(--ansi-green); }
.ansi-fg-yellow { color: var(--ansi-yellow); }
.ansi-fg-blue { color: var(--ansi-blue); }
.ansi-fg-magenta { color: var(--ansi-magenta); }
.ansi-fg-cyan { color: var(--ansi-cyan); }
.ansi-fg-white { color: var(--ansi-white); }

.ansi-bg-black { background: rgba(127, 142, 163, 0.12); }
.ansi-bg-red { background: rgba(255, 159, 159, 0.14); }
.ansi-bg-green { background: rgba(147, 245, 180, 0.14); }
.ansi-bg-yellow { background: rgba(253, 230, 138, 0.14); }
.ansi-bg-blue { background: rgba(199, 210, 254, 0.12); }
.ansi-bg-magenta { background: rgba(201, 178, 255, 0.14); }
.ansi-bg-cyan { background: rgba(133, 242, 242, 0.14); }
.ansi-bg-white { background: rgba(237, 244, 252, 0.12); }

.composer-shell {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "nav chat keys"
    "need need need"
    "composer composer composer";
  align-items: end;
  justify-content: stretch;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(23, 23, 23, 0), rgba(23, 23, 23, 0.94) 30%, rgba(23, 23, 23, 1));
}

.need-input-card {
  grid-area: need;
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(250, 204, 21, 0.28);
  border-radius: 8px;
  background: rgba(38, 38, 32, 0.96);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.32);
}

.need-input-head {
  min-width: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.need-input-kicker {
  color: #fde68a;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.need-input-label {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.need-input-instruction {
  color: rgba(236, 236, 236, 0.76);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.need-input-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.need-input-value,
.need-input-clarify {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: rgba(24, 24, 24, 0.92);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.need-input-value {
  height: 36px;
  padding: 0 10px;
}

.need-input-clarify {
  min-height: 34px;
  max-height: 90px;
  resize: vertical;
  padding: 8px 10px;
  line-height: 1.3;
}

.need-input-value:focus,
.need-input-clarify:focus {
  border-color: rgba(16, 163, 127, 0.5);
}

.need-input-submit,
.need-input-actions button {
  height: 36px;
  border: 1px solid rgba(16, 163, 127, 0.36);
  border-radius: 8px;
  background: rgba(16, 163, 127, 0.16);
  color: #c8ffe8;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.need-input-submit {
  padding: 0 13px;
}

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

.need-input-actions button {
  padding: 0 11px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(236, 236, 236, 0.9);
}

.need-input-cancel {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.need-input-submit:hover,
.need-input-actions button:hover,
.need-input-cancel:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.11);
}

.need-input-submit:disabled,
.need-input-actions button:disabled,
.need-input-cancel:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.need-input-error {
  min-width: 0;
  color: #fecaca;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.attachment-preview {
  grid-area: attachments;
  position: relative;
  margin: 0 0 4px 2px;
  display: grid;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  scrollbar-width: thin;
}

.attachment-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.attachment-strip-summary {
  min-width: 0;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: rgba(236, 236, 236, 0.72);
}

.attachment-strip-clear {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(163, 163, 163, 0.9);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.attachment-strip-clear:hover {
  color: var(--text);
}

.attachment-strip-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.attachment-strip-list::-webkit-scrollbar {
  height: 6px;
}

.attachment-strip-list::-webkit-scrollbar-track {
  background: transparent;
}

.attachment-strip-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.attachment-chip {
  position: relative;
  flex: 0 0 auto;
  width: 148px;
  min-height: 94px;
  padding: 26px 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--control-border);
  background: rgba(31, 31, 31, 0.9);
  scroll-snap-align: start;
  outline: none;
  cursor: default;
  user-select: none;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.attachment-chip:active {
  cursor: default;
}

.attachment-chip-image {
  padding: 22px 8px 8px;
}

.attachment-chip:hover,
.attachment-chip:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(42, 42, 42, 0.92);
}

.attachment-chip-selected {
  border-color: rgba(16, 163, 127, 0.36);
  background: rgba(42, 42, 42, 0.96);
  box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.08);
}

.attachment-chip-dragging {
  opacity: 0.55;
  transform: scale(0.985);
  cursor: grabbing;
}

.attachment-chip-dragover {
  border-color: rgba(16, 163, 127, 0.42);
  box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.12);
}

.attachment-chip-drop-before::before,
.attachment-chip-drop-after::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.2), 0 0 14px rgba(16, 163, 127, 0.28);
  pointer-events: none;
  z-index: 3;
}

.attachment-chip-drop-before::before {
  left: -6px;
}

.attachment-chip-drop-after::after {
  right: -6px;
}

.attachment-index {
  position: absolute;
  top: 7px;
  left: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e8e8e8;
  font-size: 11px;
  font-weight: 600;
}

.attachment-drag-handle {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 30px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(246, 246, 246, 0.9);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.95;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.attachment-drag-handle:active {
  cursor: grabbing;
}

.attachment-chip:hover .attachment-drag-handle,
.attachment-chip:focus-visible .attachment-drag-handle,
.attachment-chip-selected .attachment-drag-handle {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  opacity: 1;
}

.attachment-file-icon {
  font-size: 12px;
  color: #dedede;
}

.attachment-meta {
  display: grid;
  gap: 4px;
  padding-top: 6px;
}

.attachment-path {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.attachment-thumb {
  display: block;
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.attachment-name {
  padding: 6px 26px 0 0;
  overflow: hidden;
  line-height: 1.35;
  word-break: break-word;
  color: #e7e7e7;
}

.attachment-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(246, 246, 246, 0.9);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
  pointer-events: auto;
  transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease;
}

.attachment-remove:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.attachment-chip:hover .attachment-remove,
.attachment-chip:focus-visible .attachment-remove,
.attachment-chip-selected .attachment-remove {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none), (max-width: 720px) {
  .attachment-drag-handle,
  .attachment-remove {
    opacity: 1;
  }

  .attachment-remove {
    pointer-events: auto;
  }
}

.composer {
  grid-area: composer;
  margin: 0;
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "tools input mode send"
    ". attachments attachments .";
  align-items: end;
  gap: 6px;
  padding: 6px 8px 7px;
  border-radius: 14px;
  border: 1px solid var(--control-border);
  background: rgba(35, 35, 35, 0.9);
  backdrop-filter: blur(12px);
}

.composer-left {
  grid-area: tools;
  display: flex;
  gap: 6px;
  align-items: end;
}

.mode-toggle-button {
  grid-area: mode;
  align-self: end;
  height: 38px;
  min-width: 62px;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 520;
  font-stretch: condensed;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  will-change: background-color, border-color, color, box-shadow;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.mode-toggle-button:hover {
  background: var(--control-hover);
  border-color: var(--control-border-hover);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.08);
}

.mode-toggle-button.is-syncing {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 10px 30px rgba(0, 0, 0, 0.22);
}

.mode-toggle-button.mode-toggle-agent {
  color: #d8fff1;
  border-color: rgba(16, 163, 127, 0.26);
  background: rgba(16, 163, 127, 0.095);
}

.mode-toggle-button.mode-toggle-plan {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.28);
  background: rgba(250, 204, 21, 0.11);
}

.mode-toggle-button.mode-toggle-agent:hover {
  border-color: rgba(16, 163, 127, 0.42);
  background: rgba(16, 163, 127, 0.15);
  color: #f0fff8;
}

.mode-toggle-button.mode-toggle-plan:hover {
  border-color: rgba(250, 204, 21, 0.46);
  background: rgba(250, 204, 21, 0.18);
  color: #fff7cc;
}

.mode-toggle-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--control-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.icon-button:hover {
  background: var(--control-hover);
  border-color: var(--control-border-hover);
}

.icon-button.busy {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--control-active);
}

.attach-button {
  align-self: end;
}

.session-button.free {
  color: #86efac;
  border-color: rgba(16, 163, 127, 0.3);
}

.session-button.locked {
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.24);
}

.session-button.active {
  color: var(--accent);
  border-color: rgba(255, 255, 255, 0.2);
}

.composer-input {
  grid-area: input;
  width: 100%;
  min-height: 38px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.52;
  font-weight: 400;
  padding: 10px 6px 8px;
  scrollbar-color: transparent transparent;
  scrollbar-width: none;
}

.composer-input::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.composer-input-scrollable {
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  scrollbar-width: thin;
}

.composer-input-scrollable::-webkit-scrollbar {
  width: 6px;
  height: 0;
}

.composer-input-scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.composer-input-scrollable::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.composer-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.send-button {
  grid-area: send;
  align-self: end;
  background: var(--control-active);
}

.composer-expanded {
  align-items: stretch;
  grid-template-areas:
    "input input input input"
    "tools . mode send"
    "attachments attachments attachments attachments";
}

.composer-expanded .composer-left {
  align-self: stretch;
  flex-direction: column;
  justify-content: flex-end;
}

.composer-expanded .composer-input {
  min-height: 92px;
  padding-left: 8px;
  padding-right: 8px;
}

.composer:has(.composer-input:placeholder-shown):not(:has(.attachment-preview:not(.hidden))) {
  align-items: end;
}

.composer:has(.composer-input:placeholder-shown):not(:has(.attachment-preview:not(.hidden))) .composer-left {
  align-self: end;
  flex-direction: row;
  justify-content: flex-start;
}

.composer:has(.composer-input:placeholder-shown):not(:has(.attachment-preview:not(.hidden))) .composer-input {
  height: 38px !important;
  min-height: 38px;
  padding-left: 6px;
  padding-right: 6px;
}

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

.popover {
  position: absolute;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 6px;
  padding: 8px;
  min-width: 220px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(35, 35, 35, 0.98);
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
}

#attachMenu { left: 16px; }
#sessionMenu {
  position: fixed;
  z-index: 30;
  right: var(--session-menu-right, calc(12px + env(safe-area-inset-right)));
  bottom: var(--session-menu-bottom, calc(var(--composer-shell-height, 0px) + 66px));
  width: min(360px, calc(100vw - 28px));
  max-height: var(--session-menu-max-height, min(72vh, calc(100dvh - var(--composer-shell-height, 0px) - 76px)));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.popover button {
  border: 0;
  border-radius: 9px;
  padding: 10px 12px;
  text-align: left;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
}

.popover button:hover {
  background: rgba(255,255,255,0.06);
}

.popover button.active {
  background: var(--control-active);
  color: #f4f4f4;
}

.popover button:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  background: rgba(255,255,255,0.02);
}

.popover .workspace-action-group {
  gap: 6px;
}

.popover .workspace-action-group summary,
.popover .workspace-action {
  min-height: 34px;
  border: 1px solid var(--control-border);
  border-radius: 9px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
}

.popover .workspace-action-group summary {
  font-weight: 600;
  background: rgba(255,255,255,0.045);
}

.popover .workspace-action-group summary span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.popover .workspace-action-group summary span::before {
  content: "";
  width: 6px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--soft-accent);
  box-shadow: 0 0 18px rgba(16, 163, 127, 0.28);
}

.popover .session-agent-session-group summary span::before {
  background: #c7d2fe;
  box-shadow: 0 0 18px rgba(199, 210, 254, 0.22);
}

.popover .session-audit-group summary span::before {
  background: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.22);
}

.popover .session-services-group summary span::before {
  background: #93c5fd;
  box-shadow: 0 0 18px rgba(147, 197, 253, 0.2);
}

.popover .workspace-action {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  min-width: 0;
  white-space: normal;
}

.popover .workspace-action-label,
.popover .workspace-action-text-only span {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.popover .workspace-action-group-body {
  padding: 6px 0 0 10px;
  margin-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.1);
}

.popover .workspace-action-primary {
  border-color: rgba(16, 163, 127, 0.34);
  background: rgba(16, 163, 127, 0.12);
  font-weight: 600;
}

.popover .workspace-action-primary:hover {
  background: rgba(16, 163, 127, 0.18);
}

.popover .session-audit-group .workspace-action-primary {
  border-color: rgba(250, 204, 21, 0.34);
  background: rgba(250, 204, 21, 0.12);
  color: #fff7cc;
}

.popover .session-audit-group .workspace-action-primary:hover {
  background: rgba(250, 204, 21, 0.18);
}

.session-mode-actions,
.session-agent-provider-actions {
  display: grid;
  gap: 6px;
}

.session-agent-provider-actions {
  margin-top: 6px;
}

.terminal-choice-remote {
  position: relative;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.composer-controls {
  grid-area: keys;
  align-self: end;
  justify-self: end;
  z-index: 6;
  display: inline-flex;
  align-items: end;
  justify-content: flex-end;
  gap: 4px;
}

.terminal-choice-tab,
.terminal-choice-space,
.terminal-choice-step,
.terminal-choice-enter {
  height: 38px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: rgba(35, 35, 35, 0.92);
  color: var(--text);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.terminal-choice-tab {
  min-width: 52px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 540;
  font-stretch: normal;
}

.terminal-choice-space {
  min-width: 74px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 540;
  font-stretch: normal;
}

.terminal-choice-step {
  width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 620;
  line-height: 1;
}

.terminal-choice-enter {
  width: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  font-weight: 520;
  line-height: 1;
}

.terminal-choice-enter-icon {
  display: block;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-0.5px);
}

.terminal-choice-remote.enter-visible .terminal-choice-enter {
  border-color: rgba(16, 163, 127, 0.4);
  background: rgba(16, 163, 127, 0.16);
}

.terminal-choice-remote.plan-execute-ready .terminal-choice-enter {
  border-color: rgba(250, 204, 21, 0.58);
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(250, 204, 21, 0.12);
}

.terminal-choice-tab:hover,
.terminal-choice-space:hover,
.terminal-choice-step:hover,
.terminal-choice-enter:hover {
  background: var(--control-hover);
  border-color: var(--control-border-hover);
}

.terminal-choice-tab:disabled,
.terminal-choice-space:disabled,
.terminal-choice-step:disabled,
.terminal-choice-enter:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.opera-sidebar-surface .app {
  min-width: 0;
}

.opera-sidebar-surface .terminal-viewport {
  margin: 0;
  padding: 4px 3px 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.opera-sidebar-surface .terminal-pre {
  padding: 8px 2px calc(var(--composer-shell-height) + 68px);
  font-size: 16px;
  line-height: 1.34;
}

.opera-sidebar-surface .terminal-line {
  padding-left: 3px;
}

.opera-sidebar-surface .workspace-button {
  width: 38px;
  height: 38px;
}

body.opera-sidebar-surface .workspace-sidebar:not(.hidden) ~ .terminal-shell .terminal-session-button {
  display: none;
}

body.opera-sidebar-surface .workspace-sidebar:not(.hidden) ~ .terminal-shell .terminal-choice-remote,
body.opera-sidebar-surface .workspace-sidebar:not(.hidden) ~ .terminal-shell .terminal-auto-quality-button {
  display: none !important;
}

.opera-sidebar-surface .terminal-plan-badge {
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  font-weight: 520;
  font-stretch: condensed;
}

.opera-sidebar-surface .terminal-agent-badge {
  font-weight: 520;
  font-stretch: condensed;
}


.opera-sidebar-surface .jump-to-latest {
  bottom: calc(var(--composer-shell-height) + 5.5cm + env(safe-area-inset-bottom));
  width: 42px;
  height: 42px;
}

.opera-sidebar-surface .composer-shell {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "nav chat keys"
    "need need need"
    "composer composer composer";
  justify-content: stretch;
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.opera-sidebar-surface .active-workspace-shell {
  justify-self: start;
  width: 100%;
  max-width: 100%;
}

.opera-sidebar-surface .active-workspace-bar {
  width: 100%;
  max-width: 100%;
}

.opera-sidebar-surface .active-workspace-name-button {
  width: 100%;
  padding-left: 8px;
}

.opera-sidebar-surface .workspace-quick-menu {
  left: calc(6px + env(safe-area-inset-left));
  right: calc(6px + env(safe-area-inset-right));
  width: auto;
  max-height: min(54vh, calc(100dvh - var(--composer-shell-height) - 32px));
}

.opera-sidebar-surface .composer {
  margin: 0;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "tools input mode send"
    "attachments attachments attachments attachments";
  padding: 6px 7px 7px;
  border-radius: 12px;
}

.opera-sidebar-surface .composer-expanded {
  grid-template-areas:
    "input input input input"
    "tools . mode send"
    "attachments attachments attachments attachments";
}

.opera-sidebar-surface .composer-left {
  display: flex;
}

.opera-sidebar-surface .mode-toggle-button {
  min-width: 54px;
  padding: 0 8px;
  font-size: 13px;
}

.opera-sidebar-surface .terminal-choice-tab {
  font-weight: 540;
  font-stretch: normal;
}

.opera-sidebar-surface .terminal-auto-quality-button {
  width: 50px;
  height: 28px;
  padding: 0 4px;
  font-size: 12px;
}

.opera-sidebar-surface .terminal-auto-quality-button.terminal-continue-next-badge {
  width: 58px;
}

.opera-sidebar-surface .composer-input {
  min-height: 38px;
  max-height: 150px;
  padding: 9px 6px 7px;
  font-size: 16px;
  line-height: 1.42;
}

.opera-sidebar-surface .icon-button {
  width: 38px;
  height: 38px;
}

.opera-sidebar-surface #sessionMenu {
  right: var(--session-menu-right, calc(6px + env(safe-area-inset-right)));
  bottom: var(--session-menu-bottom, calc(var(--composer-shell-height, 0px) + 48px));
  width: min(320px, calc(100vw - 12px));
  max-height: var(--session-menu-max-height, min(72vh, calc(100dvh - var(--composer-shell-height) - 58px)));
}

@media (max-width: 900px) {
  .login-screen {
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .login-card {
    width: min(360px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 22px;
  }

  .composer-shell {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "nav chat keys"
      "need need need"
      "composer composer composer";
    align-items: end;
    gap: 4px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .terminal-viewport {
    margin-right: 0;
    margin-left: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .terminal-pre {
    padding-right: 4px;
    padding-left: 4px;
  }

  .composer {
    width: 100%;
    margin: 0;
  }

  .workspace-quick-menu {
    position: fixed;
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(var(--composer-shell-height) + 8px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(46vh, calc(100dvh - var(--composer-shell-height) - 24px));
  }

  .need-input-card {
    width: 100%;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .need-input-row,
  .need-input-actions {
    grid-template-columns: 1fr;
  }

  .need-input-submit,
  .need-input-actions button {
    width: 100%;
  }

  .app.workspace-sidebar-docked .terminal-shell {
    margin-left: 0;
  }

  .app.workspace-sidebar-docked .workspace-sidebar {
    width: min(560px, 100vw);
    min-width: 0;
    max-width: none;
    box-shadow: 24px 0 80px rgba(0, 0, 0, 0.42);
  }

  .app.workspace-sidebar-docked .workspace-sidebar-resizer {
    display: none;
  }

  .active-workspace-shell {
    position: relative;
    right: auto;
    bottom: auto;
    justify-self: start;
    width: min(460px, 100%);
    max-width: 100%;
  }

  .active-workspace-bar {
    width: min(460px, 100%);
    max-width: 100%;
    overflow: hidden;
    text-align: left;
  }

  .composer-controls {
    justify-self: end;
  }

  #sessionMenu {
    left: auto;
    right: var(--session-menu-right, calc(14px + env(safe-area-inset-right)));
    width: min(360px, calc(100vw - 28px));
    bottom: var(--session-menu-bottom, calc(var(--composer-shell-height, 0px) + 66px));
    max-height: var(--session-menu-max-height, min(62vh, calc(100dvh - var(--composer-shell-height, 0px) - 76px)));
    overflow-y: auto;
  }

  .active-workspace-name {
    font-size: 15px;
  }

  .terminal-choice-tab,
  .terminal-choice-step,
  .terminal-choice-space {
    min-width: 44px;
    padding: 0 9px;
  }

  .terminal-choice-step {
    min-width: 38px;
    padding: 0;
  }

  .terminal-choice-space {
    min-width: 64px;
  }

  .terminal-choice-enter-icon {
    font-size: 20px;
  }

  .terminal-pre {
    overflow-x: hidden;
  }

  .terminal-line {
    width: 100%;
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .terminal-pre {
    padding-bottom: calc(var(--composer-shell-height) + 64px);
  }

  .attachment-preview {
    padding: 6px 6px 8px;
  }

  .attachment-chip {
    width: 132px;
    min-height: 88px;
  }

  .attachment-thumb {
    height: 54px;
  }

  .jump-to-latest {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(var(--composer-shell-height) + 4cm + env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .platform-memory-tools {
    grid-template-columns: 1fr;
  }
}

body.phone-surface .workspace-sidebar {
  padding-bottom: max(84px, calc(12px + env(safe-area-inset-bottom)));
}

body.phone-surface .workspace-sidebar:not(.hidden) ~ .terminal-shell .terminal-choice-remote,
body.phone-surface .workspace-sidebar:not(.hidden) ~ .terminal-shell .terminal-auto-quality-button {
  display: none !important;
}
