* {
  box-sizing: border-box;
}

:root {
  --bg-deep: #0d0d0d;
  --bg-panel: #171717;
  --bg-elevated: #1f1f1f;
  --border: rgba(255, 255, 255, 0.09);
  --text: #ececec;
  --text-muted: #8e8e8e;
  --accent: #10a37f;
  --accent-hover: #12b88c;
  --accent-muted: rgba(16, 163, 127, 0.18);
  --danger: #f87171;
  --radius: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar-tight: #171717;
  --chat-surface: #212121;
  /* IDE / workbench (aprox. Cursor / VS Code dark) */
  --ide-bg: #181818;
  --ide-bg-elevated: #1f1f1f;
  --ide-bg-tab: #252526;
  --ide-bg-tab-active: #1e1e1e;
  --ide-border: rgba(255, 255, 255, 0.06);
  --ide-border-strong: rgba(255, 255, 255, 0.1);
  --ide-text: #cccccc;
  --ide-muted: #858585;
  --ide-accent: #0078d4;
  --ide-sidebar: #181818;
  --ide-editor: #1e1e1e;
  --ide-terminal-head: #252526;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #252526;
  border-bottom: 1px solid #3c3c3c;
}

.brand {
  font-weight: 600;
  color: #fff;
  margin-right: 0.5rem;
}

.inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.inline input,
.inline select {
  background: #3c3c3c;
  border: 1px solid #555;
  color: #eee;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
}

.hint {
  font-size: 0.8rem;
  color: #858585;
}

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(16, 163, 127, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s, background 0.12s;
}

.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.primary:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.primary.wide .btn-spinner {
  margin-left: 0;
}

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

.ssh-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--ide-bg-elevated);
  border-bottom: 1px solid var(--ide-border-strong);
}

.ssh-panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--ide-border);
}

.ssh-profile-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ssh-profile-label select {
  min-width: 200px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ide-border-strong);
  color: var(--ide-text);
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  font-size: 0.8rem;
}

.ssh-workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.5rem 0.85rem;
  background: rgba(0, 120, 212, 0.07);
  border-top: 1px solid var(--ide-border);
}

.ssh-ws-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.ssh-ws-path {
  font-size: 0.78rem;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ide-border);
  max-width: min(260px, 46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ssh-ws-input {
  flex: 1;
  min-width: 160px;
  max-width: 440px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ide-border-strong);
  color: var(--ide-text);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.agent-plan-row {
  margin: 0.35rem 0;
  padding: 0.5rem 0.65rem;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: var(--radius);
}

.agent-tool-ico.plan {
  color: #c4b5fd;
}

.agent-plan-head {
  font-size: 0.82rem;
}

.agent-plan-pre {
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
}

.ssh-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--ide-bg-elevated, #2d2d30);
  border-bottom: 1px solid var(--ide-border-strong, #3c3c3c);
  align-items: center;
}

.ssh-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem 0.65rem;
  align-items: start;
  padding: 0.65rem 0.85rem;
}

.ssh-panel-grid .ssh-key-field {
  grid-column: 1 / -1;
}

.ssh-panel-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.ssh-status-line {
  flex: 1;
  min-width: 120px;
}

.ssh-panel input,
.ssh-panel textarea {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ide-border-strong);
  color: var(--ide-text);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  min-width: 120px;
  font-size: 0.8rem;
}

.ssh-panel textarea {
  flex: 1 1 200px;
  min-height: 2.75rem;
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: #252526;
  border-right: 1px solid #3c3c3c;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #3c3c3c;
}

.sidebar-head button {
  background: #3c3c3c;
  border: 1px solid #555;
  color: #ccc;
  border-radius: 3px;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
}

.file-tree {
  overflow: auto;
  flex: 1;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.tree-item {
  padding: 0.2rem 0.5rem 0.2rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item:hover {
  background: #2a2d2e;
}

.tree-item.dir {
  color: #4fc1ff;
}

.tree-item.file {
  color: #ce9178;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.84rem;
}

.tree-row:hover {
  background: #2a2d2e;
}

.tree-row.dir .tree-label {
  color: #4fc1ff;
}

.tree-row.file .tree-label {
  color: #ce9178;
}

.tree-chevron {
  display: inline-block;
  width: 0.75rem;
  font-size: 0.65rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.tree-icon {
  flex-shrink: 0;
}

.tree-row.tree-pulse {
  animation: treeFlash 0.5s ease-out 3;
  background: rgba(59, 130, 246, 0.25);
}

.binary-preview-img {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: contain;
}

.binary-preview.hidden {
  display: none;
}

.monaco-wrap.hidden {
  display: none;
}

.quick-open-card {
  max-width: 520px;
}

.quick-open-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--ide-border-strong, #3c3c3c);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.quick-open-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--ide-text, #e8ecf4);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  cursor: pointer;
}

.quick-open-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

.quick-open-list li:last-child .quick-open-item {
  border-bottom: none;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #1e1e1e;
}

.editor-tabs {
  padding: 0;
  background: var(--ide-bg-tab);
  border-bottom: 1px solid var(--ide-border-strong);
  font-size: 0.8rem;
}

.editor-tabs-bar {
  display: flex;
  align-items: stretch;
  min-height: 2.25rem;
}

.editor-tabs-scroll {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 1px;
  padding: 0 0.25rem;
  align-items: flex-end;
  scrollbar-width: thin;
}

.editor-tabs-scroll::-webkit-scrollbar {
  height: 5px;
}

.editor-tabs-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.editor-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 200px;
  padding: 0.35rem 0.45rem 0.35rem 0.65rem;
  margin-bottom: 0;
  background: var(--ide-bg-tab);
  border: none;
  border-right: 1px solid var(--ide-border-strong);
  border-top: 2px solid transparent;
  color: var(--ide-muted);
  font-family: var(--font);
  font-size: 0.78rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.editor-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ide-text);
}

