* { margin: 0; padding: 0; box-sizing: border-box; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
* { scrollbar-width: thin; scrollbar-color: #333 transparent; }

:root {
  --bg: #000000;
  --bg-secondary: #0a0a0a;
  --bg-message: #111111;
  --bg-user: #1a1a1a;
  --bg-tool: #0a0f0a;
  --bg-thinking: #0f0e08;
  --text: #ffffff;
  --text-muted: #666666;
  --text-tool: #4a9e4a;
  --text-thinking: #c8a830;
  --accent: #ffffff;
  --border: #222222;
  --input-bg: #111111;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  overflow: hidden;
}

#loading-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #000;
  gap: 32px;
}

/* Universal page loader for tool transitions */
#page-loader {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  gap: 32px;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s ease;
}
#page-loader.active { display: flex; }
#page-loader.fade-out { opacity: 0; }
.loading-logo {
  width: 120px;
  height: auto;
}
.loading-bar-track {
  width: 200px;
  height: 3px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.4s ease;
}

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, #111 0%, #000 70%);
}
.login-card {
  width: 100%;
  max-width: 360px;
  padding: 40px 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-align: center;
}
.login-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 20px;
  opacity: 0.9;
}
.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}
.login-error {
  color: #ff4444;
  font-size: 13px;
  margin-bottom: 8px;
  min-height: 20px;
}
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card input {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.login-card input:focus { border-color: #444; }
.login-card input::placeholder { color: #555; }
.login-card button {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  background: #fff;
  border: none;
  border-radius: 12px;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.login-card button:hover { opacity: 0.9; }
.login-card button:disabled { opacity: 0.5; cursor: not-allowed; }

#app { display: none; flex-direction: row; height: 100%; }

/* ── Project Rail ── */
#project-rail {
  width: 60px; min-width: 60px; height: 100%;
  background: #0a0a0a; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px; flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;
}
#project-rail::-webkit-scrollbar { width: 0; }
#project-rail-items {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%;
}
.project-rail-item {
  background: none; border: none; cursor: pointer;
  padding: 4px; display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  transition: border-radius 0.2s, background 0.15s;
  position: relative;
}
.project-rail-item:hover { background: rgba(255,255,255,0.05); border-radius: 14px; }
.project-rail-item.active { background: rgba(255,255,255,0.08); border-radius: 14px; }
.project-rail-item.active::before {
  content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 28px; background: #fff; border-radius: 4px 0 0 4px;
}
.project-rail-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #000;
  transition: border-radius 0.2s;
  user-select: none;
}
.project-rail-item:hover .project-rail-icon,
.project-rail-item.active .project-rail-icon { border-radius: 10px; }
#project-rail-add {
  background: none; border: 2px dashed #333; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #555; margin-top: 4px;
  transition: color 0.15s, border-color 0.15s;
}
#project-rail-add:hover { color: #aaa; border-color: #555; }

/* ── Workspace Page ── */
#workspace-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#workspace-page.open { display: flex; }
#workspace-page-content {
  flex: 1; overflow-y: auto; min-width: 0;
}
#workspace-page-inner {
  max-width: 680px; margin: 0 auto; padding: 40px 24px 80px;
}
#workspace-email-sidebar {
  width: 340px; flex-shrink: 0; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; background: var(--bg-secondary);
  overflow: hidden;
}
#workspace-email-sidebar.empty { display: none; }
.ws-email-sidebar-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.ws-email-sidebar-header h3 {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin: 0;
}
.ws-email-sidebar-header button {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px;
}
.ws-email-sidebar-header button:hover { color: #fff; border-color: #444; }
#workspace-email-list { flex: 1; overflow-y: auto; }
#workspace-email-detail {
  display: none; flex: 1; flex-direction: column; overflow: hidden;
}
#workspace-email-detail.open { display: flex; }
#workspace-email-detail.open ~ #workspace-email-list { display: none; }
#workspace-email-detail-content { flex: 1; overflow-y: auto; }
.ws-detail-back {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; padding: 10px 16px; border-bottom: 1px solid var(--border);
  text-align: left; width: 100%;
}
.ws-detail-back:hover { color: #fff; }
@media (max-width: 900px) {
  #workspace-email-sidebar { display: none; }
}
.workspace-header-section {
  display: flex; align-items: center; gap: 20px; margin-bottom: 40px;
}
.workspace-icon-large {
  width: 64px; height: 64px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #000;
  flex-shrink: 0;
}
.workspace-header-info { flex: 1; min-width: 0; }
.workspace-header-info h1 {
  font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.5px;
}
.workspace-desc {
  font-size: 14px; color: var(--text-muted); margin: 0;
}
.workspace-edit-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; padding: 8px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.workspace-edit-btn:hover { color: #fff; border-color: #444; }

.workspace-section {
  margin-bottom: 32px;
}
.workspace-section h2 {
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin: 0 0 12px;
}

/* Links grid */
.workspace-links-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
  margin-bottom: 8px;
}
.workspace-link-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: background 0.15s; position: relative;
}
.workspace-link-card:hover { background: #1a1a1a; }
.workspace-link-icon { flex-shrink: 0; color: var(--text-muted); display: flex; }
.workspace-link-label { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-link-delete {
  position: absolute; top: 4px; right: 6px;
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 16px; opacity: 0; transition: opacity 0.15s;
  padding: 2px 4px;
}
.workspace-link-card:hover .workspace-link-delete { opacity: 1; }
.workspace-link-delete:hover { color: #ff4444; }

.workspace-add-link-btn {
  background: none; border: 1px dashed #333; color: #555;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; gap: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.workspace-add-link-btn:hover { color: #aaa; border-color: #555; }

/* Todos */
.workspace-todo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.workspace-todo-item.done .workspace-todo-text {
  text-decoration: line-through; color: var(--text-muted);
}
.workspace-todo-check {
  width: 20px; height: 20px; flex-shrink: 0; cursor: pointer;
  border: 2px solid #444; border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
}
.workspace-todo-check:hover { border-color: #666; }
.workspace-todo-check.checked {
  background: #fff; border-color: #fff;
}
.workspace-todo-text { flex: 1; font-size: 14px; }
.workspace-todo-delete {
  background: none; border: none; color: #444; cursor: pointer;
  font-size: 16px; opacity: 0; transition: opacity 0.15s; padding: 2px 4px;
}
.workspace-todo-item:hover .workspace-todo-delete { opacity: 1; }
.workspace-todo-delete:hover { color: #ff4444; }

.workspace-todo-input-row {
  display: flex; gap: 8px; margin-top: 8px;
}
.workspace-todo-input-row input {
  flex: 1; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 14px;
  outline: none;
}
.workspace-todo-input-row input:focus { border-color: #444; }
.workspace-todo-input-row button {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.workspace-todo-input-row button:hover { color: #fff; border-color: #444; }

/* Notes */
#workspace-notes {
  width: 100%; min-height: 120px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; color: var(--text); font-size: 14px;
  font-family: inherit; resize: vertical; outline: none;
  line-height: 1.6;
}
#workspace-notes:focus { border-color: #444; }

.workspace-empty { font-size: 13px; color: #444; margin: 0 0 8px; }

/* Contacts */
.workspace-contact-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: background 0.15s; position: relative;
  margin-bottom: 8px;
}
.workspace-contact-card:hover { background: #1a1a1a; }
.workspace-contact-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #222; border: 1px solid #333;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #888; flex-shrink: 0;
  text-transform: uppercase;
}
.workspace-contact-info { flex: 1; min-width: 0; }
.workspace-contact-name { font-size: 14px; font-weight: 500; }
.workspace-contact-role { font-size: 12px; color: var(--text-muted); }
.workspace-contact-email-hint { font-size: 11px; color: #444; margin-top: 1px; }
.workspace-contact-badge {
  font-size: 11px; color: #888; background: #1a1a1a;
  border: 1px solid #333; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap;
}
.workspace-contact-delete {
  position: absolute; top: 4px; right: 6px;
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 16px; opacity: 0; transition: opacity 0.15s; padding: 2px 4px;
}
.workspace-contact-card:hover .workspace-contact-delete { opacity: 1; }
.workspace-contact-delete:hover { color: #ff4444; }

.workspace-danger-zone {
  border-top: 1px solid var(--border); padding-top: 24px; margin-top: 24px;
}
.workspace-delete-btn {
  background: none; border: 1px solid #441111; color: #ff4444;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: background 0.15s;
}
.workspace-delete-btn:hover { background: #1a0000; }

/* Workspace modal body */
.workspace-modal-body {
  padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 12px;
}
.workspace-modal-icon-pick {
  display: flex; align-items: center; gap: 12px;
}
.workspace-icon-preview {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #000; cursor: pointer;
  flex-shrink: 0; transition: background 0.2s;
}
.workspace-modal-body input,
.workspace-modal-body select {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-size: 14px; outline: none; width: 100%;
}
.workspace-modal-body input:focus,
.workspace-modal-body select:focus { border-color: #444; }
.workspace-modal-body select { cursor: pointer; }
#workspace-modal-emoji { width: 120px; }
.workspace-modal-body button {
  background: #fff; color: #000; border: none; padding: 10px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.workspace-modal-body button:hover { opacity: 0.9; }

/* Desktop: hide mobile workspaces button (rail is visible) */
@media (min-width: 769px) {
  .sidebar-workspaces-btn { display: none !important; }
}

/* Mobile: hide project rail, show workspaces button */
@media (max-width: 768px) {
  #project-rail { display: none; }
}

#sidebar {
  width: 0; min-width: 0; overflow: hidden;
  height: 100%; background: var(--bg-secondary);
  transition: width 0.25s ease, min-width 0.25s ease;
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: 1px solid var(--border);
}
#sidebar.open { width: 300px; min-width: 300px; }

/* Sidebar toggle button (hamburger inside sidebar header) */
#sidebar-toggle {
  background: none; border: none; color: var(--text); cursor: pointer;
  font-size: 22px; padding: 0; flex-shrink: 0;
  display: none;
}
#sidebar-toggle:hover { color: #ccc; }

/* Collapsed logo - hidden by default (mobile), shown on desktop collapsed */
.sidebar-collapsed-logo { display: none; }

/* Desktop: collapsed sidebar shows icon strip */
@media (min-width: 769px) {
  #sidebar {
    width: 60px; min-width: 60px;
  }
  #sidebar-toggle { display: block; }
  #menu-btn { display: none; }
  /* Collapsed: header shows only hamburger centered */
  #sidebar .sidebar-header {
    justify-content: center; padding: 16px 0; border-bottom: none;
  }
  #sidebar .sidebar-header .sidebar-logo,
  #sidebar .sidebar-header #project-btn { display: none; }
  #sidebar #sidebar-search,
  #sidebar #conversation-list { display: none; }
  #sidebar .sidebar-footer { padding: 12px 0; align-items: center; border-top: none; }
  #sidebar .sidebar-footer .sidebar-footer-toggle { display: none; }
  #sidebar .sidebar-footer .sidebar-footer-items { max-height: 500px; opacity: 1; }
  #sidebar .sidebar-footer button {
    justify-content: center; padding: 14px 0; font-size: 0; gap: 0;
  }
  #sidebar .sidebar-footer button { position: relative; }
  #sidebar .sidebar-footer button .email-badge {
    display: inline; position: absolute; top: 4px; right: 8px;
    font-size: 9px; padding: 0 4px; min-width: 16px; height: 16px;
    line-height: 16px; text-align: center; margin-left: 0;
  }
  #sidebar .sidebar-bottom { padding: 12px 0; border-top: none; }
  #sidebar .sidebar-bottom button {
    justify-content: center; padding: 14px 0; font-size: 0; gap: 0;
  }

  /* Collapsed icon at bottom */
  .sidebar-collapsed-logo {
    display: flex; justify-content: center; padding-bottom: 16px;
    margin-top: auto;
  }
  .sidebar-collapsed-logo img {
    border-radius: 4px;
  }

  /* Open state */
  #sidebar.open { width: 300px; min-width: 300px; }
  #sidebar.open .sidebar-collapsed-logo { display: none; }
  #sidebar.open .sidebar-header {
    justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); gap: 12px;
  }
  #sidebar.open .sidebar-header .sidebar-logo,
  #sidebar.open .sidebar-header #project-btn { display: flex; }
  #sidebar.open #sidebar-search { display: flex; }
  #sidebar.open #conversation-list { display: block; }
  #sidebar.open .sidebar-footer { padding: 16px 16px; align-items: stretch; border-top: 1px solid var(--border); }
  #sidebar.open .sidebar-footer .sidebar-footer-toggle { display: flex; }
  #sidebar.open .sidebar-footer button {
    justify-content: flex-start; padding: 10px 4px; font-size: 15px; gap: 10px;
  }
  #sidebar.open .sidebar-footer button .email-badge { display: inline; }
  #sidebar.open .sidebar-footer.collapsed .sidebar-footer-items {
    max-height: 0; opacity: 0;
  }
  #sidebar.open .sidebar-footer.collapsed .sidebar-footer-toggle-icon { transform: rotate(180deg); }
  #sidebar.open .sidebar-bottom { padding: 12px 16px; border-top: 1px solid var(--border); }
  #sidebar.open .sidebar-bottom button {
    justify-content: flex-start; padding: 10px 4px; font-size: 15px; gap: 10px;
  }
}

#main-content {
  flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; position: relative;
}

.sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

#project-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 13px; cursor: pointer; flex: 1; min-width: 0; margin-left: 8px;
}
#project-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#project-btn svg { flex-shrink: 0; opacity: 0.5; }

/* Project Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 9999; display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: #1a1a1a; border-radius: 16px 16px 0 0;
  width: 100%; max-width: 500px; max-height: 70vh;
  padding: 8px 0 0; display: flex; flex-direction: column;
  animation: modalSlideUp 0.25s ease-out;
}
@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@media (min-width: 600px) {
  .modal-overlay {
    display: flex; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.15s ease-out;
  }
  .modal-overlay.open { opacity: 1; pointer-events: auto; }
  .modal-sheet {
    border-radius: 12px; animation: none;
  }
  .modal-handle { display: none; }
}
.modal-handle {
  width: 36px; height: 4px; background: #444; border-radius: 2px;
  margin: 0 auto 12px;
}
.modal-title {
  font-size: 16px; font-weight: 600; color: #fff;
  padding: 0 20px 12px; margin: 0; border-bottom: 1px solid var(--border);
}
#project-modal-list {
  overflow-y: auto; padding: 8px 0;
}
.project-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; cursor: pointer; color: #ccc; font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.project-option:last-child { border-bottom: none; }
.project-option:active { background: rgba(255,255,255,0.05); }
.project-option.selected { color: #fff; font-weight: 500; }
.project-option .check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #555; display: flex; align-items: center; justify-content: center;
}
.project-option.selected .check {
  border-color: #fff; background: #fff;
}
.project-option.selected .check::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: #000;
}

#sidebar-search {
  margin: 0 12px 8px; padding: 10px 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 14px; width: calc(100% - 24px); outline: none;
}
#sidebar-search::placeholder { color: var(--text-muted); }
#sidebar-search:focus { border-color: #444; }

#conversation-list { flex: 1; overflow-y: auto; padding: 8px; }

.sidebar-footer {
  padding: 16px 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0;
  position: relative;
}
.sidebar-footer-toggle {
  position: absolute; top: 8px; right: 8px;
  color: #555; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.sidebar-footer-toggle:hover { color: #aaa; }
.sidebar-footer-toggle-icon { transition: transform 0.2s; }
.sidebar-footer.collapsed .sidebar-footer-toggle-icon { transform: rotate(180deg); }
.sidebar-footer-items {
  display: flex; flex-direction: column; gap: 6px;
  overflow: hidden; transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 500px; opacity: 1;
}
.sidebar-footer.collapsed .sidebar-footer-items {
  max-height: 0; opacity: 0;
}
.sidebar-footer.collapsed {
  padding: 8px 16px;
}
.sidebar-footer button {
  background: none; border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; padding: 10px 4px;
  width: 100%;
}
.sidebar-footer button:hover { color: #ccc; }

.sidebar-bottom {
  padding: 12px 16px; border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-bottom button {
  background: none; border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; padding: 10px 4px;
  width: 100%;
}
.sidebar-bottom button:hover { color: #ccc; }

/* Content area below header */
#content-area {
  flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column;
}

/* Header back button */
#header-back {
  background: none; border: none; color: var(--text); cursor: pointer;
  padding: 4px; display: flex; align-items: center;
}
#header-back:hover { color: #ccc; }

/* Page-active: hide chat-specific header elements */
.page-active #tab-bar-wrapper,
.page-active #permissions-wrapper,
.page-active #plan-mode-btn,
.page-active #design-mode-btn,
.page-active #header-project { display: none !important; }
.page-active #header-title { display: block !important; flex: 1; }

/* Header action buttons (page-specific) */
#header-actions {
  display: flex; gap: 4px; margin-left: auto;
}
.header-action-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
}
.header-action-btn:hover { color: #fff; background: #1a1a1a; }

/* Tools showcase page */
#tools-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow-y: auto;
}
#tools-page.open { display: block; }
.tools-page-inner {
  max-width: 860px; margin: 0 auto; padding: 48px 24px 64px;
}
.tools-hero {
  text-align: center; margin-bottom: 48px;
}
.tools-hero h1 {
  font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px;
}
.tools-hero p {
  font-size: 15px; color: var(--text-muted); margin: 0;
}
.tools-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.tool-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 28px 24px; background: #0a0a0a; cursor: pointer;
  border: 1px solid var(--border); border-radius: 14px;
  transition: background 0.15s, border-color 0.15s;
  min-height: 170px; justify-content: center; align-items: center; text-align: center;
}
.tool-card:hover {
  background: #111; border-color: #333;
}
.tool-card-icon {
  flex-shrink: 0; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: #151515; border-radius: 12px; border: 1px solid var(--border);
  color: #fff;
}
.tool-card-body {
  flex: 1; min-width: 0;
}
.tool-card-body h3 {
  font-size: 16px; font-weight: 600; margin: 0 0 6px;
}
.tool-card-body p {
  font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5;
}
.tool-card-arrow { display: none; }
@media (max-width: 768px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.sidebar-tools-btn {
  border-bottom: 1px solid var(--border) !important;
  margin-bottom: 4px; padding-bottom: 12px !important;
}

/* Tool card - add button */
.tool-card-add {
  border-style: dashed; border-color: #333;
}
.tool-card-add:hover {
  border-color: #555; border-style: dashed;
}
.tool-card-icon-add {
  background: transparent; border-color: #333; color: #666;
}
.tool-card-add:hover .tool-card-icon-add {
  border-color: #555; color: #999;
}

/* ─── Tool Creator Page ──────────────────────────────────────── */
#tool-creator-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#tool-creator-page.open { display: flex; }

.tool-creator-inner {
  width: 100%; height: 100%; display: flex; flex-direction: row;
}
.tool-creator-chat {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  max-width: 680px; width: 100%; margin: 0 auto;
}
.tool-creator-inner:has(.tool-creator-build-panel.active) .tool-creator-chat {
  max-width: none; margin: 0;
}
.tool-creator-messages {
  flex: 1; overflow-y: auto; padding: 32px 20px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.tool-creator-input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 20px 20px; border-top: 1px solid var(--border);
}
.tool-creator-input-bar textarea {
  flex: 1; background: #111; border: 1px solid #2a2a2a; border-radius: 12px;
  color: #ccc; padding: 12px 16px; font-size: 14px; font-family: inherit;
  outline: none; resize: none; line-height: 1.5; max-height: 120px;
  transition: border-color 0.15s;
}
.tool-creator-input-bar textarea:focus {
  border-color: #444;
}
.tool-creator-send {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid #2a2a2a;
  background: #111; color: #666; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: all 0.15s;
}
.tool-creator-send:hover {
  background: #1a1a1a; border-color: #444; color: #ccc;
}
.tc-perm-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid #2a2a2a;
  background: #111; color: #555; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: all 0.15s; position: relative;
}
.tc-perm-btn:hover { background: #1a1a1a; border-color: #444; color: #888; }
.tc-perm-btn.unlocked { color: #fff; border-color: #444; }
.tc-perm-menu {
  display: none; position: absolute; bottom: 56px; left: 20px;
  background: #111; border: 1px solid #2a2a2a; border-radius: 12px;
  padding: 10px 14px; z-index: 100; flex-direction: column; gap: 8px;
  min-width: 150px;
}
.tc-perm-menu.open { display: flex; }
.tc-perm-menu label {
  display: flex; align-items: center; gap: 8px;
  color: #888; font-size: 13px; cursor: pointer;
}
.tc-perm-menu input[type="checkbox"] {
  accent-color: #fff; width: 14px; height: 14px;
}

/* ─── Tool Creator Intro ─────────────────────────────────────── */
.tc-intro {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 48px 16px 24px;
}
.tc-intro-icon {
  width: 64px; height: 64px; border-radius: 18px; background: #111;
  border: 1px solid #2a2a2a; display: flex; align-items: center;
  justify-content: center; margin-bottom: 20px;
}
.tc-intro-title {
  font-size: 22px; font-weight: 700; color: #eee; margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.tc-intro-subtitle {
  font-size: 14px; color: #666; line-height: 1.6; max-width: 420px;
  margin-bottom: 32px;
}

/* ─── Mode Selection Cards ───────────────────────────────────── */
.tc-mode-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  width: 100%; max-width: 520px;
}
.tc-mode-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 10px; padding: 20px; background: #0a0a0a; border: 1px solid #222;
  border-radius: 16px; cursor: pointer; text-align: left;
  font-family: inherit; color: #999; transition: all 0.2s ease;
}
.tc-mode-card:hover {
  background: #111; border-color: #444; color: #ccc;
  transform: translateY(-2px);
}
.tc-mode-icon {
  width: 40px; height: 40px; border-radius: 10px; background: #151515;
  border: 1px solid #2a2a2a; display: flex; align-items: center;
  justify-content: center; color: #888;
}
.tc-mode-card:hover .tc-mode-icon {
  border-color: #444; color: #bbb;
}
.tc-mode-label {
  font-size: 15px; font-weight: 600; color: #ddd;
}
.tc-mode-desc {
  font-size: 12px; color: #666; line-height: 1.5;
}
.tc-mode-tag {
  font-size: 11px; color: #555; background: #151515; border: 1px solid #222;
  border-radius: 999px; padding: 3px 10px; margin-top: 4px;
}
.tc-mode-card:hover .tc-mode-tag {
  border-color: #333; color: #888;
}
@media (max-width: 480px) {
  .tc-mode-cards { grid-template-columns: 1fr; }
}

/* ─── Chat Messages ──────────────────────────────────────────── */
.tc-msg {
  display: flex; gap: 10px; margin-bottom: 4px;
}
.tc-msg-user {
  justify-content: flex-end;
}
.tc-msg-avatar {
  width: 28px; height: 28px; border-radius: 8px; background: #111;
  border: 1px solid #222; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; margin-top: 2px;
}
.tc-msg-ai .tc-msg-content {
  background: #0d0d0d; border: 1px solid #1a1a1a; border-radius: 14px;
  padding: 12px 16px; font-size: 13.5px; color: #bbb; line-height: 1.65;
  max-width: 520px;
}
.tc-msg-user .tc-msg-content {
  background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 14px;
  padding: 10px 16px; font-size: 13.5px; color: #ddd; line-height: 1.5;
  max-width: 420px;
}
.tc-msg-content code {
  background: #1a1a1a; border: 1px solid #2a2a2a; padding: 1px 5px;
  border-radius: 4px; font-size: 12px; color: #aaa;
}
.tc-msg-content strong { color: #eee; }

/* ─── Typing Indicator ───────────────────────────────────────── */
.tc-typing {
  display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 2px;
}
.tc-typing::before, .tc-typing::after {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: #444; animation: tcBlink 1.2s infinite;
}
.tc-typing::after { animation-delay: 0.4s; }
@keyframes tcBlink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ─── Choice Buttons ─────────────────────────────────────────── */
.tc-choices {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 8px 38px;
  transition: all 0.3s ease;
}
.tc-choice {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: #0a0a0a; border: 1px solid #222;
  border-radius: 12px; color: #999; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: all 0.2s ease; white-space: nowrap;
}
.tc-choice:hover {
  background: #151515; border-color: #444; color: #ddd;
  transform: translateY(-1px);
}
.tc-choice.selected {
  background: #1a1a1a; border-color: #555; color: #fff;
}
.tc-choice-wide {
  width: 100%;
}
.tc-choice-emoji {
  font-size: 16px; flex-shrink: 0;
}

/* ─── Templates Grid ─────────────────────────────────────────── */
.tc-templates {
  padding: 8px 0 8px 38px;
  transition: all 0.3s ease;
}
.tc-templates-label {
  font-size: 12px; color: #555; margin-bottom: 10px;
}
.tc-templates-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.tc-template {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; background: #0a0a0a; border: 1px solid #222;
  border-radius: 12px; color: #777; font-size: 12px; cursor: pointer;
  font-family: inherit; transition: all 0.2s ease;
}
.tc-template:hover {
  background: #151515; border-color: #444; color: #ddd;
  transform: translateY(-1px);
}
.tc-template.selected {
  background: #1a1a1a; border-color: #555; color: #fff;
}
@media (max-width: 480px) {
  .tc-templates-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Response Options (parsed from AI) ──────────────────────── */
.tc-response-options {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 0 8px 38px;
}
.tc-response-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: #0a0a0a; border: 1px solid #222;
  border-radius: 14px; cursor: pointer; font-family: inherit;
  text-align: left; transition: all 0.2s ease; color: inherit;
}
.tc-response-option:hover {
  background: #111; border-color: #444;
  transform: translateY(-1px);
}
.tc-response-option.selected {
  background: #151515; border-color: #555;
}
.tc-response-option-num {
  width: 32px; height: 32px; border-radius: 10px; background: #151515;
  border: 1px solid #2a2a2a; display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700;
  color: #888; flex-shrink: 0;
}
.tc-response-option:hover .tc-response-option-num {
  border-color: #444; color: #ccc;
}
.tc-response-option-body {
  flex: 1; min-width: 0;
}
.tc-response-option-label {
  font-size: 13px; font-weight: 600; color: #ddd; margin-bottom: 2px;
}
.tc-response-option-desc {
  font-size: 12px; color: #666; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis;
}

/* ─── Animations ─────────────────────────────────────────────── */
.animate-in {
  animation: tcFadeIn 0.3s ease-out;
}
@keyframes tcFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Build Panel (Friendly Installer) ───────────────────────── */
.tool-creator-build-panel {
  width: 380px; flex-shrink: 0; border-left: 1px solid #1a1a1a;
  background: #080808; display: none; flex-direction: column; overflow: hidden;
}
.tool-creator-build-panel.active {
  display: flex;
  animation: tcbpPanelIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes tcbpPanelIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Title bar — clean, modern */
.tcbp-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; flex-shrink: 0;
}
.tcbp-titlebar-dots {
  display: flex; gap: 5px;
}
.tcbp-titlebar-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: #1a1a1a; border: 1px solid #252525;
}
.tcbp-titlebar-text {
  font-size: 11px; color: #444; font-weight: 500;
  letter-spacing: 0.3px;
}
.tcbp-titlebar-controls {
  display: flex; gap: 8px; color: #2a2a2a; font-size: 12px;
}

