:root {
  --bg-app: #f2f3f5;
  --bg-sidebar: #eef0f3;
  --bg-sidebar-alt: #f4f6fa;
  --bg-panel: #ffffff;
  --bg-hover: #e8ebf0;
  --bg-active: #dde4ee;
  --edge: #d7dce3;
  --edge-strong: #c8ced9;
  --ink-main: #151c2b;
  --ink-muted: #596070;
  --ink-soft: #798197;
  --accent: #1f6fff;
  --accent-strong: #1258cf;
  --danger: #d14a57;
  --success: #2f8f5a;
  --left-sidebar-width: clamp(220px, 21vw, 280px);
  --right-sidebar-width: clamp(280px, 26vw, 360px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  color: var(--ink-main);
  background: radial-gradient(circle at 8% 8%, #f9fbff 0%, #f2f3f5 42%, #eceef2 100%);
  font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

body {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

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

.window-shell {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--left-sidebar-width) minmax(0, 1fr) var(--right-sidebar-width);
  transition: grid-template-columns 180ms ease;
}

.window-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) var(--right-sidebar-width);
}

.window-shell.right-sidebar-collapsed {
  grid-template-columns: var(--left-sidebar-width) minmax(0, 1fr) 0;
}

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

.sidebar-toggle {
  position: absolute;
  top: 14px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink-muted);
  cursor: pointer;
  z-index: 10;
  display: grid;
  place-items: center;
  transition: left 180ms ease, right 180ms ease, transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.sidebar-toggle-left {
  left: calc(var(--left-sidebar-width) - 14px);
}

.sidebar-toggle-right {
  right: calc(var(--right-sidebar-width) - 14px);
}

.sidebar-toggle:hover {
  background: #f3f6fb;
  border-color: #bfd0f1;
}

.sidebar-toggle:active {
  transform: scale(0.96);
}

.sidebar-toggle span {
  font-size: 0.9rem;
  line-height: 1;
}

.window-shell.sidebar-collapsed .sidebar-toggle-left {
  left: 8px;
}

.window-shell.sidebar-collapsed .sidebar-toggle-left span {
  transform: scaleX(-1);
}

.window-shell.right-sidebar-collapsed .sidebar-toggle-right {
  right: 8px;
}

.window-shell.right-sidebar-collapsed .sidebar-toggle-right span {
  transform: scaleX(-1);
}

.settings-anchor {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink-muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.settings-anchor:hover {
  background: #f3f6fb;
  border-color: #bfd0f1;
  color: var(--ink-main);
}

.settings-anchor:active {
  transform: scale(0.96);
}

.settings-anchor.is-active {
  border-color: #9db7ea;
  background: #edf3ff;
  color: #1f4f9b;
}

.settings-anchor span {
  font-size: 1rem;
  line-height: 1;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border-right: 1px solid var(--edge);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.52), rgba(238, 240, 243, 0.82)),
    repeating-linear-gradient(180deg, transparent, transparent 24px, rgba(255, 255, 255, 0.22) 24px, rgba(255, 255, 255, 0.22) 25px);
  padding: 14px 10px;
  gap: 16px;
  overflow: hidden;
  transition: opacity 140ms ease, padding 140ms ease, border-color 140ms ease;
}

.window-shell.sidebar-collapsed .sidebar {
  opacity: 0;
  padding: 0;
  gap: 0;
  border-right-color: transparent;
  pointer-events: none;
}

.right-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  border-left: 1px solid var(--edge);
  background:
    linear-gradient(190deg, rgba(255, 255, 255, 0.74), rgba(244, 246, 250, 0.92)),
    repeating-linear-gradient(180deg, transparent, transparent 26px, rgba(255, 255, 255, 0.2) 26px, rgba(255, 255, 255, 0.2) 27px);
  padding: 12px 10px;
  overflow: hidden;
  min-width: 0;
  transition: opacity 140ms ease, padding 140ms ease, border-color 140ms ease;
}