.editor-tab.active {
  background: var(--ide-bg-tab-active);
  color: var(--ide-text);
  border-top-color: var(--ide-accent);
}

.editor-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-tab-label.dirty::after {
  content: '●';
  margin-left: 0.25rem;
  font-size: 0.55rem;
  color: var(--ide-accent);
  vertical-align: middle;
}

.editor-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.55;
  cursor: pointer;
}

.editor-tab:hover .editor-tab-close {
  opacity: 1;
}

.editor-tab-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.editor-tab-placeholder {
  padding: 0.5rem 0.75rem;
  color: var(--ide-muted);
  font-size: 0.78rem;
  user-select: none;
}

.editor-main-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--ide-editor);
  border-top: 1px solid var(--ide-border, rgba(255, 255, 255, 0.06));
}

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.monaco-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--ide-border);
}

#monacoMount {
  flex: 1;
  min-height: 160px;
}

.binary-preview {
  flex: 1;
  min-height: 120px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--ide-muted);
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.02) 8px,
    transparent 8px,
    transparent 16px
  );
  overflow: auto;
}

.current-file {
  color: #ccc;
}

.terminal-wrap {
  border-top: 1px solid var(--ide-border-strong);
  background: var(--ide-editor);
  min-height: 180px;
  max-height: 40vh;
  display: flex;
  flex-direction: column;
  resize: vertical;
}

.terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  background: var(--ide-terminal-head);
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
}

.terminal-title {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ide-text);
}

.terminal-open-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ide-border-strong);
  color: var(--ide-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  font-family: var(--font);
}

.terminal-open-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--ide-accent);
}

#terminal {
  flex: 1;
  padding: 0.25rem;
  min-height: 120px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  background: #252526;
  border-left: 1px solid #3c3c3c;
  min-height: 0;
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.chat-sidebar-backdrop {
  display: none;
}

.chat-app-layout {
  display: grid;
  grid-template-columns: minmax(0, 272px) 1fr;
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--chat-surface);
}

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

.chat-app-layout.sidebar-collapsed .chat-sidebar {
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  border: none;
  pointer-events: none;
}

.chat-sidebar {
  background: var(--sidebar-tight);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.chat-sidebar-caption {
  margin: 0;
  padding: 0.35rem 0.75rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.chat-sidebar-caption strong {
  color: var(--text);
  font-weight: 600;
}

.chat-new-chat-btn {
  flex: 1;
  text-align: center;
}

.chat-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--chat-surface);
  flex-shrink: 0;
}

.chat-toolbar-rename {
  flex-shrink: 0;
  opacity: 0.85;
}

.chat-toolbar-rename:hover {
  opacity: 1;
}

.chat-toolbar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-body-split {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
}

.chat-body-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-preview-dock {
  flex-shrink: 0;
  width: min(44vw, 480px);
  min-width: 260px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #181818;
  z-index: 2;
}

.chat-preview-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.chat-preview-dock-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chat-preview-dock-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-preview-dock-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.chat-preview-dock-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-preview-dock-action {
  font-size: 0.72rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-preview-dock-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.chat-preview-resize-handle {
  width: 6px;
  cursor: col-resize;
  flex-shrink: 0;
  align-self: stretch;
  background: transparent;
  transition: background 0.15s ease;
}

.chat-preview-resize-handle:hover {
  background: rgba(16, 163, 127, 0.35);
}

.hide-chat-blocks pre {
  display: none !important;
}

.chat-compose-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0 0.15rem 0.35rem;
}

.chk-inline {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}

.chk-inline input {
  accent-color: var(--accent);
}

.dual-lane-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  min-width: 0;
}

.dual-lane {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem 0.55rem;
  background: rgba(0, 0, 0, 0.2);
  min-width: 0;
}

