/* ============================================
   NLS HUB — Design System
   ============================================ */

:root {
  /* Brand */
  --p900: #4C1D95;
  --p800: #5B21B6;
  --p700: #6D28D9;
  --p600: #7C3AED;
  --p500: #8B5CF6;
  --p400: #A78BFA;
  --p300: #C4B5FD;
  --p200: #DDD6FE;
  --p100: #EDE9FE;
  --p50:  #F5F3FF;

  /* Grays */
  --g950: #030712;
  --g900: #111827;
  --g800: #1F2937;
  --g700: #374151;
  --g600: #4B5563;
  --g500: #6B7280;
  --g400: #9CA3AF;
  --g300: #D1D5DB;
  --g200: #E5E7EB;
  --g100: #F3F4F6;
  --g50:  #F9FAFB;

  /* Semantic */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  /* Theme (light) */
  --bg: #F4F4F8;
  --surface: #FFFFFF;
  --surface-2: #FAFAFA;
  --sidebar-bg: #FFFFFF;
  --sidebar-border: #F0F0F5;
  --text: #0F0F14;
  --text-2: #4B4B63;
  --text-3: #8888A0;
  --border: #E8E8F0;
  --border-2: #D8D8E8;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 2px 8px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);

  /* Layout */
  --sidebar-w: 252px;
  --topbar-h: 56px;

  /* Radius */
  --r-sm: 6px;
  --r: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  /* Transition */
  --t: 0.18s ease;
  --t-fast: 0.1s ease;
  --t-slow: 0.28s ease;

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.dark {
  --bg: #0C0C14;
  --surface: #14141E;
  --surface-2: #1A1A28;
  --sidebar-bg: #10101A;
  --sidebar-border: #1E1E2E;
  --text: #F0F0FA;
  --text-2: #A0A0B8;
  --text-3: #606078;
  --border: #242430;
  --border-2: #2E2E3E;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.7);
  --success-bg: rgba(16,185,129,.12);
  --warning-bg: rgba(245,158,11,.12);
  --danger-bg: rgba(239,68,68,.12);
  --info-bg: rgba(59,130,246,.12);
  --p50: rgba(139,92,246,.08);
  --p100: rgba(139,92,246,.15);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ============================================
   LAYOUT
   ============================================ */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width var(--t-slow), min-width var(--t-slow);
  z-index: 100;
}

.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

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

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

#page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1rem .75rem;
  min-height: 60px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, var(--p700), var(--p500));
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(109,40,217,.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity var(--t-slow), width var(--t-slow);
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.sidebar-search {
  padding: 0 .75rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--g100);
  border-radius: var(--r-md);
  margin: 0 .75rem .5rem;
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: all var(--t);
}

body.dark .sidebar-search {
  background: var(--surface-2);
}

.sidebar-search:focus-within {
  border-color: var(--p500);
  color: var(--p500);
}

.sidebar-search { padding: .5rem .75rem; }

.sidebar-search input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 0;
}

.sidebar-search input::placeholder { color: var(--text-3); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .25rem .75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: .75rem .5rem .25rem;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .625rem;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  cursor: pointer;
  white-space: nowrap;
  width: 100%;
  position: relative;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--p50);
  color: var(--p600);
}

.nav-item.active {
  background: var(--p100);
  color: var(--p700);
  font-weight: 600;
}

body.dark .nav-item.active { color: var(--p400); }
body.dark .nav-item:hover { color: var(--p400); }

.nav-item svg { min-width: 16px; }

