/* ============================================================
   NerdCode-Net Client Portal
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #252547;
  --sidebar-active: #30305a;
  --sidebar-text: #a0a0c0;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 240px;

  --bg-primary: #f5f6fa;
  --bg-white: #ffffff;
  --bg-hover: #f0f1f5;

  --text-primary: #1a1a2e;
  --text-secondary: #5a5a7a;
  --text-muted: #8a8aa0;

  --accent: #4f6ef7;
  --accent-hover: #3b5bdf;
  --accent-light: #eef1fe;

  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  --border: #e2e4ea;
  --border-light: #f0f1f5;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);

  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo,
    Monaco, Consolas, "Liberation Mono", monospace;

  --header-height: 56px;
  --transition: 150ms ease;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-stack);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* --- Auth Layout --- */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d5e 100%);
  padding: 1rem;
}

.auth-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2rem 2rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.auth-logo .logo-accent {
  color: var(--accent);
}

.auth-logo .logo-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.auth-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-primary);
  border-color: var(--border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 0.45rem;
  border-radius: var(--radius);
}

/* --- App Shell --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand .logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.sidebar-brand .logo-accent {
  color: var(--accent);
}

.sidebar-brand .logo-sub {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  margin-top: 0.15rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.75rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.25);
  padding: 1rem 0.5rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 0.88rem;
  font-weight: 450;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  text-decoration: none;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: var(--radius);
}

.sidebar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-email {
  color: var(--sidebar-text);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 0.35rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-logout:hover {
  background: var(--sidebar-hover);
  color: var(--error);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* --- Header --- */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1.5rem;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.content-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 0.35rem;
  cursor: pointer;
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

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

/* --- Content Area --- */
.content-body {
  padding: 1.5rem;
}

/* --- Cards --- */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  border-color: var(--accent);
}

/* --- Project Cards --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.project-card {
  padding: 1.25rem;
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.project-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.project-card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-intake {
  background: var(--info-bg);
  color: var(--info);
}

.badge-building {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-review {
  background: #f5f3ff;
  color: #7c3aed;
}

.badge-delivered {
  background: var(--success-bg);
  color: var(--success);
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
}

.badge-inactive {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Project Detail --- */
.project-detail {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
}

.project-status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}

.project-status-bar h2 {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.project-detail-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.project-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-sidebar {
  width: 280px;
  border-left: 1px solid var(--border);
  background: var(--bg-white);
  overflow-y: auto;
  flex-shrink: 0;
}

.project-sidebar-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.project-sidebar-section h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.deliverable-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.deliverable-item + .deliverable-item {
  border-top: 1px solid var(--border-light);
}

.deliverable-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.deliverable-icon svg {
  width: 16px;
  height: 16px;
}

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

.deliverable-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deliverable-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Chat --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.6rem;
  max-width: 75%;
}

.chat-message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message-assistant {
  align-self: flex-start;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-message-user .chat-avatar {
  background: var(--accent);
  color: #fff;
}

.chat-message-assistant .chat-avatar {
  background: var(--sidebar-bg);
  color: #fff;
}

.chat-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-message-user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-bubble {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  padding: 0 0.25rem;
}

.chat-message-user .chat-time {
  text-align: right;
}

.chat-input-area {
  padding: 0.75rem 1.25rem 1rem;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
  outline: none;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color var(--transition);
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}

.chat-send-btn:hover {
  background: var(--accent-hover);
}

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

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.chat-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.chat-empty p {
  font-size: 0.9rem;
}

/* --- Files & Links Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.file-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon svg {
  width: 16px;
  height: 16px;
}

.link-url {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  border-color: var(--success);
  color: var(--success);
}

/* --- Empty States --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 1.25rem;
}

/* --- Loading --- */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading-spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Toast Notifications --- */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  max-width: 380px;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--error);
}

.toast-info {
  border-left: 3px solid var(--info);
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-info .toast-icon { color: var(--info); }

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem;
  flex-shrink: 0;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-out {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(1rem);
  }
}