.dual-lane-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.dual-lane-body {
  font-size: 0.88rem;
  line-height: 1.45;
  max-height: 70vh;
  overflow: auto;
}

@media (max-width: 640px) {
  .dual-lane-grid {
    grid-template-columns: 1fr;
  }
}

.chat-preview-dock-iframe {
  flex: 1;
  min-height: 180px;
  width: 100%;
  border: none;
  background: #fff;
}

@media (max-width: 768px) {
  .chat-preview-dock:not(.hidden) {
    position: absolute;
    inset: 0;
    width: 100% !important;
    min-width: 0 !important;
    z-index: 40;
    border-left: none;
    background: var(--chat-surface);
  }
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  text-align: center;
  max-width: 36rem;
  margin: 0 auto;
  width: 100%;
}

.chat-empty-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.chat-empty-sub {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.chat-suggestion-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-suggestion-chip:hover {
  background: rgba(16, 163, 127, 0.12);
  border-color: rgba(16, 163, 127, 0.35);
}

.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 1rem 1rem 1.25rem;
  font-size: 0.9375rem;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  box-sizing: border-box;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 7px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.chat-compose-footer {
  flex-shrink: 0;
  padding: 0.65rem 1rem 1rem;
  background: linear-gradient(to top, rgba(13, 13, 13, 0.98), rgba(33, 33, 33, 0.92));
  border-top: 1px solid var(--border);
}

.chat-compose-shell {
  max-width: 48rem;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 0.55rem 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chat-input {
  width: 100%;
  resize: none;
  min-height: 2.5rem;
  max-height: 200px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  padding: 0.15rem 0.25rem;
}

.chat-input:focus {
  outline: none;
}

.chat-compose-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-compose-spacer {
  flex: 1;
}

.chat-compose-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.chat-attach-btn:hover {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.chat-send-btn {
  border-radius: 10px;
  padding: 0.4rem 1rem;
  min-height: 2.25rem;
}

.chat-stop-btn {
  border-radius: 10px;
  padding: 0.4rem 0.85rem;
  min-height: 2.25rem;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-stop-btn:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.22);
  border-color: rgba(248, 113, 113, 0.5);
}

.chat-retry-btn {
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  white-space: nowrap;
}

.chat-retry-btn:hover {
  background: rgba(251, 191, 36, 0.2);
}

.chat-retry-btn.hidden {
  display: none;
}

.chat-zip-btn {
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--ide-border-strong, rgba(255, 255, 255, 0.12));
  background: rgba(16, 163, 127, 0.12);
  color: #e8ecf4;
  white-space: nowrap;
}

.chat-zip-btn:hover {
  background: rgba(16, 163, 127, 0.22);
}

.msg {
  margin-bottom: 1.35rem;
  line-height: 1.6;
  max-width: 100%;
}

.msg.user {
  margin-left: auto;
  max-width: min(92%, 42rem);
}

.msg.assistant {
  max-width: min(100%, 48rem);
}

.msg.user .bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 1.25rem;
  padding: 0.65rem 0.95rem;
}

.msg.assistant .bubble {
  background: transparent;
  border: none;
  color: var(--text);
  border-radius: 0;
  padding: 0.35rem 0;
}

.msg .role {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.msg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  min-height: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.msg:hover .msg-toolbar,
.msg:focus-within .msg-toolbar {
  opacity: 1;
  pointer-events: auto;
}

.msg-toolbar-btn {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: inherit;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.msg-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.msg img.preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  margin-top: 0.55rem;
  display: block;
}

.bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-text.markdown-body {
  white-space: normal;
}

.bubble-text.markdown-body pre {
  white-space: pre;
  overflow-x: auto;
  margin: 0.65rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.45;
}

.bubble-text.markdown-body code {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
  font-size: 0.86em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
}

.bubble-text.markdown-body pre code {
  padding: 0;
  background: none;
  font-size: 0.82rem;
}

.bubble-text.markdown-body p {
  margin: 0.5rem 0;
}

.bubble-text.markdown-body p:first-child {
  margin-top: 0;
}

.bubble-text.markdown-body p:last-child {
  margin-bottom: 0;
}

.bubble-text.markdown-body ul,
.bubble-text.markdown-body ol {
  margin: 0.45rem 0;
  padding-left: 1.35rem;
}

.bubble-text.markdown-body h1,
.bubble-text.markdown-body h2,
.bubble-text.markdown-body h3 {
  margin: 0.85rem 0 0.45rem;
  font-size: 1.05em;
  font-weight: 600;
}

.bubble-text.markdown-body h1:first-child,
.bubble-text.markdown-body h2:first-child,
.bubble-text.markdown-body h3:first-child {
  margin-top: 0;
}

.bubble-text.markdown-body blockquote {
  margin: 0.5rem 0;
  padding-left: 0.85rem;
  border-left: 3px solid rgba(16, 163, 127, 0.45);
  color: var(--text-muted);
}

.code-preview-root {
  margin: 0.65rem 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.code-block-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border);
}