.nav-item span:not(.nav-badge) {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.nav-badge {
  background: var(--p600);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: .75rem .75rem 1rem;
  border-top: 1px solid var(--border);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-item span:not(.nav-badge) {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: .625rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--p600);
  color: white;
}
.btn-primary:hover { background: var(--p700); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(109,40,217,.35); }
.btn-primary:active { transform: translateY(0); }

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

body.dark .btn-secondary { background: var(--surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #DC2626; }

.btn-sm {
  padding: .3rem .625rem;
  font-size: 12px;
  border-radius: var(--r-sm);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ============================================
   FORMS
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .375rem;
  margin-bottom: 1rem;
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-control {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: .5rem .75rem;
  font-size: 14px;
  color: var(--text);
  transition: all var(--t-fast);
  width: 100%;
  outline: none;
}

body.dark .form-control { background: var(--surface-2); }

.form-control:focus {
  border-color: var(--p500);
  box-shadow: 0 0 0 3px rgba(139,92,246,.15);
}

.form-control::placeholder { color: var(--text-3); }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

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

.form-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.purple { background: var(--p100); color: var(--p600); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.blue   { background: var(--info-bg); color: var(--info); }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }

body.dark .stat-icon.purple { background: rgba(139,92,246,.15); }
body.dark .stat-icon.green  { background: rgba(16,185,129,.15); }
body.dark .stat-icon.orange { background: rgba(245,158,11,.15); }
body.dark .stat-icon.blue   { background: rgba(59,130,246,.15); }

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

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: .25rem;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

/* ============================================
   BADGES / PILLS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-purple { background: var(--p100); color: var(--p700); }
.badge-green  { background: var(--success-bg); color: #059669; }
.badge-orange { background: var(--warning-bg); color: #D97706; }
.badge-red    { background: var(--danger-bg); color: #DC2626; }
.badge-blue   { background: var(--info-bg); color: #2563EB; }
.badge-gray   { background: var(--g100); color: var(--g600); }

body.dark .badge-purple { background: rgba(139,92,246,.2); color: var(--p400); }
body.dark .badge-green  { background: rgba(16,185,129,.2); color: #34D399; }
body.dark .badge-orange { background: rgba(245,158,11,.2); color: #FCD34D; }
body.dark .badge-red    { background: rgba(239,68,68,.2); color: #F87171; }
body.dark .badge-blue   { background: rgba(59,130,246,.2); color: #60A5FA; }
body.dark .badge-gray   { background: var(--surface-2); color: var(--text-2); }

/* Priority badges */
.priority-high   { @extend .badge; background: var(--danger-bg); color: #DC2626; }
.priority-medium { @extend .badge; background: var(--warning-bg); color: #D97706; }
.priority-low    { @extend .badge; background: var(--success-bg); color: #059669; }

/* ============================================
   KANBAN
   ============================================ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
  min-height: calc(100vh - 200px);
}

.kanban-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: .75rem;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

body.dark .kanban-col { background: var(--surface-2); }

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .25rem .25rem .5rem;
  margin-bottom: .25rem;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.kanban-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--border);
  color: var(--text-2);
  padding: 1px 7px;
  border-radius: var(--r-full);
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
  min-height: 100px;
}

.kanban-cards.drag-over {
  background: var(--p50);
  border: 2px dashed var(--p300);
  border-radius: var(--r-lg);
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .875rem;
  cursor: grab;
  transition: all var(--t);
  box-shadow: var(--shadow-xs);
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.task-card.dragging {
  opacity: .5;
  cursor: grabbing;
}

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

.task-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.task-actions {
  display: none;
  gap: .25rem;
}

.task-card:hover .task-actions { display: flex; }

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .5rem;
}

.task-due {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .25rem;
}

.task-due.overdue { color: var(--danger); }

.kanban-add {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .625rem;
  border-radius: var(--r-md);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  width: 100%;
  border: none;
  background: none;
}

.kanban-add:hover {
  background: var(--p50);
  color: var(--p600);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

body.dark thead tr { background: var(--surface-2); }

th {
  padding: .625rem 1rem;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

td {
  padding: .75rem 1rem;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--p50); }
body.dark tbody tr:hover { background: rgba(139,92,246,.06); }

.td-actions {
  display: flex;
  gap: .25rem;
  justify-content: flex-end;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn .15s ease;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideUp .2s ease;
}

.modal-box.lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

/* ============================================
   TOAST
   ============================================ */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .75rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 260px;
  animation: slideInRight .2s ease, fadeOut .3s ease 2.5s forwards;
  pointer-events: auto;
}

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

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================
   SEARCH RESULTS
   ============================================ */
.search-results {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  padding: .5rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}

.search-result-item:hover { background: var(--p50); }

.search-result-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  min-width: 60px;
}

.search-result-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--p600), var(--p400));
  transition: width .6s ease;
}

.progress-fill.success { background: linear-gradient(90deg, var(--success), #34D399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #FCD34D); }

/* ============================================
   CALENDAR
   ============================================ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .25rem;
}

.calendar-header-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: .5rem;
}

.calendar-day-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  padding: .25rem;
}

.calendar-cell {
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: .375rem;
  background: var(--surface);
  cursor: pointer;
  transition: all var(--t-fast);
}

.calendar-cell:hover { border-color: var(--p400); background: var(--p50); }

.calendar-cell.today {
  border-color: var(--p500);
  background: var(--p50);
}

.calendar-cell.empty {
  background: var(--bg);
  cursor: default;
}
.calendar-cell.empty:hover { border-color: var(--border); background: var(--bg); }

.calendar-cell-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .25rem;
}

.calendar-cell.today .calendar-cell-num {
  color: var(--p600);
}

.calendar-event {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-btn {
  padding: .5rem .875rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  cursor: pointer;
  background: none;
}

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

.tab-btn.active {
  color: var(--p600);
  border-bottom-color: var(--p600);
  background: none;
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-bar select {
  max-width: 180px;
}

.filter-bar input {
  max-width: 260px;
}

.filter-count {
  font-size: 13px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

/* ============================================
   CARDS GRID
   ============================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.cards-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.125rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.item-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--border-2);
}

.item-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}

.item-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.item-card-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: .125rem;
}

.item-card-actions {
  display: flex;
  gap: .25rem;
  opacity: 0;
  transition: opacity var(--t-fast);
}

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

.item-card-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.item-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: auto;
}

/* ============================================
   KNOWLEDGE BASE
   ============================================ */
.kb-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  height: calc(100vh - 120px);
}

.kb-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

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

.kb-article-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem 1rem;
  cursor: pointer;
  transition: background var(--t-fast);
  border-left: 2px solid transparent;
}

.kb-article-item:hover { background: var(--p50); }
.kb-article-item.active {
  background: var(--p50);
  border-left-color: var(--p500);
  color: var(--p600);
}

.kb-article-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.kb-article-item.active .kb-article-title { color: var(--p600); font-weight: 600; }

.kb-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kb-editor {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.8;
  resize: none;
  outline: none;
  padding: 1.25rem;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
  color: var(--text-3);
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-xl);
  background: var(--p50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--p400);
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
}

.empty-state p {
  font-size: 13px;
  color: var(--text-3);
  max-width: 280px;
}

/* ============================================
   SECTION HEADER
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.section-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: .125rem;
}

/* ============================================
   AVATAR
   ============================================ */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--p600), var(--p400));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1rem;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: .35rem;
  flex-shrink: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.activity-time {
  font-size: 11px;
  color: var(--text-3);
  margin-top: .125rem;
}

