/* ============================================================
   Evolusco OS — Design System
   Palette : Navy #0E3667 / Powder #C1D7F8 / Orange #F5A623
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  /* Couleurs Evolusco */
  --navy:    #0E3667;
  --navy-80: #2d5494;
  --navy-60: #4e77b8;
  --powder:  #C1D7F8;
  --powder-light: #e8f1fd;
  --orange:  #F5A623;
  --orange-dark: #d4891a;

  /* Neutres */
  --white:   #ffffff;
  --gray-50: #f9fafb;
  --gray-100:#f3f4f6;
  --gray-200:#e5e7eb;
  --gray-300:#d1d5db;
  --gray-400:#9ca3af;
  --gray-500:#6b7280;
  --gray-700:#374151;
  --gray-900:#111827;

  /* Sémantiques */
  --success:    #10b981;
  --success-bg: #d1fae5;
  --warning:    #f59e0b;
  --warning-bg: #fef3c7;
  --error:      #ef4444;
  --error-bg:   #fee2e2;
  --info:       #3b82f6;
  --info-bg:    #dbeafe;

  /* Sidebar */
  --sidebar-w: 260px;
  --sidebar-bg: var(--navy);
  --sidebar-text: rgba(255,255,255,0.85);
  --sidebar-hover: rgba(255,255,255,0.1);
  --sidebar-active: rgba(193,215,248,0.2);

  /* Layout */
  --header-h: 64px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* Typography */
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-title: 'Playfair Display', Georgia, serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }

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

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: var(--white);
  font-weight: 700;
  font-size: 1.1rem;
}
.sidebar-logo img { width: 36px; height: 36px; object-fit: contain; }
.sidebar-logo span.os-badge {
  font-size: 0.6rem;
  background: var(--orange);
  color: var(--white);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
  padding: 8px 16px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--white); }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--white);
  font-weight: 600;
}
/* Filet de sécurité : une icône posée hors d'un contexte dimensionné
   (carte, tableau, texte courant) garde une taille raisonnable et suit la
   taille du texte. Les règles ci-dessous, plus spécifiques, l'emportent. */
.card-body svg,
.table svg,
.alert svg { width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0; }

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }
.nav-item .badge {
  margin-left: auto;
  background: var(--orange);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  margin-bottom: 8px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy-80);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--white);
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.7rem; color: rgba(255,255,255,0.5); }

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

.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.notif-btn {
  position: relative;
  padding: 6px;
  border-radius: 8px;
  color: var(--gray-500);
  transition: background 0.15s, color 0.15s;
}
.notif-btn:hover { background: var(--gray-100); color: var(--navy); }
.notif-btn svg { width: 22px; height: 22px; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--error);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  display: none;
}
.notif-badge.show { display: block; }

.page-content { padding: 24px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
}
.card-body { padding: 20px; }

/* ── KPI Cards ───────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.kpi-value.orange { color: var(--orange); }
.kpi-value.success { color: var(--success); }
.kpi-sub {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}
.kpi-icon {
  float: right;
  width: 40px; height: 40px;
  background: var(--powder-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--navy);
}
.kpi-icon svg { width: 20px; height: 20px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-80); }
.btn-secondary { background: var(--powder-light); color: var(--navy); border: 1px solid var(--powder); }
.btn-secondary:hover { background: var(--powder); }
.btn-orange { background: var(--orange); color: white; }
.btn-orange:hover { background: var(--orange-dark); }
.btn-danger { background: var(--error-bg); color: var(--error); }
.btn-danger:hover { background: var(--error); color: white; }
.btn-ghost { color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-100); color: var(--navy); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-navy    { background: var(--navy); color: white; }
.badge-powder  { background: var(--powder); color: var(--navy); }
.badge-orange  { background: var(--orange); color: white; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error   { background: var(--error-bg); color: var(--error); }
.badge-gray    { background: var(--gray-100); color: var(--gray-700); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(14,54,103,0.1);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.table tr:hover td { background: var(--powder-light); }
.table-striped tr:nth-child(even) td { background: var(--gray-50); }

/* ── Alerts / Flash ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--success-bg); color: #065f46; border-left: 3px solid var(--success); }
.alert-error   { background: var(--error-bg); color: #991b1b; border-left: 3px solid var(--error); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-left: 3px solid var(--warning); }
.alert-info    { background: var(--info-bg); color: #1e40af; border-left: 3px solid var(--info); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.modal-close {
  color: var(--gray-400);
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--navy); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Kanban ──────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 300px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}
.kanban-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kanban-count {
  background: var(--white);
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.task-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card-title { font-size: 0.875rem; font-weight: 600; color: var(--gray-900); margin-bottom: 8px; }
.task-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.task-priority-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-urgent { background: var(--error); }
.priority-high   { background: var(--orange); }
.priority-medium { background: var(--warning); }
.priority-low    { background: var(--success); }
.task-due { font-size: 0.7rem; color: var(--gray-400); }
.task-due.overdue { color: var(--error); font-weight: 600; }

/* ── Stat charts placeholders ────────────────────────────────── */
.chart-wrap { position: relative; height: 220px; }

/* ── Responsive ──────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: all 0.3s;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .kanban-board { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}

/* ── Utilities ───────────────────────────────────────────────── */
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-navy { color: var(--navy); }
.text-gray { color: var(--gray-500); }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.separator { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-80) 60%, var(--powder) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}
.auth-logo img { height: 48px; }
.auth-logo-text { font-size: 1.4rem; font-weight: 800; color: var(--navy); }
.auth-logo-text span { color: var(--orange); }
.auth-title { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; text-align: center; }
.auth-subtitle { font-size: 0.875rem; color: var(--gray-500); text-align: center; margin-bottom: 28px; }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  background: white;
  transition: background 0.15s, box-shadow 0.15s;
  margin-bottom: 20px;
}
.google-btn:hover { background: var(--gray-50); box-shadow: var(--shadow-sm); }
.google-btn img { width: 18px; height: 18px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--gray-400);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--powder);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Drag & drop ─────────────────────────────────────────────── */
.drag-over { outline: 2px dashed var(--navy); background: var(--powder-light) !important; }