.code-block-lang {
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  text-transform: lowercase;
}

.code-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-left: auto;
}

.btn-code-action {
  font-family: inherit;
  font-size: 0.74rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-code-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-code-copy {
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-code-dock {
  border-color: rgba(16, 163, 127, 0.45);
  background: rgba(16, 163, 127, 0.12);
  color: var(--accent-hover);
}

.btn-code-dock:hover {
  background: rgba(16, 163, 127, 0.22);
}

.btn-code-preview {
  font-family: inherit;
  font-size: 0.74rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-code-preview:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.code-preview-panel {
  border-top: 1px solid var(--border);
  background: #fff;
}

.code-preview-panel.hidden {
  display: none;
}

.code-preview-iframe {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 420px;
  border: none;
  background: #fff;
}

.markdown-code-wrap .bubble-text.markdown-body pre,
.code-preview-root pre {
  margin: 0;
  border-radius: 0;
  border: none;
}

.chat-compose {
  padding: 0.5rem;
  border-top: 1px solid #3c3c3c;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-compose textarea {
  width: 100%;
  resize: vertical;
  background: #3c3c3c;
  border: 1px solid #555;
  color: #eee;
  border-radius: 4px;
  padding: 0.4rem;
  font-family: inherit;
}

.upload-label {
  font-size: 0.8rem;
  color: #569cd6;
  cursor: pointer;
}

.upload-label:hover {
  text-decoration: underline;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -30%, rgba(59, 130, 246, 0.35), transparent),
    radial-gradient(ellipse 60% 50% at 100% 80%, rgba(139, 92, 246, 0.12), transparent),
    var(--bg-deep);
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(26, 36, 56, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.login-logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.login-card h1 {
  margin: 0;
  color: #fff;
  font-size: 1.65rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.field-label,
.login-card label.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.login-card input {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-card input::placeholder {
  color: #5c6578;
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.primary.wide {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.brand-mark {
  color: var(--accent);
  margin-right: 0.2rem;
}

.primary.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.btn-secondary.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.error-text {
  color: #f48771;
  font-size: 0.85rem;
  margin: 0;
}

.main-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main-workspace-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.main-workspace-body > .panel.active-panel {
  flex: 1;
  min-height: 0;
  min-width: 0;
}

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

.chat-ide-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat-ide-shell.hidden {
  display: none !important;
}

.chat-ide-panels {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chat-ide-panels > .panel.active-panel {
  flex: 1;
  min-height: 0;
}

.chat-slot-fill {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ide-workspace-seg {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  border: 1px solid var(--ide-border-strong, rgba(255, 255, 255, 0.12));
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
}

.ide-ws-seg {
  margin: 0;
  border: none;
  background: transparent;
  color: var(--ide-muted, #858585);
  padding: 0.38rem 0.85rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}

.ide-ws-seg:hover {
  color: var(--ide-text, #ccc);
  background: rgba(255, 255, 255, 0.06);
}

.ide-ws-seg.ide-ws-seg-active {
  background: rgba(16, 163, 127, 0.22);
  color: #fff;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
}

.nav-tabs {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  align-items: center;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.nav-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.nav-user {
  font-size: 0.85rem;
  color: #858585;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
}

.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel.active-panel {
  display: flex;
}

.chat-sidebar-search-wrap {
  padding: 0.35rem 0.65rem 0.5rem;
  flex-shrink: 0;
}

.chat-sidebar-search {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.chat-sidebar-search::placeholder {
  color: var(--text-muted);
}

.chat-sidebar-search:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.chat-sidebar-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 0.5rem 0.45rem;
  flex-shrink: 0;
}

.chat-sidebar-tab {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.chat-sidebar-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.chat-sidebar-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: var(--border);
}

.chat-list {
  overflow: auto;
  flex: 1;
  font-size: 0.84rem;
  padding: 0 0.35rem 0.5rem;
}

.chat-list-row {
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
  margin-bottom: 2px;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.chat-list-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chat-list-row.active {
  background: rgba(59, 130, 246, 0.18);
}

.chat-list-row-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 0.5rem 0.45rem 0.5rem 0.55rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-row-menu-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.chat-list-kebab {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.chat-list-row:hover .chat-list-kebab,
.chat-list-row-menu-wrap:has(.chat-list-dropdown.open) .chat-list-kebab {
  opacity: 1;
}

.chat-list-kebab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.chat-list-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 11rem;
  z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.25rem;
}

.chat-list-dropdown.open {
  display: block;
}

.chat-list-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.chat-list-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chat-list-menu-item.danger {
  color: var(--danger);
}

@media (hover: none) {
  .chat-list-kebab {
    opacity: 0.55;
  }
}

.chat-slot {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-widget {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--chat-surface);
}

.ide-chat-slot {
  border-left: 1px solid var(--ide-border-strong);
  min-width: 280px;
  background: var(--chat-surface);
}

#ideChatAside .ide-chat-slot {
  border: none;
  min-width: 0;
  flex: 1;
  min-height: 0;
}

#panelIde.ide-panel {
  background: var(--ide-bg);
  min-height: 0;
}

.ide-workbench-header {
  flex-shrink: 0;
  background: var(--ide-bg);
  border-bottom: 1px solid var(--ide-border-strong);
}

.ide-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.85rem;
}

.ide-header-primary {
  justify-content: space-between;
  border-bottom: 1px solid var(--ide-border);
}

.ide-header-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.ide-brand-mark {
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  background: rgba(16, 163, 127, 0.12);
  border: 1px solid rgba(16, 163, 127, 0.35);
  color: #fff !important;
}

.ide-workspace-hint {
  flex: 1;
  text-align: right;
  min-width: 140px;
  color: var(--ide-muted);
}

.ide-header-secondary {
  padding-top: 0.35rem;
  padding-bottom: 0.55rem;
  align-items: flex-start;
  gap: 0.65rem 1rem;
}

.ide-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-left: auto;
  justify-content: flex-end;
}

.ide-toolbar-btn {
  white-space: nowrap;
}

.ide-save-btn {
  box-shadow: 0 2px 12px rgba(0, 120, 212, 0.28);
}

.ide-topbar {
  flex-shrink: 0;
}

.ide-layout .sidebar {
  background: var(--ide-sidebar);
  border-right-color: var(--ide-border-strong);
}

.ide-layout .sidebar-head {
  border-bottom-color: var(--ide-border-strong);
  color: var(--ide-text);
}

.ide-layout .sidebar-head span {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ide-layout .sidebar-head button {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ide-border-strong);
  color: var(--ide-text);
  border-radius: 6px;
}

.ide-layout .sidebar-head button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ide-layout .editor-panel {
  background: var(--ide-editor);
}

.ide-layout .tree-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ide-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.ide-layout-bar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0.85rem;
  background: var(--ide-bg, #181818);
  border-bottom: 1px solid var(--ide-border-strong);
}

.ide-layout-bar-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ide-muted, #8b949e);
  margin-right: 0.35rem;
}

.ide-layout-btn {
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--ide-border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ide-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.ide-layout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ide-text);
}

.ide-layout-btn.ide-layout-btn-on {
  border-color: rgba(16, 163, 127, 0.45);
  background: rgba(16, 163, 127, 0.12);
  color: #fff;
}

.ide-workbench {
  --ide-files-w: 220px;
  --ide-chat-w: min(360px, 38vw);
  --ide-terminal-h: 200px;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
}

.ide-pane-files {
  width: var(--ide-files-w);
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.15s ease;
}

.ide-pane-files.ide-pane-off {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border: none !important;
}

.ide-split {
  flex-shrink: 0;
  background: transparent;
  transition: background 0.12s ease;
  touch-action: none;
}

.ide-split-col {
  width: 5px;
  cursor: col-resize;
  align-self: stretch;
}

.ide-split-row {
  height: 5px;
  cursor: row-resize;
  flex-shrink: 0;
}

.ide-split:hover,
.ide-split.ide-split-active {
  background: rgba(16, 163, 127, 0.35);
}

.ide-split.ide-split-hidden {
  display: none !important;
}

.ide-center-column {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ide-editor-body-grow {
  flex: 1;
  min-height: 100px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ide-chat-pane {
  width: var(--ide-chat-w);
  max-width: 100%;
  flex-shrink: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--ide-border-strong);
  background: var(--chat-surface);
  transition: opacity 0.15s ease;
}

.ide-workbench.ide-chat-left .ide-chat-pane {
  border-left: none;
  border-right: 1px solid var(--ide-border-strong);
}

.ide-chat-pane.ide-pane-off {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border: none !important;
}

.ide-workbench.ide-chat-left > #ideFilesAside {
  order: 5;
}
.ide-workbench.ide-chat-left > #ideSplitFiles {
  order: 4;
}
.ide-workbench.ide-chat-left > .ide-center-column {
  order: 3;
}
.ide-workbench.ide-chat-left > #ideSplitChat {
  order: 2;
}
.ide-workbench.ide-chat-left > #ideChatAside {
  order: 1;
}

#ideTerminalWrap.terminal-wrap {
  height: var(--ide-terminal-h);
  min-height: 0;
  max-height: none;
  flex-shrink: 0;
  resize: none;
}

#ideTerminalWrap.ide-pane-off {
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden;
  border: none !important;
  opacity: 0;
  pointer-events: none;
}

.brand.small {
  font-size: 0.9rem;
}

.config-card {
  max-width: 720px;
  margin: 1rem auto;
  padding: 1.5rem;
  background: #252526;
  border: 1px solid #3c3c3c;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: auto;
}

.config-card h2,
.config-card h3 {
  margin: 0.5rem 0 0;
  color: #fff;
}

.config-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.wide-input {
  width: 100%;
  background: #3c3c3c;
  border: 1px solid #555;
  color: #eee;
  padding: 0.45rem;
  border-radius: 4px;
  font-family: inherit;
}

.row-actions {
  margin-top: 0.5rem;
}

.ide-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.ide-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ide-header-secondary .ide-toolbar-group {
  flex: 1;
  min-width: 240px;
}

.chk-tight {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.chk-tight input {
  accent-color: var(--accent);
}

.ide-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  min-height: 2rem;
  align-items: center;
}

.ide-chip {
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--text);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font);
}

.ide-chip:hover {
  background: rgba(59, 130, 246, 0.35);
}

.ide-chip-x {
  opacity: 0.85;
  font-weight: 700;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-warn {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fcd34d;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  animation: softPulse 2s ease-in-out infinite;
}

@keyframes softPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(251, 191, 36, 0.2);
  }
}