/* ============================================
   OBJECTIVES
   ============================================ */
.objective-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.objective-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.objective-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .875rem;
}

.objective-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.objective-period {
  font-size: 11px;
  color: var(--text-3);
  margin-top: .125rem;
}

.objective-values {
  display: flex;
  align-items: baseline;
  gap: .375rem;
  margin-bottom: .625rem;
}

.objective-current {
  font-size: 28px;
  font-weight: 800;
  color: var(--p600);
}

.objective-separator {
  font-size: 16px;
  color: var(--text-3);
}

.objective-target {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
}

.objective-unit {
  font-size: 12px;
  color: var(--text-3);
  margin-left: .25rem;
}

.objective-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: .375rem;
}

/* ============================================
   TECHNIQUE CARDS
   ============================================ */
.technique-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.technique-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.technique-header {
  padding: 1rem 1.125rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.technique-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--p700), var(--p500));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.technique-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.technique-body {
  padding: 1rem 1.125rem;
  display: none;
}

.technique-body.open { display: block; }

.technique-card.tc-expanded {
  grid-column: 1 / -1;
}

.technique-card.tc-expanded .technique-content {
  max-width: 860px;
}

.technique-content {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: .75rem;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  resize: none;
  overflow: hidden;
  outline: none;
  font-family: var(--font);
  line-height: 1.7;
  transition: border-color var(--t-fast);
}