/* Progress section — big, friendly, clear */
.tcbp-progress-section {
  padding: 0 24px 24px; flex-shrink: 0;
}
.tcbp-progress-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
#tcbp-progress-text {
  font-size: 13px; color: #999; font-weight: 500;
}
#tcbp-progress-pct {
  font-size: 20px; color: #fff; font-weight: 700;
  letter-spacing: -0.5px;
}
.tcbp-progress-bar {
  height: 6px; background: #151515; border-radius: 99px; overflow: hidden;
}
.tcbp-progress-fill {
  height: 100%; background: #fff; width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 99px;
}

/* Phase roadmap — vertical timeline, friendly */
.tcbp-phases {
  padding: 20px 24px; border-top: 1px solid #131313;
  border-bottom: 1px solid #131313; flex-shrink: 0;
}
.tcbp-phase {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0; font-size: 13px; color: #333;
  position: relative; transition: all 0.4s ease;
}
.tcbp-phase-line {
  position: absolute; left: 11px; top: -2px; width: 2px; height: 12px;
  background: #1a1a1a; border-radius: 1px;
  transition: background 0.4s ease;
}
.tcbp-phase:first-child .tcbp-phase-line { display: none; }
.tcbp-phase.done + .tcbp-phase .tcbp-phase-line,
.tcbp-phase.active + .tcbp-phase .tcbp-phase-line {
  background: #333;
}
.tcbp-phase-check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #1a1a1a; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: all 0.4s ease;
  position: relative; background: #0a0a0a;
}
.tcbp-phase-check::after {
  content: ''; display: none;
}
.tcbp-phase.active {
  color: #eee;
}
.tcbp-phase.active .tcbp-phase-check {
  border-color: #fff; background: #111;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}
.tcbp-phase.active .tcbp-phase-check::after {
  content: ''; display: block; width: 8px; height: 8px;
  border-radius: 50%; background: #fff;
  animation: tcbpPulse 2s ease-in-out infinite;
}
.tcbp-phase.done {
  color: #777;
}
.tcbp-phase.done .tcbp-phase-check {
  border-color: #555; background: #1a1a1a;
}
.tcbp-phase.done .tcbp-phase-check::after {
  content: ''; display: block; width: 10px; height: 10px;
  border-radius: 0; background: none; animation: none;
  /* CSS checkmark */
  border-right: 2px solid #888; border-bottom: 2px solid #888;
  width: 5px; height: 9px; transform: rotate(45deg);
  margin-top: -2px;
}
.tcbp-phase-label {
  flex: 1; font-weight: 500;
}
.tcbp-phase-status {
  font-size: 11px; color: #333; font-weight: 500;
  transition: all 0.3s ease;
}
.tcbp-phase.active .tcbp-phase-status {
  color: #666;
}
.tcbp-phase.done .tcbp-phase-status {
  color: #444;
}

@keyframes tcbpPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.6); }
}

/* Activity log — clean, readable */
.tcbp-console {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
  min-height: 0;
}
.tcbp-console-header {
  padding: 16px 24px 8px; font-size: 11px; color: #444;
  font-weight: 600; letter-spacing: 0.3px;
  flex-shrink: 0;
}
.tcbp-console-output {
  flex: 1; overflow-y: auto; padding: 4px 24px 16px;
  font-size: 12px; color: #444; line-height: 2;
}
.tcbp-console-line {
  animation: tcbpLineIn 0.35s ease-out;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 1px 0;
}
.tcbp-console-line:empty {
  height: 8px;
}
.tcbp-console-line.success { color: #999; }
.tcbp-console-line.phase {
  color: #ccc; font-weight: 600; padding-top: 4px;
}
.tcbp-console-line.file { color: #666; }

@keyframes tcbpLineIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spec card — product card feel */
.tcbp-spec {
  padding: 20px 24px; flex-shrink: 0;
  border-top: 1px solid #131313;
  background: #0a0a0a;
}
.tcbp-spec-header {
  font-size: 11px; color: #444; font-weight: 600;
  letter-spacing: 0.3px; margin-bottom: 14px;
}
.tcbp-spec-row {
  display: flex; gap: 10px; font-size: 12px; margin-bottom: 8px;
  align-items: baseline;
}
.tcbp-spec-key {
  color: #555; flex-shrink: 0; min-width: 44px;
  font-weight: 500;
}
.tcbp-spec-val {
  color: #666; transition: all 0.3s ease;
}
.tcbp-spec-val.updated {
  color: #ddd;
}
.tcbp-spec-features {
  margin-top: 12px; font-size: 12px;
}
.tcbp-spec-features .tcbp-spec-key {
  display: block; margin-bottom: 8px;
}
.tcbp-spec-features ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tcbp-spec-features li {
  background: #111; border: 1px solid #1e1e1e; border-radius: 8px;
  padding: 4px 12px; font-size: 11px; color: #888; font-weight: 500;
  animation: tcbpLineIn 0.35s ease-out;
}

/* Flash animation for spec updates */
@keyframes tcbpFlash {
  0% { background: rgba(255,255,255,0.08); border-radius: 4px; }
  100% { background: transparent; }
}
.tcbp-spec-val.flash {
  animation: tcbpFlash 0.8s ease-out;
}

@media (max-width: 768px) {
  .tool-creator-build-panel { display: none !important; }
  .tool-creator-inner { flex-direction: column; }
}

/* Settings page */
#settings-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow-y: auto;
}
#settings-page.open { display: block; }
#settings-page-inner {
  max-width: 480px; margin: 0 auto; padding: 32px 20px;
}
#settings-page-inner h2 {
  font-size: 24px; font-weight: 700; margin-bottom: 28px;
}
.settings-group { margin-bottom: 20px; }
.settings-group label { font-size: 13px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.settings-group select {
  width: 100%; padding: 10px 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.settings-logout-group { display: flex; flex-direction: column; gap: 8px; }
.settings-logout-btn {
  padding: 10px 20px; background: none; border: 1px solid #333;
  border-radius: 8px; color: var(--text-muted); font-size: 14px;
  cursor: pointer; width: 100%;
}
.settings-logout-btn:hover { border-color: #fff; color: #fff; }

/* Settings sections */
.settings-section { margin-bottom: 32px; }
.settings-section-title {
  font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--text);
}
.settings-section-desc {
  font-size: 13px; color: var(--text-muted); margin: 0 0 16px 0;
}

/* Toggle switches */
.settings-toggle-list { display: flex; flex-direction: column; gap: 2px; }
.settings-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  transition: background 0.15s;
}
.settings-toggle-row:hover { background: var(--bg-message); }
.settings-toggle-label { font-size: 14px; color: var(--text); }
.settings-toggle-row input[type="checkbox"] { display: none; }
.settings-toggle-switch {
  width: 44px; height: 24px; background: #333; border-radius: 999px;
  position: relative; transition: background 0.2s; flex-shrink: 0;
}
.settings-toggle-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: #666; border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.settings-toggle-row input:checked + .settings-toggle-switch {
  background: #fff;
}
.settings-toggle-row input:checked + .settings-toggle-switch::after {
  transform: translateX(20px); background: #000;
}

/* Color picker rows */
.settings-color-list { display: flex; flex-direction: column; gap: 2px; }
.settings-color-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 10px;
}
.settings-color-row:hover { background: var(--bg-message); }
.settings-color-row label { font-size: 14px; color: var(--text); }
.settings-color-input-wrap { display: flex; align-items: center; gap: 10px; }
.settings-color-input-wrap input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 32px; height: 32px; border: 2px solid #333; border-radius: 8px;
  background: none; cursor: pointer; padding: 0;
}
.settings-color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.settings-color-input-wrap input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
.settings-color-hex { font-size: 13px; color: var(--text-muted); font-family: monospace; width: 62px; }

/* Reset button */
.settings-reset-btn {
  margin-top: 12px; padding: 8px 16px; background: none;
  border: 1px solid #333; border-radius: 8px; color: var(--text-muted);
  font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.settings-reset-btn:hover { border-color: #fff; color: #fff; }

.conversation-item {
  padding: 12px; border-radius: 8px; cursor: pointer;
  margin-bottom: 4px; border: 1px solid transparent;
  position: relative;
}
.conversation-item:hover, .conversation-item.active {
  background: var(--bg); border-color: var(--border);
}
.conversation-item .conv-menu-btn {
  display: none; position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted); border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
}
.conversation-item .conv-menu-btn:hover { color: var(--text); }
.conversation-item .conv-menu-btn.visible { display: flex; }
@media (hover: hover) {
  .conversation-item:hover .conv-menu-btn { display: flex; }
}
.conv-dropdown {
  display: none; position: absolute; right: 8px; top: 100%;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 8px; min-width: 140px; z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); overflow: hidden;
}
.conv-dropdown.open { display: block; }
.conv-dropdown button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px; background: none; border: none;
  color: var(--text); font-size: 13px; cursor: pointer; text-align: left;
}
.conv-dropdown button:hover { background: var(--bg); }
.conv-dropdown button.danger { color: #ff4444; }
.conv-dropdown button.danger:hover { color: #ff6666; }
.conversation-item .title {
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-item .meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

#header {
  display: flex; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-secondary); gap: 12px;
  flex-wrap: wrap;
}
#menu-btn {
  background: none; border: none; color: var(--text);
  font-size: 22px; cursor: pointer; padding: 4px;
}
.sidebar-logo {
  height: 22px; width: auto;
}
#header-project {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 8px; white-space: nowrap;
  cursor: pointer; position: relative;
}
#header-project:hover { border-color: var(--text-muted); }
#header-project-menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 4px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 8px; min-width: 180px; z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); overflow: hidden;
}
#header-project-menu.open { display: block; }
#header-project-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; background: none; border: none;
  color: var(--text); font-size: 13px; cursor: pointer; text-align: left;
}
#header-project-menu button:hover { background: var(--input-bg); }
#header-project-menu button svg { flex-shrink: 0; opacity: 0.5; }
#header-title {
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#plan-mode-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; padding: 6px 8px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
#plan-mode-btn.active {
  background: #fff; color: #000; border-color: #fff;
}
#plan-mode-btn.active svg { stroke: #000; }
#permissions-wrapper {
  position: relative;
}
#permissions-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; padding: 6px 8px; display: flex; align-items: center; justify-content: center;
}
#permissions-btn.unlocked {
  background: #fff; border-color: #fff;
}
#permissions-btn.unlocked svg { stroke: #000; }
#permissions-menu {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 4px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; z-index: 600;
  min-width: 180px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#permissions-menu.open { display: block; }
#permissions-menu label {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 13px; color: var(--text);
  cursor: pointer; white-space: nowrap;
}
#permissions-menu input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px; min-width: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  margin: 0;
}
#permissions-menu input[type="checkbox"]:checked {
  background: #fff;
  border-color: #fff;
}
#permissions-menu input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#tab-bar-wrapper {
  display: flex; align-items: center; min-height: 36px; flex-shrink: 0; flex: 1; min-width: 0;
}
#tab-bar {
  display: flex; align-items: center; overflow-x: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  gap: 0; min-height: 36px; flex: 1; min-width: 0;
}
#tab-bar::-webkit-scrollbar { height: 4px; }
#tab-bar::-webkit-scrollbar-track { background: transparent; }
#tab-bar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#tab-bar::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  white-space: nowrap; border-right: 1px solid var(--border);
  color: var(--text-muted); flex-shrink: 0; max-width: 180px;
  position: relative;
}
.tab.active { color: var(--text); background: var(--bg); }
.tab .tab-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab .tab-close {
  font-size: 14px; opacity: 0.5; padding: 0 2px; line-height: 1;
}
.tab .tab-close:hover { opacity: 1; }
.tab .tab-streaming {
  width: 6px; height: 6px; border-radius: 50%;
  background: #33cc33; flex-shrink: 0; animation: pulse 1.5s ease infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

#tab-new {
  padding: 6px 12px; font-size: 16px; cursor: pointer;
  color: var(--text-muted); background: none; border: none;
  flex-shrink: 0;
}
#tab-new:hover { color: var(--text); }

#messages-container { flex: 1; position: relative; overflow-y: auto; overflow-x: hidden; }
.messages-panel { padding: 16px; display: none; max-width: 800px; margin: 0 auto; }
.messages-panel.active { display: block; }