.tree-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.35rem 0.5rem;
  line-height: 1.35;
  border-bottom: 1px solid var(--border);
}

.tree-item.tree-pulse {
  animation: treeFlash 0.5s ease-out 3;
  background: rgba(59, 130, 246, 0.25);
}

@keyframes treeFlash {
  from {
    background: rgba(59, 130, 246, 0.45);
  }
  to {
    background: transparent;
  }
}

.ide-activity-strip {
  margin: 0.5rem 0 0.75rem;
  padding: 0.5rem 0.65rem;
  background: rgba(16, 163, 127, 0.08);
  border: 1px solid rgba(16, 163, 127, 0.22);
  border-radius: var(--radius);
}

.ide-activity-item {
  font-size: 0.82rem;
  margin: 0.35rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.ide-activity-item.pulse-in {
  animation: slideIn 0.35s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ide-activity-icon {
  color: var(--accent);
}

.linkish {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  padding: 0;
  font-family: inherit;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(96vw, 1100px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0;
  padding: 1rem 1.25rem 0;
  font-size: 1.1rem;
}

.modal-path {
  margin: 0.35rem 1.25rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
}

.monaco-diff-mount {
  height: min(62vh, 560px);
  min-height: 280px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
}

.agent-activity {
  max-height: 140px;
  overflow: auto;
  padding: 0.45rem 0.65rem;
  margin: 0 auto 0.5rem;
  max-width: 52rem;
  width: calc(100% - 2rem);
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  font-size: 0.78rem;
}

.agent-tool-row {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.agent-tool-row:last-child {
  border-bottom: none;
}

.agent-tool-ico {
  color: var(--accent);
  margin-right: 0.25rem;
}

.agent-tool-ico.ok {
  color: #4ade80;
}

.agent-args,
.agent-preview {
  opacity: 0.85;
  word-break: break-all;
}

.fade-in {
  animation: slideIn 0.25s ease-out;
}

.thinking-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  margin: 0 auto 0.35rem;
  max-width: 52rem;
  width: calc(100% - 2rem);
  font-size: 0.82rem;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  border-radius: 8px;
}

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

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounceDot 1s ease-in-out infinite;
}

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

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

@keyframes bounceDot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.msg.streaming-live .bubble {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.msg.assistant.streaming-live:not(.dual-stream) .bubble-text:not(.markdown-body) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.stream-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 1px;
  background: var(--accent);
  animation: caretBlink 0.9s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes caretBlink {
  50% {
    opacity: 0;
  }
}

.agent-cursor input {
  accent-color: #a78bfa;
}

@media (max-width: 960px) {
  .ide-workbench {
    flex-direction: column;
  }

  .ide-workbench > * {
    order: 0 !important;
  }

  .ide-workbench .ide-split-col {
    display: none;
  }

  .ide-workbench .ide-split-row {
    display: none;
  }

  .ide-pane-files,
  .ide-chat-pane {
    width: 100% !important;
    max-height: 40vh;
  }

  .ide-pane-files.ide-pane-off,
  .ide-chat-pane.ide-pane-off {
    max-height: 0;
  }

  .layout,
  .ide-layout {
    min-height: 0;
  }

  .sidebar {
    max-height: 200px;
  }

  .chat-app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .chat-app-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 300px);
    z-index: 220;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .chat-app-layout.drawer-open .chat-sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  .chat-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(0, 0, 0, 0.48);
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
  }

  .chat-sidebar-backdrop.hidden {
    display: none;
  }

  .chat-sidebar-close-btn {
    display: inline-flex;
    flex-shrink: 0;
  }

  .ide-chat-slot {
    max-width: none;
    max-height: 280px;
  }
}

@media (min-width: 961px) {
  .chat-sidebar-close-btn {
    display: none !important;
  }

  .chat-sidebar {
    position: relative;
    transform: none !important;
    width: auto !important;
  }

  .chat-sidebar-backdrop {
    display: none !important;
  }
}

.account-card {
  max-width: 880px;
}

.account-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.account-new-user {
  padding: 0.5rem 0 1rem;
}

.account-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(120px, 140px);
  gap: 0.75rem;
  align-items: end;
}