/* --- Back button --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.back-link svg {
  width: 16px;
  height: 16px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .content-body {
    padding: 1rem;
  }

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

  .project-detail-body {
    flex-direction: column;
  }

  .project-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 200px;
  }

  .chat-message {
    max-width: 88%;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  .link-url {
    max-width: 160px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 1.75rem 1.25rem 1.5rem;
  }

  .project-status-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* --- Upload Zone --- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 0.75rem;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-zone.drag-over {
  border-style: solid;
}

.upload-zone-icon {
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.upload-zone-icon svg {
  width: 28px;
  height: 28px;
}

.upload-zone:hover .upload-zone-icon,
.upload-zone.drag-over .upload-zone-icon {
  color: var(--accent);
}

.upload-zone-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.upload-zone-text strong {
  color: var(--accent);
}

.upload-zone-limit {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  opacity: 0.7;
}

.upload-progress {
  margin-bottom: 0.75rem;
}

.upload-progress-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.8rem;
}

.upload-progress-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.upload-progress-bar {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.upload-progress-pct {
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 2.5rem;
  text-align: right;
  flex-shrink: 0;
}

.upload-progress-done {
  color: var(--success);
}

.uploaded-file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
}

.uploaded-file-item + .uploaded-file-item {
  border-top: 1px solid var(--border-light);
}

.uploaded-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.uploaded-file-icon svg {
  width: 14px;
  height: 14px;
}

.uploaded-file-icon-img {
  background: #fef3c7;
  color: #d97706;
}

.uploaded-file-icon-doc {
  background: #dbeafe;
  color: #2563eb;
}

.uploaded-file-icon-code {
  background: #f0fdf4;
  color: #16a34a;
}

.uploaded-file-icon-default {
  background: var(--accent-light);
  color: var(--accent);
}

.uploaded-file-info {
  flex: 1;
  min-width: 0;
}

.uploaded-file-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uploaded-file-size {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* --- Secrets Vault --- */
.secret-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
}

.secret-item + .secret-item {
  border-top: 1px solid var(--border-light);
}

.secret-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fef3c7;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.secret-icon svg {
  width: 14px;
  height: 14px;
}

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

.secret-name {
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secret-delete-btn {
  color: var(--text-muted);
  flex-shrink: 0;
}

.secret-delete-btn:hover {
  color: var(--error);
}

.secret-delete-btn svg {
  width: 14px;
  height: 14px;
}

.project-sidebar-section h3 svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 0.15rem;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-header h3 svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border-light);
}

.modal-footer .btn svg {
  width: 14px;
  height: 14px;
}

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

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 0.82rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-switch a {
  font-weight: 500;
}

.form-error {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* --- Intake Page (unguarded) --- */
.intake-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f6fa 0%, #eef1fe 100%);
  padding: 2rem;
}

.intake-container {
  width: 100%;
  max-width: 520px;
}

.intake-header {
  text-align: center;
  margin-bottom: 2rem;
}

.intake-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.intake-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
}

.intake-form {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.intake-form-row { margin-bottom: 1rem; }

.intake-form-row-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.intake-form .optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

.intake-start-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-size: 1rem;
}

.intake-login-link {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.intake-login-link a { font-weight: 500; }

/* --- Intake Chat --- */
.intake-chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-primary);
}

.intake-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.intake-chat-brand strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.intake-chat-industry {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 0.75rem;
}

.intake-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.intake-chat-welcome {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.intake-msg {
  display: flex;
  gap: 0.6rem;
  max-width: 85%;
  animation: fadeIn 0.2s ease;
}

.intake-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.intake-msg-assistant { align-self: flex-start; }

.intake-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.intake-msg-user .intake-avatar {
  background: var(--accent-light);
  color: var(--accent);
}

.intake-msg-assistant .intake-avatar {
  background: #e8f5e9;
  color: #2e7d32;
}

.intake-bubble {
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.intake-msg-user .intake-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.intake-msg-assistant .intake-bubble {
  background: var(--bg-white);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.intake-typing .intake-bubble {
  color: var(--text-muted);
  font-style: italic;
}

.intake-chat-input-area {
  padding: 0.75rem 1.25rem;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.intake-chat-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.intake-chat-textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}

.intake-chat-textarea:focus { border-color: var(--accent); }

.intake-send-btn { flex-shrink: 0; padding: 0.6rem 1.25rem; }

.intake-chat-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-align: center;
}

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