.right-sidebar-content {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.window-shell.right-sidebar-collapsed .right-sidebar {
  opacity: 0;
  padding: 0;
  gap: 0;
  border-left-color: transparent;
  pointer-events: none;
}

.right-sidebar-head {
  display: grid;
  gap: 2px;
  padding: 0 2px 6px;
  border-bottom: 1px solid rgba(215, 220, 227, 0.85);
}

.right-sidebar-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.right-sidebar-project {
  font-size: 0.85rem;
  color: var(--ink-main);
  overflow-wrap: anywhere;
}

.sidebar-panel {
  flex: 0 0 auto;
  border: 0;
  border-top: 1px solid rgba(215, 220, 227, 0.9);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  min-height: 0;
  padding-top: 12px;
}

.right-sidebar-content > .sidebar-panel:first-child {
  border-top: 0;
  padding-top: 0;
}

.sidebar-panel-explorer {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.sidebar-panel-explorer.is-collapsed {
  flex: 0 0 auto;
  grid-template-rows: auto;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-panel-toggle {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  color: var(--ink-main);
  font-weight: 600;
  min-width: 0;
}

.sidebar-panel-toggle:hover {
  background: transparent;
  color: var(--accent-strong);
}

.sidebar-panel-toggle-text {
  letter-spacing: 0.02em;
}

.sidebar-panel-toggle-indicator {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1;
}

.sidebar-panel-body {
  border-top: 0;
  padding: 8px 0 0;
  display: grid;
  gap: 8px;
  min-height: 0;
}

.sidebar-panel-explorer .sidebar-panel-body {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.sidebar-panel.is-collapsed .sidebar-panel-body {
  display: none;
}

.sidebar-icon-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.sidebar-icon-btn:hover {
  border-color: var(--edge);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-main);
}

.sidebar-icon-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.sidebar-search-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink-main);
  padding: 7px 9px;
  font-size: 0.8rem;
}

.sidebar-search-input:focus {
  outline: none;
  border-color: #b8ccf0;
  box-shadow: 0 0 0 1px rgba(31, 111, 255, 0.12);
}

.sidebar-search-input:disabled {
  background: rgba(248, 250, 253, 0.9);
  color: var(--ink-soft);
}

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

.sidebar-search-status {
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.sidebar-search-nav {
  display: flex;
  gap: 4px;
}

.sidebar-search-summary {
  margin: 0;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

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

.sidebar-panel-copy {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(140deg, #5b95ff, #89b5ff);
  box-shadow: 0 0 0 2px rgba(31, 111, 255, 0.2);
}

.brand-name {
  font-size: 1.07rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.primary-nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-main);
  border-radius: 9px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.nav-btn:hover:enabled {
  background: var(--bg-hover);
}

.nav-btn:disabled {
  color: var(--ink-soft);
  cursor: not-allowed;
}

.nav-btn-primary {
  background: var(--bg-panel);
  border-color: var(--edge);
}

.project-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.project-list {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.project-row {
  position: relative;
  margin-bottom: 7px;
}

.project-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  padding: 9px 64px 9px 10px;
  cursor: pointer;
  color: var(--ink-main);
}

.project-item:hover {
  background: var(--bg-hover);
}

.project-item.active {
  background: var(--bg-active);
  border-color: var(--edge-strong);
}

.project-name {
  display: block;
  font-size: 0.86rem;
  line-height: 1.25;
}

.project-description {
  display: block;
  margin-top: 3px;
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--ink-muted);
}

.project-meta {
  display: block;
  margin-top: 3px;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.project-icon-btn {
  position: absolute;
  top: 7px;
  width: 22px;
  min-width: 22px;
  height: 22px;
  border: 1px solid #c8d3e8;
  border-radius: 999px;
  background: #ffffff;
  color: #3e567f;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 0.74rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity 140ms ease, transform 140ms ease, background 120ms ease, border-color 120ms ease;
}

.project-edit-btn {
  right: 33px;
}

.project-remove-btn {
  right: 7px;
  border-color: #e2c4ca;
  color: #8e4651;
}

.project-row:hover .project-icon-btn,
.project-row:focus-within .project-icon-btn {
  opacity: 1;
  transform: translateY(0);
}

.project-item.active ~ .project-icon-btn {
  opacity: 1;
  transform: translateY(0);
}

.project-icon-btn:hover {
  background: #f1f5fd;
  border-color: #a9bddf;
}

.project-remove-btn:hover {
  background: #fff1f2;
  border-color: #d89ea7;
}

.project-icon-btn:focus-visible {
  opacity: 1;
  outline: 2px solid #7ca4f4;
  outline-offset: 1px;
}

.project-add-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-footer {
  border-top: 1px solid var(--edge);
  padding: 12px 8px 0;
  display: grid;
  gap: 9px;
}

.sidebar-footer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.status-line {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  min-height: 1.1rem;
  line-height: 1.35;
}

.status-line.error {
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0)),
    var(--bg-app);
}

.workspace-view {
  display: contents;
  min-height: 0;
}

.workspace-view.hidden {
  display: none !important;
}

.chat-panel {
  display: contents;
}

.settings-page {
  min-height: 0;
  overflow: auto;
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 16px;
}

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

.settings-page-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.settings-page-head p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.settings-card {
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 40px rgba(21, 28, 43, 0.08);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.settings-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.settings-card-head h2 {
  margin: 0;
  font-size: 1rem;
}

.settings-card-head p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.settings-close-btn {
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}

.settings-callout {
  border: 1px solid #cfdcf5;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(237, 243, 255, 0.92), rgba(249, 251, 255, 0.92));
  color: #355481;
  padding: 12px 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.settings-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-info {
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.settings-label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.settings-value {
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-main);
}

.settings-mono {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 0.78rem;
  color: #28456e;
}

.workspace-header {
  border-bottom: 1px solid var(--edge);
  padding: 16px 20px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 14px;
}

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

.title-wrap h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.badge-row {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-size: 0.77rem;
  color: var(--ink-muted);
  background: #f7f8fa;
  padding: 4px 10px;
}

.chat-token-count {
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-size: 0.77rem;
  color: var(--ink-muted);
  background: #f7f8fa;
  padding: 4px 10px;
  white-space: nowrap;
}

.clear-chat-btn {
  white-space: nowrap;
  border-color: #d9c0c5;
  background: #fff8f8;
  color: #8b4250;
}

.view-context-btn {
  white-space: nowrap;
}

.clear-chat-btn:hover:enabled {
  background: #ffeef0;
  border-color: #cfafb6;
  color: #73313d;
}

.clear-chat-btn:disabled {
  border-color: var(--edge);
  background: #fff;
  color: var(--ink-soft);
}

.action-row {
  display: flex;
  gap: 8px;
}

.action-btn {
  border: 1px solid var(--edge);
  background: var(--bg-panel);
  color: var(--ink-main);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

.action-btn:hover:enabled {
  background: #f3f6fb;
}

.action-btn:disabled {
  color: var(--ink-soft);
  cursor: not-allowed;
}

.action-btn-primary {
  background: linear-gradient(155deg, #2a78ff, var(--accent-strong));
  border-color: #2a78ff;
  color: #fff;
}

.action-btn-primary:hover:enabled {
  background: linear-gradient(155deg, #3680ff, #2469e0);
}

.conversation {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 13px;
}

.message {
  max-width: min(880px, 95%);
  border: 1px solid var(--edge);
  border-radius: 13px;
  padding: 11px 12px;
  background: var(--bg-panel);
  box-shadow: 0 1px 2px rgba(18, 33, 59, 0.05);
}

.message-user {
  margin-left: auto;
  border-color: #b9cef8;
  background: #edf3ff;
}

.message-assistant {
  border-color: var(--edge);
}

.message-event {
  border-color: #cfd7e5;
  background: #f8fafc;
}

.message-error {
  border-color: #f0bcc2;
  background: #fff5f6;
}

.message-notice {
  margin: 2px auto;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 2px 8px;
}

.notice-text {
  margin: 0;
  color: #8a92a5;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.35;
}

.message-pending {
  border-color: #c7d7f4;
  background: linear-gradient(160deg, #f8fbff, #eef4ff);
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 5px;
}

.message-role {
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 600;
}

.message-time {
  color: var(--ink-soft);
  font-size: 0.73rem;
}

.message-body {
  margin: 0;
  display: grid;
  gap: 10px;
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.44;
  font-size: 0.92rem;
}

.message-code {
  margin: 0;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #32415f;
  background: #0f1728;
  color: #dce7ff;
  padding: 10px 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
}

.message-code[data-lang]::before {
  content: attr(data-lang);
  display: block;
  margin-bottom: 8px;
  color: #96acd7;
  font-size: 0.72rem;
  text-transform: lowercase;
  letter-spacing: 0.03em;
}

.message-code code {
  display: block;
  white-space: pre;
}

.message-details {
  border-top: 1px solid rgba(209, 74, 87, 0.18);
  padding-top: 8px;
}

.message-details-summary {
  cursor: pointer;
  color: #a63e48;
  font-size: 0.82rem;
  font-weight: 600;
  user-select: none;
}

.message-details-summary:hover {
  color: #8d2f39;
}

.message-details-code {
  margin-top: 8px;
}

.message-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3f78da;
  opacity: 0.3;
  animation: typing-bounce 1.05s infinite ease-in-out;
}

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

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.chat-command-card {
  margin: 0;
}

.chat-command-summary {
  display: block;
  cursor: pointer;
  list-style: none;
}

.chat-command-summary::marker {
  content: "";
}

.chat-command-summary::-webkit-details-marker {
  display: none;
}

.chat-command-summary:focus-visible {
  outline: 2px solid #8ab0f0;
  outline-offset: 4px;
  border-radius: 8px;
}

.chat-command-card:not([open]) > .chat-command-summary {
  padding: 4px 0;
}

.chat-command-card[open] {
  border: 1px solid #d7e0ef;
  border-radius: 11px;
  padding: 10px;
  background: #f8fbff;
  display: grid;
  gap: 9px;
}

.chat-command-line {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #36527e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
}

.chat-command-line-state {
  color: #6b7c98;
}

.chat-command-card[data-status="failed"] .chat-command-line,
.chat-command-card[data-status="cancelled"] .chat-command-line {
  color: #a33d46;
}

.chat-command-card[data-status="awaiting-approval"] .chat-command-line,
.chat-command-card[data-status="awaiting-input"] .chat-command-line {
  color: #8a5a00;
}

.chat-command-body {
  display: grid;
  gap: 9px;
}

.chat-command-card[open] > .chat-command-body {
  padding-top: 8px;
  border-top: 1px solid rgba(171, 186, 214, 0.65);
}

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

.chat-command-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #36527e;
}

.chat-command-status {
  font-size: 0.74rem;
  color: #61728f;
}

.chat-command-preview,
.chat-command-output {
  margin: 0;
  border-radius: 9px;
  border: 1px solid #304361;
  background: #0f1728;
  color: #dce7ff;
  padding: 9px 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
}

.chat-command-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.74rem;
  color: #6b7c98;
}

.chat-command-info {
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  color: #445671;
}

.chat-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-command-input-wrap {
  display: grid;
  gap: 8px;
}

.chat-command-input {
  min-height: 82px;
  border-radius: 9px;
  border: 1px solid #c6d3e8;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  resize: vertical;
}

.chat-command-size {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 110px));
  gap: 8px;
}

.chat-command-size input {
  border-radius: 9px;
  border: 1px solid #c6d3e8;
  background: #fff;
  color: var(--ink);
  padding: 8px 9px;
}

.context-view {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
}

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

.context-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.context-view-title {
  font-size: 0.95rem;
  color: var(--ink-main);
}

.context-view-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.context-surface {
  min-height: 0;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: #fbfcfe;
  overflow: hidden;
}

.context-textarea {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  background: transparent;
  color: var(--ink-main);
  padding: 16px 18px;
  resize: none;
  outline: none;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
  line-height: 1.55;
}

.empty-state {
  color: var(--ink-muted);
  font-size: 0.94rem;
  border: 1px dashed var(--edge);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  padding: 14px 15px;
}

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

.explorer-item {
  --depth: 0;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-main);
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px calc(8px + (var(--depth) * 14px));
  cursor: pointer;
  text-align: left;
}

.explorer-item:hover {
  background: var(--bg-hover);
}

.explorer-item.active {
  background: var(--bg-active);
  border-color: var(--edge-strong);
}

.explorer-expander {
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
}

.explorer-item-file .explorer-expander {
  visibility: hidden;
}

.explorer-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.explorer-meta {
  color: #2f6fd5;
  font-size: 0.72rem;
  font-weight: 600;
}

.explorer-branch {
  display: grid;
  gap: 2px;
}

.explorer-children {
  display: grid;
  gap: 2px;
}

.explorer-message {
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  padding: 4px 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.explorer-message-error {
  color: #8e4651;
}

.explorer-search-results {
  display: grid;
  gap: 4px;
}

.explorer-search-result {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-main);
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}

.explorer-search-result:hover {
  background: var(--bg-hover);
}

.explorer-search-result.active {
  background: var(--bg-active);
  border-color: var(--edge-strong);
}

.explorer-search-result-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.explorer-search-result-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.81rem;
  font-weight: 600;
}

.explorer-search-result-kind {
  flex: 0 0 auto;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.explorer-search-result-path {
  font-size: 0.74rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.composer {
  border-top: 1px solid var(--edge);
  background: rgba(250, 251, 253, 0.96);
  padding: 14px 20px 16px;
}

.composer-label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

#goal {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  max-height: 220px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--ink-main);
  background: #ffffff;
}

#goal:focus,
.field input:focus,
.field select:focus,
.configured-form input:focus,
.configured-form select:focus,
.configured-form textarea:focus {
  outline: none;
  border-color: #5d94ff;
  box-shadow: 0 0 0 3px rgba(93, 148, 255, 0.16);
}

.composer-controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.composer-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.field {
  color: var(--ink-muted);
  font-size: 0.8rem;
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.field input,
.field select {
  border: 1px solid var(--edge);
  border-radius: 9px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink-main);
}

.field select {
  min-height: 36px;
}

.field-wide {
  flex: 1 1 380px;
}

.github-field {
  min-width: 280px;
}

.github-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.github-panel-sidebar {
  align-items: stretch;
  flex-direction: column;
}

.github-panel-sidebar .github-state,
.github-panel-sidebar .github-branch-picker,
.github-panel-sidebar .agent-approve-toggle,
.github-panel-sidebar .tiny-btn {
  width: 100%;
}

.github-state {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.github-branch-picker {
  min-width: 180px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-main);
  padding: 5px 8px;
  font-size: 0.8rem;
}

.access-picker {
  min-width: 220px;
}

.access-picker.access-danger {
  color: var(--danger);
  border-color: #d89ea7;
  background: #fff2f4;
  font-weight: 600;
}

.agent-approve-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.77rem;
  line-height: 1.2;
  cursor: pointer;
}

.agent-approve-toggle input {
  margin: 0;
}

.agent-approve-toggle.approve-danger {
  border-color: transparent;
  background: transparent;
  color: #8f4250;
  font-weight: 600;
}

.field-small {
  width: 120px;
}

.model-actions {
  display: flex;
  gap: 7px;
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.icon-btn span {
  font-size: 0.95rem;
  line-height: 1;
}

.model-hint {
  margin: 8px 0 0;
  font-size: 0.79rem;
  color: var(--ink-muted);
  min-height: 1rem;
}

.editor-view {
  grid-row: 2 / span 2;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(248, 250, 253, 0.94);
}

.editor-toolbar {
  border-bottom: 1px solid var(--edge);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(250, 251, 253, 0.96);
}

.editor-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.editor-file-name {
  font-size: 0.95rem;
  line-height: 1.2;
}

.editor-file-path {
  font-size: 0.78rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.editor-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-search-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(420px, 100%);
  flex: 1 1 280px;
}

.editor-search-input {
  min-width: 140px;
  flex: 1 1 180px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-main);
  padding: 7px 9px;
  font-size: 0.8rem;
}

.editor-search-input:focus {
  outline: none;
  border-color: #b8ccf0;
  box-shadow: 0 0 0 1px rgba(31, 111, 255, 0.12);
}

.editor-search-input:disabled {
  background: rgba(248, 250, 253, 0.9);
  color: var(--ink-soft);
}

.editor-search-status {
  min-width: 68px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: right;
  white-space: nowrap;
}

.editor-search-nav {
  display: flex;
  gap: 6px;
}

.editor-surface {
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  background: #f4f7fb;
}

.editor-line-numbers {
  margin: 0;
  padding: 16px 10px 16px 14px;
  border-right: 1px solid #d7dce3;
  background: #edf2f8;
  color: #7a8598;
  text-align: right;
  overflow: hidden;
  user-select: none;
  font-size: 0.82rem;
  line-height: 1.5;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
}

.editor-textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  margin: 0;
  padding: 16px;
  resize: none;
  background: #fbfcfe;
  color: var(--ink-main);
  font-size: 0.84rem;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
}