@media (max-width: 640px) {
  .account-form-row {
    grid-template-columns: 1fr;
  }
}

.admin-users-table {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(100px, 1.3fr) 100px minmax(120px, 1fr) auto auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

@media (max-width: 720px) {
  .admin-user-row {
    grid-template-columns: 1fr;
  }
}

.admin-user-row input,
.admin-user-row select {
  width: 100%;
  background: #3c3c3c;
  border: 1px solid #555;
  color: #eee;
  padding: 0.4rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.12);
}

.btn-danger:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.studies-panel {
  overflow: auto;
  background: linear-gradient(180deg, var(--bg-deep) 0%, #141414 40%, var(--bg-deep) 100%);
}

.studies-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.35rem 1.1rem 3rem;
}

.studies-hero-grid {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 280px);
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.35rem;
  background: linear-gradient(135deg, rgba(16, 163, 127, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
}

@media (max-width: 820px) {
  .studies-hero-grid {
    grid-template-columns: 1fr;
  }
}

.studies-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-hover);
  font-weight: 600;
}

.studies-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.studies-lead {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 40rem;
}

.studies-hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 120px;
}

.studies-hero-orbit {
  position: relative;
  width: 100px;
  height: 100px;
}

.studies-hero-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.9;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 20px rgba(16, 163, 127, 0.45);
}