body.dark .technique-content { background: var(--surface-2); }

.technique-content:focus { border-color: var(--p500); }

/* ============================================
   TEMPLATE CARD
   ============================================ */
.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.125rem;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}

.template-card:hover {
  border-color: var(--p400);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.template-preview {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  max-height: 60px;
  overflow: hidden;
  margin: .5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* ============================================
   RESOURCE CARD
   ============================================ */
.resource-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}

.resource-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.resource-favicon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--p100);
  color: var(--p600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  font-weight: 700;
}

body.dark .resource-favicon { background: rgba(139,92,246,.15); }

/* ============================================
   UTILITY CLASSES
   ============================================ */
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

.fade-in { animation: fadeIn .2s ease; }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .kanban-board { grid-template-columns: 1fr; }
  .kb-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================
   SOCIAL / CALENDAR RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  /* Onglets réseau : scroll horizontal */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; }

  /* Calendrier compact */
  .calendar-cell {
    min-height: 46px;
    padding: .2rem .25rem;
  }

  .calendar-cell-num {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .calendar-day-label {
    font-size: 9px;
    padding: .2rem 0;
  }

  /* Événements → points colorés sur mobile */
  .calendar-event {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    padding: 0;
    font-size: 0;
    display: inline-block;
    margin: 1px;
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: unset;
    white-space: unset;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: left var(--t-slow);
  }

  #sidebar.open { left: 0; }

  .content { padding: 1rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Filter bar */
  .filter-bar {
    gap: .5rem;
  }
  .filter-bar input,
  .filter-bar select {
    max-width: 100%;
    flex: 1 1 130px;
    min-width: 0;
  }
  .filter-count {
    margin-left: 0;
    width: 100%;
    text-align: right;
  }

  /* Table → Cards */
  .table-wrapper {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .table-wrapper table { display: block; }
  .table-wrapper thead { display: none; }

  .table-wrapper tbody {
    display: flex;
    flex-direction: column;
    gap: .625rem;
  }

  .table-wrapper tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: .75rem 1rem;
    box-shadow: var(--shadow-sm);
  }

  .table-wrapper td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .3rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    text-align: right;
    min-height: 30px;
  }

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

  .table-wrapper td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: left;
  }

  /* Contact cell: acts as card title, no label */
  .table-wrapper td:first-child {
    justify-content: flex-start;
    padding-bottom: .625rem;
    margin-bottom: .125rem;
  }
  .table-wrapper td:first-child::before { display: none; }

  /* Actions cell: no label */
  .table-wrapper td:last-child::before { display: none; }
  .table-wrapper td:last-child .td-actions { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================
   SOCIAL NETWORK COLORS
   ============================================ */
.network-linkedin  { background: #0A66C2; color: white; }
.network-facebook  { background: #1877F2; color: white; }
.network-instagram { background: linear-gradient(135deg, #833AB4, #FD1D1D, #FCB045); color: white; }
.network-x         { background: #000000; color: white; }
.network-tiktok    { background: #000000; color: white; }

/* View toggle (list/grid) */
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.view-toggle button {
  padding: .375rem .625rem;
  color: var(--text-3);
  transition: all var(--t-fast);
}

.view-toggle button.active {
  background: var(--p600);
  color: white;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-intro {
  margin-bottom: 1.5rem;
}

.page-intro h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .25rem;
}

.page-intro p {
  font-size: 14px;
  color: var(--text-3);
}

/* ============================================
   COPY BUTTON
   ============================================ */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .375rem .75rem;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-fast);
}

.copy-btn:hover { background: var(--p50); color: var(--p600); border-color: var(--p300); }

/* initiales section */
.kb-cat-label {
  padding: .5rem 1rem .25rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
}

/* Prospects status colors map */
.status-tocontact { @extend .badge; background: var(--info-bg); color: #2563EB; }
.status-contacted { @extend .badge; background: var(--warning-bg); color: #D97706; }
.status-relaunched{ @extend .badge; background: var(--p100); color: var(--p700); }
.status-converted { @extend .badge; background: var(--success-bg); color: #059669; }