.message {
  max-width: 95%; margin-bottom: 8px; padding: 10px 14px;
  border-radius: 16px; line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; overflow: hidden;
  position: relative;
}
.message .msg-delete-btn {
  display: none; position: absolute; top: 6px; right: 6px;
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  color: var(--text-secondary); border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer;
  align-items: center; justify-content: center; font-size: 14px;
  z-index: 2;
}
.message .msg-delete-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
@media (hover: hover) {
  .message:hover .msg-delete-btn { display: flex; }
}
.msg-context-menu {
  position: fixed; background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 4px; z-index: 1000; min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.msg-context-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; color: var(--text-primary);
  padding: 10px 14px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.msg-context-menu button:hover { background: var(--bg-hover); }
.msg-context-menu button.destructive { color: #ff4444; }
.message.user {
  background: var(--bg-user); margin-left: auto;
  border-bottom-right-radius: 4px; white-space: pre-wrap;
}
.message.assistant {
  background: var(--bg-message); margin-right: auto;
  border-bottom-left-radius: 4px;
}
.message.assistant .content { white-space: pre-wrap; word-wrap: break-word; }
.message.assistant .content h1,
.message.assistant .content h2,
.message.assistant .content h3,
.message.assistant .content h4,
.message.assistant .content table,
.message.assistant .content ul,
.message.assistant .content ol,
.message.assistant .content blockquote,
.message.assistant .content hr { white-space: normal; }

.tool-block {
  background: var(--bg-tool); border-radius: 8px; padding: 8px 10px;
  margin: 6px 0; font-size: 13px; border-left: 3px solid var(--text-tool);
}
.tool-block .tool-header {
  color: var(--text-tool); font-weight: 600; margin-bottom: 4px;
  cursor: pointer;
}
.tool-block .tool-input {
  color: var(--text-muted); font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px; white-space: pre-wrap; word-break: break-all;
}
.tool-block .tool-result {
  color: var(--text); font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px; white-space: pre-wrap; margin-top: 4px;
  max-height: 200px; overflow-y: auto; word-break: break-all;
}
.tool-block.collapsed .tool-input,
.tool-block.collapsed .tool-result { display: none; }

.thinking-block {
  background: var(--bg-thinking); border-radius: 8px;
  margin: 6px 0; font-size: 13px; color: var(--text-thinking);
  border-left: 3px solid var(--text-thinking);
}
.thinking-header {
  padding: 8px 10px; cursor: pointer; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8;
}
.thinking-header::before { content: '▼ '; font-size: 10px; }
.thinking-block.collapsed .thinking-header::before { content: '▶ '; }
.thinking-content {
  padding: 0 10px 8px; font-style: italic; white-space: pre-wrap;
  max-height: 60vh; overflow-y: auto; line-height: 1.5;
  font-size: 13px;
}
.thinking-block.collapsed .thinking-content { display: none; }

.message pre {
  background: rgba(0,0,0,0.3); padding: 10px; border-radius: 8px;
  overflow-x: auto; margin: 8px 0; font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.message code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; }
.message :not(pre) > code {
  background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px;
}
.message.assistant .content { line-height: 1.6; }
.message.assistant .content h1,
.message.assistant .content h2,
.message.assistant .content h3,
.message.assistant .content h4 {
  margin: 12px 0 6px 0; font-weight: 600; color: var(--text);
}
.message.assistant .content h1 { font-size: 1.4em; }
.message.assistant .content h2 { font-size: 1.2em; }
.message.assistant .content h3 { font-size: 1.05em; }
.message.assistant .content h4 { font-size: 1em; color: var(--text-muted); }
.message.assistant .content table {
  width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px;
}
.message.assistant .content table th,
.message.assistant .content table td {
  border: 1px solid var(--border); padding: 6px 10px; text-align: left;
}
.message.assistant .content table th {
  background: rgba(255,255,255,0.05); font-weight: 600;
}
.message.assistant .content table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}
.message.assistant .content ul,
.message.assistant .content ol {
  margin: 6px 0; padding-left: 20px;
}
.message.assistant .content li { margin: 3px 0; }
.message.assistant .content blockquote {
  border-left: 3px solid var(--border); padding: 4px 12px;
  margin: 8px 0; color: var(--text-muted); font-style: italic;
}
.message.assistant .content hr {
  border: none; border-top: 1px solid var(--border); margin: 12px 0;
}
.message.assistant .content a {
  color: var(--text); text-decoration: underline;
  text-decoration-color: var(--text-muted);
}
.message.assistant .content a:hover { text-decoration-color: var(--text); }
.message.assistant .content del { opacity: 0.5; }

.activity-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; color: var(--text-muted); font-size: 13px;
  cursor: pointer; user-select: none;
}
.activity-indicator:hover { color: var(--text); }
.activity-indicator .spinner {
  width: 16px; height: 16px; border: 2px solid #333333;
  border-top-color: #ffffff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.activity-indicator .activity-peek {
  display: none; width: 100%; margin-top: 6px;
  font-size: 12px; font-style: italic; color: var(--text-thinking);
  white-space: pre-wrap; max-height: 200px; overflow-y: auto;
  padding: 6px 10px; background: var(--bg-thinking);
  border-left: 3px solid var(--text-thinking); border-radius: 4px;
  line-height: 1.4;
}
.activity-indicator.expanded { flex-wrap: wrap; }
.activity-indicator.expanded .activity-peek { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

#input-area {
  padding: 12px 10px; padding-bottom: calc(28px + var(--safe-bottom));
  background: #000000;
}
.input-bar-inner {
  display: flex; gap: 8px; align-items: flex-end;
  max-width: 800px; margin: 0 auto;
}
.input-bar-row {
  flex: 1; display: flex; align-items: flex-end;
  background: var(--input-bg); border: 1px solid #444444;
  border-radius: 24px; padding: 4px 4px 4px 12px;
  gap: 2px;
}
.input-bar-row textarea {
  flex: 1; padding: 8px 4px; background: transparent;
  border: none; color: var(--text);
  font-size: 16px; font-family: inherit; resize: none; outline: none;
  max-height: 120px; line-height: 1.4;
}
.input-bar-action {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: #ffffff; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.input-bar-action svg { stroke: #000000; }
.input-icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: transparent; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.input-icon-btn:hover svg { stroke: #ffffff !important; fill: #ffffff !important; }
.input-icon-btn:hover svg[fill="none"] { fill: none !important; }
.attach-wrapper { position: relative; }
.attach-menu {
  display: none; position: absolute; bottom: 44px; right: 0;
  background: #1a1a1a; border: 1px solid #333; border-radius: 10px;
  overflow: hidden; min-width: 160px; z-index: 100;
}
.attach-menu.open { display: block; }
.attach-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 16px; border: none; background: none; color: #ccc;
  font-size: 14px; cursor: pointer; text-align: left;
}
.attach-menu button:hover { background: #222; }
.attach-menu button + button { border-top: 1px solid #2a2a2a; }
#abort-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  color: white; font-size: 20px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
#action-btn.recording { background: #ff3333; }
#action-btn.recording svg { stroke: #ffffff; }
#abort-btn { background: #333333; color: #ffffff; display: none; }

#status-bar {
  display: none; padding: 6px 16px; background: #222222;
  color: #ffffff; font-size: 13px; text-align: center;
}

.cost-info {
  font-size: 11px; color: var(--text-muted); text-align: center; padding: 4px;
}

/* Image gen modal (chat button) */
#image-gen-modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8); z-index: 200;
  align-items: center; justify-content: center; padding: 20px;
}
#image-gen-modal.open { display: flex; }
.image-gen-box {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; width: 100%; max-width: 420px;
}
.image-gen-box h3 { margin-bottom: 16px; font-size: 18px; }
.image-gen-box textarea {
  width: 100%; padding: 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  font-size: 15px; font-family: inherit; resize: none; outline: none;
  min-height: 80px; margin-bottom: 12px;
}
.image-gen-box .btn-row { display: flex; gap: 10px; justify-content: flex-end; }
.image-gen-box button {
  padding: 10px 20px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.image-gen-box .btn-cancel { background: #333; color: #fff; }
.image-gen-box .btn-generate { background: #fff; color: #000; }
.image-gen-box .btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

/* Files page (sidebar > Bestanden) */
#files-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#files-page.open { display: flex; flex-direction: column; }
#files-page-inner {
  display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden;
}
.files-top-bar {
  display: flex; align-items: center; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.files-breadcrumb {
  display: flex; align-items: center; gap: 2px;
  padding: 10px 16px;
  font-size: 13px; overflow-x: auto; flex: 1;
}
.files-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 0 12px; flex-shrink: 0;
}
.files-toolbar-btn {
  background: none; border: 1px solid var(--border-color); color: #888;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.files-toolbar-btn:hover { background: #1a1a1a; color: #fff; border-color: #555; }
.files-input-field {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border-color);
  border-radius: 8px; color: #fff; font-size: 14px; outline: none; margin-bottom: 16px;
}
.files-input-field:focus { border-color: #555; }
.files-confirm-ok {
  background: #fff; border: none; color: #000;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.files-confirm-ok:hover { background: #ddd; }
.files-breadcrumb-btn {
  background: none; border: none; color: #888; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; font-size: 13px;
}
.files-breadcrumb-btn:hover { background: #1a1a1a; color: #fff; }
.files-breadcrumb-btn:last-child { color: #fff; }
.files-breadcrumb-sep { color: #444; margin: 0 1px; }
.files-layout {
  display: flex; flex: 1; overflow: hidden;
}
.files-tree {
  width: 280px; min-width: 200px; max-width: 400px;
  border-right: 1px solid var(--border); overflow-y: auto;
  flex-shrink: 0; padding: 4px 0;
}
.files-viewer {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
}
.files-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 12px; color: #444;
}
.files-empty p { font-size: 14px; }
.files-content {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.files-content-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; flex-shrink: 0;
}
.files-filename { font-weight: 600; color: #fff; }
.files-filesize { color: #666; font-size: 12px; }
.files-send-btn {
  background: #222; border: 1px solid #333; color: #aaa;
  padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.files-send-btn:hover { background: #333; color: #fff; }
.files-code {
  flex: 1; overflow: auto; padding: 12px 16px; margin: 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; line-height: 1.6; color: #ccc;
  white-space: pre; tab-size: 2; background: var(--bg);
}

/* File editor — overlay textarea on highlighted code */
.files-editor-wrapper {
  flex: 1; overflow: hidden; position: relative;
}
.files-editor-wrapper .files-code {
  overflow: auto; pointer-events: none;
}
.files-editor {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  padding: 12px 16px; margin: 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; line-height: 1.6;
  white-space: pre; tab-size: 2;
  background: transparent; color: transparent; caret-color: #fff;
  border: none; outline: none; resize: none;
  box-sizing: border-box; overflow: auto;
  z-index: 1;
}
.files-header-actions {
  margin-left: auto; display: flex; gap: 6px; align-items: center;
}
.files-edit-btn {
  background: #222; border: 1px solid #333; color: #aaa;
  padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.files-edit-btn:hover { background: #333; color: #fff; }
.files-save-btn {
  background: #fff; border: 1px solid #fff; color: #000;
  padding: 3px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
  font-weight: 600;
}
.files-save-btn:hover { background: #ddd; }
.files-save-btn:disabled { opacity: 0.5; cursor: default; }
.files-cancel-btn {
  background: #222; border: 1px solid #333; color: #aaa;
  padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.files-cancel-btn:hover { background: #333; color: #fff; }
.files-edit-indicator {
  color: #888; font-size: 11px; font-style: italic;
}

/* Syntax highlighting — github-dark thema met transparante achtergrond */
code.hljs, .files-code.hljs, pre code.hljs { background: transparent !important; padding: 0 !important; }
.files-line-num {
  display: inline-block; width: 4em; text-align: right;
  margin-right: 16px; color: #444; user-select: none;
  font-size: 12px;
}
.files-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; cursor: pointer; font-size: 13px;
}
.files-item:hover { background: #111; }
.files-item-active { background: #1a1a1a; }
.files-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-item-dir .files-item-name { color: #fff; }
.files-item-file .files-item-name { color: #aaa; }
.files-item-size { color: #555; font-size: 11px; flex-shrink: 0; }
/* Files context menu */
.files-context-menu {
  position: fixed; background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 4px; z-index: 1000; min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.files-context-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; color: var(--text-primary);
  padding: 10px 14px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.files-context-menu button:hover { background: var(--bg-hover); }
.files-context-menu button.destructive { color: #ff4444; }
.files-context-sep { height: 1px; background: var(--border-color); margin: 4px 8px; }

/* Files confirm dialog */
.files-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 1001;
}
.files-confirm-dialog {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 24px; max-width: 360px; width: 90%;
}
.files-confirm-title { font-size: 16px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.files-confirm-message { font-size: 13px; color: #888; margin-bottom: 20px; line-height: 1.5; }
.files-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.files-confirm-cancel {
  background: none; border: 1px solid var(--border-color); color: #aaa;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.files-confirm-cancel:hover { background: var(--bg-hover); }
.files-confirm-delete {
  background: #ff4444; border: none; color: #fff;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.files-confirm-delete:hover { background: #cc3333; }

/* Files toast */
.files-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px;
  opacity: 0; transition: opacity 0.3s, transform 0.3s; z-index: 1002;
  pointer-events: none;
}
.files-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.files-loading { display: flex; justify-content: center; padding: 40px; }
.files-error { padding: 20px; color: #666; text-align: center; font-size: 13px; }

/* Files chat panel */
.files-chat-panel {
  width: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column;
  border-left: 1px solid var(--border); background: var(--bg);
  transition: width 0.25s ease, min-width 0.25s ease;
  flex-shrink: 0;
}
.files-layout.chat-open .files-chat-panel {
  width: 420px; min-width: 320px;
}
.files-layout.chat-open .files-viewer {
  flex: 1; min-width: 0;
}
.files-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
  white-space: nowrap;
}
.files-chat-close {
  background: none; border: none; color: #666; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 4px;
}
.files-chat-close:hover { color: #fff; }
.files-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 12px;
  font-size: 13px; line-height: 1.6;
}
.files-chat-msg {
  padding: 8px 12px; border-radius: 8px; max-width: 100%;
  word-wrap: break-word; white-space: pre-wrap;
}
.files-chat-msg.user {
  background: #1a1a1a; color: #ccc; align-self: flex-end;
  border: 1px solid #333;
}
.files-chat-msg.assistant {
  background: #111; color: #ccc; align-self: flex-start;
  border: 1px solid #222;
}
.files-chat-msg.assistant .content { line-height: 1.6; }
.files-chat-msg.assistant .content p { margin: 0 0 8px 0; }
.files-chat-msg.assistant .content p:last-child { margin: 0; }
.files-chat-msg.assistant .content code {
  background: #1a1a1a; padding: 1px 5px; border-radius: 3px; font-size: 12px;
}
.files-chat-msg.assistant .content pre {
  background: #0a0a0a; padding: 8px 10px; border-radius: 4px;
  overflow-x: auto; margin: 6px 0; font-size: 12px;
}
.files-chat-msg.system {
  color: #555; font-size: 11px; text-align: center; align-self: center;
  font-style: italic;
}
.files-chat-msg.assistant .tool-block {
  margin: 6px 0; border: 1px solid #222; border-radius: 4px; font-size: 11px;
}
.files-chat-msg.assistant .tool-block .tool-header {
  padding: 4px 8px; background: #1a1a1a; color: #888; cursor: pointer;
}
.files-chat-msg.assistant .tool-block .tool-input,
.files-chat-msg.assistant .tool-block .tool-result {
  padding: 4px 8px; color: #666; max-height: 80px; overflow: auto;
  font-family: monospace; font-size: 11px; white-space: pre-wrap;
}
.files-chat-msg.assistant .thinking-block {
  margin: 4px 0; font-size: 11px;
}
.files-chat-msg.assistant .thinking-block .thinking-header {
  color: #555; cursor: pointer; padding: 2px 0;
}
.files-chat-msg.assistant .thinking-block .thinking-content {
  color: #444; max-height: 60px; overflow: auto; white-space: pre-wrap;
}
.files-chat-input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
}
#files-chat-input {
  flex: 1; background: #111; border: 1px solid #333; color: #ccc;
  padding: 8px 12px; border-radius: 6px; font-size: 13px;
  resize: none; outline: none; font-family: inherit;
  max-height: 120px; line-height: 1.4;
}
#files-chat-input:focus { border-color: #555; }
.files-chat-send {
  background: #222; border: 1px solid #333; color: #aaa;
  padding: 8px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.files-chat-send:hover { background: #333; color: #fff; }
.files-chat-activity {
  padding: 4px 12px; color: #555; font-size: 11px; font-style: italic;
}

@media (max-width: 768px) {
  .files-layout { flex-direction: column; }
  .files-tree { width: 100%; max-width: none; border-right: none; border-bottom: 1px solid var(--border); max-height: 45%; }
  .files-viewer { min-height: 0; }
  .files-layout.chat-open .files-chat-panel { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); }
  .files-layout.chat-open .files-viewer { max-height: 50%; }
}

/* Designer page */
#designer-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#designer-page.open { display: flex; flex-direction: column; }
#designer-page-inner {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.designer-toolbar-top {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.designer-back-btn {
  background: none; border: none; color: #fff; cursor: pointer;
  padding: 4px; display: flex; align-items: center; margin-right: 4px;
}
.designer-back-btn:hover { opacity: 0.7; }
.designer-toolbar-group {
  display: flex; align-items: center; gap: 6px;
}
.designer-toolbar-group label {
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.designer-toolbar-group select,
.designer-toolbar-group input[type="number"] {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px 8px; font-size: 13px; font-family: inherit;
}
.designer-toolbar-group input[type="color"] {
  width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px;
  background: none; cursor: pointer; padding: 0;
}
.designer-toolbar-right { margin-left: auto; }
.designer-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 10px; font-size: 13px; font-family: inherit;
  cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.designer-btn:hover { background: #222; }
.designer-btn.active { background: #fff; color: #000; border-color: #fff; }
.designer-gen-mode {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 13px; font-family: inherit; cursor: pointer;
}
.designer-btn-export { background: #fff; color: #000; border-color: #fff; }
.designer-btn-export:hover { background: #ddd; }
.designer-topbar-dropdown { position: relative; display: inline-flex; }
.designer-topbar-dropdown-menu {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 4px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px; z-index: 600; min-width: 180px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.designer-topbar-dropdown-menu.open { display: block; }
.designer-topbar-dropdown-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; background: none; border: none; color: var(--text);
  font-size: 14px; cursor: pointer; border-radius: 6px; white-space: nowrap;
}
.designer-topbar-dropdown-menu button:hover { background: #222; }
.designer-topbar-dropdown-menu button svg { flex-shrink: 0; }
.designer-btn-delete { color: #ff4444; border-color: #ff4444; }
.designer-btn-delete:hover { background: rgba(255,68,68,0.15); }

.designer-gen-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.designer-gen-modal-content {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 10px; width: 340px; max-width: 90vw;
}
.designer-gen-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
}
.designer-gen-modal-close {
  background: none; border: none; color: var(--text); font-size: 20px;
  cursor: pointer; padding: 0; line-height: 1;
}
.designer-gen-modal-body {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
}
.designer-gen-modal-body input {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; font-family: inherit;
}
.designer-gen-modal-body input::placeholder { color: #555; }
.designer-gen-modal-body .designer-gen-mode { width: 100%; }

.designer-layer-text-controls,
.designer-layer-shape-controls {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.designer-layer-text-controls select,
.designer-layer-text-controls input[type="number"],
.designer-layer-shape-controls input[type="number"] {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 2px 4px; font-size: 11px; font-family: inherit;
}
.designer-layer-text-controls select { max-width: 70px; }
.designer-layer-action-btn.active {
  background: #fff; color: #000;
}

#designer-main-area {
  flex: 1; display: flex; overflow: hidden; position: relative;
}
.designer-tools-sidebar {
  display: flex; flex-direction: column; gap: 4px; padding: 8px 6px;
  background: var(--bg-secondary); border-left: 1px solid var(--border);
  align-items: center; position: relative; z-index: 10;
  transition: box-shadow 0.2s, border-radius 0.2s;
}
.designer-tools-sidebar.floating {
  position: absolute; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 100;
  cursor: default;
}
.designer-tools-sidebar.floating.snapped {
  border-radius: 0; box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.designer-toolbar-draghandle {
  width: 28px; height: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text-muted); cursor: grab; user-select: none;
  border-radius: 4px; margin-bottom: 2px; letter-spacing: 1px; line-height: 1;
}
.designer-toolbar-draghandle:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.designer-toolbar-draghandle:active { cursor: grabbing; }
.designer-tools-sidebar.floating .designer-toolbar-draghandle { cursor: grab; }
.designer-tools-sidebar.floating .designer-toolbar-draghandle:active { cursor: grabbing; }
.designer-tool-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: none; border: 1px solid transparent; color: var(--text);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.designer-tool-icon:hover { background: #222; border-color: var(--border); }
.designer-tool-icon:active { background: #fff; color: #000; border-color: #fff; }
.designer-tool-icon.active { background: #fff; color: #000; border-color: #fff; }
.designer-zoom-controls {
  display: flex; align-items: center; gap: 2px;
}
.designer-zoom-btn { padding: 4px 6px !important; min-width: 0 !important; }
.designer-zoom-label {
  font-size: 11px; color: var(--text-muted); min-width: 40px; text-align: center;
  cursor: pointer; user-select: none;
}
.designer-zoom-label:hover { color: var(--text); }
#designer-canvas-wrapper {
  flex: 1; position: relative; overflow: hidden; background: #0a0a0a;
}
#designer-layers-panel {
  width: 220px; min-width: 220px; background: var(--bg-secondary);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  overflow: hidden;
}
.designer-layers-header {
  padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
#designer-layers-list {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
.designer-layer-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--border); transition: background 0.1s;
  user-select: none;
}
.designer-layer-item:hover { background: #1a1a1a; }
.designer-layer-item.active { background: #222; outline: 1px solid #555; }
.designer-layer-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.designer-layer-icon {
  width: 18px; height: 18px; flex-shrink: 0; opacity: 0.6;
}
.designer-layer-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px;
}
.designer-layer-rename-input {
  flex: 1; background: var(--input-bg); border: 1px solid #555; color: var(--text);
  border-radius: 3px; padding: 1px 4px; font-size: 12px; font-family: inherit;
  outline: none; min-width: 0;
}
.designer-layer-collapse-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px; flex-shrink: 0; opacity: 0.4; transition: opacity 0.1s, transform 0.15s;
  display: flex; align-items: center;
}
.designer-layer-collapse-btn:hover { opacity: 0.8; }
.designer-layer-collapse-btn.collapsed { transform: rotate(-90deg); }
.designer-layer-actions {
  display: flex; gap: 2px; opacity: 0; transition: opacity 0.1s;
}
.designer-layer-item:hover .designer-layer-actions { opacity: 1; }
.designer-layer-action-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px; font-size: 14px; line-height: 1;
}
.designer-layer-action-btn:hover { color: var(--text); }
.designer-layer-lock-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px; font-size: 13px; line-height: 1; opacity: 0.4; transition: opacity 0.1s;
  flex-shrink: 0;
}
.designer-layer-lock-btn:hover { opacity: 0.8; }
.designer-layer-lock-btn.locked { opacity: 1; color: #fff; }
.designer-layer-item.locked .designer-layer-name { opacity: 0.5; }
.designer-layer-item.locked .designer-layer-props { opacity: 0.4; pointer-events: none; }
.designer-layer-props {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
}
.designer-layer-prop-row {
  display: flex; align-items: center; gap: 6px; width: 100%;
}
.designer-layer-prop-label {
  font-size: 10px; color: var(--text-muted); min-width: 14px; flex-shrink: 0;
}
.designer-layer-props input[type="range"] {
  flex: 1; height: 3px; -webkit-appearance: none; appearance: none;
  background: #333; border-radius: 2px; outline: none; cursor: pointer;
}
.designer-layer-props input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px;
  background: #fff; border-radius: 50%; cursor: pointer;
}
.designer-layer-props select {
  flex: 1; background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 2px 4px; font-size: 10px; font-family: inherit;
  cursor: pointer;
}
.designer-layer-opacity-val {
  font-size: 10px; color: var(--text-muted); min-width: 28px; text-align: right;
}
.designer-layer-fx-container {
  width: 100%; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border);
}
.designer-layer-fx-header {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 0; user-select: none;
}
.designer-layer-fx-header:hover { color: var(--text); }
.designer-layer-fx-arrow {
  font-size: 8px; width: 10px; text-align: center; transition: color 0.15s;
}
.designer-layer-fx-badge {
  background: #555; color: #fff; font-size: 8px; padding: 0 4px;
  border-radius: 6px; margin-left: auto; line-height: 14px;
}
.designer-layer-fx-body {
  display: flex; flex-direction: column; gap: 4px; padding-top: 4px; width: 100%;
}
.designer-layer-fx-row {
  gap: 6px;
}
.designer-layer-fx-row input[type="checkbox"] {
  width: 12px; height: 12px; margin: 0; cursor: pointer;
  accent-color: #fff;
}
.designer-layer-fx-label {
  font-size: 10px; color: var(--text); cursor: default;
}
.designer-layer-fx-details {
  display: flex; flex-direction: column; gap: 3px; padding-left: 18px; width: 100%;
  box-sizing: border-box;
}
.designer-layer-fx-color {
  width: 24px; height: 18px; padding: 0; border: 1px solid var(--border);
  border-radius: 3px; cursor: pointer; background: none;
}
#designer-canvas {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border), 0 4px 24px rgba(0,0,0,0.5);
  touch-action: none;
}
.designer-guides {
  position: absolute; inset: 0; pointer-events: none; z-index: 9999;
}
.designer-guide {
  position: absolute; background: none;
}
.designer-guide-h {
  left: 0; right: 0; top: 50%; height: 0;
  border-top: 1px dashed rgba(255,255,255,0.35);
}
.designer-guide-v {
  top: 0; bottom: 0; left: 50%; width: 0;
  border-left: 1px dashed rgba(255,255,255,0.35);
}
#designer-guides-btn.active {
  background: #333;
}
.designer-element {
  position: absolute; cursor: move; user-select: none;
  min-width: 20px; min-height: 16px;
}
.designer-element.selected {
  outline: 2px solid #000; outline-offset: 2px;
}
.designer-text {
  padding: 4px 8px; cursor: move; white-space: nowrap; overflow: visible;
  outline-color: #fff;
}
.designer-text[data-text-mode="area"] {
  white-space: normal; word-wrap: break-word; overflow: hidden;
}
.designer-text:focus { cursor: text; }
.designer-text-mode-widget {
  position: absolute; bottom: -22px; right: -2px;
  width: 20px; height: 20px;
  background: #333; border: 1px solid #555; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; z-index: 10;
  pointer-events: auto;
}
.designer-text-mode-widget:hover { background: #555; }
.designer-image { display: inline-block; }
.designer-image img { pointer-events: none; user-select: none; }
.designer-shape { display: inline-block; }
.designer-shape svg { pointer-events: none; }
.path-edit-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 100; overflow: visible; pointer-events: none;
}
.path-edit-point { pointer-events: all; z-index: 101; }
.path-edit-anchor {
  background: #000; border: 1.5px solid #fff; border-radius: 1px;
  box-shadow: 0 0 3px rgba(0,0,0,0.5);
}
.path-edit-anchor.selected { background: #fff; }
.path-edit-handle {
  background: #888; border: 1px solid #fff; border-radius: 50%;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.path-edit-radius {
  background: transparent; border: 2px solid #888; border-radius: 50%;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.path-edit-radius:hover { border-color: #fff; }
.path-edit-add {
  background: transparent; border: 1px dashed #666; border-radius: 50%;
  opacity: 0.4; transition: opacity 0.15s;
}
.path-edit-add:hover { opacity: 1; background: rgba(255,255,255,0.15); }
#designer-shape-controls {
  display: flex; align-items: center; gap: 6px;
}
#designer-shape-controls input[type="color"] {
  width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px;
  background: none; cursor: pointer; padding: 0;
}
/* Context menu */
.designer-context-menu {
  position: fixed; z-index: 10000;
  background: #1a1a1a; border: 1px solid #333;
  border-radius: 6px; padding: 4px 0;
  min-width: 140px; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.designer-context-menu-item {
  padding: 8px 16px; cursor: pointer;
  font-size: 13px; color: #ccc;
}
.designer-context-menu-item:hover {
  background: #333; color: #fff;
}
.designer-context-menu-item.has-submenu {
  display: flex; align-items: center; position: relative;
}
.designer-context-submenu {
  display: none; position: absolute;
  left: 100%; top: -4px;
  background: #1a1a1a; border: 1px solid #333;
  border-radius: 6px; padding: 4px 0;
  min-width: 180px; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.designer-context-menu-item.has-submenu:hover > .designer-context-submenu {
  display: block;
}

/* AI Image Edit Modal */
.ai-edit-modal-overlay {
  position: fixed; inset: 0; z-index: 20000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.ai-edit-modal {
  background: #111; border: 1px solid #333; border-radius: 16px;
  display: flex; width: 800px; max-width: 90vw; max-height: 85vh;
  overflow: hidden; position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.ai-edit-close {
  position: absolute; top: 12px; right: 16px; z-index: 10;
  background: none; border: none; color: #666; font-size: 24px;
  cursor: pointer; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: all .15s;
}
.ai-edit-close:hover { background: #222; color: #fff; }
.ai-edit-preview {
  flex: 1; min-width: 0; background: repeating-conic-gradient(#222 0% 25%, #1a1a1a 0% 50%) 50% / 20px 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; border-right: 1px solid #222;
}
.ai-edit-preview img {
  max-width: 100%; max-height: 60vh; object-fit: contain;
  border-radius: 4px;
}
.ai-edit-controls {
  width: 280px; flex-shrink: 0; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.ai-edit-title {
  font-size: 16px; font-weight: 600; color: #fff;
}
.ai-edit-quick-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ai-edit-preset {
  background: #1a1a1a; border: 1px solid #333; border-radius: 999px;
  color: #aaa; font-size: 12px; padding: 6px 14px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.ai-edit-preset:hover:not(:disabled) { background: #222; color: #fff; border-color: #555; }
.ai-edit-preset:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-edit-input-row {
  display: flex; gap: 8px; margin-top: auto;
}
.ai-edit-input {
  flex: 1; background: #1a1a1a; border: 1px solid #333;
  border-radius: 10px; padding: 10px 14px; color: #fff;
  font-size: 13px; outline: none;
}
.ai-edit-input:focus { border-color: #555; }
.ai-edit-input:disabled { opacity: 0.4; }
.ai-edit-send {
  background: #fff; border: none; border-radius: 10px;
  width: 40px; height: 40px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: #000;
  flex-shrink: 0; transition: all .15s;
}
.ai-edit-send:hover:not(:disabled) { background: #ddd; }
.ai-edit-send:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-edit-status {
  font-size: 12px; color: #666; min-height: 18px;
  transition: all .2s;
}
.ai-edit-status.active { color: #888; }
.ai-edit-status.success { color: #4a4; }
.ai-edit-status.error { color: #a44; }

.designer-resize-handle {
  position: absolute; width: 14px; height: 14px;
  background: #fff; border: 2px solid #000; border-radius: 3px;
  display: none; z-index: 10;
}
.designer-element.selected .designer-resize-handle { display: block; }
.designer-multi-active .designer-element.selected .designer-resize-handle { display: none; }
.designer-multi-active .designer-element.selected .designer-rotate-zone { display: none; }
/* Handles live in wrapper, not canvas, so use :has() to detect multi-active state */
#designer-canvas-wrapper:has(.designer-multi-active) .designer-corner-radius-handle { display: none; }
.designer-multi-active .designer-element.selected { outline: 1px dashed #000; outline-offset: 1px; }
.designer-handle-tl { top: -7px; left: -7px; cursor: nwse-resize; }
.designer-handle-tr { top: -7px; right: -7px; cursor: nesw-resize; }
.designer-handle-bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.designer-handle-br { bottom: -7px; right: -7px; cursor: nwse-resize; }


/* Group element */
.designer-group {
  border: 1px dashed rgba(255,255,255,0.15);
}
.designer-group.selected {
  border-color: rgba(255,255,255,0.3);
}

/* Alignment toolbar */
.designer-align-group { gap: 2px !important; }
.designer-btn-small {
  padding: 4px 5px !important; min-width: 0;
}
.designer-btn-small svg { width: 14px; height: 14px; }
.designer-toolbar-sep {
  width: 1px; height: 18px; background: #333; margin: 0 2px;
}

/* Disabled context menu */
.designer-context-menu-item.disabled {
  color: #555; cursor: default; pointer-events: none;
}

.designer-corner-radius-handle {
  position: absolute; width: 10px; height: 10px;
  background: #fff; border: 2px solid #888;
  border-radius: 50%; z-index: 1001;
  cursor: pointer; box-sizing: border-box;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}
.designer-corner-radius-handle:hover { border-color: #4a90d9; background: #4a90d9; }
.designer-corner-radius-handle.single-active { background: #4a90d9; border-color: #4a90d9; }

/* Corner rotation zones — invisible hit areas just outside each corner */
.designer-rotate-zone {
  position: absolute; width: 20px; height: 20px;
  display: none; z-index: 9;
}
.designer-element.selected .designer-rotate-zone { display: block; }
.designer-rotate-tl { top: -16px; left: -16px; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M1 4v6h6'/%3E%3Cpath d='M3.51 15a9 9 0 1 0 2.13-9.36L1 10'/%3E%3C/svg%3E") 9 9, pointer; }
.designer-rotate-tr { top: -16px; right: -16px; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M23 4v6h-6'/%3E%3Cpath d='M20.49 15a9 9 0 1 1-2.13-9.36L23 10'/%3E%3C/svg%3E") 9 9, pointer; }
.designer-rotate-bl { bottom: -16px; left: -16px; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M1 20v-6h6'/%3E%3Cpath d='M3.51 9a9 9 0 1 1 2.13 9.36L1 14'/%3E%3C/svg%3E") 9 9, pointer; }
.designer-rotate-br { bottom: -16px; right: -16px; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M23 20v-6h-6'/%3E%3Cpath d='M20.49 9a9 9 0 1 0-2.13 9.36L23 14'/%3E%3C/svg%3E") 9 9, pointer; }

/* Multi-select */
.designer-element.multi-selected {
  outline: 1px dashed #000; outline-offset: 1px;
}

/* Multi-selection bounding box */
.designer-multi-bbox {
  position: absolute;
  border: 2px solid #000;
  pointer-events: auto;
  cursor: move;
  z-index: 9990;
}
.designer-bbox-handle {
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border: 2px solid #000;
  border-radius: 3px;
  z-index: 9991;
  pointer-events: auto;
}
.designer-bbox-handle-tl { top: -7px; left: -7px; cursor: nwse-resize; }
.designer-bbox-handle-tr { top: -7px; right: -7px; cursor: nesw-resize; }
.designer-bbox-handle-bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.designer-bbox-handle-br { bottom: -7px; right: -7px; cursor: nwse-resize; }

/* Boolean operations toolbar (in topbar) */
.designer-bool-group {
  gap: 2px;
}

/* Group */
.designer-group { pointer-events: all; }
.designer-group > .designer-element { position: absolute; }

/* Alignment toolbar */
.designer-align-group { gap: 2px !important; }
.designer-btn-small { padding: 4px 5px !important; }
.designer-toolbar-sep {
  width: 1px; height: 20px; background: #333; margin: 0 2px;
}

/* Context menu disabled items */
.designer-context-menu-item.disabled {
  color: #555; cursor: default; pointer-events: none;
}

#designer-radius-control {
  display: flex; align-items: center; gap: 4px;
}
#designer-corner-radius {
  background: var(--bg-secondary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px;
  font-size: 12px;
}

#designer-custom-size {
  display: flex; align-items: center; gap: 4px;
}
#designer-custom-size input { width: 70px; }
#designer-custom-size span { color: var(--text-muted); font-size: 13px; }

/* Gradient controls */
.designer-gradient-control {
  padding: 4px 0;
}
.designer-gradient-type-row {
  display: flex; gap: 2px; margin-bottom: 4px;
}
.designer-gradient-type-btn {
  flex: 1; padding: 3px 4px; font-size: 11px;
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 4px; cursor: pointer; font-family: inherit;
}
.designer-gradient-type-btn.active {
  background: #fff; color: #000; border-color: #fff;
}
.designer-gradient-type-btn:hover:not(.active) { background: #222; }
.designer-gradient-preview {
  height: 16px; border-radius: 4px; margin-bottom: 4px;
  border: 1px solid var(--border);
}
.designer-gradient-stops { display: flex; flex-direction: column; gap: 3px; }
.designer-gradient-stop-row {
  display: flex; align-items: center; gap: 4px;
}

/* Designer projects overview */
#designer-projects-view {
  flex: 1; overflow-y: auto; padding: 40px 24px;
}
.designer-projects-header {
  text-align: center; margin-bottom: 32px;
}
.designer-projects-header svg { margin-bottom: 8px; }
.designer-projects-header h2 {
  font-size: 22px; font-weight: 600; color: var(--text); margin: 0 0 4px;
}
.designer-projects-header p {
  font-size: 14px; color: var(--text-muted); margin: 0;
}
.designer-projects-actions {
  display: flex; justify-content: center; margin-bottom: 24px;
}
.designer-new-project-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #000; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-family: inherit;
  font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.designer-new-project-btn:hover { background: #ddd; }
.designer-projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; max-width: 900px; margin: 0 auto;
}
.designer-project-card {
  display: flex; flex-direction: column;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; overflow: hidden;
  transition: background 0.15s, border-color 0.15s;
}
.designer-project-card:hover {
  background: #1a1a1a; border-color: #444;
}
.designer-project-thumb {
  width: 100%; aspect-ratio: 16/10; background: #0a0a0a;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.designer-project-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.designer-project-thumb.empty {
  opacity: 0.4;
}
.designer-project-card-bottom {
  display: flex; align-items: center;
}
.designer-project-info { flex: 1; min-width: 0; padding: 12px 14px; }
.designer-project-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.designer-project-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 3px;
}
.designer-project-delete {
  background: none; border: none; color: #666; cursor: pointer;
  padding: 6px; border-radius: 6px; transition: color 0.15s, background 0.15s;
  flex-shrink: 0; margin-right: 8px;
}
.designer-project-delete:hover { color: #ff4444; background: rgba(255,68,68,0.1); }
#designer-projects-empty {
  text-align: center; padding: 40px; color: #444;
}
#designer-projects-empty svg { margin-bottom: 12px; }
#designer-projects-empty p { font-size: 14px; color: #555; margin: 0; }

/* Mobile designer */
@media (max-width: 768px) {
  .designer-toolbar-top {
    padding: 6px 8px; gap: 4px; flex-wrap: wrap;
  }
  .designer-toolbar-group { gap: 4px; }
  .designer-toolbar-group label { display: none; }
  .designer-toolbar-group select,
  .designer-toolbar-group input[type="number"] { padding: 4px 6px; font-size: 12px; }
  .designer-toolbar-group input[type="color"] { width: 24px; height: 24px; }
  .designer-toolbar-right { margin-left: 0; }
  .designer-btn {
    padding: 6px 8px; font-size: 0; gap: 0;
  }
  .designer-btn svg { width: 20px; height: 20px; }
  .designer-btn-export { font-size: 0; }
  .designer-align-group { display: none !important; }
  .designer-tools-sidebar { display: none; }

  /* Overflow menu for secondary actions */
  .designer-mobile-overflow { display: inline-flex; position: relative; }
  .designer-mobile-overflow-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 18px; line-height: 1;
  }
  .designer-mobile-overflow-btn:hover { background: #222; }
  .designer-overflow-menu {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 4px;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
    padding: 4px; z-index: 600; min-width: 160px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
  .designer-overflow-menu.open { display: block; }
  .designer-overflow-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 10px 12px; background: none; border: none; color: var(--text);
    font-size: 14px; cursor: pointer; border-radius: 6px; white-space: nowrap;
  }
  .designer-overflow-menu button:hover { background: #222; }
  .designer-overflow-menu button svg { width: 16px; height: 16px; flex-shrink: 0; }

  /* Hide desktop-only buttons that move to overflow */
  .designer-mobile-hide { display: none !important; }
  .designer-align-group { display: none !important; }

  /* Layers button in toolbar */
  .designer-mobile-layers-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 6px 8px; cursor: pointer;
  }
  .designer-mobile-layers-btn:hover { background: #222; }
  .designer-mobile-layers-btn svg { width: 20px; height: 20px; }

  /* Layers panel: bottom sheet on mobile */
  #designer-layers-panel {
    display: none; position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; height: auto; max-height: 55vh; min-width: 0;
    border-left: none; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; z-index: 500;
    transform: translateY(100%); transition: transform 0.25s ease;
  }
  #designer-layers-panel.mobile-open {
    display: flex; transform: translateY(0);
  }
  .designer-layers-header {
    padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  }
  .designer-layers-close-btn {
    display: inline-flex; background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 20px; padding: 4px;
  }
  .designer-layers-close-btn:hover { color: var(--text); }
  .designer-layers-backdrop {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 499;
  }
  .designer-layers-backdrop.open { display: block; }

  #designer-projects-view { padding: 24px 16px; }
  .designer-projects-grid { grid-template-columns: 1fr; }
  #designer-main-area.designer-chat-open .designer-chat-panel { width: 100% !important; min-width: 0 !important; border-left: none !important; border-top: 1px solid var(--border); }
  #designer-main-area.designer-chat-open #designer-canvas-wrapper { flex: 1; min-height: 40%; }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 769px) {
  .designer-mobile-overflow { display: none; }
  .designer-mobile-layers-btn { display: none; }
  .designer-layers-close-btn { display: none; }
  .designer-layers-backdrop { display: none !important; }
}

/* Designer Chat Panel */
.designer-chat-panel {
  width: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column;
  border-left: 1px solid var(--border); background: var(--bg);
  transition: width 0.25s ease, min-width 0.25s ease;
  flex-shrink: 0;
}
#designer-main-area.designer-chat-open .designer-chat-panel {
  width: 420px; min-width: 320px;
}
#designer-main-area.designer-chat-open #designer-canvas-wrapper {
  flex: 1; min-width: 0;
}

/* Designer Preview Mode */
#designer-page.designer-preview-mode .designer-toolbar-top,
#designer-page.designer-preview-mode .designer-tools-sidebar,
#designer-page.designer-preview-mode #designer-layers-panel,
#designer-page.designer-preview-mode .designer-chat-panel,
#designer-page.designer-preview-mode .designer-layers-backdrop {
  display: none !important;
}
#designer-page.designer-preview-mode #designer-page-inner {
  height: 100%;
}
#designer-page.designer-preview-mode #designer-main-area {
  height: 100%;
}
#designer-page.designer-preview-mode #designer-canvas-wrapper {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#designer-page.designer-preview-mode #designer-canvas {
  box-shadow: none;
}
.designer-preview-hint {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.1); color: #888; padding: 8px 20px;
  border-radius: 8px; font-size: 13px; z-index: 100;
  pointer-events: none; backdrop-filter: blur(8px);
  transition: opacity 0.3s;
}

.designer-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
  white-space: nowrap;
}
.designer-chat-close {
  background: none; border: none; color: #666; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 4px;
}
.designer-chat-close:hover { color: #fff; }
.designer-chat-tabs {
  display: flex; align-items: center; gap: 0;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
  background: #0a0a0a;
}
.designer-chat-tabs::-webkit-scrollbar { display: none; }
.designer-chat-tab {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; font-size: 11px; color: #666;
  cursor: pointer; border-right: 1px solid var(--border);
  white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.designer-chat-tab:hover { background: #1a1a1a; color: #999; }
.designer-chat-tab.active { background: #111; color: #fff; }
.designer-chat-tab-title {
  max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.designer-chat-tab-close {
  font-size: 14px; line-height: 1; color: #555; cursor: pointer;
  margin-left: 2px;
}
.designer-chat-tab-close:hover { color: #fff; }
.designer-chat-tab-new {
  color: #555; font-size: 16px; padding: 5px 10px;
  border-right: none;
}
.designer-chat-tab-new:hover { color: #fff; background: #1a1a1a; }
.designer-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 12px;
  font-size: 13px; line-height: 1.6;
}
.designer-chat-msg {
  padding: 8px 12px; border-radius: 8px; max-width: 100%;
  word-wrap: break-word; white-space: pre-wrap;
}
.designer-chat-msg.user {
  background: #1a1a1a; color: #ccc; align-self: flex-end;
  border: 1px solid #333;
}
.designer-chat-msg.assistant {
  background: #111; color: #ccc; align-self: flex-start;
  border: 1px solid #222;
}
.designer-chat-msg.assistant .content { line-height: 1.6; white-space: normal; }
.designer-chat-msg.assistant .content p { margin: 0 0 8px 0; }
.designer-chat-msg.assistant .content p:last-child { margin: 0; }
.designer-chat-msg.assistant .content code {
  background: #1a1a1a; padding: 1px 5px; border-radius: 3px; font-size: 12px;
}
.designer-chat-msg.assistant .content pre {
  background: #0a0a0a; padding: 8px 10px; border-radius: 4px;
  overflow-x: auto; margin: 6px 0; font-size: 12px;
}
.designer-chat-msg.system {
  color: #555; font-size: 11px; text-align: center; align-self: center;
  font-style: italic; white-space: normal;
}
.designer-chat-msg.assistant .tool-block {
  margin: 6px 0; border: 1px solid #222; border-radius: 4px; font-size: 11px;
}
.designer-chat-msg.assistant .tool-block .tool-header {
  padding: 4px 8px; background: #1a1a1a; color: #888; cursor: pointer;
}
.designer-chat-msg.assistant .tool-block .tool-input,
.designer-chat-msg.assistant .tool-block .tool-result {
  padding: 4px 8px; color: #666; max-height: 80px; overflow: auto;
  font-family: monospace; font-size: 11px; white-space: pre-wrap;
}
.designer-chat-msg.assistant .thinking-block {
  margin: 4px 0; font-size: 11px;
}
.designer-chat-msg.assistant .thinking-block .thinking-header {
  color: #555; cursor: pointer; padding: 2px 0;
}
.designer-chat-msg.assistant .thinking-block .thinking-content {
  color: #444; max-height: 60px; overflow: auto; white-space: pre-wrap;
}
.designer-chat-input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
}
#designer-chat-input {
  flex: 1; background: #111; border: 1px solid #333; color: #ccc;
  padding: 8px 12px; border-radius: 6px; font-size: 13px;
  resize: none; outline: none; font-family: inherit;
  max-height: 120px; line-height: 1.4;
}
#designer-chat-input:focus { border-color: #555; }
.designer-chat-send {
  background: #222; border: 1px solid #333; color: #aaa;
  padding: 8px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.designer-chat-send:hover { background: #333; color: #fff; }
.designer-chat-attach {
  background: #222; border: 1px solid #333; color: #aaa;
  padding: 8px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.designer-chat-attach:hover { background: #333; color: #fff; }
.designer-chat-image-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-top: 1px solid var(--border);
  background: #111;
}
.designer-chat-image-preview img {
  max-height: 80px; max-width: 120px; border-radius: 6px;
  object-fit: cover;
}
.designer-chat-preview-remove {
  background: #333; border: none; color: #aaa; cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; flex-shrink: 0;
}
.designer-chat-preview-remove:hover { background: #555; color: #fff; }
.designer-chat-activity {
  padding: 4px 12px; color: #555; font-size: 11px; font-style: italic;
}

/* ─── Chat/Build View Toggle ─────────────────────────────── */
.designer-chat-header-tabs {
  display: flex; gap: 2px; background: #0a0a0a; border-radius: 6px; padding: 2px;
}
.designer-chat-view-tab {
  background: none; border: none; color: #555; cursor: pointer;
  padding: 4px 12px; border-radius: 4px; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.designer-chat-view-tab:hover { color: #999; }
.designer-chat-view-tab.active { background: #1a1a1a; color: #fff; }
.build-tab-dot {
  width: 6px; height: 6px; border-radius: 50%; display: none;
}
.build-tab-dot.active {
  display: inline-block; background: #fff; animation: buildPulse 1.5s ease infinite;
}
@keyframes buildPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ─── Build Panel ─────────────────────────────────────────── */
.designer-build-panel {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  background: #080808;
}
.build-panel-content {
  padding: 0; display: flex; flex-direction: column;
}
.build-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; gap: 12px; text-align: center;
}
.build-empty-title {
  font-size: 14px; font-weight: 600; color: #444;
}
.build-empty-sub {
  font-size: 12px; color: #333; max-width: 260px; line-height: 1.5;
}

/* Build event entries */
.build-event {
  border-bottom: 1px solid #141414; animation: buildFadeIn 0.2s ease;
}
@keyframes buildFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.build-event-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; transition: background 0.1s;
}
.build-event-header:hover { background: #111; }
.build-event-icon {
  width: 24px; height: 24px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 12px; background: #111; border: 1px solid #222;
}
.build-event-icon.tool-bash { color: #888; }
.build-event-icon.tool-read { color: #888; }
.build-event-icon.tool-edit { color: #888; }
.build-event-icon.tool-write { color: #888; }
.build-event-icon.tool-grep { color: #888; }
.build-event-icon.tool-other { color: #666; }
.build-event-icon.tool-thinking { color: #555; }
.build-event-info {
  flex: 1; min-width: 0;
}
.build-event-name {
  font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.build-event-summary {
  font-size: 12px; color: #555; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.build-event-time {
  font-size: 10px; color: #333; flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.build-event-status {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.build-event-status.running {
  background: #555; animation: buildPulse 1s ease infinite;
}
.build-event-status.done { background: #333; }
.build-event-detail {
  display: none; padding: 0 12px 10px 44px;
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px;
  line-height: 1.5; color: #555; white-space: pre-wrap;
  max-height: 300px; overflow-y: auto; word-break: break-all;
}
.build-event.expanded .build-event-detail { display: block; }
.build-event-detail .build-diff-add { color: #888; }
.build-event-detail .build-diff-del { color: #555; text-decoration: line-through; }

/* Build progress bar */
.build-progress {
  padding: 8px 12px; border-bottom: 1px solid #141414;
  display: none; align-items: center; gap: 10px;
}
.build-progress.active { display: flex; }
.build-progress-label {
  font-size: 11px; color: #555; white-space: nowrap;
}
.build-progress-bar {
  flex: 1; height: 2px; background: #111; border-radius: 1px; overflow: hidden;
}
.build-progress-fill {
  height: 100%; background: #444; border-radius: 1px;
  animation: buildProgressIndeterminate 1.5s ease infinite;
  width: 30%;
}
@keyframes buildProgressIndeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* Build text streaming */
.build-event-stream {
  display: none; padding: 6px 12px 10px 44px;
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px;
  line-height: 1.5; color: #666; max-height: 200px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.build-event.streaming .build-event-stream { display: block; }

/* ─── Designer Chat Wizard ─────────────────────────────── */
.designer-wizard {
  padding: 20px 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.designer-wizard-intro {
  text-align: center; margin-bottom: 16px;
}
.designer-wizard-icon {
  margin: 0 auto 10px; width: 48px; height: 48px; border-radius: 12px;
  background: #1a1a1a; border: 1px solid #2a2a2a;
  display: flex; align-items: center; justify-content: center;
}
.designer-wizard-title {
  font-size: 16px; font-weight: 600; color: #ddd; margin-bottom: 6px;
}
.designer-wizard-subtitle {
  font-size: 12px; color: #666; line-height: 1.5;
}
.designer-wizard-step {
  margin-bottom: 12px;
}
.designer-wizard-step.animate-in {
  animation: wizardFadeIn 0.25s ease-out;
}
@keyframes wizardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.designer-wizard-question {
  font-size: 13px; font-weight: 600; color: #ccc; margin-bottom: 8px;
}
.designer-wizard-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.designer-wizard-option {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: #111; border: 1px solid #2a2a2a;
  border-radius: 8px; color: #aaa; font-size: 12px; cursor: pointer;
  transition: all 0.15s ease; text-align: left;
  font-family: inherit;
}
.designer-wizard-option:hover {
  background: #1a1a1a; border-color: #444; color: #ddd;
}
.designer-wizard-option.selected {
  background: #1a1a1a; border-color: #555; color: #fff;
}
.designer-wizard-option-icon {
  font-size: 16px; width: 22px; text-align: center; flex-shrink: 0;
}
.designer-wizard-input,
.designer-wizard-textarea {
  width: 100%; background: #111; border: 1px solid #2a2a2a;
  border-radius: 8px; color: #ccc; padding: 10px 12px; font-size: 12px;
  font-family: inherit; outline: none; resize: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.designer-wizard-input:focus,
.designer-wizard-textarea:focus {
  border-color: #555;
}
.designer-wizard-textarea {
  min-height: 60px; line-height: 1.5;
}
.designer-wizard-actions {
  display: flex; gap: 8px; align-items: center; margin-top: 4px;
}
.designer-wizard-next {
  padding: 7px 16px; background: #222; border: 1px solid #444;
  border-radius: 6px; color: #ddd; font-size: 12px; cursor: pointer;
  font-family: inherit; transition: all 0.15s ease;
}
.designer-wizard-next:hover {
  background: #333; border-color: #555; color: #fff;
}
.designer-wizard-skip {
  padding: 7px 12px; background: transparent; border: none;
  color: #555; font-size: 11px; cursor: pointer; font-family: inherit;
  transition: color 0.15s ease;
}
.designer-wizard-skip:hover {
  color: #888;
}

/* Wizard tags (style picker) */
.designer-wizard-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.designer-wizard-tag {
  padding: 6px 14px; background: #111; border: 1px solid #2a2a2a;
  border-radius: 20px; color: #999; font-size: 12px; cursor: pointer;
  font-family: inherit; transition: all 0.15s ease; white-space: nowrap;
}
.designer-wizard-tag:hover {
  background: #1a1a1a; border-color: #444; color: #ddd;
}
.designer-wizard-tag.selected {
  background: #fff; border-color: #fff; color: #000; font-weight: 500;
}
.designer-wizard-tag-custom {
  margin-top: 4px;
}

/* Wizard summary */
.designer-wizard-summary {
  background: #111; border: 1px solid #2a2a2a; border-radius: 10px;
  padding: 14px 16px; margin: 4px 12px 8px; align-self: stretch;
}
.designer-wizard-summary-title {
  font-size: 11px; font-weight: 600; color: #666; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 10px;
}
.designer-wizard-summary-items {
  display: flex; flex-direction: column; gap: 6px;
}
.designer-wizard-summary-item {
  display: flex; gap: 8px; font-size: 12px; color: #aaa;
}
.designer-wizard-summary-item .label {
  color: #666; min-width: 70px; flex-shrink: 0;
}

/* Eyedropper tool */
.designer-eyedropper-toast {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #333;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}
.designer-eyedropper-preview {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 1000;
  min-width: 180px;
  pointer-events: none;
}
.eyedropper-preview-title {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
}
.eyedropper-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #ccc;
  padding: 2px 0;
}
.eyedropper-preview-label {
  color: #777;
  min-width: 70px;
}
.eyedropper-preview-value {
  color: #fff;
  font-family: monospace;
}
.eyedropper-preview-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #555;
  flex-shrink: 0;
}

/* Images page (sidebar > Images) */
#images-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow-y: auto; padding-top: 0;
}
#images-page.open { display: block; }
#images-page-inner {
  max-width: 720px; margin: 0 auto; padding: 24px 20px 80px;
}

/* Prompt bar */
.images-prompt-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 28px; padding: 10px 12px 10px 18px; margin-bottom: 32px;
}
.images-prompt-icon { flex-shrink: 0; }
.images-prompt-bar input {
  flex: 1; background: none; border: none; color: var(--text);
  font-size: 15px; font-family: inherit; outline: none;
}
.images-prompt-bar input::placeholder { color: #555; }
.images-prompt-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity 0.15s;
}
.images-prompt-btn:hover { opacity: 0.85; }

/* Gallery */
.images-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.gallery-item {
  position: relative; border-radius: 10px; overflow: hidden;
  cursor: pointer; aspect-ratio: 1; background: #111;
  border: 1px solid var(--border); transition: border-color 0.15s;
}
.gallery-item:hover { border-color: #444; }
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.gallery-date {
  position: absolute; bottom: 6px; left: 8px;
  font-size: 11px; color: #999; background: rgba(0,0,0,0.7);
  padding: 2px 6px; border-radius: 4px;
}

/* Gallery three-dot menu */
.gallery-menu-btn {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff; border: none;
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s; z-index: 2;
  line-height: 1;
}
.gallery-item:hover .gallery-menu-btn { opacity: 1; }
.gallery-menu-btn:hover { background: rgba(0,0,0,0.9); }

.gallery-menu {
  display: none; position: absolute; top: 38px; right: 6px;
  background: #1a1a1a; border: 1px solid #333; border-radius: 8px;
  z-index: 3; min-width: 130px; overflow: hidden;
}
.gallery-menu.open { display: block; }
.gallery-menu button {
  width: 100%; padding: 10px 14px; background: none; border: none;
  color: #e44; font-size: 13px; cursor: pointer; text-align: left;
}
.gallery-menu button:hover { background: #222; }

/* Gallery image modal */
#gallery-image-modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); z-index: 9999;
  align-items: center; justify-content: center; cursor: pointer;
}
#gallery-modal-img {
  max-width: 90vw; max-height: 90vh; border-radius: 12px;
  cursor: default;
}

/* Empty state */
.images-empty {
  text-align: center; padding: 60px 20px; color: #333;
}
.images-empty p {
  margin-top: 16px; font-size: 15px; color: var(--text-muted);
}

/* Generating indicator */
#images-generating {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 40px; color: var(--text-muted); font-size: 15px;
}

/* Result display */
#images-result {
  text-align: center; padding: 20px 0;
}
#images-result img {
  max-width: 100%; max-height: 60vh; border-radius: 12px;
  border: 1px solid var(--border);
}
.images-result-actions {
  display: flex; gap: 10px; justify-content: center; margin-top: 16px;
}
.images-result-actions button {
  padding: 10px 20px; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: opacity 0.15s;
  border: 1px solid var(--border); background: none; color: var(--text);
}
.images-result-actions button:first-child { background: #fff; color: #000; border: none; }
.images-result-actions button:hover { opacity: 0.85; }

/* Mobile */
@media (max-width: 600px) {
  .images-discover-grid { grid-template-columns: 1fr; }
  .images-style-card { width: 96px; }
  .style-preview { width: 96px; height: 96px; }
  .images-gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

.generated-image {
  max-width: 100%; border-radius: 12px; margin-top: 8px; cursor: pointer;
}

/* Preview toggle button */
#preview-toggle {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 350; width: 32px; height: 56px;
  background: #111; border: 1px solid #333; border-right: none;
  border-radius: 8px 0 0 8px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  color: #888; transition: color 0.2s, background 0.2s;
}
#preview-toggle:hover { background: #1a1a1a; color: #fff; }
#preview-toggle svg { width: 16px; height: 16px; }

#live-edit-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow-y: auto;
}
#live-edit-page.open { display: block; }
#live-edit-page-inner {
  max-width: 480px; margin: 0 auto; padding: 40px 20px 80px;
}
.live-edit-header {
  text-align: center; margin-bottom: 32px;
}
.live-edit-header svg { margin-bottom: 12px; }
.live-edit-header h2 {
  font-size: 28px; font-weight: 800; margin-bottom: 8px;
}
.live-edit-header p {
  font-size: 14px; color: #666; margin: 0;
}
.live-edit-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
.live-edit-site {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: #111; border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; width: 100%;
  transition: border-color 0.2s, background 0.2s;
}
.live-edit-site:hover { border-color: #444; background: #1a1a1a; }
.live-edit-site:active { transform: scale(0.98); }
.live-edit-site-icon {
  width: 44px; height: 44px; border-radius: 12px; background: #222;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.live-edit-site-icon svg { width: 22px; height: 22px; color: #888; }
.live-edit-site-name { font-size: 15px; font-weight: 600; color: #fff; }
.live-edit-site-url { font-size: 12px; color: #555; margin-top: 2px; }
.live-edit-empty {
  text-align: center; padding: 40px 0; color: #444;
}
.live-edit-empty svg { margin-bottom: 12px; }
.live-edit-empty p { font-size: 13px; }

/* Preview overlay */
#preview-overlay {
  position: fixed; top: 0; right: 0; width: 100%; height: 100%;
  background: #000; z-index: 400; flex-direction: column;
  display: flex; transform: translateX(100%);
  transition: transform 0.3s ease, width 0.3s ease;
}
#preview-overlay.open { transform: translateX(0); }
body.editor-mode #preview-overlay {
  right: auto; left: 0; transform: translateX(-100%);
}
body.editor-mode #preview-overlay.open { transform: translateX(0); }
#preview-overlay.split {
  width: 50%; transform: translateX(0);
  border-left: 1px solid #333;
}
/* Live edit bar */
#live-edit-bar {
  display: none; position: fixed; top: 0; left: 0; width: 100%;
  z-index: 500; background: #0a0a0a; border-bottom: 1px solid #222;
  padding: 0; height: 44px; align-items: center;
}
#live-edit-bar.visible { display: flex; }
.live-edit-bar-title {
  font-size: 14px; font-weight: 600; color: #fff;
  padding: 0 16px; white-space: nowrap;
}
.live-edit-bar-tabs {
  display: flex; gap: 0; flex: 1; height: 100%;
}
.live-edit-bar-tab {
  padding: 0 16px; height: 100%; border: none; background: none;
  color: #666; font-size: 13px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; transition: color 0.2s;
  display: flex; align-items: center;
}
.live-edit-bar-tab.active { color: #fff; border-bottom-color: #fff; }
.live-edit-bar-tab:hover { color: #aaa; }
.live-edit-bar-actions {
  display: flex; gap: 4px; padding-right: 8px; align-items: center;
}
.live-edit-bar-actions .preview-btn { padding: 4px 10px; font-size: 12px; }
.live-edit-bar-close {
  width: 32px; height: 32px; border: none; background: none;
  color: #888; font-size: 18px; cursor: pointer;
}
.live-edit-bar-close:hover { color: #fff; }
/* Permissions button inside live-edit-bar */
#live-edit-bar #permissions-btn {
  padding: 4px 8px; border-color: #333;
}
/* When live edit bar is visible, push everything down */
body.live-edit-active #header { top: 44px; }
body.live-edit-active #messages-container { margin-top: 44px; }
/* Preview in split mode */
@media (max-width: 768px) {
  #preview-overlay.split { width: 100%; transform: translateX(100%); }
  #preview-overlay.split.show-preview { transform: translateX(0); }
}

/* Editor mode: shared rules (all screen sizes) */
body.editor-mode #preview-overlay #preview-toolbar { display: none; }
body.editor-mode #sidebar { display: none; }

/* Editor mode: desktop */
@media (min-width: 769px) {
  body.editor-mode #preview-overlay.open {
    left: 0; right: auto; width: 65%;
    top: 44px; height: calc(100% - 44px);
    transform: none; border-left: none;
    border-right: 1px solid #333; z-index: 10;
  }
  body.editor-mode #header {
    position: fixed; top: 44px; right: 0; width: 35%; z-index: 10;
    border-bottom: 1px solid #333;
  }
  body.editor-mode #menu-btn,
  body.editor-mode #header-project { display: none; }
  body.editor-mode #messages-container {
    position: fixed; top: calc(44px + 48px); right: 0; width: 35%;
    height: calc(100% - 44px - 48px - 60px);
    margin: 0; overflow-y: auto;
  }
  body.editor-mode #input-area {
    position: fixed; bottom: 0; right: 0; width: 35%; z-index: 10;
  }
  body.editor-mode .live-edit-bar-tabs { display: none; }
  body.editor-mode #status-bar {
    position: fixed; right: 0; width: 35%; z-index: 10;
  }

  /* Chat hidden */
  body.editor-mode.editor-chat-hidden #status-bar { display: none; }
  body.editor-mode.editor-chat-hidden #preview-overlay.open { width: 100%; }
  body.editor-mode.editor-chat-hidden #header,
  body.editor-mode.editor-chat-hidden #messages-container,
  body.editor-mode.editor-chat-hidden #input-area { display: none; }
}
/* Editor mode: mobile */
@media (max-width: 768px) {
  body.editor-mode #preview-overlay.open {
    top: 44px; height: calc(100% - 44px);
  }
  body.editor-mode #header { top: 44px; }
  /* Preview visible: hide chat, show preview full width */
  body.editor-mode.editor-show-preview #header,
  body.editor-mode.editor-show-preview #messages-container,
  body.editor-mode.editor-show-preview #input-area,
  body.editor-mode.editor-show-preview #status-bar { display: none; }
  body.editor-mode.editor-show-preview #preview-overlay.open {
    width: 100%; left: 0; transform: none;
  }
  /* Chat visible: hide preview */
  body.editor-mode:not(.editor-show-preview) #preview-overlay.open {
    display: none;
  }
}

#preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #0a0a0a; border-bottom: 1px solid #222;
  flex-shrink: 0;
}
#preview-toolbar .preview-title {
  font-size: 14px; font-weight: 600; color: #fff;
  display: flex; align-items: center; gap: 8px;
}
#preview-page-select,
#live-edit-page-select {
  background: #1a1a1a; color: #fff; border: 1px solid #333;
  border-radius: 6px; padding: 3px 8px; font-size: 12px;
  font-weight: 500; cursor: pointer; outline: none;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
  padding-right: 22px;
}
#preview-page-select:hover,
#live-edit-page-select:hover { border-color: #555; }
#preview-page-select option,
#live-edit-page-select option { background: #1a1a1a; color: #fff; }
#preview-streaming {
  display: none; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; animation: preview-pulse 1s ease-in-out infinite;
}
#preview-streaming.active { display: block; }
@keyframes preview-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
#preview-toolbar .preview-actions { display: flex; gap: 8px; align-items: center; }
.preview-btn {
  padding: 6px 14px; border: 1px solid #333; border-radius: 8px;
  background: transparent; color: #fff; font-size: 13px; cursor: pointer;
  font-weight: 500;
}
.preview-btn.active { background: #fff; color: #000; border-color: #fff; }
.preview-btn-close {
  width: 32px; height: 32px; border: none; background: transparent;
  color: #fff; font-size: 20px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}

#preview-frame-container {
  flex: 1; position: relative; overflow: hidden; background: #fff;
}
#preview-frame {
  width: 100%; height: 100%; border: none; background: #fff;
}

#preview-feedback {
  flex-shrink: 0; padding: 12px 10px; padding-bottom: calc(28px + var(--safe-bottom));
  background: #000000;
}
body.editor-mode #preview-feedback { display: none; }
body.editor-mode #preview-feedback.has-selection { display: block; }
#preview-feedback .feedback-element-info {
  font-size: 12px; color: #888; margin-bottom: 8px; padding: 0 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  display: none;
}
#preview-feedback .feedback-element-info.has-selection { display: block; }

.preview-select-hint {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.8); color: #fff; padding: 8px 16px;
  border-radius: 20px; font-size: 13px; pointer-events: none;
  transition: opacity 0.3s;
}

.preview-code-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; margin-top: 6px;
  background: #1a1a1a; border: 1px solid #333; border-radius: 6px;
  color: #fff; font-size: 12px; cursor: pointer; font-weight: 500;
}
.preview-code-btn:hover { background: #2a2a2a; border-color: #555; }
.preview-code-btn svg { width: 14px; height: 14px; }

#permission-modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); z-index: 99999;
  align-items: center; justify-content: center; padding: 20px;
}
#permission-modal.open { display: flex; }
.permission-box {
  background: var(--bg-secondary); border: 1px solid #333333;
  border-radius: 16px; padding: 20px; width: 100%; max-width: 420px;
}
.permission-box h3 {
  font-size: 16px; margin-bottom: 12px; color: #ffffff;
}
.permission-tool {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 8px;
}
.permission-detail {
  background: #111; border-radius: 8px; padding: 10px;
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px;
  color: #ccc; white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow-y: auto; margin-bottom: 16px;
}
.permission-buttons { display: flex; gap: 10px; }
.permission-buttons button {
  flex: 1; padding: 12px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-deny { background: #000000; color: #ffffff; border: 1px solid #333; }
.btn-allow { background: #ffffff; color: #000000; border: 1px solid #333; }
.permission-session-buttons { margin-top: 8px; }
.btn-session {
  background: #1a1a1a; color: #999; border: 1px solid #333;
  font-size: 13px; padding: 10px;
}

/* Greeting card */
.greeting-msg.message.assistant {
  background: transparent;
  max-width: 100%;
  width: 100%;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}
.greeting-card {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  box-sizing: border-box;
  text-align: center;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 24px;
}
.greeting-card .greeting-hello {
  font-size: 44px;
  font-weight: 800;
  margin-bottom: 28px;
  color: var(--text);
  letter-spacing: -0.5px;
}
.greeting-card .greeting-project-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.greeting-card .greeting-project-hero {
  font-size: 44px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.greeting-card .greeting-desc {
  font-size: 14px;
  color: #888;
  line-height: 1.6;
  margin-bottom: 20px;
}
.greeting-card .greeting-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}
.greeting-card .greeting-tech span {
  background: #111;
  color: #888;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-weight: 500;
}
.greeting-card .greeting-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
.greeting-card .greeting-stats {
  font-size: 14px;
  color: #666;
  margin-bottom: 6px;
}
.greeting-card .greeting-recent {
  font-size: 13px;
  color: #555;
}
.greeting-card .greeting-recent em {
  color: #777;
  font-style: normal;
}
.greeting-card .greeting-hint {
  font-size: 12px;
  color: #444;
  margin-top: 20px;
  letter-spacing: 0.2px;
}
.greeting-card .greeting-conversations {
  margin-top: 8px;
  text-align: left;
}
.greeting-card .greeting-conversations .conv-list-title {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-align: center;
}
.greeting-card .greeting-conversations .conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.greeting-card .greeting-conversations .conv-item:last-child {
  margin-bottom: 0;
}
.greeting-card .greeting-conversations .conv-item:hover {
  background: #1a1a1a;
  border-color: #444;
}
.greeting-card .greeting-conversations .conv-item .conv-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.greeting-card .greeting-conversations .conv-item .conv-meta {
  font-size: 11px;
  color: #555;
  margin-left: 12px;
  white-space: nowrap;
}
/* Continue section */
.greeting-card .greeting-continue {
  margin-top: 24px;
  text-align: left;
}
.greeting-card .greeting-continue .quick-nav-title {
  margin-bottom: 10px;
  text-align: center;
}
.greeting-card .continue-btn {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.greeting-card .continue-btn:hover {
  background: #1a1a1a;
  border-color: #444;
}
.greeting-card .continue-btn:active {
  transform: scale(0.98);
}
.greeting-card .continue-text {
  flex: 1;
  min-width: 0;
}
.greeting-card .continue-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.greeting-card .continue-meta {
  font-size: 10px;
  color: #555;
}
.greeting-card .continue-arrow {
  font-size: 18px;
  color: #444;
  flex-shrink: 0;
}

/* Quick nav */
.greeting-card .greeting-quick-nav {
  margin-top: 24px;
  text-align: left;
}
.greeting-card .quick-nav-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.greeting-card .quick-nav-title {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.greeting-card .quick-nav-edit-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #555;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
}
.greeting-card .quick-nav-edit-btn:hover,
.greeting-card .quick-nav-edit-btn.active {
  color: #fff;
  border-color: #444;
}
.greeting-card .quick-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.greeting-card .quick-nav-btn {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.greeting-card .quick-nav-btn:hover {
  background: #1a1a1a;
  border-color: #444;
}
.greeting-card .quick-nav-btn:active {
  transform: scale(0.98);
}
.greeting-card .quick-nav-btn.editing {
  cursor: grab;
  border-style: dashed;
}
.greeting-card .quick-nav-btn.dragging {
  opacity: 0.4;
}
.greeting-card .quick-nav-btn.drag-over {
  border-color: #666;
  background: #1a1a1a;
}
/* Icon */
.greeting-card .quick-nav-icon-wrap,
.greeting-card .quick-nav-icon-upload {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  position: relative;
}
.greeting-card .quick-nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}
.greeting-card .quick-nav-icon-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #222;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #666;
}
.greeting-card .quick-nav-icon-upload {
  cursor: pointer;
}
.greeting-card .quick-nav-icon-overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  color: #fff;
}
.greeting-card .quick-nav-icon-upload:hover .quick-nav-icon-overlay {
  opacity: 1;
}
/* Text */
.greeting-card .quick-nav-text {
  min-width: 0;
  flex: 1;
}
.greeting-card .quick-nav-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.greeting-card .quick-nav-path {
  font-size: 10px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Delete button */
.greeting-card .quick-nav-delete-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #333;
  border: 1px solid #555;
  color: #aaa;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.greeting-card .quick-nav-delete-btn:hover {
  background: #555;
  color: #fff;
}
/* Edit panel */
.greeting-card .quick-nav-edit-panel {
  margin-top: 10px;
}
.greeting-card .quick-nav-select {
  width: 100%;
  padding: 8px 12px;
  background: #111;
  border: 1px dashed #444;
  border-radius: 10px;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.greeting-card .quick-nav-select:hover {
  border-color: #666;
  color: #bbb;
}
.greeting-card .quick-nav-empty {
  text-align: center;
  color: #444;
  font-size: 12px;
  padding: 16px 0;
}

/* Desktop: tabs inline in header, hide title */
@media (min-width: 769px) {
  #header { flex-wrap: nowrap; }
  #header-title { display: none; }
  #tab-bar-wrapper {
    flex: 1; border-bottom: none; background: none;
    border-left: 1px solid var(--border);
  }
}

/* Mobile: tabs as separate row below header */
@media (max-width: 768px) {
  #header-title { flex: 1; }
  #tab-bar-wrapper {
    flex-basis: 100%; order: 99;
    border-top: 1px solid var(--border);
    margin: -12px -16px; margin-bottom: -12px;
    padding: 0;
    background: var(--bg-secondary);
  }
  /* Mobile: sidebar als overlay, geen icon strip */
  #sidebar {
    position: fixed; top: 0; left: 0; z-index: 100;
    width: 0; min-width: 0; height: 100%;
  }
  #sidebar .sidebar-header,
  #sidebar #sidebar-search,
  #sidebar #conversation-list { display: none; }
  #sidebar .sidebar-footer { display: none; }
  #sidebar .sidebar-bottom { display: none; }
  #sidebar.open .sidebar-header,
  #sidebar.open #sidebar-search { display: flex; }
  #sidebar.open #conversation-list { display: block; }
  #sidebar.open .sidebar-footer { display: flex; }
  #sidebar.open .sidebar-bottom { display: block; }
  #sidebar.open { width: 85%; max-width: 320px; }
}

/* ── Email Panel ── */
#email-panel {
  display: none;
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg);
  z-index: 50;
}
#email-panel.open { display: flex; }
#email-panel-inner {
  display: flex; width: 100%; height: 100%; overflow: hidden;
}

/* Email sidebar (gesprekken lijst) */
#email-sidebar {
  width: 320px; min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg-secondary);
}
#email-list { flex: 1; overflow-y: auto; }

/* Email main (inhoud rechts) */
#email-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
#email-content { flex: 1; overflow-y: auto; }
.email-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); font-size: 14px;
}

.email-header-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px;
}
.email-header-btn:hover { background: var(--bg); }
.email-loading { padding: 32px; text-align: center; color: var(--text-muted); }

/* Active item in sidebar */
.email-item.active { background: var(--bg); }

/* Inbox list */
.email-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.email-item:hover { background: var(--bg); }
.email-item.unread { border-left: 3px solid var(--accent); }
.email-item-top { display: flex; justify-content: space-between; align-items: center; }
.email-from { font-size: 14px; font-weight: 600; }
.email-date { font-size: 11px; color: var(--text-muted); }
.email-subject { font-size: 13px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-snippet { font-size: 12px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.6; }

/* Email detail */
.email-detail-top { display: none; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.email-back-mobile {
  background: none; border: none; color: var(--text); cursor: pointer;
  font-size: 14px; padding: 4px 0;
}
@media (max-width: 768px) {
  .email-detail-top { display: block; }
}
.email-detail-header { padding: 16px; border-bottom: 1px solid var(--border); }
.email-detail-subject { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.email-detail-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); }
.email-detail-to { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.email-detail-body { padding: 16px; font-size: 14px; line-height: 1.6; word-break: break-word; color: #ffffff; }
.email-detail-body pre { white-space: pre-wrap; font-family: inherit; color: #ffffff; }
.email-detail-body * { color: #ffffff !important; }
.email-detail-body img { max-width: 100%; }

/* Draft reply */
.email-draft {
  padding: 16px; background: var(--bg); border-top: 1px solid var(--border);
}
.email-draft-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
  font-size: 14px; font-weight: 600;
}
.email-draft textarea {
  width: 100%; min-height: 100px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; padding: 12px; resize: vertical;
  font-family: inherit;
}
.email-draft-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.btn-ai-draft {
  background: #ffffff; color: #000000;
  border: none; padding: 6px 14px;
  border-radius: 0; cursor: pointer; font-size: 13px; font-weight: 600;
}
.btn-ai-draft:hover { opacity: 0.9; }
.btn-ai-draft:disabled { opacity: 0.5; cursor: wait; }
.btn-email-send {
  background: var(--accent); color: #000; border: none;
  padding: 8px 20px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600;
}
.btn-email-send:hover { opacity: 0.9; }

/* Compose */
.email-compose { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.email-compose input, .email-compose textarea {
  width: 100%; padding: 10px 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; font-family: inherit;
}
.email-compose textarea { min-height: 200px; resize: vertical; }

/* Badge */
.email-badge {
  background: #ff4444; color: white; border-radius: 10px;
  padding: 1px 6px; font-size: 11px; font-weight: 600; margin-left: auto;
}

/* Dismiss button */
.btn-email-dismiss {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 16px; border-radius: 0; cursor: pointer; font-size: 13px;
}
.btn-email-dismiss:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Toast Notificaties ── */
#email-toasts {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 999; display: flex; flex-direction: column-reverse; gap: 10px;
  pointer-events: none; max-width: 380px;
}
.email-toast {
  pointer-events: all;
  background: #111; border: 1px solid #333;
  padding: 14px 16px; width: 360px;
  opacity: 0; transform: translateX(100%);
  transition: all 0.3s ease;
}
.email-toast.show {
  opacity: 1; transform: translateX(0);
}
.email-toast.reminder {
  border-left: 3px solid #ff8800;
}
.email-toast:not(.reminder) {
  border-left: 3px solid #ffffff;
}
.email-toast-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.email-toast-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #888; font-weight: 600;
}
.email-toast.reminder .email-toast-label { color: #ff8800; }
.email-toast-close {
  background: none; border: none; color: #666; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0;
}
.email-toast-close:hover { color: #fff; }
.email-toast-from {
  font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 2px;
}
.email-toast-subject {
  font-size: 13px; color: #ccc; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.email-toast-snippet {
  font-size: 12px; color: #666; margin-bottom: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.email-toast-actions {
  display: flex; gap: 8px;
}
.email-toast-actions button {
  flex: 1; padding: 8px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600;
  background: #fff; color: #000;
}
.email-toast-actions button:hover { opacity: 0.9; }
.email-toast-actions button.dismiss {
  background: none; border: 1px solid #333; color: #888;
}
.email-toast-actions button.dismiss:hover { color: #fff; border-color: #666; }

@media (max-width: 500px) {
  #email-toasts { right: 10px; left: 10px; max-width: none; }
  .email-toast { width: auto; }
}

/* Mobile: email sidebar wordt full-width, main verborgen tot selectie */
@media (max-width: 768px) {
  #email-panel-inner { flex-direction: column; }
  #email-sidebar { width: 100%; min-width: 0; min-height: 0; flex: 1; border-right: none; border-bottom: 1px solid var(--border); }
  #email-panel.open.email-detail-open #email-sidebar { display: none; }
  #email-panel.open:not(.email-detail-open) #email-main { display: none; }
  #email-panel.open.email-detail-open #email-main {
    display: flex; flex-direction: column; height: 100%; min-height: 0;
  }
}

/* ─── Code block copy button ─────────────────────────── */

.code-block-wrapper {
  position: relative;
}
.code-copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.1); border: none; color: #888;
  border-radius: 4px; padding: 4px 6px; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.code-block-wrapper:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { color: #fff; background: rgba(255,255,255,0.2); }
@media (max-width: 768px) {
  .code-copy-btn { opacity: 1; }
}

/* ─── Video Editor ─────────────────────────────────── */

#video-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#video-page.open { display: flex; flex-direction: column; }

/* Project list */
.video-projects-header {
  text-align: center; padding: 40px 20px 16px;
}
.video-projects-header svg { margin-bottom: 8px; }
.video-projects-header h2 { color: var(--text); font-size: 20px; margin-bottom: 4px; }
.video-projects-header p { color: var(--text-muted); font-size: 13px; }
.video-projects-actions { display: flex; justify-content: center; padding: 0 20px 16px; }
.video-new-project-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 20px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.video-new-project-btn:hover { border-color: #555; }
.video-projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; padding: 0 20px 20px; overflow-y: auto; flex: 1;
}
#video-projects-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
#video-projects-empty svg { margin-bottom: 12px; }

.video-project-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; cursor: pointer; transition: border-color 0.15s;
}
.video-project-card:hover { border-color: #555; }
.video-project-card-preview {
  width: 72px; height: 48px; border-radius: 6px; background: #111;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.video-project-card-info { flex: 1; min-width: 0; }
.video-project-card-name { color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-project-card-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.video-project-card-delete {
  background: none; border: none; color: #555; cursor: pointer; padding: 4px;
  border-radius: 4px; opacity: 0; transition: opacity 0.15s;
}
.video-project-card:hover .video-project-card-delete { opacity: 1; }
.video-project-card-delete:hover { color: #ff4444; }

/* Editor layout */
#video-editor-view {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}

/* Toolbar */
.video-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.video-toolbar-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.video-toolbar-center { display: flex; align-items: center; gap: 10px; }
.video-toolbar-right { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
.video-project-title { color: var(--text); font-size: 14px; font-weight: 500; }
.video-transport-btn {
  width: 36px; height: 36px; border-radius: 50%; background: #333; border: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.video-transport-btn:hover { background: #444; }
.video-time-display { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.video-btn {
  background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.video-btn:hover { border-color: #555; }
.video-btn-primary { background: #fff; color: #000; border-color: #fff; font-weight: 500; }
.video-btn-primary:hover { background: #ddd; border-color: #ddd; }
.video-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Agent status indicator */
.video-agent-indicator {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.video-agent-indicator.connected { background: #4a4; }
.video-agent-indicator.disconnected { background: #555; }

/* Main area: preview + file browser */
.video-main {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
}

/* Effects panel (left of preview) */
.video-effects-panel {
  width: 220px; border-right: 1px solid var(--border); display: flex;
  flex-direction: column; overflow: hidden; flex-shrink: 0; background: var(--bg);
}
.video-effects-header {
  padding: 10px 14px; font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.video-effects-content { flex: 1; overflow-y: auto; padding: 12px; }
.video-effects-empty { color: #555; font-size: 12px; text-align: center; padding: 20px 0; }
.video-effects-clip-name {
  font-size: 12px; color: var(--text); margin-bottom: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.video-fx-group { margin-bottom: 10px; }
.video-fx-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-muted); margin-bottom: 4px;
}
.video-fx-slider {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: #333; border-radius: 2px; outline: none; cursor: pointer;
}
.video-fx-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  background: #fff; border-radius: 50%; cursor: pointer;
}
.video-fx-slider::-moz-range-thumb {
  width: 12px; height: 12px; background: #fff;
  border-radius: 50%; cursor: pointer; border: none;
}
.video-color-temp-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 2; mix-blend-mode: multiply;
  opacity: 0;
}
.video-fx-divider {
  border-top: 1px solid #333; margin: 14px 0 10px;
}
.video-fx-section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: #666; margin-bottom: 10px;
}
.video-fx-select {
  width: 100%; background: #222; color: #ccc; border: 1px solid #333;
  border-radius: 4px; padding: 5px 8px; font-size: 12px; outline: none;
  cursor: pointer;
}
.video-fx-select:focus { border-color: #555; }
.video-fx-input {
  width: 100%; background: #222; color: #ccc; border: 1px solid #333;
  border-radius: 4px; padding: 5px 8px; font-size: 12px; outline: none;
  box-sizing: border-box;
}
.video-fx-input:focus { border-color: #555; }
.video-fx-color {
  width: 100%; height: 32px; border: 1px solid #333; border-radius: 4px;
  background: #222; cursor: pointer; padding: 2px;
}
.video-fx-color::-webkit-color-swatch-wrapper { padding: 2px; }
.video-fx-color::-webkit-color-swatch { border: none; border-radius: 2px; }
.video-canvas-info {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid #333;
  font-size: 11px; color: #555; text-align: center;
}
.video-fx-reset-btn {
  width: 100%; margin-top: 12px; font-size: 11px; padding: 6px 0;
}

.video-preview-area {
  flex: 1; display: flex; flex-direction: column; align-items: stretch;
  background: #111; position: relative; min-width: 0;
}
.video-preview-area .video-preview-container { flex: 1; min-height: 0; }
.video-preview-container {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
/* The canvas frame that represents the project dimensions */
.video-preview-canvas {
  position: relative; background: #000; overflow: hidden;
  /* sized by JS based on project settings aspect ratio */
}
.video-preview-canvas video {
  width: 100%; height: 100%; object-fit: cover;
  transform-origin: center center;
}
.video-preview-canvas canvas {
  width: 100%; height: 100%; object-fit: contain;
  transform-origin: center center;
}
.video-text-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.video-comp-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.video-preview-placeholder {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #555; font-size: 13px; text-align: center; padding: 20px;
  pointer-events: none;
}
.video-preview-canvas video[src] ~ .video-preview-placeholder,
.video-preview-canvas canvas.has-content ~ .video-preview-placeholder { display: none; }

/* Preview controls under video */
.video-preview-controls {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #111; border-top: 1px solid #222;
  flex-shrink: 0;
}
.video-preview-ctrl-btn {
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; opacity: 0.8;
}
.video-preview-ctrl-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.video-preview-time {
  color: #aaa; font-size: 12px; font-family: monospace; margin-left: auto;
}

/* File browser */
.video-file-browser {
  width: 260px; border-left: 1px solid var(--border); display: flex;
  flex-direction: column; overflow: hidden; flex-shrink: 0;
}
.video-file-browser-header {
  padding: 10px 14px; font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
}
.video-file-list { flex: 1; overflow-y: auto; }
.video-file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.video-file-item:hover { background: var(--bg-secondary); }
.video-file-thumb {
  width: 48px; height: 32px; object-fit: cover; border-radius: 4px;
  background: #111; flex-shrink: 0;
}
.video-file-info { flex: 1; min-width: 0; }
.video-file-name { color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-file-meta { color: var(--text-muted); font-size: 11px; margin-top: 1px; }
.video-file-add {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: none; color: var(--text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s;
}
.video-file-item:hover .video-file-add { opacity: 1; }
.video-file-add:hover { background: #333; }

.video-no-agent {
  padding: 32px 16px; text-align: center; color: var(--text-muted);
}
.video-no-agent svg { margin-bottom: 12px; }
.video-no-agent p { margin-bottom: 8px; font-size: 13px; }
.video-no-agent code {
  display: block; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; font-size: 11px; color: #aaa; word-break: break-all;
}

/* Composition items in file browser */
#video-comp-list:not(:empty) { border-top: 1px solid var(--border); }
.video-comp-section-header {
  padding: 10px 14px; font-size: 12px; color: var(--text-muted);
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: space-between;
}
.video-comp-section-header button {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 11px; padding: 2px 8px; border-radius: 4px; cursor: pointer;
}
.video-comp-section-header button:hover { border-color: #555; color: var(--text); }
.video-comp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.video-comp-item:hover { background: var(--bg-secondary); }
.video-comp-icon {
  width: 48px; height: 32px; border-radius: 4px; background: #111;
  display: flex; align-items: center; justify-content: center;
  color: #555; font-size: 18px; flex-shrink: 0; border: 1px solid var(--border);
}
.video-comp-info { flex: 1; min-width: 0; }
.video-comp-name { color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-comp-meta { color: var(--text-muted); font-size: 11px; margin-top: 1px; }
.video-comp-item:hover .video-file-add { opacity: 1; }
.video-comp-remove {
  width: 20px; height: 20px; border: none; background: none; color: #555;
  cursor: pointer; font-size: 14px; opacity: 0; transition: opacity 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.video-comp-item:hover .video-comp-remove { opacity: 1; }
.video-comp-remove:hover { color: #ff6b6b; }

/* Composition browser modal items */
.comp-browser-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer; color: #ccc; font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.1s;
}
.comp-browser-item:last-child { border-bottom: none; }
.comp-browser-item:hover { background: rgba(255,255,255,0.05); }
.comp-browser-icon {
  width: 36px; height: 36px; border-radius: 8px; background: #222;
  display: flex; align-items: center; justify-content: center;
  color: #666; font-size: 16px; flex-shrink: 0;
}
.comp-browser-info { flex: 1; }
.comp-browser-name { color: #fff; font-weight: 500; }
.comp-browser-meta { color: #666; font-size: 12px; margin-top: 2px; }
.comp-browser-back {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; cursor: pointer; color: #888; font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.comp-browser-back:hover { color: #fff; background: rgba(255,255,255,0.03); }
.comp-browser-empty {
  padding: 32px 20px; text-align: center; color: #555; font-size: 13px;
}

/* Timeline resize handle */
.video-timeline-resize-handle {
  height: 5px; cursor: ns-resize; background: transparent;
  border-top: 1px solid var(--border); flex-shrink: 0;
  position: relative; z-index: 10;
}
.video-timeline-resize-handle:hover,
.video-timeline-resize-handle.active {
  background: #444;
}

/* Sequence tabs */
.video-sequence-tabs {
  display: flex; align-items: center; gap: 0;
  background: #0a0a0a; border-bottom: 1px solid var(--border);
  padding: 0 4px; min-height: 30px; flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
}
.video-sequence-tabs::-webkit-scrollbar { display: none; }
.video-seq-tab {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 12px; cursor: pointer; white-space: nowrap;
  font-size: 12px; color: #666; border-right: 1px solid var(--border);
  background: transparent; transition: background 0.15s, color 0.15s;
  user-select: none; position: relative;
}
.video-seq-tab:hover { background: #1a1a1a; color: #aaa; }
.video-seq-tab.active {
  background: var(--bg-secondary); color: #fff;
  border-bottom: 2px solid #fff; margin-bottom: -1px;
}
.video-seq-tab-name { pointer-events: auto; }
.video-seq-tab-close {
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 14px; padding: 0 2px; line-height: 1;
  display: flex; align-items: center;
}
.video-seq-tab-close:hover { color: #fff; }
.video-seq-add-btn {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: #555; cursor: pointer; font-size: 14px;
  width: 24px; height: 22px; margin-left: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.video-seq-add-btn:hover { background: #1a1a1a; color: #fff; border-color: #555; }

/* Timeline */
.video-timeline {
  background: var(--bg-secondary);
  display: flex; flex-direction: column; height: 200px; flex-shrink: 0;
}
.video-timeline-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-bottom: 1px solid var(--border);
}
.video-tool-btn {
  width: 28px; height: 28px; border-radius: 4px; border: 1px solid var(--border);
  background: none; color: #888; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.video-tool-btn:hover { background: #222; color: #ccc; }
.video-tool-btn.active { background: #333; color: #fff; border-color: #555; }
.video-toolbar-divider {
  width: 1px; height: 20px; background: var(--border); margin: 0 2px;
}
.video-zoom-btn {
  width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--border);
  background: none; color: var(--text); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.video-zoom-btn:hover { background: #222; }
.video-timeline-area {
  flex: 1; position: relative; overflow: hidden; cursor: pointer;
}
.video-timeline-scroll {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow-x: auto; overflow-y: hidden;
}
.video-timeline-ruler {
  height: 24px; position: relative; border-bottom: 1px solid var(--border); user-select: none;
}
.video-ruler-mark {
  position: absolute; top: 0; height: 100%;
  border-left: 1px solid #333;
}
.video-ruler-mark span {
  position: absolute; top: 4px; left: 4px;
  font-size: 10px; color: #666; white-space: nowrap;
}
.video-timeline-tracks {
  position: relative; min-height: 100px;
}

/* Track section headers */
.video-track-section-header {
  height: 20px; display: flex; align-items: center; gap: 6px;
  padding: 0 8px; background: #111; border-bottom: 1px solid var(--border);
  font-size: 10px; color: #666; letter-spacing: 1px; font-weight: 600;
  position: sticky; left: 0; width: fit-content; min-width: 100%;
}
.video-track-add-btn {
  background: none; border: 1px solid #444; color: #888; cursor: pointer;
  width: 16px; height: 16px; font-size: 12px; line-height: 14px;
  border-radius: 3px; padding: 0; display: flex; align-items: center; justify-content: center;
}
.video-track-add-btn:hover { border-color: #888; color: #fff; }

/* Drop new track indicator */
.video-drop-new-track-indicator {
  position: absolute; left: 0; right: 0; height: 3px;
  background: #fff; z-index: 20; pointer-events: none;
  transform: translateY(-1px);
}
.video-drop-new-track-indicator span {
  position: absolute; left: 50%; top: -10px; transform: translateX(-50%);
  font-size: 10px; color: #fff; background: #333; padding: 1px 8px;
  border-radius: 3px; white-space: nowrap; letter-spacing: 0.5px;
}

/* Tracks */
.video-track {
  height: 56px; position: relative; border-bottom: 1px solid var(--border);
}
.video-track-text { height: 40px; }
.video-track-audio { height: 44px; }
.video-track-label {
  position: absolute; left: 0; top: 0; bottom: 0;
  font-size: 10px; color: #555; z-index: 4;
  display: flex; align-items: center; padding-left: 4px; gap: 3px;
  white-space: nowrap; background: rgba(10,10,10,0.85);
  padding-right: 6px; border-radius: 0 4px 4px 0;
}
.video-track-remove-btn {
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 14px; padding: 0; line-height: 1; opacity: 0;
  transition: opacity 0.15s;
}
.video-track:hover .video-track-remove-btn { opacity: 1; }
.video-track-remove-btn:hover { color: #fff; }
.video-track-toggle-btn {
  background: none; border: none; color: #888; cursor: pointer;
  padding: 2px; line-height: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; flex-shrink: 0;
}
.video-track-toggle-btn:hover { color: #fff; background: #333; }
.video-track-toggle-btn.disabled { color: #444; }
.video-track-toggle-btn.disabled:hover { color: #888; }
.video-track-disabled { opacity: 0.35; }

/* Context menu */
.video-context-menu {
  position: fixed; z-index: 1000; background: #1a1a1a; border: 1px solid #444;
  border-radius: 6px; padding: 4px 0; min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.video-context-menu-item {
  padding: 6px 14px; font-size: 12px; color: #ccc; cursor: pointer;
}
.video-context-menu-item:hover { background: #333; color: #fff; }

/* Linked indicator */
.video-clip-audio.video-clip-unlinked { border-style: dashed; }

/* Clips */
.video-clip {
  position: absolute; top: 4px; height: calc(100% - 8px);
  background: #222; border: 1px solid #444; border-radius: 4px;
  overflow: hidden; cursor: grab; user-select: none;
  display: flex; align-items: center;
}
.video-clip:hover { border-color: #666; }
.video-clip-selected { border-color: #fff; }
.video-clip-selected:hover { border-color: #fff; }
.video-clip-text { background: #1a1a2a; border-color: #444; }
.video-clip-composition { background: #1a2a1a; border-color: #4a4; }
.video-clip-comp-icon { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); color: #6a6; font-size: 10px; }
.video-clip-composition .video-clip-content { padding-left: 18px; }
.video-clip-audio { background: #1c1c1c; border-color: #444; }
.video-waveform-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0.9;
}
.video-clip-content-audio {
  position: absolute; bottom: 0; left: 8px; right: 24px;
  font-size: 9px; color: #666; padding: 0; z-index: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-clip-thumb {
  position: absolute; top: 0; left: 0; height: 100%; width: 80px;
  object-fit: cover; opacity: 0.5; pointer-events: none;
}
.video-clip-content {
  position: relative; z-index: 1; padding: 0 24px 0 8px;
  font-size: 11px; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-clip-speed-badge {
  position: absolute; top: 2px; right: 10px; z-index: 2;
  font-size: 9px; color: #fff; background: rgba(255,255,255,0.15);
  padding: 1px 4px; border-radius: 3px; pointer-events: none;
}

/* Keyframe toggle button in effects panel */
.video-kf-toggle {
  background: none; border: 1px solid #444; color: #555;
  font-size: 10px; cursor: pointer; padding: 1px 4px;
  margin-left: 6px; line-height: 1; vertical-align: middle;
}
.video-kf-toggle:hover { color: #aaa; border-color: #666; }
.video-kf-toggle.active { color: #fff; border-color: #888; }

/* Keyframe diamond markers on timeline clips */
.video-clip-keyframes {
  position: absolute; bottom: 2px; left: 0; right: 0;
  height: 8px; pointer-events: none; z-index: 2;
}
.video-kf-diamond {
  position: absolute; width: 6px; height: 6px;
  background: #888; transform: translateX(-50%) rotate(45deg); bottom: 0;
}
.video-clip-selected .video-kf-diamond { background: #fff; }
.video-clip-handle {
  position: absolute; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3;
}
.video-clip-handle.left { left: 0; border-left: 2px solid transparent; }
.video-clip-handle.right { right: 0; border-right: 2px solid transparent; }
.video-clip-handle:hover { background: rgba(255,255,255,0.1); }
.video-clip-handle.left:hover { border-left-color: #fff; }
.video-clip-handle.right:hover { border-right-color: #fff; }

/* Opacity curve overlay (Premiere-style rubber band) */
.video-opacity-curve {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2; pointer-events: none;
}
.video-opacity-svg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.video-opacity-hitline { pointer-events: none; }
.video-clip:hover .video-opacity-hitline,
.video-clip-selected .video-opacity-hitline { pointer-events: auto; }
.video-clip:hover .video-opacity-svg polyline:first-child { stroke: rgba(255,255,255,0.5); }
.video-clip-selected .video-opacity-svg polyline:first-child { stroke: rgba(255,255,255,0.65); }
.video-opacity-dot {
  position: absolute; width: 7px; height: 7px; background: #fff;
  border: 1px solid #888; border-radius: 50%;
  transform: translate(-50%, -50%); cursor: ns-resize;
  pointer-events: none; opacity: 0; transition: opacity 0.15s;
  z-index: 3;
}
.video-clip:hover .video-opacity-dot,
.video-clip-selected .video-opacity-dot { pointer-events: auto; opacity: 1; }
.video-opacity-dot:hover { background: #ccc; transform: translate(-50%, -50%) scale(1.3); }

/* Playhead */
.video-playhead {
  position: absolute; top: 0; bottom: 0; z-index: 10;
  pointer-events: none; width: 1px;
}
.video-playhead-head {
  width: 12px; height: 12px; background: #fff; border-radius: 2px;
  position: absolute; top: 0; left: -6px; cursor: pointer;
  pointer-events: auto; clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
}
.video-playhead-line {
  position: absolute; top: 12px; bottom: 0; left: 0; width: 1px;
  background: #fff;
}

/* Loop region */
.video-loop-overlay {
  position: absolute; top: 0; bottom: 0;
  pointer-events: none;
}
.video-loop-overlay-ruler {
  background: rgba(255, 255, 255, 0.12);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  pointer-events: auto; cursor: grab; z-index: 2;
}
.video-loop-overlay-tracks {
  background: rgba(255, 255, 255, 0.04);
  border-left: 1px dashed rgba(255, 255, 255, 0.2);
  border-right: 1px dashed rgba(255, 255, 255, 0.2);
  z-index: 1;
}
.video-loop-handle {
  position: absolute; top: 0; width: 8px; height: 100%;
  cursor: ew-resize; z-index: 3;
}
.video-loop-handle-in {
  margin-left: -4px;
  border-left: 2px solid rgba(255, 255, 255, 0.6);
}
.video-loop-handle-out {
  margin-left: -4px;
  border-right: 2px solid rgba(255, 255, 255, 0.6);
}
.video-loop-handle:hover {
  border-color: #fff;
}

/* Transcription panel */
.video-transcription-panel {
  width: 280px; border-left: 1px solid var(--border); display: flex;
  flex-direction: column; overflow: hidden; flex-shrink: 0;
}
.video-transcription-panel .video-file-browser-header {
  display: flex; align-items: center; justify-content: space-between;
}
.video-transcription-close {
  background: none; border: none; color: var(--text-muted); font-size: 18px;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.video-transcription-close:hover { color: var(--text); }
.video-transcription-content { flex: 1; overflow-y: auto; }
.video-transcription-empty {
  padding: 20px 14px; color: var(--text-muted); font-size: 12px; text-align: center;
}
.video-transcription-segment {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.video-transcription-segment:hover { background: var(--bg-secondary); }
.video-transcription-time {
  font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.video-transcription-text { font-size: 13px; color: var(--text); }
.video-transcription-actions {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.video-transcription-actions .video-btn { flex: 1; text-align: center; }
.video-btn-danger { background: #333 !important; color: #ff6b6b !important; border-color: #555 !important; }
.video-btn-danger:hover { background: #444 !important; }

/* Word-level transcript */
.video-transcript-words {
  padding: 12px 14px; line-height: 1.8; user-select: none; cursor: default;
}
.video-transcript-word {
  display: inline; padding: 2px 1px; border-radius: 2px; font-size: 13px;
  color: var(--text); cursor: pointer; transition: background 0.1s;
}
.video-transcript-word:hover { background: var(--bg-secondary); }
.video-transcript-word-selected {
  background: #444; color: #fff;
}
.video-transcript-word-active {
  background: #555; color: #fff; font-weight: 600;
}
.video-transcript-clip-break {
  color: var(--text-muted); font-size: 11px; margin: 0 4px;
}

/* ─── Transcript Editor Modal ─────────────────────────────── */
.transcript-editor-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.transcript-editor-container {
  width: 96vw; height: 92vh; background: #0a0a0a;
  border: 1px solid #222; border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.transcript-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.transcript-editor-header-left {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: #fff;
}
.transcript-editor-header-actions {
  display: flex; align-items: center; gap: 8px;
}
.te-btn {
  background: #1a1a1a; border: 1px solid #333; border-radius: 8px;
  color: #aaa; cursor: pointer; padding: 6px 14px; font-size: 12px;
  font-family: inherit; display: flex; align-items: center; gap: 4px;
  transition: background 0.15s, color 0.15s;
}
.te-btn:hover { background: #222; color: #fff; }
.te-btn-danger { color: #ff6b6b; }
.te-btn-danger:hover { background: #2a1515; color: #ff8888; }
.transcript-editor-body {
  flex: 1; display: flex; overflow: hidden;
}
.transcript-editor-toc {
  width: 220px; border-right: 1px solid #1a1a1a;
  display: flex; flex-direction: column; flex-shrink: 0;
  background: #080808;
}
.te-toc-header {
  padding: 12px 16px; font-size: 11px; font-weight: 600;
  color: #666; text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid #1a1a1a;
}
.te-toc-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.te-toc-empty {
  padding: 20px 16px; color: #444; font-size: 12px; text-align: center;
  line-height: 1.5;
}
.te-toc-item {
  padding: 10px 16px; cursor: pointer; border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.te-toc-item:hover { background: #111; border-left-color: #333; }
.te-toc-item-title {
  font-size: 13px; font-weight: 600; color: #ccc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.te-toc-item-meta {
  font-size: 10px; color: #555; margin-top: 2px;
}
.te-toc-item-preview {
  font-size: 11px; color: #444; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.transcript-editor-content {
  flex: 1; overflow-y: auto; padding: 0; min-width: 0;
}
.te-content-inner {
  padding: 24px 32px; line-height: 2.2; user-select: none;
}
.te-empty {
  padding: 40px; color: #444; font-size: 14px; text-align: center;
}
.te-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 24px 0 12px 0; padding: 10px 16px;
  background: #111; border: 1px solid #222; border-radius: 10px;
  gap: 12px;
}
.te-section-header:first-child { margin-top: 0; }
.te-section-title {
  font-size: 16px; font-weight: 700; color: #fff;
  outline: none; flex: 1; min-width: 0;
}
.te-section-title:focus {
  background: #1a1a1a; border-radius: 4px; padding: 2px 6px; margin: -2px -6px;
}
.te-section-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.te-section-btn {
  background: #1a1a1a; border: 1px solid #333; border-radius: 6px;
  color: #888; cursor: pointer; padding: 4px 10px; font-size: 11px;
  font-family: inherit; transition: all 0.15s;
}
.te-section-btn:hover { background: #222; color: #fff; }
.te-section-btn-del { color: #666; font-size: 16px; padding: 2px 8px; line-height: 1; }
.te-section-btn-del:hover { color: #ff6b6b; background: #2a1515; }
.te-word {
  display: inline; padding: 2px 1px; border-radius: 3px;
  font-size: 15px; color: #bbb; cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.te-word:hover { background: #1a1a1a; color: #fff; }
.te-word-selected { background: #333; color: #fff; }
.te-word-active { background: #444; color: #fff; font-weight: 600; }
.te-clip-break {
  color: #333; font-size: 12px; margin: 0 8px;
  user-select: none;
}
/* Subtitle bars (inline in transcript editor) */
.te-subtitle-bar {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 0 12px 0; padding: 6px 10px;
  background: #0d0d0d; border: 1px solid #1a1a1a; border-radius: 6px;
  font-size: 12px;
}
.te-subtitle-bar.te-subtitle-override {
  border-color: #2a2a1a; background: #111108;
}
.te-subtitle-icon {
  background: #222; color: #666; font-size: 9px; font-weight: 700;
  padding: 2px 5px; border-radius: 3px; flex-shrink: 0;
  letter-spacing: 0.5px;
}
.te-subtitle-override .te-subtitle-icon {
  background: #2a2a10; color: #998;
}
.te-subtitle-text {
  flex: 1; color: #777; outline: none; min-width: 0;
  border-radius: 3px; padding: 1px 4px;
}
.te-subtitle-text:focus {
  background: #1a1a1a; color: #ccc;
}
.te-subtitle-override .te-subtitle-text {
  color: #aa9;
}
.te-subtitle-reset {
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 4px; flex-shrink: 0;
}
.te-subtitle-reset:hover { color: #ff6b6b; }
.transcript-editor-chat {
  width: 340px; border-left: 1px solid #1a1a1a;
  display: flex; flex-direction: column; flex-shrink: 0;
  background: #080808;
}
.te-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 13px; line-height: 1.6;
}
.te-chat-input-bar {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 10px 14px; border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.te-chat-input-bar textarea {
  flex: 1; background: #111; border: 1px solid #222; border-radius: 8px;
  color: #ccc; padding: 8px 10px; font-size: 13px; font-family: inherit;
  resize: none; outline: none; min-height: 36px; max-height: 120px;
  line-height: 1.4;
}
.te-chat-input-bar textarea:focus { border-color: #444; }

/* Video Chat Panel */
.video-chat-panel {
  width: 320px; border-left: 1px solid var(--border); display: flex;
  flex-direction: column; overflow: hidden; flex-shrink: 0; background: var(--bg);
}
.video-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.video-chat-close {
  background: none; border: none; color: #666; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 4px;
}
.video-chat-close:hover { color: #fff; }
.video-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 13px; line-height: 1.6;
}
.video-chat-msg {
  padding: 8px 12px; border-radius: 8px; max-width: 100%;
  word-wrap: break-word; white-space: pre-wrap;
}
.video-chat-msg.user {
  background: #1a1a1a; color: #ccc; align-self: flex-end;
  border: 1px solid #333;
}
.video-chat-msg.assistant {
  background: #111; color: #ccc; align-self: flex-start;
  border: 1px solid #222;
}
.video-chat-msg.assistant .content { line-height: 1.6; white-space: normal; }
.video-chat-msg.assistant .content p { margin: 0 0 8px 0; }
.video-chat-msg.assistant .content p:last-child { margin: 0; }
.video-chat-msg.assistant .content code {
  background: #1a1a1a; padding: 1px 5px; border-radius: 3px; font-size: 12px;
}
.video-chat-msg.assistant .content pre {
  background: #0a0a0a; padding: 8px 10px; border-radius: 6px;
  overflow-x: auto; font-size: 12px; margin: 6px 0;
}
.video-chat-msg.system {
  color: #666; font-size: 12px; align-self: center;
  text-align: center; padding: 6px; font-style: italic;
}
.video-chat-msg.assistant .tool-block {
  margin: 6px 0; border: 1px solid #222; border-radius: 6px; overflow: hidden;
}
.video-chat-msg.assistant .tool-block .tool-header {
  padding: 4px 8px; background: #0a0a0a; font-size: 11px; color: #888; cursor: pointer;
}
.video-chat-msg.assistant .tool-block .tool-input,
.video-chat-msg.assistant .tool-block .tool-result {
  padding: 4px 8px; font-size: 11px; color: #666;
  max-height: 100px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.video-chat-msg.assistant .thinking-block {
  margin: 4px 0; border-radius: 6px; overflow: hidden;
}
.video-chat-msg.assistant .thinking-block .thinking-header {
  padding: 4px 8px; font-size: 11px; color: #555; cursor: pointer;
}
.video-chat-msg.assistant .thinking-block .thinking-content {
  padding: 4px 8px; font-size: 11px; color: #444; max-height: 80px; overflow-y: auto;
}
.video-chat-input-bar {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 10px 14px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.video-chat-input-bar textarea {
  flex: 1; background: #111; border: 1px solid #333; border-radius: 8px;
  color: #ccc; padding: 8px 10px; font-size: 13px; font-family: inherit;
  resize: none; outline: none; min-height: 36px; max-height: 120px;
  line-height: 1.4;
}
.video-chat-input-bar textarea:focus { border-color: #555; }
.video-chat-send {
  background: #222; border: 1px solid #333; border-radius: 8px;
  color: #888; cursor: pointer; padding: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.video-chat-send:hover { background: #333; color: #fff; }
.video-chat-activity {
  color: #666; font-size: 12px; padding: 4px 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
  .video-main { flex-direction: column; }
  .video-file-browser { width: 100%; height: 140px; border-left: none; border-top: 1px solid var(--border); }
  .video-transcription-panel { width: 100%; height: 200px; border-left: none; border-top: 1px solid var(--border); }
  .video-chat-panel { width: 100%; height: 280px; border-left: none; border-top: 1px solid var(--border); }
  .video-toolbar { flex-wrap: wrap; gap: 8px; }
  .video-toolbar-left { order: 1; flex-basis: 100%; }
  .video-toolbar-center { order: 2; }
  .video-toolbar-right { order: 3; }
  .video-timeline { height: 160px; }
}

/* ─── Git page ─────────────────────────────────────── */
#git-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#git-page.open { display: flex; flex-direction: column; }
#git-page-inner {
  display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden;
}

.git-repo-selector {
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.git-repo-selector select {
  width: 100%; padding: 8px 12px; background: #111; color: #fff; border: 1px solid #333;
  border-radius: 8px; font-size: 14px; font-family: inherit; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.git-repo-selector select:focus { outline: none; border-color: #555; }

.git-status-cards {
  display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; overflow-x: auto;
}
.git-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; color: #ccc; white-space: nowrap;
}
.git-card-icon { display: flex; align-items: center; color: #888; }
.git-card-label { font-weight: 500; }

.git-actions-bar {
  display: flex; gap: 6px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  overflow-x: auto;
}
.git-action-btn {
  padding: 6px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px;
  color: #ccc; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.git-action-btn:hover { background: #1a1a1a; color: #fff; }
.git-action-primary { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
.git-action-primary:hover { background: #ddd; color: #000; }

.git-layout {
  display: flex; flex: 1; overflow: hidden;
}
.git-files-panel {
  width: 320px; min-width: 220px; max-width: 450px;
  border-right: 1px solid var(--border); overflow-y: auto;
  flex-shrink: 0;
}
.git-diff-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.git-section-title {
  padding: 10px 16px 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: #666;
}
.git-count {
  background: #222; padding: 1px 6px; border-radius: 10px;
  font-size: 10px; color: #888; margin-left: 4px;
}

.git-file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.git-file-item:hover { background: rgba(255,255,255,0.03); }
.git-file-item.selected { background: rgba(255,255,255,0.06); }
.git-file-checkbox { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.git-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.git-file-name { font-size: 13px; color: #ddd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.git-file-dir { font-size: 11px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.git-file-status {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  flex-shrink: 0; font-weight: 500;
}
.git-status-m { color: #c8a830; background: rgba(200,168,48,0.1); }
.git-status-a, .git-status-\? { color: #4a9e4a; background: rgba(74,158,74,0.1); }
.git-status-d { color: #cc4444; background: rgba(204,68,68,0.1); }
.git-status-r { color: #6a9ec8; background: rgba(106,158,200,0.1); }
.git-status-u { color: #cc7744; background: rgba(204,119,68,0.1); }

.git-diff-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; flex-shrink: 0;
}
.git-diff-filename { font-weight: 600; color: #fff; }
.git-diff-content { flex: 1; overflow: auto; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; line-height: 1.7; }

.git-diff-rendered { padding: 4px 0; }
.git-line { padding: 0 16px; white-space: pre; }
.git-line-add { background: rgba(74,158,74,0.1); color: #6fc66f; }
.git-line-del { background: rgba(204,68,68,0.1); color: #e06060; }
.git-line-hunk { color: #6a9ec8; padding: 8px 16px 4px; font-weight: 600; }
.git-line-num { display: inline-block; width: 40px; color: #444; text-align: right; margin-right: 12px; user-select: none; }
.git-line-text { }

.git-diff-empty, .git-diff-new { padding: 16px; color: #666; font-size: 13px; }
.git-diff-new .git-line { padding: 0; }

.git-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 12px; color: #444; padding: 40px;
}
.git-empty p { font-size: 14px; }

.git-error { padding: 16px; color: #cc4444; font-size: 13px; }
.git-loading { display: flex; justify-content: center; padding: 24px; }

/* Git log */
.git-log-panel {
  display: none; flex-direction: column; border-top: 1px solid var(--border);
  max-height: 280px; overflow: hidden;
}
.git-log-header {
  padding: 10px 16px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: #666;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.git-log-list { overflow-y: auto; flex: 1; }
.git-log-item {
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
}
.git-log-item:hover { background: rgba(255,255,255,0.03); }
.git-log-msg { font-size: 13px; color: #ddd; margin-bottom: 4px; }
.git-log-meta { display: flex; gap: 12px; font-size: 11px; color: #555; }
.git-log-hash { font-family: monospace; color: #888; }

/* Git commit modal */
.git-commit-textarea {
  width: 100%; padding: 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 14px; font-family: inherit; resize: vertical; outline: none;
}
.git-commit-textarea:focus { border-color: #444; }
.git-commit-submit {
  width: 100%; padding: 12px; margin-top: 12px;
  background: #fff; border: none; border-radius: 8px;
  color: #000; font-size: 14px; font-weight: 600; cursor: pointer;
}
.git-commit-submit:hover { background: #ddd; }
.git-commit-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Git branch modal */
.git-branch-item {
  padding: 12px 20px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; justify-content: space-between; align-items: center;
  color: #ccc; font-size: 14px;
}
.git-branch-item:hover { background: rgba(255,255,255,0.05); }
.git-branch-item.current { color: #fff; font-weight: 500; }
.git-branch-current {
  font-size: 11px; color: #888; background: #222;
  padding: 2px 8px; border-radius: 4px;
}
.git-branch-name { font-family: monospace; }

@media (max-width: 768px) {
  .git-layout { flex-direction: column; }
  .git-files-panel { width: 100%; max-width: none; border-right: none; border-bottom: 1px solid var(--border); max-height: 40%; }
  .git-status-cards { flex-wrap: wrap; }
  .git-actions-bar { flex-wrap: wrap; }
}

/* Bridge shared input & button styles */
.bridge-input {
  width: 100%; box-sizing: border-box;
  background: #111; color: #fff; border: 1px solid #333;
  border-radius: 8px; padding: 12px 14px; font-size: 15px;
  font-family: inherit; outline: none; transition: border-color 0.15s;
}
.bridge-input:focus { border-color: #fff; }
.bridge-input::placeholder { color: #555; }
.bridge-btn {
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: 14px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.bridge-btn-primary { background: #fff; color: #000; }
.bridge-btn-primary:hover { background: #ddd; }
.bridge-btn-secondary { background: #333; color: #ccc; }
.bridge-btn-secondary:hover { background: #444; }

/* ─── Inline Chat Design Panel ──────────────────────────── */

#design-mode-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer;
  padding: 6px 8px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
#design-mode-btn:hover { color: #fff; background: #1a1a1a; }
#design-mode-btn.active { background: #fff; color: #000; border-color: #fff; }
#design-mode-btn.active svg { stroke: #000; }

/* Chat column wrapper */
#chat-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ─── Chat Build Panel (live IDE side panel) ─────────── */
#content-area.build-split {
  flex-direction: row;
}

#chat-build-panel {
  display: none;
  flex-direction: column;
  width: 46%;
  min-width: 320px;
  max-width: 55%;
  border-left: 1px solid #1a1a1a;
  background: #080808;
  position: relative;
  overflow: hidden;
}
#chat-build-panel.open {
  display: flex;
}

/* Status bar — thinking / activity */
.cbp-status {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #6a6230;
  font-style: italic;
  background: #0c0b06;
  border-bottom: 1px solid #1a1a0e;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cbp-status.active { display: flex; }
.cbp-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8a7a30; flex-shrink: 0;
  animation: cbpPulse 1.2s ease infinite;
}
@keyframes cbpPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.cbp-status-text {
  overflow: hidden; text-overflow: ellipsis;
}

/* File tabs */
.cbp-tabs {
  display: flex;
  align-items: center;
  background: #050505;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.cbp-tabs::-webkit-scrollbar { display: none; }
.cbp-tabs:empty { display: none; }
.cbp-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12px; color: #555;
  cursor: pointer; border-right: 1px solid #111;
  white-space: nowrap; flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
  position: relative;
}
.cbp-tab:hover { background: #111; color: #888; }
.cbp-tab.active { background: #0d0d0d; color: #ccc; }
.cbp-tab.active::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 1px;
  background: #444;
}
.cbp-tab-icon {
  font-size: 11px; opacity: 0.6;
}
.cbp-tab-name {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.cbp-tab-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #555; animation: cbpPulse 1s ease infinite;
}
.cbp-tab-close {
  font-size: 13px; line-height: 1; color: #333;
  cursor: pointer; margin-left: 2px;
}
.cbp-tab-close:hover { color: #999; }

/* Code viewer */
.cbp-viewer {
  flex: 1;
  overflow-y: auto;
  background: #080808;
  position: relative;
}
.cbp-file-view {
  display: none;
  flex-direction: column;
  min-height: 100%;
}
.cbp-file-view.active { display: flex; }

/* Code content */
.cbp-code {
  padding: 12px 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  color: #888;
  counter-reset: cbp-line;
}
.cbp-line {
  display: flex;
  padding: 0 12px 0 0;
  min-height: 1.65em;
}
.cbp-line:hover { background: #0d0d0d; }
.cbp-line-num {
  display: inline-block;
  width: 44px;
  min-width: 44px;
  padding-right: 12px;
  text-align: right;
  color: #2a2a2a;
  user-select: none;
  flex-shrink: 0;
  font-size: 11px;
}
.cbp-line-text {
  flex: 1;
  min-width: 0;
}
/* Diff highlighting */
.cbp-line.diff-add { background: rgba(80, 120, 80, 0.08); }
.cbp-line.diff-add .cbp-line-num { color: #3a5a3a; }
.cbp-line.diff-add .cbp-line-text { color: #8a8; }
.cbp-line.diff-del { background: rgba(120, 80, 80, 0.08); }
.cbp-line.diff-del .cbp-line-num { color: #5a3a3a; }
.cbp-line.diff-del .cbp-line-text { color: #a88; text-decoration: line-through; }

/* Bash/terminal view */
.cbp-terminal {
  padding: 12px 16px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #777;
  white-space: pre-wrap;
  word-break: break-all;
}
.cbp-terminal-cmd {
  color: #999;
  margin-bottom: 4px;
}
.cbp-terminal-output {
  color: #555;
}

/* Empty state */
.cbp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px;
  gap: 14px;
  text-align: center;
}
.cbp-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #222;
}
.cbp-empty-sub {
  font-size: 12px;
  color: #1a1a1a;
  max-width: 240px;
  line-height: 1.6;
}

/* Header button */
#build-panel-btn {
  position: relative; background: none; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; padding: 6px 8px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
#build-panel-btn.active { background: #fff; color: #000; border-color: #fff; }
#build-panel-btn.active svg { stroke: #000; }
.build-btn-dot {
  display: none;
  position: absolute;
  top: 2px; right: 2px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
}
.build-btn-dot.active {
  display: block;
  animation: cbpPulse 1.2s ease infinite;
}

/* ─── Writer Panel ──────────────────────────────────────── */

#writer-panel-btn {
  position: relative; background: none; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; padding: 6px 8px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
#writer-panel-btn.active { background: #fff; color: #000; border-color: #fff; }
#writer-panel-btn.active svg { stroke: #000; }

#content-area.writer-split {
  flex-direction: row;
}

#chat-writer-panel {
  display: none;
  flex-direction: column;
  width: 46%;
  min-width: 320px;
  max-width: 55%;
  border-left: 1px solid #1a1a1a;
  background: #080808;
  position: relative;
  overflow: hidden;
}
#chat-writer-panel.open {
  display: flex;
}

.cwp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #1a1a1a;
  background: #050505;
  flex-shrink: 0;
}
.cwp-title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
}
.cwp-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cwp-btn {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.cwp-btn:hover { color: #888; background: #111; }
.cwp-close {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  line-height: 1;
}
.cwp-close:hover { color: #999; }

.cwp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.cwp-editor {
  flex: 1;
  background: #080808;
  color: #ccc;
  border: none;
  outline: none;
  resize: none;
  padding: 20px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  overflow-y: auto;
}
.cwp-editor::placeholder {
  color: #2a2a2a;
}

.cwp-feedback {
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid #1a1a1a;
  background: #050505;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cwp-feedback:empty {
  display: none;
}
.cwp-msg {
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.6;
  border-bottom: 1px solid #111;
}
.cwp-msg-user {
  color: #888;
  background: #0a0a0a;
}
.cwp-msg-ai {
  color: #666;
  background: #050505;
}
.cwp-msg-loading {
  color: #444;
  font-style: italic;
}
.cwp-loading-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #555;
  animation: cbpPulse 1.2s ease infinite;
  vertical-align: middle;
  margin-right: 4px;
}

.cwp-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #1a1a1a;
  background: #050505;
  flex-shrink: 0;
}
.cwp-input-bar textarea {
  flex: 1;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  color: #ccc;
  padding: 8px 12px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 80px;
}
.cwp-input-bar textarea::placeholder {
  color: #444;
}
.cwp-input-bar textarea:focus {
  border-color: #333;
}
.cwp-send {
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cwp-send svg { stroke: #000; }
.cwp-send:hover { background: #ddd; }

/* Split view: when design panel is open */
#content-area.design-split {
  flex-direction: row;
}

#chat-design-panel {
  display: none;
  flex-direction: column;
  width: 50%;
  min-width: 320px;
  max-width: 60%;
  border-left: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
#chat-design-panel.open {
  display: flex;
}


.chat-design-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  min-height: 40px;
  gap: 6px;
  flex-shrink: 0;
}
.chat-design-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.chat-design-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.chat-design-format-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-design-format-group select {
  background: #111;
  color: #ccc;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 11px;
  cursor: pointer;
}
#chat-design-custom-size {
  display: flex;
  align-items: center;
  gap: 2px;
}
#chat-design-custom-size input {
  width: 50px;
  background: #111;
  color: #ccc;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 11px;
}
#chat-design-custom-size span {
  color: #666;
  font-size: 11px;
}
#chat-design-bg {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.chat-design-btn {
  background: none;
  border: 1px solid #333;
  color: #ccc;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.chat-design-btn:hover { background: #222; color: #fff; }
.chat-design-close {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.chat-design-close:hover { color: #fff; }

/* Body: tools | canvas | layers */
.chat-design-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Tools sidebar */
.chat-design-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  gap: 2px;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  width: 36px;
  flex-shrink: 0;
}
.chat-design-tool {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-design-tool:hover { color: #fff; background: #222; }
.chat-design-tool.active { color: #fff; background: #333; }
.chat-design-tool-sep {
  width: 20px;
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* Canvas area */
.chat-design-canvas-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  position: relative;
}
.chat-design-canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
#chat-design-canvas {
  position: relative;
  overflow: hidden;
  transform-origin: center center;
  box-shadow: 0 0 0 1px #222;
}

/* Elements on canvas */
.cd-element {
  position: absolute;
  cursor: move;
  user-select: none;
}
.cd-element:hover {
  outline: 1px dashed rgba(255,255,255,0.3);
}
.cd-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 1px solid #000;
  z-index: 9999;
}

/* Layers panel */
.chat-design-layers {
  width: 140px;
  border-left: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-y: auto;
  flex-shrink: 0;
}
.chat-design-layers-header {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cd-layer {
  padding: 6px 8px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  border-bottom: 1px solid #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-layer:hover { background: #1a1a1a; color: #fff; }
.cd-layer.selected { background: #222; color: #fff; }

/* Design suggestion bar (in chat) */
.design-suggestion-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 8px 16px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 13px;
  color: #ccc;
}
.design-suggestion-bar span {
  flex: 1;
}
.design-suggestion-accept {
  background: #fff;
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.design-suggestion-accept:hover { background: #ddd; }
.design-suggestion-dismiss {
  background: #333;
  color: #ccc;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}
.design-suggestion-dismiss:hover { background: #444; }

/* Mobile: design panel goes full width below */
@media (max-width: 900px) {
  #content-area.design-split {
    flex-direction: column;
  }
  #chat-design-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 50%;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .chat-design-layers {
    display: none;
  }
}
/* ═══════════════════════════════════════════════════════════
   ANIMATOR
   ═══════════════════════════════════════════════════════════ */

#animator-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#animator-page.open { display: flex; flex-direction: column; }
#anim-editor-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

.anim-comp-tabs {
  display: flex; align-items: center; gap: 0;
  border-bottom: 1px solid var(--border); background: #0a0a0a;
  padding: 0 8px; flex-shrink: 0; overflow-x: auto;
}
.anim-comp-tab {
  padding: 6px 16px; font-size: 12px; color: #888;
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap;
}
.anim-comp-tab:hover { color: #ccc; }
.anim-comp-tab.active { color: #fff; border-bottom-color: #fff; }
.anim-comp-add { color: #555; font-size: 16px; padding: 4px 12px; }
.anim-comp-add:hover { color: #fff; }

.anim-toolbar-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #0a0a0a;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.anim-project-title {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  margin-right: 8px;
  white-space: nowrap;
}
.anim-toolbar-tools,
.anim-toolbar-add,
.anim-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.anim-toolbar-right { margin-left: auto; }

.anim-tool-btn {
  background: none;
  border: 1px solid transparent;
  color: #aaa;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.anim-tool-btn:hover { background: #222; color: #fff; }
.anim-tool-btn.active { background: #333; color: #fff; border-color: #555; }

.anim-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #ccc;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.anim-btn:hover { background: #252525; color: #fff; }
.anim-btn-primary { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
.anim-btn-primary:hover { background: #ddd; }

.anim-zoom-label {
  font-size: 11px;
  color: #888;
  min-width: 40px;
  text-align: center;
}
.anim-zoom-btn {
  background: none;
  border: 1px solid #333;
  color: #aaa;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.anim-zoom-btn:hover { background: #222; color: #fff; }

.anim-main-area {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.anim-layers-panel {
  width: 200px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  flex-shrink: 0;
}
.anim-layers-header {
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.anim-layers-actions { display: flex; gap: 2px; }
.anim-layers-actions button {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
}
.anim-layers-actions button:hover { color: #fff; background: #333; }

.anim-layers-list { flex: 1; overflow-y: auto; }

.anim-layer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #111;
  font-size: 12px;
  color: #aaa;
}
.anim-layer:hover { background: #151515; }
.anim-layer.selected { background: #1a1a1a; color: #fff; }
.anim-layer.hidden { opacity: 0.4; }
.anim-layer.dragging { opacity: 0.5; }
.anim-layer.drag-over { border-top: 2px solid #fff; }
.anim-layer-icon { flex-shrink: 0; display: flex; }
.anim-layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anim-layer-vis, .anim-layer-lock {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.5;
  flex-shrink: 0;
}
.anim-layer-vis:hover, .anim-layer-lock:hover { opacity: 1; }
.anim-layer-vis.off { opacity: 0.3; }
.anim-layer-lock.on { opacity: 0.8; }

.anim-canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #111;
}
.anim-canvas-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.anim-canvas {
  position: absolute;
  transform-origin: 0 0;
  overflow: hidden;
}

.anim-properties-panel {
  width: 260px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  flex-shrink: 0;
  overflow-y: auto;
}
.anim-properties-header {
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.anim-properties { padding: 8px; flex: 1; overflow-y: auto; }
.anim-props-empty {
  color: #444;
  font-size: 12px;
  text-align: center;
  padding: 40px 20px;
}
.anim-prop-group { margin-bottom: 8px; }
.anim-prop-group label {
  display: block;
  font-size: 10px;
  color: #666;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.anim-prop-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.anim-prop-row > div { flex: 1; }
.anim-prop-input {
  width: 100%;
  background: #111;
  border: 1px solid #333;
  color: #ddd;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}
.anim-prop-input:focus { border-color: #666; }
.anim-prop-num { width: 70px; text-align: right; }
.anim-prop-color {
  width: 32px;
  height: 26px;
  border: 1px solid #333;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  padding: 0;
}
.anim-prop-unit {
  font-size: 10px;
  color: #555;
  flex-shrink: 0;
  min-width: 16px;
}
.anim-prop-divider {
  height: 1px;
  background: #222;
  margin: 12px 0;
}

.anim-kf-btn {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}
.anim-kf-btn:hover { color: #ffa500; }
.anim-kf-btn.active { color: #ffa500; }

.anim-timeline {
  height: 220px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  flex-shrink: 0;
}
.anim-timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.anim-time-display {
  font-size: 11px;
  color: #888;
  font-family: monospace;
  margin: 0 8px;
}
.anim-toolbar-divider {
  width: 1px;
  height: 18px;
  background: #333;
  margin: 0 4px;
}
.anim-timeline-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.anim-timeline-tracks {
  position: relative;
  min-height: 100%;
}

.anim-timeline-track {
  position: relative;
  height: 28px;
  border-bottom: 1px solid #151515;
}
.anim-timeline-label {
  position: absolute;
  left: 0;
  top: 0;
  width: 140px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  font-size: 11px;
  color: #888;
  background: #0a0a0a;
  z-index: 2;
  border-right: 1px solid #222;
  cursor: pointer;
  overflow: hidden;
}
.anim-timeline-label.selected { background: #1a1a1a; color: #fff; }
.anim-timeline-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.anim-track-vis-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 1px;
  display: flex;
  flex-shrink: 0;
}
.anim-track-vis-btn:hover { color: #fff; }

.anim-timeline-bar {
  position: absolute;
  top: 3px;
  height: 22px;
  background: #222;
  border-radius: 3px;
  cursor: pointer;
  min-width: 8px;
  margin-left: 140px;
}
.anim-timeline-bar:hover { background: #2a2a2a; }
.anim-timeline-bar.selected { background: #333; outline: 1px solid #666; }

.anim-trim-handle {
  position: absolute;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  z-index: 3;
}
.anim-trim-left { left: -2px; border-radius: 3px 0 0 3px; }
.anim-trim-right { right: -2px; border-radius: 0 3px 3px 0; }
.anim-trim-handle:hover { background: rgba(255,255,255,0.15); }

.anim-kf-diamond {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #ffa500;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 1px;
  z-index: 4;
  cursor: pointer;
}
.anim-kf-diamond:hover { background: #ffcc00; transform: translate(-50%, -50%) rotate(45deg) scale(1.3); }

/* Sub-tracks for expanded keyframe properties */
.anim-sub-track {
  height: 22px;
  border-bottom: 1px solid #111;
  background: #080808;
}
.anim-sub-label {
  padding-left: 24px;
  font-size: 10px;
  color: #666;
  background: #080808;
  gap: 5px;
}
.anim-sub-label.selected { background: #111; color: #999; }
.anim-sub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.anim-sub-bar {
  height: 14px;
  top: 4px;
  background: #181818;
  border-radius: 2px;
}
.anim-sub-bar:hover { background: #1e1e1e; }
.anim-sub-bar .anim-kf-diamond {
  width: 7px;
  height: 7px;
}

/* Expand/collapse button */
.anim-track-expand-btn {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.anim-track-expand-btn:hover { color: #fff; }
.anim-track-expand-btn.expanded { transform: rotate(90deg); }
.anim-track-expand-btn svg { display: block; }

.anim-element {
  position: absolute;
  cursor: move;
}
.anim-element.selected {
  outline: 2px solid #fff;
  outline-offset: 0;
}

/* Animator Chat Panel */
.anim-chat-panel {
  width: 320px; border-left: 1px solid var(--border); display: flex;
  flex-direction: column; background: var(--bg); flex-shrink: 0;
}
.anim-main-area.anim-chat-open .anim-chat-panel { display: flex; }
.anim-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: #888;
}
.anim-chat-close {
  background: none; border: none; color: #666; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0;
}
.anim-chat-close:hover { color: #fff; }
.anim-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.anim-chat-msg {
  padding: 8px 12px; border-radius: 8px; max-width: 100%;
  font-size: 13px; line-height: 1.5; word-wrap: break-word;
}
.anim-chat-msg.user {
  background: #1a1a1a; color: #ccc; align-self: flex-end;
  white-space: pre-wrap;
}
.anim-chat-msg.assistant {
  background: #111; color: #ccc; align-self: flex-start;
  width: 100%;
}
.anim-chat-msg.assistant .content { line-height: 1.6; white-space: normal; }
.anim-chat-msg.assistant .content p { margin: 0 0 8px 0; }
.anim-chat-msg.assistant .content p:last-child { margin: 0; }
.anim-chat-msg.assistant .content code {
  background: #1a1a1a; padding: 1px 5px; border-radius: 3px; font-size: 12px;
}
.anim-chat-msg.assistant .content pre {
  background: #0a0a0a; padding: 8px 10px; border-radius: 6px;
  overflow-x: auto; font-size: 12px;
}
.anim-chat-msg.system {
  color: #666; font-size: 12px; align-self: center;
  text-align: center; padding: 6px 12px;
}
.anim-chat-msg.assistant .tool-block {
  margin: 6px 0; border: 1px solid #222; border-radius: 6px; overflow: hidden;
}
.anim-chat-msg.assistant .tool-block .tool-header {
  padding: 4px 8px; background: #0a0a0a; font-size: 11px; color: #888; cursor: pointer;
}
.anim-chat-msg.assistant .tool-block .tool-input,
.anim-chat-msg.assistant .tool-block .tool-result {
  padding: 4px 8px; font-size: 11px; color: #666;
  max-height: 80px; overflow-y: auto; white-space: pre-wrap;
}
.anim-chat-msg.assistant .thinking-block {
  margin: 4px 0; border-radius: 6px; overflow: hidden;
}
.anim-chat-msg.assistant .thinking-block .thinking-header {
  padding: 4px 8px; font-size: 11px; color: #555; cursor: pointer;
}
.anim-chat-msg.assistant .thinking-block .thinking-content {
  padding: 4px 8px; font-size: 11px; color: #444; max-height: 80px; overflow-y: auto;
}
.anim-chat-msg.assistant .thinking-block.collapsed .thinking-content { display: none; }
.anim-chat-msg.assistant .tool-block.collapsed .tool-input,
.anim-chat-msg.assistant .tool-block.collapsed .tool-result { display: none; }
.anim-chat-input-bar {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 10px 14px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.anim-chat-input-bar textarea {
  flex: 1; background: #111; border: 1px solid #333; border-radius: 8px;
  color: #ccc; padding: 8px 10px; font-size: 13px; font-family: inherit;
  resize: none; max-height: 120px; min-height: 36px;
  line-height: 1.4;
}
.anim-chat-input-bar textarea:focus { border-color: #555; outline: none; }
.anim-chat-input-bar button {
  background: #222; border: 1px solid #333; border-radius: 8px;
  color: #888; cursor: pointer; padding: 7px 10px; flex-shrink: 0;
}
.anim-chat-input-bar button:hover { background: #333; color: #fff; }
.anim-chat-activity {
  color: #666; font-size: 12px; padding: 4px 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
  .anim-layers-panel { display: none; }
  .anim-properties-panel { display: none; }
  .anim-chat-panel { display: none !important; }
  .anim-timeline-label { width: 80px; font-size: 10px; }
  .anim-timeline-bar { margin-left: 80px; }
  .anim-toolbar-add { display: none; }
}

/* ===== PODCAST INTRO MAKER ===== */
#podcast-page {
  display: none;
  position: absolute;
  inset: 0;
  background: #000;
  overflow-y: auto;
  z-index: 10;
}
#podcast-page.open { display: block; }

.podcast-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 120px;
}

.podcast-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
}
.podcast-header h2 { font-size: 22px; color: #fff; font-weight: 600; }
.podcast-header p { font-size: 14px; color: #666; margin-top: 2px; }

.podcast-section {
  margin-bottom: 32px;
}
.podcast-section h3 {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  font-weight: 600;
}
.podcast-section-desc {
  font-size: 13px;
  color: #555;
  margin: -8px 0 14px;
}

/* Style Cards */
.podcast-styles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.podcast-style-card {
  background: #111;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.podcast-style-card:hover {
  border-color: #444;
  background: #161616;
}
.podcast-style-card.active {
  border-color: #fff;
  background: #1a1a1a;
}
.podcast-style-card strong {
  display: block;
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
}
.podcast-style-card span {
  font-size: 12px;
  color: #666;
}

/* Controls */
.podcast-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.podcast-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.podcast-control label {
  font-size: 13px;
  color: #aaa;
  font-weight: 500;
}
.podcast-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.podcast-control-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
}
.podcast-control-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.podcast-control-row span {
  font-size: 13px;
  color: #888;
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.podcast-control select {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  max-width: 120px;
}

/* Voice Actions */
.podcast-voice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.podcast-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.podcast-record-btn {
  background: #111;
  border: 1px solid #333;
  color: #fff;
}
.podcast-record-btn:hover { border-color: #555; }
.podcast-record-btn.recording {
  background: #1a0000;
  border-color: #ff3333;
  color: #ff3333;
  animation: podcast-pulse 1s ease infinite;
}
@keyframes podcast-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.podcast-upload-btn {
  background: #111;
  border: 1px solid #333;
  color: #fff;
}
.podcast-upload-btn:hover { border-color: #555; }
.podcast-remove-btn {
  background: transparent;
  border: 1px solid #333;
  color: #666;
}
.podcast-remove-btn:hover { border-color: #555; color: #aaa; }

.podcast-voice-status {
  font-size: 13px;
  color: #555;
  margin-top: 10px;
}

/* Player Bar */
.podcast-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111;
  border-top: 1px solid #222;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 100;
}
.podcast-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.podcast-play-btn:active { transform: scale(0.95); }
.podcast-player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.podcast-player-info span:first-child {
  font-size: 15px;
  color: #fff;
  font-weight: 600;
}
.podcast-player-info span:last-child {
  font-size: 12px;
  color: #666;
}
.podcast-export-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  background: #fff;
  color: #000;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.podcast-export-btn:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .podcast-styles { grid-template-columns: 1fr 1fr; }
  .podcast-player { padding: 12px 16px; }
  .podcast-export-btn span { display: none; }
}

/* ===== OMNION ===== */
#omnion-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow: hidden;
}
#omnion-page.open { display: flex; flex-direction: column; }

#offertebeheer-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10;
}
#offertebeheer-page.open { display: flex; flex-direction: column; }
#offertebeheer-container { flex: 1; width: 100%; overflow: hidden; }
.offertebeheer-iframe { width: 100%; height: 100%; border: none; display: block; }
.offertebeheer-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: #888; font-size: 15px; }

/* Omnion Layout with Sidebar */
.omnion-layout {
  display: flex; flex: 1; min-height: 0;
}
.omnion-sidebar {
  width: 260px; min-width: 260px; border-right: 1px solid #1a1a1a;
  background: #0a0a0a; display: flex; flex-direction: column; overflow-y: auto;
}
.omnion-sidebar-header {
  padding: 20px 20px 12px; border-bottom: 1px solid #1a1a1a;
  display: flex; align-items: center; justify-content: space-between;
}
.omnion-sidebar-title {
  font-size: 13px; font-weight: 600; color: #555; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.omnion-sidebar-new {
  background: #222; border: 1px solid #333; color: #888; width: 28px; height: 28px;
  border-radius: 8px; cursor: pointer; font-size: 16px; display: flex;
  align-items: center; justify-content: center; transition: all 0.15s;
}
.omnion-sidebar-new:hover { background: #333; color: #fff; }
.omnion-sidebar-list {
  padding: 8px; display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; flex: 1;
}
.omnion-sidebar-empty {
  padding: 20px 12px; color: #444; font-size: 13px; text-align: center;
}
.omnion-ws-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s;
}
.omnion-ws-item:hover { background: #151515; }
.omnion-ws-item.active { background: #1a1a1a; }
.omnion-ws-dot { color: #444; font-size: 10px; flex-shrink: 0; }
.omnion-ws-running .omnion-ws-dot { color: #888; }
.omnion-ws-info { min-width: 0; }
.omnion-ws-name {
  font-size: 13px; font-weight: 500; color: #aaa;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omnion-ws-item.active .omnion-ws-name { color: #fff; }
.omnion-ws-meta { font-size: 11px; color: #444; margin-top: 1px; }

.omnion-main {
  max-width: 900px; margin: 0 auto; padding: 48px 24px 64px; flex: 1; min-width: 0;
  overflow-y: auto;
}
.omnion-header { margin-bottom: 32px; }
.omnion-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.omnion-title { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }
.omnion-subtitle { color: #666; font-size: 14px; margin: 0; }

.omnion-badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: #222; color: #666; text-transform: uppercase; letter-spacing: 0.5px;
}
.omnion-badge-running { background: #1a1a1a; color: #aaa; border: 1px solid #333; }
.omnion-badge-done { background: #111; color: #fff; border: 1px solid #444; }
.omnion-badge-stopped { background: #1a1a1a; color: #555; }
.omnion-badge-idle { background: #222; color: #555; }

.omnion-input-section { margin-bottom: 24px; }
.omnion-textarea {
  width: 100%; background: #111; border: 1px solid #222; border-radius: 12px;
  color: #fff; font-size: 15px; padding: 14px 16px; resize: vertical;
  font-family: inherit; outline: none; box-sizing: border-box;
}
.omnion-textarea:focus { border-color: #444; }
.omnion-textarea::placeholder { color: #444; }

.omnion-target-section { margin-top: 12px; }
.omnion-target-toggle { display: flex; gap: 10px; }
.omnion-target-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #111; border: 1px solid #222; border-radius: 10px;
  padding: 12px 16px; cursor: pointer; transition: all 0.15s;
}
.omnion-target-btn:hover { border-color: #444; }
.omnion-target-btn.active { border-color: #fff; background: #1a1a1a; }
.omnion-target-icon { font-size: 20px; color: #555; }
.omnion-target-btn.active .omnion-target-icon { color: #fff; }
.omnion-target-label { font-size: 14px; font-weight: 600; color: #888; }
.omnion-target-btn.active .omnion-target-label { color: #fff; }
.omnion-target-desc { font-size: 11px; color: #444; }
.omnion-target-btn.active .omnion-target-desc { color: #666; }

.omnion-controls {
  display: flex; align-items: center; justify-content: space-between; margin-top: 12px;
}
.omnion-options { display: flex; gap: 16px; color: #666; font-size: 13px; }
.omnion-options label { display: flex; align-items: center; gap: 6px; }
.omnion-options select {
  background: #111; border: 1px solid #333; color: #fff; border-radius: 6px;
  padding: 4px 8px; font-size: 13px;
}

.omnion-btn {
  background: #222; color: #fff; border: 1px solid #333; border-radius: 8px;
  padding: 8px 20px; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.15s;
}
.omnion-btn:hover { background: #333; }
.omnion-btn-primary { background: #fff; color: #000; border-color: #fff; }
.omnion-btn-primary:hover { background: #ddd; }
.omnion-btn-danger { background: #1a1a1a; color: #888; border-color: #333; }
.omnion-btn-danger:hover { background: #2a1a1a; color: #aaa; }

.omnion-progress { margin-bottom: 20px; }
.omnion-phases { margin-bottom: 12px; }
.omnion-phase-indicator {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: #111; border: 1px solid #222; border-radius: 10px;
}
.omnion-phase-label { color: #555; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.omnion-phase-name { color: #fff; font-size: 15px; font-weight: 600; }

.omnion-stats {
  display: flex; gap: 16px; margin-top: 8px;
}
.omnion-stat {
  display: flex; flex-direction: column; gap: 2px; background: #0d0d0d;
  border: 1px solid #1a1a1a; border-radius: 8px; padding: 10px 16px; flex: 1;
}
.omnion-stat-label { font-size: 11px; color: #555; text-transform: uppercase; font-weight: 600; }
.omnion-stat-value { font-size: 16px; color: #fff; font-weight: 600; }

.omnion-panel-tabs {
  display: flex; gap: 0; border-bottom: 1px solid #222; margin-bottom: 0;
}
.omnion-tab {
  padding: 10px 20px; font-size: 13px; color: #555; cursor: pointer;
  background: none; border: none; border-bottom: 2px solid transparent;
  font-weight: 500; transition: color 0.15s;
}
.omnion-tab:hover { color: #999; }
.omnion-tab.active { color: #fff; border-bottom-color: #fff; }

.omnion-panel {
  background: #0a0a0a; border: 1px solid #1a1a1a; border-top: none;
  border-radius: 0 0 12px 12px; min-height: 350px; max-height: 500px;
  overflow-y: auto;
}

.omnion-terminal {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px;
  padding: 16px; line-height: 1.6; color: #888;
}
.omnion-log { white-space: pre-wrap; word-break: break-all; }
.omnion-log-system { color: #666; }
.omnion-log-stdout { color: #aaa; }
.omnion-log-stderr { color: #777; }
.omnion-log-error { color: #888; }

.omnion-chat { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* Agent spawn card */
.omnion-agent-spawn {
  background: #0d0d0d; border: 1px solid #222; border-radius: 10px;
  padding: 12px 14px; border-left: 3px solid #444;
}
.omnion-agent-spawn-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.omnion-agent-icon { color: #555; font-size: 8px; }
.omnion-agent-spawn-label {
  font-size: 11px; color: #555; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px;
}
.omnion-agent-role-badge {
  font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: #1a1a1a; color: #aaa; border: 1px solid #333;
}
.omnion-agent-spawn-prompt {
  font-size: 12px; color: #666; line-height: 1.5;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Message from Tech Lead or Agent */
.omnion-agent-msg {
  background: #111; border: 1px solid #1a1a1a; border-radius: 10px;
  padding: 12px 14px;
}
.omnion-msg-techlead { border-left: 3px solid #666; }
.omnion-msg-agent { border-left: 3px solid #333; }

.omnion-agent-msg-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.omnion-agent-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.omnion-dot-techlead { background: #888; }
.omnion-dot-agent { background: #444; }

.omnion-agent-name {
  font-size: 12px; font-weight: 600; color: #ccc;
}
.omnion-agent-phase {
  font-size: 10px; color: #444; text-transform: uppercase; font-weight: 600;
  margin-left: auto; letter-spacing: 0.5px;
}

.omnion-agent-msg-body {
  font-size: 13px; line-height: 1.6; color: #999; white-space: pre-wrap; word-break: break-word;
}
.omnion-msg-collapsed {
  max-height: 120px; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}
.omnion-msg-expand {
  background: none; border: none; color: #666; font-size: 12px;
  cursor: pointer; padding: 4px 0 0; font-weight: 500;
}
.omnion-msg-expand:hover { color: #aaa; }

.omnion-file-tree {
  padding: 12px; border-right: 1px solid #1a1a1a;
  max-height: 200px; overflow-y: auto;
}
.omnion-file-entry {
  padding: 4px 8px; font-size: 12px; color: #888; cursor: pointer;
  border-radius: 4px; font-family: 'SF Mono', monospace;
}
.omnion-file-entry:hover { background: #111; color: #fff; }

.omnion-file-content { padding: 12px; }
.omnion-file-path {
  font-size: 11px; color: #555; margin-bottom: 8px;
  font-family: 'SF Mono', monospace; padding: 6px 10px;
  background: #111; border-radius: 6px;
}
.omnion-file-code {
  font-size: 12px; color: #aaa; line-height: 1.5; white-space: pre-wrap;
  font-family: 'SF Mono', 'Fira Code', monospace; margin: 0;
}

.omnion-actions {
  margin-top: 20px; display: flex; flex-direction: column; gap: 12px;
}

.omnion-feedback-section { width: 100%; }
.omnion-feedback-row {
  display: flex; gap: 8px; align-items: flex-start;
}
.omnion-feedback-row .omnion-textarea {
  flex: 1; min-height: 44px; font-size: 14px; padding: 10px 14px;
  border-radius: 10px;
}
.omnion-feedback-row .omnion-btn { align-self: flex-start; margin-top: 1px; }

.omnion-action-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.omnion-export-row { display: flex; gap: 8px; align-items: center; }
.omnion-input-small {
  background: #111; border: 1px solid #222; border-radius: 8px;
  color: #fff; font-size: 13px; padding: 8px 12px; width: 160px;
  font-family: inherit; outline: none;
}
.omnion-input-small:focus { border-color: #444; }
.omnion-input-small::placeholder { color: #444; }

.omnion-project-header { margin-bottom: 20px; }

#omnion-panels { margin-bottom: 16px; }

/* File card in chat */
.file-card {
  display: flex; align-items: center; gap: 12px;
  background: #111; border: 1px solid #222; border-radius: 12px;
  padding: 14px 16px; margin: 10px 0; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.file-card:hover { background: #1a1a1a; border-color: #333; }
.file-card-icon { color: #555; flex-shrink: 0; }
.file-card-info { flex: 1; min-width: 0; }
.file-card-name {
  font-size: 14px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-card-path {
  font-size: 12px; color: #555; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-card-btn {
  background: #222; border: 1px solid #333; border-radius: 8px;
  padding: 8px; color: #888; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.file-card-btn:hover { background: #333; color: #fff; }

/* ── Liquid Rainbow ── */
#liquid-rainbow-page {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #000; z-index: 100;
}
#liquid-rainbow-page.open { display: block; }

#recorder-page {
  display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 10; overflow-y: auto;
}
#recorder-page.open { display: block; }

#lr-canvas-container {
  width: 100%; height: 100%; position: relative; overflow: hidden; cursor: crosshair;
}
#lr-canvas { display: block; width: 100%; height: 100%; }

#lr-toolbar {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: rgba(17,17,17,0.92); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px; padding: 6px 16px;
  opacity: 0; transition: opacity 0.4s ease;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}
#lr-toolbar.visible { opacity: 1; pointer-events: auto; }

.lr-hue-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: hsl(0,90%,60%); flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.lr-mode-btn {
  background: #222; border: none; border-radius: 999px;
  padding: 5px 14px; color: #888; font-size: 13px;
  font-family: Inter, sans-serif; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.lr-mode-btn:hover { background: #333; color: #ccc; }
.lr-mode-btn.active { background: rgba(255,255,255,0.12); color: #fff; }

.lr-divider {
  width: 1px; height: 24px; background: #333; flex-shrink: 0;
}

.lr-flow-label {
  font-size: 13px; color: #666; font-family: Inter, sans-serif;
  white-space: nowrap; user-select: none;
}
.lr-flow-label span { color: #aaa; }

.lr-action-btn {
  background: #222; border: none; border-radius: 999px;
  width: 32px; height: 32px; color: #888; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.lr-action-btn:hover { background: #333; color: #fff; }

#lr-pause-indicator {
  position: absolute; top: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(17,17,17,0.8); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 8px 24px;
  color: #666; font-size: 14px; font-family: Inter, sans-serif;
  letter-spacing: 2px; pointer-events: none;
}

/* ─── Recorder Projects Overview ──────────────────── */
.rec-projects-view {
  flex: 1; overflow-y: auto; padding: 40px 24px;
  font-family: Inter, -apple-system, sans-serif; color: #fff;
  background: #0a0a0a;
}
.rec-projects-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 900px; margin: 0 auto 24px;
}
.rec-projects-title {
  font-size: 22px; font-weight: 600; color: #fff; margin: 0;
}
.rec-projects-new-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #000; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-family: inherit;
  font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.rec-projects-new-btn:hover { background: #ddd; }
.rec-projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px; max-width: 900px; margin: 0 auto;
}
.rec-projects-empty {
  text-align: center; padding: 60px 20px; color: #444;
  grid-column: 1 / -1;
}
.rec-project-card {
  display: flex; align-items: center; gap: 14px;
  background: #111; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 16px 18px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.rec-project-card:hover { background: #1a1a1a; border-color: #444; }
.rec-project-card-icon {
  flex-shrink: 0; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border-radius: 10px;
}
.rec-project-card-info { flex: 1; min-width: 0; }
.rec-project-card-name {
  font-size: 14px; font-weight: 500; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rec-project-card-meta { font-size: 11px; color: #666; margin-top: 3px; }
.rec-project-card-delete {
  background: none; border: none; color: #555; cursor: pointer;
  padding: 6px; border-radius: 6px; flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.rec-project-card-delete:hover { color: #ff4444; background: rgba(255,68,68,0.1); }
.rec-editor-view { display: flex; flex-direction: column; height: 100%; }
.rec-back-btn {
  background: none; border: none; color: #888; cursor: pointer;
  padding: 6px; border-radius: 6px; display: flex; align-items: center;
  transition: color 0.15s;
}
.rec-back-btn:hover { color: #fff; }

/* ─── Recorder ────────────────────────────────────── */
.rec-container {
  display: flex; flex-direction: column; height: 100%; padding: 16px;
  font-family: Inter, -apple-system, sans-serif; color: #fff;
  background: #0a0a0a; overflow: hidden;
}

.rec-toolbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #111; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px; flex-shrink: 0; flex-wrap: wrap;
}
.rec-toolbar-left { display: flex; align-items: center; gap: 8px; }
.rec-toolbar-center { display: flex; align-items: center; gap: 16px; }
.rec-toolbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.rec-project-name-input {
  background: transparent; border: 1px solid transparent; color: #fff;
  font-size: 15px; font-weight: 600; padding: 4px 8px; border-radius: 6px;
  width: 180px; outline: none; font-family: inherit;
}
.rec-project-name-input:hover, .rec-project-name-input:focus {
  border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.04);
}

.rec-transport { display: flex; align-items: center; gap: 4px; }
.rec-transport-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08);
  background: #1a1a1a; color: #888; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.rec-transport-btn:hover { background: #222; color: #fff; }
.rec-transport-btn.active { background: #222; color: #fff; border-color: rgba(255,255,255,0.2); }

.rec-record-btn { color: #ff4444; }
.rec-record-btn:hover { background: rgba(255,68,68,0.15); }
.rec-record-btn.recording {
  background: rgba(255,68,68,0.2); color: #ff4444;
  animation: rec-pulse 1s ease infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,68,68,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(255,68,68,0); }
}

.rec-time-display {
  font-family: 'Space Grotesk', monospace; font-size: 20px; font-weight: 700;
  color: #fff; letter-spacing: 1px; min-width: 110px; text-align: center;
}

.rec-bpm-group {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666;
}
.rec-bpm-input {
  width: 52px; background: #1a1a1a; border: 1px solid rgba(255,255,255,0.08);
  color: #fff; padding: 4px 6px; border-radius: 6px; font-size: 13px;
  text-align: center; outline: none; font-family: inherit;
}

.rec-action-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: #1a1a1a; border: 1px solid rgba(255,255,255,0.08);
  color: #888; border-radius: 8px; cursor: pointer; font-size: 12px;
  font-family: inherit; transition: all 0.15s;
}
.rec-action-btn:hover { background: #222; color: #fff; }

/* Main layout */
.rec-main {
  display: flex; flex: 1; overflow: hidden; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06); background: #0d0d0d;
}

/* Track headers column */
.rec-headers-col {
  width: 220px; min-width: 220px; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06); background: #111;
}
.rec-headers-top {
  height: 32px; display: flex; align-items: center; padding: 0 12px;
  font-size: 10px; font-weight: 600; color: #555; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.rec-track-headers-scroll { flex: 1; overflow-y: auto; }

.rec-empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 200px; color: #666;
}

.rec-track-header {
  padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.1s;
}
.rec-track-header:hover { background: rgba(255,255,255,0.02); }
.rec-track-header.selected { background: rgba(255,255,255,0.04); }

.rec-track-header-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.rec-track-name {
  flex: 1; background: transparent; border: none; color: #ccc; font-size: 13px;
  font-weight: 500; padding: 2px 4px; outline: none; font-family: inherit;
  border-radius: 4px;
}
.rec-track-name:hover, .rec-track-name:focus { background: rgba(255,255,255,0.04); }

.rec-track-controls { display: flex; gap: 8px; margin-bottom: 6px; }
.rec-slider-group {
  flex: 1; display: flex; align-items: center; gap: 4px;
}
.rec-slider-group label { font-size: 10px; color: #555; min-width: 22px; }
.rec-slider-group input[type="range"] {
  flex: 1; height: 3px; -webkit-appearance: none; appearance: none;
  background: #333; border-radius: 2px; outline: none;
}
.rec-slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%;
  background: #888; cursor: pointer;
}
.rec-slider-group input[type="range"]::-webkit-slider-thumb:hover { background: #fff; }

.rec-track-buttons { display: flex; gap: 4px; }
.rec-track-btn {
  width: 28px; height: 22px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.08);
  background: #1a1a1a; color: #555; cursor: pointer; font-size: 10px; font-weight: 700;
  font-family: inherit; transition: all 0.1s;
}
.rec-track-btn:hover { color: #fff; background: #222; }
.rec-track-btn.active { border-color: rgba(255,255,255,0.15); }
.rec-track-btn.muted { color: #ff6b6b; background: rgba(255,107,107,0.1); }
.rec-track-btn.soloed { color: #ffd93d; background: rgba(255,217,61,0.1); }

.rec-track-btn-sm {
  width: 22px; height: 22px; border-radius: 4px; border: none;
  background: transparent; color: #555; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.rec-track-btn-sm:hover { color: #fff; }
.rec-delete-btn:hover { color: #ff4444; }

.rec-transcript {
  margin-top: 8px; padding: 8px 10px; background: rgba(255,255,255,0.03);
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.06);
  max-height: 80px; overflow-y: auto;
}
.rec-transcript-text {
  font-size: 11px; line-height: 1.5; color: #999; white-space: pre-wrap;
}

.rec-add-track-bar {
  display: flex; gap: 6px; padding: 10px; border-top: 1px solid rgba(255,255,255,0.06);
}
.rec-add-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; background: #1a1a1a; border: 1px solid rgba(255,255,255,0.06);
  color: #666; border-radius: 8px; cursor: pointer; font-size: 11px;
  font-family: inherit; transition: all 0.15s;
}
.rec-add-btn:hover { background: #222; color: #fff; }

/* Timeline column */
.rec-timeline-col {
  flex: 1; overflow-x: auto; overflow-y: hidden; position: relative;
  display: flex; flex-direction: column;
}
.rec-time-ruler-wrap {
  height: 32px; flex-shrink: 0; overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.rec-time-ruler {
  height: 100%; position: relative; cursor: pointer; min-width: 100%;
}
.rec-ruler-mark {
  position: absolute; top: 0; height: 100%;
  border-left: 1px solid rgba(255,255,255,0.06);
}
.rec-ruler-mark span {
  position: absolute; top: 8px; left: 6px;
  font-size: 10px; color: #444; white-space: nowrap;
  font-family: 'Space Grotesk', monospace;
}

.rec-lanes-scroll { flex: 1; position: relative; overflow-y: auto; }

.rec-track-lane {
  height: 70px; position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.rec-track-lane:hover { background: rgba(255,255,255,0.01); }

.rec-audio-clip {
  position: absolute; top: 4px; bottom: 4px;
  background: rgba(100, 140, 255, 0.08);
  border: 1px solid rgba(100, 140, 255, 0.2);
  border-radius: 6px; overflow: hidden;
}
.rec-waveform-canvas { width: 100%; height: 100%; display: block; }

.rec-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #ff4444; z-index: 10; pointer-events: none;
  box-shadow: 0 0 6px rgba(255,68,68,0.3);
}

/* FX Panel */
.rec-fx-panel {
  position: fixed; bottom: -320px; left: 236px; right: 16px;
  height: 300px; background: #111; border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px 16px 0 0; transition: bottom 0.25s ease;
  z-index: 100; overflow-y: auto; padding: 0;
}
.rec-fx-panel.open { bottom: 0; }

.rec-fx-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; font-size: 14px; font-weight: 600; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky; top: 0; background: #111; z-index: 1;
}

.rec-fx-sections { display: flex; gap: 24px; padding: 16px; }
.rec-fx-section { flex: 1; }
.rec-fx-title {
  font-size: 11px; font-weight: 700; color: #555; letter-spacing: 1px;
  margin-bottom: 12px; text-transform: uppercase;
}
.rec-fx-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.rec-fx-row label {
  font-size: 12px; color: #888; min-width: 90px;
  display: flex; justify-content: space-between;
}
.rec-fx-row label span { color: #fff; font-weight: 500; font-family: 'Space Grotesk', monospace; font-size: 11px; }
.rec-fx-row input[type="range"] {
  flex: 1; height: 3px; -webkit-appearance: none; appearance: none;
  background: #333; border-radius: 2px; outline: none;
}
.rec-fx-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: #888; cursor: pointer; border: 2px solid #222;
}
.rec-fx-row input[type="range"]::-webkit-slider-thumb:hover { background: #fff; }

/* Project modal */
.rec-project-modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 200;
  align-items: center; justify-content: center;
}
.rec-project-modal.open { display: flex; }
.rec-modal-content {
  background: #111; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; width: 400px; max-height: 500px;
  overflow: hidden; display: flex; flex-direction: column;
}
.rec-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.rec-modal-list { overflow-y: auto; flex: 1; }
.rec-project-item {
  display: flex; align-items: center; padding: 12px 20px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.03); transition: background 0.1s;
}
.rec-project-item:hover { background: rgba(255,255,255,0.04); }
.rec-project-item-info { flex: 1; }
.rec-project-item-name { font-size: 14px; font-weight: 500; color: #fff; }
.rec-project-item-meta { font-size: 11px; color: #555; margin-top: 2px; }

/* Zoom bar */
.rec-zoom-bar {
  position: absolute; bottom: 12px; right: 28px;
  display: flex; align-items: center; gap: 8px; padding: 4px 12px;
  background: rgba(17,17,17,0.9); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; z-index: 50;
}
.rec-zoom-bar input[type="range"] {
  width: 80px; height: 3px; -webkit-appearance: none; appearance: none;
  background: #333; border-radius: 2px; outline: none;
}
.rec-zoom-bar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%;
  background: #888; cursor: pointer;
}

/* Toast */
.rec-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(60px);
  background: #1a1a1a; border: 1px solid rgba(255,255,255,0.1);
  color: #fff; padding: 10px 24px; border-radius: 10px;
  font-size: 13px; z-index: 300; opacity: 0; transition: all 0.25s ease;
  pointer-events: none;
}
.rec-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Onboarding Wizard */
#onboarding-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  animation: obFadeIn 0.3s ease;
}
@keyframes obFadeIn { from { opacity: 0; } to { opacity: 1; } }
.onboarding-card {
  background: #111; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px; padding: 40px; max-width: 440px; width: 90%;
}
.onboarding-card h2 { margin: 0 0 6px; font-size: 24px; color: #fff; font-weight: 600; }
.ob-desc { color: #777; font-size: 14px; margin: 0 0 28px; line-height: 1.5; }
.ob-field { margin-bottom: 16px; }
.ob-field label { display: block; font-size: 12px; color: #888; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.ob-field input, .ob-field select {
  width: 100%; background: #0a0a0a; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 10px 14px; color: #fff; font-size: 15px;
  outline: none; box-sizing: border-box;
}
.ob-field input:focus, .ob-field select:focus { border-color: rgba(255,255,255,0.25); }
.ob-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: #fff; color: #000; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 8px; transition: opacity 0.15s;
}
.ob-btn:hover { opacity: 0.85; }
.ob-provider-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.ob-provider-card {
  padding: 14px 16px; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; cursor: pointer; transition: all 0.15s;
}
.ob-provider-card:hover { border-color: rgba(255,255,255,0.2); }
.ob-provider-card.ob-selected { border-color: #fff; background: rgba(255,255,255,0.04); }
.ob-provider-card.ob-unavailable { opacity: 0.4; }
.ob-provider-name { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.ob-provider-desc { font-size: 12px; color: #666; }
.ob-provider-badge { font-size: 11px; color: #f90; margin-top: 4px; }

/* Settings API key management */
.settings-key-row { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.settings-key-row:last-child { border-bottom: none; }
.settings-key-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings-key-name { font-size: 14px; color: #fff; font-weight: 500; }
.settings-key-status { font-size: 12px; }
.settings-key-actions { display: flex; gap: 8px; }
.settings-key-input {
  flex: 1; background: #0a0a0a; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 8px 12px; color: #fff; font-size: 13px; outline: none;
}
.settings-key-input:focus { border-color: rgba(255,255,255,0.25); }
.settings-key-save {
  background: #222; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  padding: 8px 16px; color: #fff; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.settings-key-save:hover { background: #333; }