.studies-hero-dot.d2 {
  top: 55%;
  left: 15%;
  background: rgba(16, 163, 127, 0.55);
}

.studies-hero-dot.d3 {
  top: 55%;
  left: auto;
  right: 15%;
  background: rgba(255, 255, 255, 0.25);
}

.studies-hero-caption {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.studies-layout {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 300px);
  gap: 1.35rem;
  align-items: start;
}

@media (max-width: 960px) {
  .studies-layout {
    grid-template-columns: 1fr;
  }
}

.studies-main-col {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.studies-stats-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.studies-progress-card {
  margin-bottom: 1rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, rgba(16, 163, 127, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 14px;
}

.studies-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.studies-progress-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.studies-progress-pct {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
}

.studies-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.studies-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(16, 163, 127, 0.55), rgba(16, 163, 127, 0.95));
  transition: width 0.35s ease;
}

.studies-progress-line {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.studies-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.35rem;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.studies-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.45rem 0.95rem;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.studies-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.studies-tab.active {
  color: var(--text);
  background: rgba(16, 163, 127, 0.18);
  border: 1px solid rgba(16, 163, 127, 0.35);
}

.studies-layout-with-tabs {
  margin-top: 0;
}

.studies-stat-pill {
  flex: 1;
  min-width: 100px;
  padding: 0.65rem 0.85rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.studies-stat-pill-wide {
  flex: 1.4;
  min-width: 140px;
}

.studies-stat-pill-accent {
  border-color: rgba(16, 163, 127, 0.28);
  background: rgba(16, 163, 127, 0.06);
}

.studies-stat-num-sm {
  font-size: 1.15rem !important;
}

.studies-stat-num {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent-hover);
  line-height: 1.1;
}

.studies-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.studies-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem 1.2rem;
}

.studies-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.studies-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.studies-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(16, 163, 127, 0.15);
  border: 1px solid rgba(16, 163, 127, 0.35);
  color: var(--accent-hover);
}

.studies-card-desc {
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.studies-list-card h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.studies-list-sub {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.studies-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  border: 2px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  cursor: pointer;
  margin: 0.35rem 0 0.85rem;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.studies-dropzone-hover {
  border-color: rgba(16, 163, 127, 0.5);
  background: rgba(16, 163, 127, 0.07);
}

.studies-dropzone input[type='file'] {
  display: none;
}

.studies-dropzone-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
}

.studies-dropzone-icon {
  font-size: 2rem;
  line-height: 1;
  opacity: 0.85;
}

.studies-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.studies-dropzone-sub {
  font-size: 0.75rem;
  opacity: 0.85;
}

.studies-note-label {
  margin-top: 0.35rem;
}

.studies-upload-btn {
  margin-top: 0.55rem;
}

.studies-status {
  margin-top: 0.55rem;
  font-size: 0.82rem;
}

.studies-textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.45;
}

.studies-form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 560px) {
  .studies-form-row-2 {
    grid-template-columns: 1fr;
  }
}

