/* ── BASE ────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; }

/* ── SIDEBAR ─────────────────────────────────────────────────────── */
.sidebar-desktop {
  display: none;
}
@media (min-width: 768px) {
  .sidebar-desktop { display: flex; }
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #94A3B8;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  min-height: 40px;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: #E2E8F0; }
.nav-link.active { background: #3B82F6; color: #fff; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-section-label {
  padding: 0.75rem 0.5rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

/* ── BOTTOM TAB BAR ──────────────────────────────────────────────── */
#bottom-bar { display: none; }
@media (max-width: 767px) {
  #bottom-bar { display: flex; }
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  font-size: 0.65rem;
  font-weight: 500;
  color: #64748B;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  min-height: 56px;
  transition: color 0.15s;
}
.bottom-tab.active { color: #3B82F6; }
.bottom-tab:hover { color: #3B82F6; }

/* ── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  padding: 20px;
}
.stat-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 20px;
  min-height: 100px;
}

/* ── STATUS BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-gray    { background: #F1F5F9; color: #475569; }
.badge-blue    { background: #DBEAFE; color: #1D4ED8; }
.badge-cyan    { background: #CFFAFE; color: #0E7490; }
.badge-indigo  { background: #E0E7FF; color: #4338CA; }
.badge-purple  { background: #F3E8FF; color: #7C3AED; }
.badge-red     { background: #FEE2E2; color: #DC2626; }
.badge-amber   { background: #FEF3C7; color: #D97706; }
.badge-green   { background: #DCFCE7; color: #16A34A; }
.badge-emerald { background: #D1FAE5; color: #059669; }
.badge-orange  { background: #FFEDD5; color: #EA580C; }

/* ── PRIORITY DOTS ────────────────────────────────────────────────── */
.priority-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-dot-high   { background: #EF4444; }
.priority-dot-medium { background: #EAB308; }
.priority-dot-low    { background: #22C55E; }

/* ── TABLES ──────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  padding: 8px 12px;
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { color: #1E293B; }
.data-table td {
  padding: 10px 12px;
  font-size: 0.8125rem;
  color: #374151;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #F8FAFC; }
.data-table tr { cursor: pointer; }

/* ── FORMS ───────────────────────────────────────────────────────── */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #1E293B;
  background: white;
  font-family: 'Inter', system-ui, sans-serif;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 36px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}
.form-group { margin-bottom: 16px; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  min-height: 36px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: #3B82F6; color: white; }
.btn-primary:hover { background: #2563EB; }
.btn-secondary { background: #F1F5F9; color: #374151; border: 1px solid #E2E8F0; }
.btn-secondary:hover { background: #E2E8F0; }
.btn-danger { background: #FEE2E2; color: #DC2626; }
.btn-danger:hover { background: #FECACA; }
.btn-ghost { background: transparent; color: #64748B; }
.btn-ghost:hover { background: #F1F5F9; color: #1E293B; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; min-height: 30px; }
.btn-lg { padding: 10px 20px; font-size: 0.875rem; }

/* ── MODAL ───────────────────────────────────────────────────────── */
#modal-overlay { transition: opacity 0.2s; }
#modal-container { animation: slideUp 0.25s ease; }
@media (min-width: 768px) {
  #modal-container { animation: fadeScale 0.2s ease; }
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes fadeScale {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  border-bottom: 1px solid #F1F5F9;
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.modal-title { font-size: 1rem; font-weight: 700; color: #0F172A; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #F1F5F9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #64748B;
  flex-shrink: 0;
}
.modal-close:hover { background: #E2E8F0; }
.modal-body { padding: 0 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid #F1F5F9;
  margin-top: 20px;
}

/* ── TOASTS ──────────────────────────────────────────────────────── */
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  max-width: 320px;
}
.toast-success { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.toast-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.toast-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── SKELETON LOADERS ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── INTERACTION LOG ─────────────────────────────────────────────── */
.interaction-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F1F5F9;
}
.interaction-item:last-child { border-bottom: none; }
.interaction-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* ── CONTACT CARDS ────────────────────────────────────────────────── */
.contact-card {
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 12px 16px;
  background: white;
}

/* ── TASK ITEMS ──────────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F8FAFC;
}
.task-checkbox {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 2px solid #CBD5E1;
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.task-checkbox:checked {
  background: #22C55E;
  border-color: #22C55E;
}
.task-checkbox:checked::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: bold;
}

/* ── FILTER BAR ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 0;
}
.filter-select {
  padding: 6px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  background: white;
  cursor: pointer;
  min-height: 36px;
}
.filter-select:focus { outline: none; border-color: #3B82F6; }

/* ── DETAIL PAGE ─────────────────────────────────────────────────── */
.detail-header {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}
.quick-edit-strip {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .quick-edit-strip { grid-template-columns: repeat(4, 1fr); }
}
.quick-edit-field label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

/* ── IMPORT WIZARD ───────────────────────────────────────────────── */
.import-step { display: none; }
.import-step.active { display: block; }
.step-indicator {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}
.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #CBD5E1;
  transition: background 0.2s;
}
.step-dot.active { background: #3B82F6; width: 24px; border-radius: 4px; }
.step-dot.done   { background: #22C55E; }
.dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: #3B82F6;
  background: #EFF6FF;
}

/* ── INLINE EDIT ──────────────────────────────────────────────────── */
.inline-edit {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 6px;
  transition: border-color 0.15s;
}
.inline-edit:hover { border-color: #CBD5E1; background: #F8FAFC; }
.inline-edit:focus { outline: none; border-color: #3B82F6; background: white; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* ── RECENTLY VIEWED ─────────────────────────────────────────────── */
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  font-size: 0.75rem;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.recent-chip:hover { border-color: #3B82F6; color: #3B82F6; }

/* ── DUPLICATE WARNING ───────────────────────────────────────────── */
.dup-warning {
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: #92400E;
  margin-top: 8px;
}

/* ── EMPTY STATE ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #94A3B8;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: #64748B; margin-bottom: 4px; }
.empty-state p  { font-size: 0.875rem; margin-bottom: 16px; }

/* ── PROGRESS BAR ─────────────────────────────────────────────────── */
.progress-bar-track {
  height: 6px;
  background: #E2E8F0;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: #3B82F6;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ── RESEARCH LINKS ──────────────────────────────────────────────── */
.research-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  text-decoration: none;
  color: #1E293B;
  font-size: 0.8125rem;
  font-weight: 500;
  background: #F8FAFC;
  transition: border-color 0.15s, background 0.15s;
}
.research-link:hover { border-color: #3B82F6; background: #EFF6FF; color: #1D4ED8; }
.research-link .link-icon { font-size: 1.2rem; }

/* ── MISC ────────────────────────────────────────────────────────── */
.page-title { font-size: 1.5rem; font-weight: 700; color: #0F172A; margin-bottom: 4px; }
.section-header { font-size: 0.9375rem; font-weight: 600; color: #374151; margin-bottom: 12px; }
.text-muted { color: #94A3B8; font-size: 0.8125rem; }
.link-text { color: #3B82F6; text-decoration: none; font-weight: 500; }
.link-text:hover { text-decoration: underline; }
.divider { height: 1px; background: #F1F5F9; margin: 16px 0; }

.auth-tab { transition: color 0.15s, border-color 0.15s; }
.truncate-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Saved indicator */
.saved-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #16A34A;
  animation: fadeOut 2s forwards;
}
@keyframes fadeOut {
  0%  { opacity: 1; }
  70% { opacity: 1; }
  100%{ opacity: 0; }
}

/* Search highlight */
.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: #E2E8F0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.search-result-item:hover { background: rgba(255,255,255,0.08); }
.search-result-item:last-child { border-bottom: none; }
.search-type-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(59,130,246,0.2);
  color: #93C5FD;
}

/* Auth tabs */
.auth-tab.active { color: #3B82F6; border-bottom-color: #3B82F6; }
