@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Variables ─────────────────────────────────────── */
:root {
  --bg-base:    #0d0f14;
  --bg-card:    #13161f;
  --bg-surface: #1a1e2a;
  --bg-hover:   #222638;
  --border:     #2a2f45;
  --border-light: #353c58;

  --accent:       #6366f1;
  --accent-light: #818cf8;
  --accent-dim:   rgba(99, 102, 241, 0.15);
  --accent-glow:  rgba(99, 102, 241, 0.3);

  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #06b6d4;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --sidebar-w: 240px;
  --header-h:  60px;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* ─── Light Theme ────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:    #f1f3f9;
  --bg-card:    #ffffff;
  --bg-surface: #f7f8fc;
  --bg-hover:   #eceef7;
  --border:     #dde1f0;
  --border-light: #c9ceea;

  --text-primary:   #1a1e35;
  --text-secondary: #4a5280;
  --text-muted:     #8890b5;

  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] .badge-new-lead            { background: #dbeafe; color: #1d4ed8; }
[data-theme="light"] .badge-need-to-contact     { background: #fef3c7; color: #b45309; }
[data-theme="light"] .badge-contacted           { background: #cffafe; color: #0e7490; }
[data-theme="light"] .badge-meeting-completed   { background: #ede9fe; color: #7c3aed; }
[data-theme="light"] .badge-waiting-feedback    { background: #ffedd5; color: #c2410c; }
[data-theme="light"] .badge-negotiation         { background: #fce7f3; color: #be185d; }
[data-theme="light"] .badge-onboarded           { background: #dcfce7; color: #16a34a; }
[data-theme="light"] .badge-not-interested      { background: #f3f4f6; color: #6b7280; }
[data-theme="light"] .badge-client              { background: #ede9fe; color: #7c3aed; }
[data-theme="light"] .badge-competitor          { background: #cffafe; color: #0e7490; }

[data-theme="light"] .role-badge                { background: #f1f3f9; color: #4a5280; border-color: #dde1f0; }
[data-theme="light"] .role-badge.owner          { background: #ede9fe; color: #7c3aed; border-color: rgba(124,58,237,0.25); }

/* ─── Theme Toggle Button ─────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 8px;
}
.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.theme-toggle-icon { font-size: 14px; }

/* ─── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .brand-icon {
  width: 34px; height: 34px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-light);
  font-size: 16px;
}
.sidebar-brand .brand-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid var(--accent-glow);
}
.nav-item .nav-icon {
  width: 18px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.user-card:hover { background: var(--bg-hover); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.logout-btn {
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.logout-btn:hover { color: var(--danger); }

/* Main content area */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top header */
.top-header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Page content */
.page-content {
  padding: 28px 28px;
  flex: 1;
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }

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

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.25); }

/* ─── Cards ─────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Stats ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: rgba(99,102,241,0.15); color: #818cf8; }
.stat-icon.green  { background: rgba(16,185,129,0.15); color: #34d399; }
.stat-icon.amber  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.stat-icon.cyan   { background: rgba(6,182,212,0.15);  color: #22d3ee; }

.stat-content { flex: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Forms ─────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-label span.req { color: var(--danger); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input:disabled, .form-select:disabled, .form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-textarea { resize: vertical; min-height: 90px; }

/* ─── Tables ─────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
}
.td-muted { color: var(--text-secondary); font-size: 12.5px; }

/* ─── Status Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-new-lead            { background: #1e3267; color: #93c5fd; }
.badge-need-to-contact     { background: #3d2308; color: #fcd34d; }
.badge-contacted           { background: #083344; color: #67e8f9; }
.badge-meeting-completed   { background: #2e1065; color: #c4b5fd; }
.badge-waiting-feedback    { background: #431407; color: #fdba74; }
.badge-negotiation         { background: #500724; color: #f9a8d4; }
.badge-onboarded           { background: #052e16; color: #86efac; }
.badge-not-interested      { background: #1c2030; color: #6b7280; }
.badge-client              { background: var(--accent-dim); color: var(--accent-light); }
.badge-competitor          { background: rgba(6,182,212,0.12); color: #67e8f9; }

/* Role badges */
.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.role-badge.owner { background: rgba(99,102,241,0.12); color: var(--accent-light); border-color: var(--accent-glow); }

/* ─── Search Bar ─────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.search-input-wrap input {
  padding-left: 34px;
}

/* ─── Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow);
}
.modal-lg { max-width: 680px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none;
  color: var(--text-muted);
  font-size: 20px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── Divider ─────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ─── Activity Feed ─────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-dot.green { background: var(--success); }
.activity-dot.amber { background: var(--warning); }
.activity-dot.cyan  { background: var(--info); }
.activity-content { flex: 1; }
.activity-desc {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}
.activity-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─── Status Distribution Bar ─────────────────────────── */
.status-dist { display: flex; flex-direction: column; gap: 10px; }
.status-row { display: flex; align-items: center; gap: 12px; }
.status-row-label { width: 160px; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-bar-wrap { flex: 1; height: 8px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; }
.status-bar { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.status-row-count { width: 30px; text-align: right; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

/* ─── Contacts List ─────────────────────────────────── */
.contacts-grid { display: flex; flex-direction: column; gap: 10px; }
.contact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.contact-card.primary-contact {
  border-color: var(--accent-glow);
  background: var(--accent-dim);
}
.contact-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.contact-details { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.contact-detail { display: flex; align-items: center; gap: 4px; }
.contact-actions { display: flex; gap: 4px; }

/* ─── Contact cell (list table) ────────────────────────── */
.cc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cc-info {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cc-line {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.cc-more {
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent-light);
}

/* ─── Contact Entry (modal form) ───────────────────────── */
.contact-entry {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.contact-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.contact-entry-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .contact-entry-fields { grid-template-columns: 1fr; }
}

/* ─── Empty State ─────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}
.empty-icon { font-size: 40px; opacity: 0.4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.empty-sub { font-size: 13px; color: var(--text-muted); max-width: 300px; }

/* ─── Pagination ─────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.pagination-btns { display: flex; gap: 4px; }

/* ─── Toast ─────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  color: var(--text-primary);
  animation: slideLeft 0.25s ease;
  min-width: 260px;
  max-width: 380px;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast-icon { font-size: 16px; flex-shrink: 0; }

/* ─── Login Page ─────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.08) 0%, transparent 60%);
  padding: 24px;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 52px; height: 52px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 4px;
}
.login-logo h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.login-logo p  { font-size: 13px; color: var(--text-muted); text-align: center; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .form-group { gap: 8px; }
.login-form .btn { margin-top: 4px; }
.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  display: none;
}
.login-error.show { display: block; }

/* ─── Loading Spinner ─────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.page-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
.page-spinner .spinner {
  width: 32px; height: 32px;
  border-color: var(--border);
  border-top-color: var(--accent);
  border-width: 3px;
}

/* ─── Section Headings ─────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* ─── Link style text ─────────────────────────────────── */
.text-accent { color: var(--accent-light); }
.text-muted  { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

/* ─── Dashboard clock banner ────────────────────────── */
.clock-banner {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99,102,241,0.06) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.clock-greeting {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.clock-subdate {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
}
.clock-time {
  font-size: 38px;
  font-weight: 700;
  color: var(--accent-light);
  font-family: ui-monospace, 'SF Mono', monospace;
  letter-spacing: 4px;
  text-shadow: 0 0 24px rgba(129,140,248,0.25);
}
@media (max-width: 640px) {
  .clock-banner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .clock-time { font-size: 28px; letter-spacing: 2px; }
}

/* ─── Dashboard 2-column grid ────────────────────────── */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
}

/* ─── Donut chart ────────────────────────────────────── */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.donut-svg-wrap {
  position: relative;
  flex-shrink: 0;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-center-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.donut-center-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.donut-legend {
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.donut-legend-item:last-child { border-bottom: none; }
.donut-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}
.donut-legend-name {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.donut-legend-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.donut-legend-pct {
  font-size: 11.5px;
  color: var(--text-muted);
  width: 36px;
  text-align: right;
}

/* ─── Dashboard 3-column grid ────────────────────────── */
.dash-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .dash-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .dash-grid-3 { grid-template-columns: 1fr; }
}

/* ─── Recent items list ──────────────────────────────── */
.recent-list { display: flex; flex-direction: column; overflow-y: auto; max-height: 320px; }
.recent-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: color 0.12s;
}
.recent-list .recent-item:last-child { border-bottom: none; }
.recent-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.recent-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.recent-item:hover .recent-item-name { color: var(--accent-light); }
.recent-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─── Country distribution ───────────────────────────── */
.country-dist { display: flex; flex-direction: column; gap: 12px; }
.country-row { display: flex; align-items: center; gap: 10px; }
.country-flag { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.country-label { font-size: 12.5px; color: var(--text-secondary); width: 82px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-bar-wrap { flex: 1; height: 7px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; }
.country-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.6s ease; }
.country-count { font-size: 12.5px; color: var(--text-muted); font-weight: 600; width: 26px; text-align: right; flex-shrink: 0; }

/* ─── Top contributors ───────────────────────────────── */
.contributor-list { display: flex; flex-direction: column; gap: 12px; }
.contributor-row { display: flex; align-items: center; gap: 10px; }
.contributor-rank { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.contributor-name { font-size: 13px; color: var(--text-primary); font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contributor-count { font-size: 11.5px; color: var(--text-muted); background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 2px 9px; white-space: nowrap; }

/* ─── Detail page two-column layout ─────────────────── */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 960px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideLeft { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none;
  color: var(--text-secondary);
  font-size: 20px;
  padding: 6px;
  border-radius: 6px;
}
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; align-items: center; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ─── Misc Utilities ─────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-mono { font-family: ui-monospace, monospace; }