.studies-action-btn {
  margin-top: 0.5rem;
}

.studies-lessons-list,
.studies-calendar-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.studies-lesson-row,
.studies-cal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s ease;
}

.studies-lesson-row:hover,
.studies-cal-row:hover {
  border-color: rgba(16, 163, 127, 0.25);
}

.studies-lesson-main {
  flex: 1;
  min-width: 0;
}

.studies-lesson-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0 0 0.25rem;
  word-break: break-word;
}

.studies-lesson-title.done {
  text-decoration: line-through;
  opacity: 0.75;
}

.studies-lesson-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.studies-lesson-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.studies-lesson-actions,
.studies-cal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.studies-ln-btn,
.studies-cal-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: inherit;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}

.studies-ln-btn:hover,
.studies-cal-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.studies-ln-btn.primary-lite {
  border-color: rgba(16, 163, 127, 0.45);
  color: var(--accent-hover);
  background: rgba(16, 163, 127, 0.1);
}

.studies-ln-btn.danger,
.studies-cal-btn.danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: #f87171;
}

.studies-lesson-check {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.studies-cal-when {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  margin: 0 0 0.2rem;
}

.studies-cal-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.studies-cal-main {
  flex: 1;
  min-width: 0;
}

.studies-cal-done {
  text-decoration: line-through;
  opacity: 0.72;
}

.studies-aside-highlight {
  border-color: rgba(16, 163, 127, 0.35);
  background: linear-gradient(145deg, rgba(16, 163, 127, 0.1), rgba(255, 255, 255, 0.02));
}

.studies-aside-lead {
  margin: 0 0 0.65rem !important;
  font-size: 0.82rem !important;
}

.studies-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.studies-quick-btn {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.studies-quick-btn:hover {
  border-color: rgba(16, 163, 127, 0.45);
  background: rgba(16, 163, 127, 0.12);
}

.studies-aside {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 0.75rem;
}

.studies-aside-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.studies-aside-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.studies-aside-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.studies-aside-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.studies-aside-muted {
  opacity: 0.92;
}

.studies-aside-tech {
  font-size: 0.76rem !important;
}

.studies-aside-tech code {
  font-size: 0.68rem;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.studies-list-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.studies-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.studies-doc-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease;
}

.studies-doc-card:hover {
  border-color: rgba(16, 163, 127, 0.25);
}

.studies-doc-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.studies-doc-body {
  flex: 1;
  min-width: 0;
}

.studies-doc-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
}

.studies-doc-filename {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}

.studies-doc-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.studies-doc-action-btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}

.studies-doc-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.studies-doc-action-btn.danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--danger);
}

.studies-doc-meta {
  margin-top: 0.35rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.studies-doc-note {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.45rem 0.55rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border-left: 3px solid rgba(16, 163, 127, 0.45);
}

.studies-list-empty {
  margin: 0.75rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.studies-list-empty.hidden {
  display: none !important;
}

/* Barras de rolagem discretas (sidebar, lista de chats, IDE, estudos) */
.chat-list,
.chat-sidebar,
.file-tree,
.ide-layout .sidebar,
.studies-layout,
.studies-doc-list,
#monacoMount,
.xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-list::-webkit-scrollbar,
.chat-sidebar::-webkit-scrollbar,
.file-tree::-webkit-scrollbar,
.ide-layout .sidebar::-webkit-scrollbar,
.studies-layout::-webkit-scrollbar,
.studies-doc-list::-webkit-scrollbar,
#monacoMount::-webkit-scrollbar,
.xterm-viewport::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb,
.file-tree::-webkit-scrollbar-thumb,
.ide-layout .sidebar::-webkit-scrollbar-thumb,
.studies-layout::-webkit-scrollbar-thumb,
.studies-doc-list::-webkit-scrollbar-thumb,
#monacoMount::-webkit-scrollbar-thumb,
.xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.chat-list::-webkit-scrollbar-thumb:hover,
.chat-sidebar::-webkit-scrollbar-thumb:hover,
.file-tree::-webkit-scrollbar-thumb:hover,
.ide-layout .sidebar::-webkit-scrollbar-thumb:hover,
.studies-layout::-webkit-scrollbar-thumb:hover,
.studies-doc-list::-webkit-scrollbar-thumb:hover,
#monacoMount::-webkit-scrollbar-thumb:hover,
.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-list::-webkit-scrollbar-track,
.chat-sidebar::-webkit-scrollbar-track,
.file-tree::-webkit-scrollbar-track,
.ide-layout .sidebar::-webkit-scrollbar-track,
.studies-layout::-webkit-scrollbar-track,
.studies-doc-list::-webkit-scrollbar-track,
#monacoMount::-webkit-scrollbar-track,
.xterm-viewport::-webkit-scrollbar-track {
  background: transparent;
}