.editor-textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px #5d94ff;
}

.editor-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.send-btn {
  border: 1px solid var(--accent-strong);
  border-radius: 10px;
  padding: 9px 16px;
  background: linear-gradient(155deg, #2a78ff, #1258cf);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover {
  background: linear-gradient(155deg, #3680ff, #2469e0);
}

.send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.chat-download-btn {
  min-width: 44px;
  padding: 0;
  border-color: #b7c8ec;
  background: #fff;
  color: var(--accent-strong);
  font-size: 1.05rem;
  line-height: 1;
}

.chat-download-btn:hover:enabled {
  background: #eef4ff;
}

.chat-download-btn:disabled {
  border-color: var(--edge);
  background: #f4f7fb;
  color: #9aa6bb;
  opacity: 1;
}

.send-btn.is-stop {
  border-color: #c65555;
  background: linear-gradient(155deg, #d36a6a, #b94e4e);
}

.send-btn.is-stop:hover {
  background: linear-gradient(155deg, #db7272, #c45757);
}

.tiny-btn {
  border: 1px solid var(--edge);
  background: #fff;
  color: var(--ink-muted);
  border-radius: 8px;
  font-size: 0.77rem;
  padding: 5px 8px;
  cursor: pointer;
}

.tiny-btn:hover {
  background: #f6f8fb;
}

.tiny-btn-strong {
  border-color: #b7c8ec;
  color: #2a4f8e;
}

.modal-shell {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 36, 0.28);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 50;
}

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

.modal-card {
  width: min(1150px, 100%);
  max-height: min(860px, 95vh);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--edge-strong);
  background: #f7f9fc;
  box-shadow: 0 20px 60px rgba(20, 33, 55, 0.26);
  padding: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.03rem;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.86rem;
}

.modal-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-panel {
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  min-height: 170px;
}

.modal-panel h3 {
  margin: 0 0 10px;
  font-size: 0.89rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.manager-list {
  display: grid;
  gap: 8px;
}

.manager-empty {
  margin: 0;
  border: 1px dashed var(--edge);
  border-radius: 10px;
  color: var(--ink-muted);
  background: #f9fbff;
  padding: 10px;
  font-size: 0.84rem;
}

.manager-item {
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
}

.manager-item h4 {
  margin: 0;
  font-size: 0.92rem;
}

.manager-item p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.34;
}

.manager-item .chip-row {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: #f3f7ff;
  color: var(--ink-muted);
  font-size: 0.73rem;
  padding: 2px 8px;
}

.manager-item .item-actions {
  margin-top: 10px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.modal-panel-form {
  grid-column: span 2;
}

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

.configured-form label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.configured-form input,
.configured-form select,
.configured-form textarea {
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-main);
  padding: 8px 9px;
}

.configured-form textarea {
  min-height: 72px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.modal-card-wide {
  width: min(1280px, 100%);
}

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

.command-bridge-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 12px;
}

.command-bridge-form textarea {
  min-height: 96px;
}

.command-bridge-size-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.command-bridge-output-panel {
  min-height: 520px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.command-bridge-meta {
  display: grid;
  gap: 8px;
}

.command-bridge-session {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.command-bridge-diagnostics {
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: #f6f8fc;
  color: var(--ink-main);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-bridge-output {
  margin: 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid #32415f;
  border-radius: 10px;
  background: #0f1728;
  color: #dce7ff;
  padding: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-bridge-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.command-bridge-input-actions {
  display: grid;
  gap: 8px;
}

.command-bridge-input-row textarea {
  min-height: 72px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-main);
  padding: 8px 9px;
  resize: vertical;
}

@media (max-width: 860px) {
  .window-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .window-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 0 minmax(0, 1fr) auto;
  }

  .window-shell.right-sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) 0;
  }

  .window-shell.sidebar-collapsed.right-sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 0 minmax(0, 1fr) 0;
  }

  .sidebar-toggle-left {
    left: 8px;
  }

  .sidebar-toggle-right {
    right: 8px;
    top: auto;
    bottom: 8px;
  }

  .sidebar {
    grid-row: 1;
    grid-template-rows: auto auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--edge);
  }

  .right-sidebar {
    grid-row: 3;
    border-left: 0;
    border-top: 1px solid var(--edge);
    max-height: 280px;
  }

  .right-sidebar-content {
    padding-right: 0;
  }

  .project-panel {
    display: none;
  }

  .sidebar-footer {
    border-top: 0;
    padding: 0 8px 10px;
  }

  .workspace {
    grid-row: 2;
    min-height: 0;
  }

  .workspace-header {
    padding: 12px 14px;
  }

  .conversation {
    padding: 14px;
  }

  .settings-page {
    padding: 14px;
  }

  .settings-page-head {
    align-items: center;
  }

  .composer {
    padding: 12px 14px;
  }

  .composer-actions {
    margin-left: 0;
  }

  .editor-toolbar {
    padding: 12px 14px;
    align-items: flex-start;
  }

  .editor-surface {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .settings-info-grid {
    grid-template-columns: 1fr;
  }

  .modal-panel-form {
    grid-column: auto;
  }

  .command-bridge-layout {
    grid-template-columns: 1fr;
  }

  .command-bridge-input-row {
    grid-template-columns: 1fr;
  }

  .command-bridge-size-grid {
    grid-template-columns: 1fr;
  }

  .editor-prompt-actions {
    justify-content: stretch;
  }

  .editor-prompt-actions .action-btn {
    width: 100%;
  }
}
