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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  overflow: hidden;
}

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 50%, #f0fdf4 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input {
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-btn {
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  background: #2563eb;
  color: #fff;
}

.login-btn:hover {
  background: #1d4ed8;
}

.login-btn-alt {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.login-btn-alt:hover {
  background: #f9fafb;
  color: #374151;
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  margin: 4px 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}
.login-divider span {
  padding: 0 10px;
}

.login-btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
}
.login-btn-google:hover {
  background: #f8faff;
  border-color: #c6d4f0;
}
.login-btn-google svg {
  flex-shrink: 0;
}
.login-btn-google[disabled] {
  opacity: 0.6;
  cursor: default;
}

.login-error {
  color: #dc2626;
  font-size: 13px;
  text-align: left;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 8px;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1e293b;
  border-radius: 10px;
  margin: 8px 12px 4px;
}

.user-bar-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

.user-bar-logout {
  font-size: 12px;
  font-weight: 500;
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
}

.user-bar-logout:hover {
  color: #fff;
  background: #dc2626;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: #f8f9fa;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
}

.accent {
  color: #2563eb;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
}

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: background 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: #e5e7eb;
}

.sidebar-item.active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 500;
}

.sidebar-item .si-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.sidebar-item .si-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.si-actions {
  display: none;
  flex-shrink: 0;
  gap: 2px;
  margin-left: auto;
}

.sidebar-item:hover .si-actions {
  display: flex;
}

.si-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #9ca3af;
  line-height: 1;
}

.si-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.si-btn-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.inline-rename {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-family: inherit;
  padding: 2px 6px;
  border: 1px solid #7c3aed;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: #111;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.sidebar-btn:hover {
  background: #f3f4f6;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
}

.cc-status {
  padding: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
}

