/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  line-height: 1.5;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
  min-height: 44px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: var(--text-inverse);
  border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border-color: var(--blue);
}
.btn-secondary:hover { background: var(--blue-bg); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--surface-alt); border-color: var(--text-muted); }

.btn-ghost {
  background: transparent;
  color: var(--blue);
  border-color: transparent;
  padding: var(--space-2) var(--space-3);
}
.btn-ghost:hover { background: var(--blue-bg); }

.btn-danger {
  background: var(--red);
  color: var(--text-inverse);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn-success {
  background: var(--green);
  color: var(--text-inverse);
  border-color: var(--green);
}
.btn-success:hover { background: var(--green-dark); border-color: var(--green-dark); }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); min-height: 32px; }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); min-height: 52px; }
.btn-icon { padding: var(--space-2); min-height: auto; border-radius: var(--radius-md); }
.btn-icon:hover { background: var(--surface-hover); }

.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-body { padding: var(--space-4); }
.card-header { padding: var(--space-4); border-bottom: 1px solid var(--border-light); }
.card-footer { padding: var(--space-4); border-top: 1px solid var(--border-light); }
.card-img { width: 100%; height: 200px; object-fit: cover; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1.5;
}

.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-green { background: var(--green-bg); color: var(--green-dark); }
.badge-red { background: var(--red-bg); color: var(--red-dark); }
.badge-yellow { background: var(--yellow-bg); color: #92400E; }
.badge-orange { background: var(--orange-bg); color: #9A3412; }
.badge-cyan { background: var(--cyan-bg); color: var(--cyan-dark); }
.badge-gray { background: var(--surface-hover); color: var(--text-secondary); }
.badge-navy { background: var(--navy); color: var(--text-inverse); }

/* DPE Badges */
.dpe-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  color: white;
}
.dpe-a { background: var(--dpe-a); }
.dpe-b { background: var(--dpe-b); }
.dpe-c { background: var(--dpe-c); color: var(--text); }
.dpe-d { background: var(--dpe-d); color: var(--text); }
.dpe-e { background: var(--dpe-e); }
.dpe-f { background: var(--dpe-f); }
.dpe-g { background: var(--dpe-g); }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text);
  margin-bottom: var(--space-1);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: 44px;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-input.error { border-color: var(--red); }
.form-input.success { border-color: var(--green); }

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--red);
  margin-top: var(--space-1);
}

textarea.form-input {
  min-height: 120px;
  resize: vertical;
}

input[type="date"].form-input,
input[type="time"].form-input {
  cursor: pointer;
  -webkit-appearance: none;
  position: relative;
  min-height: 44px;
}

/* Make entire date/time field clickable — expand the native picker icon hit area */
input[type="date"].form-input::-webkit-calendar-picker-indicator,
input[type="time"].form-input::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

input[type="time"].form-input {
  /* Browser uses system locale for 24h — we rely on fr-FR system setting */
}

.form-select {
  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='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-10);
}

.form-checkbox, .form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
}

.form-checkbox input, .form-radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

/* File Upload Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--blue);
  background: var(--blue-bg);
}

/* Password Strength */
.password-strength {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.password-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: background var(--transition-fast);
}

.password-strength-bar.active.weak { background: var(--red); }
.password-strength-bar.active.medium { background: var(--yellow); }
.password-strength-bar.active.strong { background: var(--green); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 400px; }

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

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }

.modal-body { padding: var(--space-6); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
}

.toast-success { border-left: 4px solid var(--green); }
.toast-error { border-left: 4px solid var(--red); }
.toast-warning { border-left: 4px solid var(--yellow); }
.toast-info { border-left: 4px solid var(--blue); }

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; }
.toast-message { flex: 1; font-size: var(--text-sm); }
.toast-close {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-1);
}
.toast-close:hover { color: var(--text); }

/* ===== TABS ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  gap: 0;
  overflow-x: auto;
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-nav {
  display: flex;
  gap: var(--space-1);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tab-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}
.tab-btn:hover { color: var(--blue); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-panel { display: none; padding: var(--space-6) 0; }
.tab-panel.active { display: block; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.progress-fill.green { background: var(--green); }

/* ===== STEPPER ===== */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  flex-shrink: 0;
}

.step.active .step-number { background: var(--blue); color: var(--text-inverse); border-color: var(--blue); }
.step.completed .step-number { background: var(--green); color: var(--text-inverse); border-color: var(--green); }

.step-label { font-size: var(--text-sm); color: var(--text-muted); }
.step.active .step-label { color: var(--blue); font-weight: var(--font-medium); }
.step.completed .step-label { color: var(--green-dark); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 var(--space-2);
}
.step.completed + .step-line, .step.completed .step-line { background: var(--green); }

/* ===== TABLE ===== */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

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

.table th {
  background: var(--surface-alt);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-alt); }

.table-actions {
  display: flex;
  gap: var(--space-1);
}

/* ===== KPI CARD ===== */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.kpi-card:has(.kpi-icon) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

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

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }

/* ===== KANBAN ===== */
.kanban-board {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
  min-height: 400px;
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2);
  margin-bottom: var(--space-3);
}

.kanban-column-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.kanban-column-count {
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 100px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: grab;
  transition: box-shadow var(--transition-fast);
}

.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card.sortable-ghost { opacity: 0.4; }
.kanban-card.sortable-chosen { box-shadow: var(--shadow-lg); }

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text-inverse);
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-lg); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--text-2xl); }

.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-4);
  color: var(--text-muted);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

/* ===== CHIP/TAG ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--surface-hover);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.chip:hover { background: var(--surface-active); }
.chip.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }

.chip-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  margin-left: var(--space-1);
}
.chip-remove:hover { background: rgba(0,0,0,0.1); }

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  width: 100%;
}

.search-bar-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--surface);
  transition: all var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

/* ===== NOTIFICATION DOT ===== */
.notification-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: var(--radius-full);
  border: 2px solid var(--surface);
}

/* ===== DIVIDER ===== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

/* ===== TOOLTIP ===== */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--text-inverse);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
}

.tooltip-wrapper:hover .tooltip { opacity: 1; }
