:root { color-scheme: light; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f6f8;
  color: #1a1d24;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
.app { max-width: 1200px; margin: 0 auto; padding: 20px; }
.hidden { display: none !important; }

/* LOGIN */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
  padding: 20px;
}
.login-card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.login-card h1 { font-size: 22px; margin-bottom: 8px; color: #111827; }
.login-card .sub { color: #6b7280; margin-bottom: 24px; font-size: 13px; }
.error-msg {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  display: none;
}
.error-msg.show { display: block; }

/* HEADER */
.header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(30,58,95,0.15);
  gap: 16px;
  flex-wrap: wrap;
}
.header h1 { font-size: 18px; font-weight: 600; }
.header .user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.header .user-info .name { font-weight: 500; }
.header .user-info .role {
  background: rgba(255,255,255,0.2);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nav {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: white;
  padding: 6px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.nav-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.15s;
}
.nav-btn:hover { background: #f3f4f6; }
.nav-btn.active { background: #1e3a5f; color: white; }

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: white;
  padding: 16px 18px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-left: 4px solid;
}
.stat-card.pending { border-color: #f59e0b; }
.stat-card.validated { border-color: #10b981; }
.stat-card.refused { border-color: #ef4444; }
.stat-card.total { border-color: #6366f1; }
.stat-card .label { color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .sub { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* TABS */
.tabs {
  display: flex;
  gap: 4px;
  background: white;
  padding: 6px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: #1e3a5f; color: white; }
.tab .badge {
  background: #f59e0b;
  color: white;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* TOOLBAR */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.btn {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: #1e3a5f; color: white; border-color: #1e3a5f; }
.btn.primary:hover { background: #152a45; }
.btn.success { background: #10b981; color: white; border-color: #10b981; }
.btn.success:hover { background: #059669; }
.btn.danger { background: #ef4444; color: white; border-color: #ef4444; }
.btn.danger:hover { background: #dc2626; }
.btn.ghost { background: transparent; border-color: transparent; }
.filter-select {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
}

/* CARDS */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: white;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-left: 4px solid #e5e7eb;
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card.pending { border-left-color: #f59e0b; }
.card.validated { border-left-color: #10b981; }
.card.refused { border-left-color: #ef4444; }
.card.urgent { background: linear-gradient(90deg, #fef3c7 0%, white 25%); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: #111827; }
.card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  flex-wrap: wrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag.commercial { background: #dbeafe; color: #1e40af; }
.tag.juridique { background: #ede9fe; color: #5b21b6; }
.tag.rh { background: #fce7f3; color: #9d174d; }
.tag.achat { background: #d1fae5; color: #065f46; }
.tag.pending { background: #fef3c7; color: #92400e; }
.tag.validated { background: #d1fae5; color: #065f46; }
.tag.refused { background: #fee2e2; color: #991b1b; }
.tag.urgent { background: #fecaca; color: #991b1b; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 16px;
  margin: 10px 0;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 8px;
}
.field { display: flex; flex-direction: column; }
.field .k { font-size: 10px; text-transform: uppercase; color: #9ca3af; font-weight: 600; letter-spacing: 0.5px; }
.field .v { font-size: 14px; color: #111827; font-weight: 500; margin-top: 2px; word-break: break-word; }
.field .v.big { font-size: 16px; font-weight: 700; }
.field .v.margin-high { color: #059669; }
.field .v.margin-mid { color: #d97706; }
.field .v.margin-low { color: #dc2626; }

.card-desc { font-size: 13px; color: #4b5563; margin: 8px 0; line-height: 1.5; }
.card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.comment-box {
  flex: 1;
  min-width: 200px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.decision-info {
  background: #f3f4f6;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 13px;
}
.decision-info .who { font-weight: 600; color: #111827; }
.decision-info .when { color: #6b7280; font-size: 11px; }
.decision-info .comment { margin-top: 6px; color: #374151; font-style: italic; }

/* MODAL */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
  overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal h2 { font-size: 18px; margin-bottom: 16px; color: #111827; }
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none;
  border-color: #2c5282;
  box-shadow: 0 0 0 3px rgba(44,82,130,0.15);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.empty { text-align: center; padding: 60px 20px; color: #9ca3af; }
.empty .icon { font-size: 16px; margin-bottom: 8px; font-weight: 600; color: #6b7280; }

.priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.priority-dot.high { background: #ef4444; }
.priority-dot.normal { background: #f59e0b; }
.priority-dot.low { background: #10b981; }

/* ADMIN USERS */
.users-table {
  width: 100%;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-collapse: collapse;
}
.users-table th, .users-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.users-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table .actions { display: flex; gap: 6px; }
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.active { background: #d1fae5; color: #065f46; }
.status-badge.inactive { background: #fee2e2; color: #991b1b; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e3a5f;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-size: 13px;
  z-index: 200;
  animation: slideIn 0.3s ease-out;
}
.toast.error { background: #dc2626; }
.toast.success { background: #10b981; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