.cc-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cc-bar {
  height: 4px;
  background: #dbeafe;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.cc-fill {
  height: 100%;
  width: 0%;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.3s;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  min-height: 52px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.topbar-project {
  font-size: 13px;
  color: #6b7280;
  flex: 1;
}

.topbar-btn {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
}

.topbar-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  gap: 12px;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

.message.user .msg-avatar {
  background: #dbeafe;
  color: #1d4ed8;
}

.message.assistant .msg-avatar {
  background: #f3e8ff;
  color: #7c3aed;
}

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

.msg-role {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-copy-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 1px 5px;
  line-height: 1;
  color: #9ca3af;
  transition: all 0.15s;
}

.msg-copy-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.msg-actions-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.msg-audit-btn {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  line-height: 1.4;
  color: #92400e;
  transition: all 0.15s;
}
.msg-audit-btn:hover {
  background: #fde68a;
  border-color: #d97706;
  color: #78350f;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}
.msg-audit-btn.auditing {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  cursor: wait;
  animation: pulse-audit 1.5s ease-in-out infinite;
}
@keyframes pulse-audit {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.staleness-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.staleness-banner.severity-warning {
  background: #fff7ed;
  border-color: #f97316;
  color: #9a3412;
}
.staleness-banner.severity-critical {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}
.staleness-banner .staleness-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.staleness-banner .staleness-text {
  flex: 1;
}
.staleness-banner .btn-run-audit-banner {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.staleness-banner .btn-run-audit-banner:hover {
  background: #d97706;
}
.staleness-banner .btn-run-audit-banner.auditing {
  background: #d97706;
  cursor: wait;
  animation: pulse-audit 1.5s ease-in-out infinite;
}
.staleness-banner .btn-dismiss-staleness {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 16px;
  padding: 0 2px;
  opacity: 0.6;
  flex-shrink: 0;
}
.staleness-banner .btn-dismiss-staleness:hover {
  opacity: 1;
}

.audit-result-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50%;
  max-width: 600px;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.audit-result-panel.active {
  transform: translateX(0);
}
.audit-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid #f59e0b;
  background: #fffbeb;
}
.audit-result-header h3 {
  margin: 0;
  font-size: 15px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
}
.audit-result-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #92400e;
  padding: 0 4px;
}
.audit-result-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.audit-result-status {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-style: italic;
}
@media (max-width: 768px) {
  .audit-result-panel {
    width: 90%;
    max-width: none;
  }
}

.msg-text {
  font-size: 15px;
  line-height: 1.65;
  color: #1f2937;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.doc-upload-card {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 18px;
  max-width: 520px;
}

.doc-upload-card .duc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.doc-upload-card .duc-icon {
  font-size: 24px;
}

.doc-upload-card .duc-name {
  font-size: 14px;
  font-weight: 600;
  color: #1d4ed8;
}

.doc-upload-card .duc-meta {
  font-size: 12px;
  color: #6b7280;
}

.doc-upload-card .duc-preview {
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
  max-height: 80px;
  overflow: hidden;
  white-space: pre-wrap;
  border-top: 1px solid #dbeafe;
  padding-top: 8px;
  margin-top: 4px;
}

.doc-upload-card .duc-status {
  font-size: 12px;
  color: #2563eb;
  font-weight: 500;
  margin-top: 8px;
  padding: 6px 10px;
  background: #eff6ff;
  border-radius: 6px;
}

.doc-upload-card .duc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #dbeafe;
}

.duc-btn {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.duc-btn:hover {
  background: #f3f4f6;
}

.duc-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.duc-btn-analyze {
  color: #7c3aed;
  border-color: #c4b5fd;
  background: #f5f3ff;
}

.duc-btn-analyze:hover {
  background: #ede9fe;
}

.duc-btn-global {
  color: #2563eb;
  border-color: #93c5fd;
  background: #eff6ff;
}

.duc-btn-global:hover {
  background: #dbeafe;
}

.duc-btn-project {
  color: #059669;
  border-color: #6ee7b7;
  background: #ecfdf5;
}

.duc-btn-project:hover {
  background: #d1fae5;
}

.collapsed-card {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 500px;
}

.collapsed-preview {
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
}

.collapsed-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.btn-expand {
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #2563eb;
  font-size: 12px;
  cursor: pointer;
}

.btn-expand:hover {
  background: #eff6ff;
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.thinking-dot {
  width: 8px;
  height: 8px;
  background: #2563eb;
  border-radius: 50%;
  animation: thinking-bounce 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: #2563eb;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

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

.input-area {
  padding: 12px 24px 24px;
  background: #fff;
  border-top: 1px solid #f3f4f6;
}

.response-length-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 16px 8px;
}

.rl-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  margin-right: 4px;
  white-space: nowrap;
}

.rl-btn {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  line-height: 1.4;
}

.rl-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

.rl-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.rl-divider {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: #d1d5db;
  margin: 0 6px;
  vertical-align: middle;
}

.rs-btn {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  line-height: 1.4;
}
.rs-btn:hover { border-color: #b45309; color: #b45309; background: #fffbeb; }
.rs-btn.active { background: #b45309; color: #fff; border-color: #b45309; }

.topbar-btn-diagnostic { background: #0d9488; color: #fff; border-color: #0d9488; }
.topbar-btn-diagnostic:hover { background: #0f766e; border-color: #0f766e; }

.diagnostic-modal-content { max-width: 820px; width: 92%; max-height: 85vh; display: flex; flex-direction: column; }
.diagnostic-controls { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
.diagnostic-run-btn { padding: 8px 18px; background: #0d9488; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; }
.diagnostic-run-btn:hover { background: #0f766e; }
.diagnostic-run-btn:disabled { background: #94a3b8; cursor: not-allowed; }
.diagnostic-summary { font-size: 13px; color: #374151; font-weight: 500; }
.diagnostic-body { padding: 16px 20px; overflow-y: auto; flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.diagnostic-intro { font-family: 'Inter', sans-serif; font-size: 13px; color: #4b5563; line-height: 1.5; margin: 0 0 8px; }
.diag-category { margin-top: 14px; font-weight: 700; color: #111827; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #e5e7eb; padding-bottom: 4px; font-family: 'Inter', sans-serif; }
.diag-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #f3f4f6; }
.diag-status { display: inline-block; width: 56px; text-align: center; font-weight: 700; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.diag-status.running { background: #fef3c7; color: #92400e; }
.diag-status.pass { background: #d1fae5; color: #065f46; }
.diag-status.fail { background: #fee2e2; color: #991b1b; }
.diag-name { flex: 1; color: #1f2937; }
.diag-msg { color: #6b7280; font-size: 11px; }
.diag-ms { color: #9ca3af; font-size: 11px; min-width: 48px; text-align: right; }

.rf-btn {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  line-height: 1.4;
}

.rf-btn:hover {
  border-color: #7c3aed;
  color: #7c3aed;
  background: #f5f3ff;
}

.rf-btn.active {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

.rm-btn {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  line-height: 1.4;
}

.rm-btn:hover {
  border-color: #059669;
  color: #059669;
  background: #ecfdf5;
}

.rm-btn.active {
  background: #059669;
  color: #fff;
  border-color: #059669;
}

.attached-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 16px;
  padding: 0;
}

.attached-files:empty {
  display: none;
}

.attached-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: #1e40af;
  max-width: 250px;
}

.attached-chip.uploading {
  opacity: 0.6;
}

.attached-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attached-chip-remove {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.attached-chip-remove:hover {
  color: #dc2626;
}

.analyze-btn {
  font-size: 16px;
  color: #059669;
}

.analyze-btn:hover {
  color: #047857;
}

.input-box {
  max-width: 100%;
  margin: 0 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.6;
  color: #1a1a1a;
  outline: none;
  min-height: 72px;
  max-height: 300px;
  padding: 8px 0;
}

.chat-textarea::placeholder {
  color: #9ca3af;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #6b7280;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.paper-btn {
  padding: 6px 12px;
  border: none;
  background: #7c3aed;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  gap: 4px;
  transition: background 0.15s;
  white-space: nowrap;
}

.paper-btn:hover {
  background: #6d28d9;
}

.paper-btn:disabled {
  background: #c4b5fd;
  cursor: not-allowed;
}

.send-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #2563eb;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.15s;
}

.send-btn:hover {
  background: #1d4ed8;
}

.send-btn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

.sum-len-btn {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.sum-len-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.sum-len-btn.active {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

.send-btn.stop-mode {
  background: #dc2626;
  font-size: 12px;
  animation: stop-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35);
}

.send-btn.stop-mode:hover {
  background: #991b1b;
  animation: none;
  transform: scale(1.08);
}

@keyframes stop-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.15); }
}

.mic-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mic-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.mic-btn.recording {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
  animation: micPulse 1s infinite;
}
.mic-btn.transcribing {
  background: #f59e0b;
  border-color: #d97706;
  color: #fff;
  cursor: wait;
}
.mic-btn:disabled { opacity: 0.5; cursor: not-allowed; }
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}
.mic-timer {
  position: absolute;
  background: #111827;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  transform: translate(-50%, -130%);
  font-family: ui-monospace, monospace;
  z-index: 100;
}

.file-input {
  display: none;
}

.doc-panel {
  width: 260px;
  min-width: 260px;
  background: #fafbfc;
  border-left: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.doc-panel-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.doc-panel-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #6b7280;
  padding: 2px 6px;
  border-radius: 4px;
}

.doc-panel-toggle:hover {
  background: #e5e7eb;
  color: #374151;
}

.doc-panel-collapsed {
  width: 40px !important;
  min-width: 40px !important;
}

.doc-panel-collapsed .doc-panel-title {
  display: none;
}

.doc-panel-collapsed .doc-panel-list {
  display: none;
}

.doc-panel-collapsed .doc-panel-header {
  justify-content: center;
  padding: 12px 8px;
}

.doc-panel-collapsed .doc-panel-toggle {
  transform: none;
}

.doc-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.doc-panel-empty {
  text-align: center;
  padding: 24px 16px;
  color: #9ca3af;
  font-size: 13px;
  line-height: 1.5;
}

.dp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}

.dp-item:hover {
  background: #e8f0fe;
}

.dp-item .dp-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.dp-item .dp-info {
  flex: 1;
  min-width: 0;
}

.dp-item .dp-name {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dp-item .dp-words {
  font-size: 11px;
  color: #9ca3af;
}

.dp-item .dp-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.dp-item:hover .dp-actions {
  opacity: 1;
}

.dp-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.dp-action-btn:hover {
  background: #dbeafe;
  color: #2563eb;
}

.dp-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.move-project-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 6px;
  color: #1f2937;
  transition: background 0.15s, border-color 0.15s;
}

.move-project-btn:hover {
  background: #f3e8ff;
  border-color: #a78bfa;
  color: #6d28d9;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 99, 235, 0.08);
  border: 3px dashed #2563eb;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-overlay.active {
  display: flex;
}

.drop-label {
  font-size: 20px;
  font-weight: 600;
  color: #2563eb;
  background: #fff;
  padding: 24px 48px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  pointer-events: none;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-bg.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.modal-x {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-x:hover {
  background: #f3f4f6;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.library-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 12px;
}

.doc-list {
  list-style: none;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.doc-item:hover {
  background: #f3f4f6;
}

.doc-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.doc-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.doc-name {
  font-size: 14px;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-date {
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
}

.doc-item-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.doc-item-actions button {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.doc-item-actions button:hover {
  background: #eff6ff;
  color: #2563eb;
}

.empty-state {
  text-align: center;
  padding: 16px;
  color: #9ca3af;
  font-size: 13px;
  list-style: none;
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.text-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-ok {
  padding: 8px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.btn-ok:hover {
  background: #1d4ed8;
}

.btn-cancel {
  padding: 8px 16px;
  background: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.btn-cancel:hover {
  background: #f3f4f6;
}

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  text-align: center;
}

.welcome h2 {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.welcome p {
  font-size: 15px;
  color: #6b7280;
  max-width: 420px;
  line-height: 1.6;
}

.download-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.dl-btn {
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.dl-btn:hover {
  background: #f3f4f6;
}

.dl-btn-save {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

.dl-btn-save:hover {
  background: #6d28d9;
}

.dl-btn-save:disabled {
  background: #a78bfa;
  cursor: default;
}

.dl-btn-revise {
  background: #0891b2;
  color: #fff;
  border-color: #0891b2;
}

.dl-btn-revise:hover {
  background: #0e7490;
}

.lib-modal-resizable {
  width: 620px;
  height: 70vh;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
  min-width: 380px;
  min-height: 300px;
}
.lib-modal-resizable.lib-expanded {
  width: 90vw;
  height: 90vh;
}

.lib-toolbar {
  flex: 0 0 auto;
  padding: 10px 18px 6px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.lib-doc-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px;
}

.modal-resize-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-resize-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.lib-search-big {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  padding: 10px 14px;
  border: 2px solid #7c3aed;
  border-radius: 8px;
  outline: none;
  margin-bottom: 8px;
  background: #faf5ff;
}
.lib-search-big::placeholder {
  color: #9ca3af;
}
.lib-search-big:focus {
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
  background: #fff;
}

.lib-sort-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.lib-sort-btn {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #f9fafb;
  cursor: pointer;
  color: #6b7280;
}
.lib-sort-btn:hover {
  background: #f3f4f6;
}
.lib-sort-btn.active {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}
.lib-sort-label {
  font-size: 11px;
  color: #9ca3af;
  margin-right: 4px;
}

.lib-footer {
  align-items: center;
  border-top: 2px solid #7c3aed;
  background: #f5f3ff;
  padding: 10px 18px;
  gap: 12px;
}

.pp-revise-area {
  padding: 10px 14px 10px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.hidden {
  display: none !important;
}

.notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: opacity 0.3s;
  max-width: 500px;
  text-align: center;
}

.notification.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.notification.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.notification.info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.paper-popup {
  position: fixed;
  bottom: 80px;
  right: 40px;
  width: 600px;
  max-width: calc(100vw - 80px);
  max-height: 70vh;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  z-index: 5000;
  overflow: hidden;
}

.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #7c3aed;
  color: #fff;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.pp-header:active { cursor: grabbing; }

.pp-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.pp-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pp-controls button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.pp-controls button:hover { background: rgba(255,255,255,0.35); }

.pp-status {
  padding: 8px 14px;
  background: #f5f3ff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.pp-status-text {
  font-size: 12px;
  color: #6b7280;
  display: block;
  margin-bottom: 4px;
}

.pp-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.pp-fill {
  height: 100%;
  width: 0%;
  background: #7c3aed;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.pp-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.pp-content {
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: #1a1a1a;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.pp-content:empty::after {
  content: 'Waiting for content...';
  color: #9ca3af;
  font-style: italic;
}

.pp-footer {
  padding: 10px 14px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pp-downloads {
  display: flex;
  gap: 6px;
}

.pp-word-count {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.lib-selectable {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}

.lib-selectable:hover {
  background: #f3f4f6;
}

.lib-selected {
  background: #ede9fe;
  border-left: 3px solid #7c3aed;
}

.lib-selected:hover {
  background: #ddd6fe;
}

.lib-checkbox-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.lib-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #7c3aed;
  cursor: pointer;
}

.doc-meta-right {
  margin-left: auto;
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.lib-download-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  transition: all 0.15s;
  line-height: 1;
}

.lib-download-btn:hover {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

.lib-delete-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  transition: all 0.15s;
  line-height: 1;
  margin-left: 4px;
}

.lib-delete-btn:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.tractator-depth-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tractator-depth-btn {
  flex: 1;
  min-width: 100px;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  transition: all 0.15s;
}

.tractator-depth-btn:hover {
  border-color: #0d9488;
  background: #f0fdfa;
}

.tractator-depth-btn.active {
  border-color: #0d9488;
  background: #0d9488;
  color: #fff;
}

.tractator-lib-item {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}

.tractator-lib-item:hover {
  background: #f3f4f6;
}

.tractator-lib-item.selected {
  background: #ecfdf5;
  outline: 2px solid #0d9488;
}

.library-drop-hover {
  outline: 3px dashed #fff !important;
  outline-offset: -3px;
  background: #6d28d9 !important;
  transform: scale(1.05);
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.5);
}

.tractatus-popup {
  position: fixed;
  top: 120px;
  left: 20px;
  width: 380px;
  max-width: calc(100vw - 80px);
  max-height: 50vh;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  cursor: grab;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.tp-header:active { cursor: grabbing; }

.tp-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tp-controls button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-controls button:hover { background: rgba(255,255,255,0.35); }

.tp-body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.tp-content {
  padding: 12px 14px;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #374151;
  overflow-y: auto;
  max-height: 30vh;
  white-space: pre-wrap;
  word-break: break-word;
}

.artifact-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  max-width: 700px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.artifact-panel.hidden {
  display: none !important;
}

.artifact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}

.artifact-title {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 8px;
}

.artifact-wordcount {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  margin-right: 8px;
  flex-shrink: 0;
}

.artifact-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.artifact-btn {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
  transition: all 0.15s;
  white-space: nowrap;
}

.artifact-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.artifact-save-btn {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

.artifact-save-btn:hover {
  background: #6d28d9;
}

.artifact-save-btn:disabled {
  background: #a78bfa;
  cursor: default;
}

.artifact-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #6b7280;
  padding: 0 4px;
  line-height: 1;
  margin-left: 4px;
}

.artifact-close:hover {
  color: #1f2937;
}

.artifact-body {
  flex: 1;
  overflow-y: auto;
  padding: 40px 60px;
  font-family: 'Times New Roman', 'Georgia', 'Garamond', serif;
  font-size: 14px;
  line-height: 1.8;
  color: #1a1a1a;
  background: #fff;
}

.artifact-body h1,
.artifact-body .doc-title {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.artifact-body h2,
.artifact-body .doc-heading {
  font-size: 15px;
  font-weight: bold;
  margin: 24px 0 8px;
  text-transform: uppercase;
}

.artifact-body h3 {
  font-size: 14px;
  font-weight: bold;
  margin: 18px 0 6px;
}

.artifact-body p {
  margin: 0 0 12px;
  text-align: justify;
  text-indent: 0;
}

.artifact-body .doc-center {
  text-align: center;
  margin: 8px 0;
}

.artifact-body hr {
  border: none;
  border-top: 1px solid #333;
  margin: 20px auto;
  width: 60%;
}

.artifact-body blockquote {
  margin: 12px 0 12px 30px;
  padding-left: 15px;
  border-left: 2px solid #666;
  font-style: italic;
}

.artifact-body ol,
.artifact-body ul {
  margin: 8px 0 12px 30px;
}

.artifact-body li {
  margin-bottom: 4px;
}

.artifact-body pre {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #f5f5f5;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 12px 0;
}

.artifact-body code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #f5f5f5;
  padding: 1px 4px;
  border-radius: 2px;
}

.msg-text .artifact-link {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: #7c3aed;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  border: none;
  transition: background 0.15s;
}

.msg-text .artifact-link:hover {
  background: #6d28d9;
}

@media (max-width: 900px) {
  .artifact-panel {
    width: 90vw;
    max-width: none;
  }
  .artifact-body {
    padding: 24px 20px;
  }
}

.reminder-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 9px;
  height: 9px;
  background: #fbbf24;
  border-radius: 50%;
  border: 2px solid #dc2626;
  animation: pulse-dot 2s ease-in-out infinite;
}
.reminder-dot.hidden { display: none; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.reminder-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.reminder-item:last-child { border-bottom: none; }
.reminder-item.completed .reminder-text {
  text-decoration: line-through;
  color: #9ca3af;
}
.reminder-check {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all 0.15s;
  background: #fff;
}
.reminder-check:hover { border-color: #059669; }
.reminder-item.completed .reminder-check {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.reminder-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  word-break: break-word;
}
.reminder-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}
.reminder-delete {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  flex-shrink: 0;
}
.reminder-delete:hover { color: #ef4444; }
.reminders-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 24px 0;
}

/* === Compare Stances === */
.rs-compare-btn {
  background: #6b46c1 !important;
  color: #fff !important;
  border-color: #553c9a !important;
  margin-left: 6px;
  font-weight: 600;
}
.rs-compare-btn:hover { background: #553c9a !important; }

.compare-picker-content {
  max-width: 520px;
  width: 90vw;
}
.compare-picker-body { padding: 8px 4px; }
.compare-picker-intro {
  color: #555;
  font-size: 13px;
  margin: 0 0 16px 0;
  line-height: 1.5;
}
.compare-picker-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.compare-picker-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compare-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.compare-picker-select {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  color: #222;
  cursor: pointer;
}
.compare-picker-note {
  color: #b00;
  font-size: 12px;
  min-height: 16px;
  margin: 4px 0 12px 0;
}
.compare-picker-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.compare-cancel-btn,
.compare-go-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.compare-go-btn {
  background: #6b46c1;
  color: #fff;
  border-color: #553c9a;
  font-weight: 600;
}
.compare-go-btn:hover { background: #553c9a; }
.compare-cancel-btn:hover { background: #f5f5f5; }

.compare-overlay-content {
  width: 96vw;
  height: 92vh;
  max-width: none;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.compare-overlay-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e5e5e5;
  flex: 0 0 auto;
}
.compare-cols {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.compare-col {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid #e5e5e5;
}
.compare-col:last-child { border-right: none; }
.compare-col-header {
  padding: 10px 16px;
  background: #f7f4ff;
  border-bottom: 1px solid #e5e5e5;
  font-weight: 600;
  font-size: 13px;
  color: #4a2f8a;
  flex: 0 0 auto;
}
.compare-col-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #222;
}
.compare-footer {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-top: 1px solid #e5e5e5;
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 10px;
}
.compare-status {
  flex: 1;
  font-size: 12px;
  color: #666;
}
.compare-copy-btn {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid #d0d0d0;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.compare-copy-btn:hover { background: #f0f0f0; }
.compare-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #6b46c1;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}

.audit-lesson-note {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}
.audit-lesson-saved {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}
.audit-lesson-clean {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #4b5563;
}

/* ===================================================================
   CLAUDE THEME OVERRIDE  — warm cream palette, serif greeting,
   rounded input, bubble user messages. Loaded last to win specificity.
   =================================================================== */
:root{
  --c-bg:#faf9f5;
  --c-surface:#ffffff;
  --c-side:#f5f3ee;
  --c-side-hover:#ece9e1;
  --c-border:#e7e3d8;
  --c-border-soft:#efece3;
  --c-text:#3d3d3a;
  --c-text-dim:#6b6a63;
  --c-text-mute:#97948b;
  --c-head:#2a2925;
  --c-accent:#c96442;
  --c-accent-hover:#b5573a;
  --c-bubble:#f0eee6;
}

html, body{
  background:var(--c-bg);
  color:var(--c-text);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

#app{ background:var(--c-bg); }

/* ---- Sidebar ---- */
.sidebar{ background:var(--c-side); border-right:1px solid var(--c-border); }
.sidebar-header{ border-bottom:1px solid var(--c-border); }
.sidebar-header h1{ color:var(--c-head); font-weight:600; }
.accent{ color:var(--c-accent); }
.sidebar-label{ color:var(--c-text-mute); }
.sidebar-item{ color:var(--c-text); border-radius:8px; }
.sidebar-item:hover{ background:var(--c-side-hover); }
.sidebar-item.active{ background:#e6e1d4; color:var(--c-head); font-weight:500; }
.sidebar-footer{ border-top:1px solid var(--c-border); }

/* Uniform, muted Claude-style sidebar buttons (override inline colors) */
.sidebar-btn{
  background:transparent !important;
  color:var(--c-text) !important;
  border:1px solid var(--c-border) !important;
  border-radius:8px;
  font-weight:500;
  justify-content:flex-start;
  gap:8px;
  padding:8px 12px;
}
.sidebar-btn:hover{ background:var(--c-side-hover) !important; border-color:var(--c-text-mute) !important; }
#btn-new-project, #btn-new-session{
  background:var(--c-accent) !important; color:#fff !important; border-color:var(--c-accent) !important;
  justify-content:center;
}
#btn-new-project:hover, #btn-new-session:hover{ background:var(--c-accent-hover) !important; border-color:var(--c-accent-hover) !important; }

.user-bar-name{ color:var(--c-text-dim); }
.user-bar-logout{ color:var(--c-text-mute); }

/* ---- Main / topbar ---- */
.main{ background:var(--c-bg); }
.topbar{ background:var(--c-bg); border-bottom:1px solid var(--c-border-soft); }
.topbar-title{ color:var(--c-head); }
.topbar-project{ color:var(--c-text-dim); }
.topbar-btn{ background:transparent; border:1px solid var(--c-border); color:var(--c-text-dim); border-radius:8px; }
.topbar-btn:hover{ background:var(--c-side-hover); border-color:var(--c-text-mute); }
.topbar-btn-diagnostic{ background:transparent; color:var(--c-text-dim); border-color:var(--c-border); }
.topbar-btn-diagnostic:hover{ background:var(--c-side-hover); color:var(--c-text); border-color:var(--c-text-mute); }

/* ---- Messages ---- */
.messages{ background:var(--c-bg); padding:28px 24px; gap:22px; }
.message{ max-width:740px; }

/* assistant: full width, plain, no avatar */
.message.assistant{ gap:0; }
.message.assistant .msg-avatar{ display:none; }
.message.assistant .msg-role{ color:var(--c-text-mute); font-weight:500; font-size:12px; }

/* user: right-aligned warm bubble, no avatar */
.message.user{ justify-content:flex-end; gap:0; }
.message.user .msg-avatar{ display:none; }
.message.user .msg-role{ display:none; }
.message.user .msg-body{
  flex:0 1 auto;
  max-width:80%;
  background:var(--c-bubble);
  border-radius:18px;
  padding:11px 17px;
}
.message.user .msg-text{ color:var(--c-text); }

.msg-text{ color:var(--c-text); font-size:15.5px; line-height:1.7; }
.msg-copy-btn{ border-color:var(--c-border); color:var(--c-text-mute); }
.msg-copy-btn:hover{ background:var(--c-side-hover); border-color:var(--c-text-mute); color:var(--c-text); }

/* ---- Welcome / greeting ---- */
.welcome{ justify-content:center; }
.welcome-inner{ display:flex; flex-direction:column; align-items:center; gap:14px; }
.welcome-star{ font-size:40px; color:var(--c-accent); line-height:1; }
.welcome h2, #welcome-greeting{
  font-family:'Source Serif 4', Georgia, serif;
  font-weight:400;
  font-size:38px;
  letter-spacing:-0.01em;
  color:var(--c-head);
  margin:0;
}
.welcome p, #welcome-sub{ color:var(--c-text-mute); font-size:15px; max-width:460px; }

/* ---- Input area ---- */
.input-area{ background:var(--c-bg); border-top:none; padding:8px 24px 26px; }
.input-box{
  margin:0 auto;
  max-width:740px;
  background:var(--c-surface);
  border:1px solid var(--c-border);
  border-radius:24px;
  box-shadow:0 2px 8px rgba(60,55,40,0.06);
  padding:10px 14px;
}
.input-box:focus-within{
  border-color:#d8d2c4;
  box-shadow:0 4px 16px rgba(60,55,40,0.10);
}
.chat-textarea{ color:var(--c-text); font-size:16px; }
.chat-textarea::placeholder{ color:var(--c-text-mute); }

.icon-btn{ color:var(--c-text-dim); border-radius:50%; }
.icon-btn:hover{ background:var(--c-side-hover); color:var(--c-text); }
.analyze-btn{ color:var(--c-accent); }
.analyze-btn:hover{ color:var(--c-accent-hover); }

.send-btn{ background:var(--c-accent); border-radius:50%; }
.send-btn:hover{ background:var(--c-accent-hover); }
.send-btn:disabled{ background:#dcc6bd; }
.send-btn.stop-mode{ background:#b5573a; }
.send-btn.stop-mode:hover{ background:#9c4a31; }

.mic-btn{ border:1px solid var(--c-border); background:var(--c-surface); color:var(--c-text-dim); border-radius:50%; }
.mic-btn:hover{ background:var(--c-side-hover); border-color:var(--c-text-mute); }

.paper-btn{ background:transparent; color:var(--c-text-dim); border:1px solid var(--c-border); border-radius:18px; font-weight:500; }
.paper-btn:hover{ background:var(--c-side-hover); color:var(--c-text); }

/* ---- Toolbar pills (model / length / format / stance) ---- */
.response-length-bar{ max-width:740px; margin:0 auto; padding:6px 4px 10px; justify-content:center; }
.rl-label{ color:var(--c-text-mute); }
.rl-divider{ background:var(--c-border); }
.rl-btn, .rf-btn, .rm-btn, .rs-btn{
  background:transparent; border:1px solid var(--c-border); color:var(--c-text-dim); border-radius:14px;
}
.rl-btn:hover, .rf-btn:hover, .rm-btn:hover, .rs-btn:hover{
  background:var(--c-side-hover); border-color:var(--c-text-mute); color:var(--c-text);
}
.rl-btn.active, .rf-btn.active, .rm-btn.active, .rs-btn.active{
  background:var(--c-accent); color:#fff; border-color:var(--c-accent);
}
.rs-compare-btn{ color:var(--c-accent); border-color:var(--c-accent); }
.rs-compare-btn:hover{ background:#f7ece7; color:var(--c-accent-hover); border-color:var(--c-accent-hover); }

/* ---- Login screen warm tint ---- */
.login-screen{ background:linear-gradient(135deg,#f7f4ec 0%, #faf9f5 50%, #f3efe4 100%); }
.login-title{ color:var(--c-head); }
.login-input:focus{ border-color:var(--c-accent); box-shadow:0 0 0 3px rgba(201,100,66,0.12); }
.login-btn{ background:var(--c-accent); }
.login-btn:hover{ background:var(--c-accent-hover); }
.login-btn-alt{ background:transparent; color:var(--c-text); border:1px solid var(--c-border); }
.login-btn-alt:hover{ background:var(--c-side-hover); }
.login-btn-google{ background:#fff; color:#3c4043; border:1px solid #dadce0; }
.login-btn-google:hover{ background:#f7f4ec; border-color:var(--c-border); }
