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

:root {
  --primary: #1a1f36;
  --primary-light: #2d3561;
  --accent: #e8a020;
  --accent-light: #f5c15d;
  --accent-dim: rgba(232,160,32,0.15);
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f7;
  --border: #e2e5f0;
  --text: #1a1f36;
  --text-2: #4a5280;
  --text-3: #8b91b0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --neuf: #10b981;
  --bon: #3b82f6;
  --endommage: #f59e0b;
  --hs: #ef4444;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 2px 12px rgba(26,31,54,0.08);
  --shadow-md: 0 8px 30px rgba(26,31,54,0.12);
  --shadow-lg: 0 20px 60px rgba(26,31,54,0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.login-hero {
  background: var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(232,160,32,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(232,160,32,0.08) 0%, transparent 40%);
}

.login-hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: repeating-linear-gradient(
    45deg,
    #fff 0px, #fff 1px,
    transparent 1px, transparent 60px
  );
}

.login-hero-content { position: relative; z-index: 1; text-align: center; }

.login-logo {
  width: 80px; height: 80px;
  background: var(--accent);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px;
  box-shadow: 0 8px 32px rgba(232,160,32,0.4);
}

.login-logo svg { width: 44px; height: 44px; fill: white; }

.login-hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.login-hero p {
  color: rgba(255,255,255,0.55);
  font-size: 15px;
  max-width: 320px;
  margin: 0 auto;
}

.login-features {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 320px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}

.login-feature-icon {
  width: 32px; height: 32px;
  background: var(--accent-dim);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  background: var(--surface);
}

.login-form-container {
  width: 100%;
  max-width: 400px;
}

.login-form-container h2 {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-form-container .subtitle {
  color: var(--text-3);
  margin-bottom: 36px;
}

/* ─── LAYOUT ─── */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo svg { width: 22px; height: 22px; fill: white; }

.sidebar-brand {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand span { color: var(--accent); }

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 16px 8px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-transform: capitalize;
}

.logout-btn {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5);
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}

.logout-btn:hover { background: rgba(239,68,68,0.2); color: #ef4444; }
.logout-btn svg { width: 16px; height: 16px; }

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.top-bar-subtitle { font-size: 13px; color: var(--text-3); }

.top-bar-actions { display: flex; gap: 10px; align-items: center; }

.page-body { padding: 28px 32px; flex: 1; }

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

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.card-body { padding: 24px; }

/* ─── STATS GRID ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

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

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }

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

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td { padding: 14px 16px; font-size: 13.5px; vertical-align: middle; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-3); }

textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b91b0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #d4901a; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(232,160,32,0.4); }

.btn-dark { background: var(--primary); color: white; }
.btn-dark:hover { background: var(--primary-light); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

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

.btn-success { background: #d1fae5; color: var(--success); }
.btn-success:hover { background: var(--success); color: white; }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-neuf { background: #d1fae5; color: #065f46; }
.badge-bon { background: #dbeafe; color: #1e40af; }
.badge-endommage { background: #fef3c7; color: #92400e; }
.badge-hs { background: #fee2e2; color: #991b1b; }
.badge-admin { background: var(--accent-dim); color: #92400e; }
.badge-controleur { background: #dbeafe; color: #1e40af; }
.badge-finalise { background: #d1fae5; color: #065f46; }
.badge-brouillon { background: #f3f4f6; color: #6b7280; }
.badge-entree { background: #dbeafe; color: #1e40af; }
.badge-sortie { background: #fce7f3; color: #9d174d; }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── ALERTS ─── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,14,30,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

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

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--surface-3);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--text-2);
}

.modal-close:hover { background: #fee2e2; color: var(--danger); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── EDL STATE SELECTOR ─── */
.etat-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.etat-btn {
  padding: 8px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
  background: var(--surface);
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.etat-btn .etat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.etat-btn[data-etat="neuf"] .etat-dot { background: var(--neuf); }
.etat-btn[data-etat="bon"] .etat-dot { background: var(--bon); }
.etat-btn[data-etat="endommage"] .etat-dot { background: var(--endommage); }
.etat-btn[data-etat="hs"] .etat-dot { background: var(--hs); }

.etat-btn[data-etat="neuf"].selected { border-color: var(--neuf); background: #d1fae5; color: #065f46; }
.etat-btn[data-etat="bon"].selected { border-color: var(--bon); background: #dbeafe; color: #1e40af; }
.etat-btn[data-etat="endommage"].selected { border-color: var(--endommage); background: #fef3c7; color: #92400e; }
.etat-btn[data-etat="hs"].selected { border-color: var(--hs); background: #fee2e2; color: #991b1b; }

/* ─── ELEMENT ROW IN EDL ─── */
.element-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
  background: var(--surface);
}

.element-card:hover { border-color: var(--accent); }
.element-card.has-etat { border-left: 4px solid var(--accent); }
.element-card.etat-neuf { border-left-color: var(--neuf); }
.element-card.etat-bon { border-left-color: var(--bon); }
.element-card.etat-endommage { border-left-color: var(--endommage); }
.element-card.etat-hs { border-left-color: var(--hs); }

.element-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.element-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

/* ─── PHOTO UPLOAD ─── */
.photo-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.photo-zone:hover { border-color: var(--accent); background: var(--accent-dim); }

.photo-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.photo-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: var(--surface-3);
}

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

.photo-thumb .remove-photo {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.photo-thumb:hover .remove-photo { opacity: 1; }

/* ─── SIGNATURE PAD ─── */
.signature-area {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
  position: relative;
}

.signature-area canvas {
  display: block;
  cursor: crosshair;
  width: 100%;
  touch-action: none;
}

.signature-toolbar {
  padding: 8px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.signature-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── PIECE ACCORDION ─── */
.piece-accordion {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.piece-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--surface);
  transition: var(--transition);
  user-select: none;
}

.piece-header:hover { background: var(--surface-2); }

.piece-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.piece-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.progress-bar-mini {
  width: 80px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-mini .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.piece-body { padding: 16px 20px; border-top: 1px solid var(--border); }

.accordion-arrow {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: var(--surface-3);
  transition: var(--transition);
  color: var(--text-3);
}

.accordion-arrow svg { width: 16px; height: 16px; transition: transform 0.25s; }
.piece-accordion.open .accordion-arrow svg { transform: rotate(180deg); }

/* ─── BUILDING MANAGEMENT ─── */
.building-list { display: grid; gap: 16px; }

.building-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.building-icon {
  width: 52px; height: 52px;
  background: var(--accent-dim);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.building-icon svg { width: 28px; height: 28px; color: var(--accent); }

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

.building-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.building-addr { font-size: 13px; color: var(--text-3); }

.building-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.building-stat { font-size: 12px; color: var(--text-2); }
.building-stat strong { color: var(--text); }

.building-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── EDL LIST ─── */
.edl-list { display: grid; gap: 14px; }

.edl-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

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

.edl-card-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.edl-card-icon.entree { background: #dbeafe; }
.edl-card-icon.sortie { background: #fce7f3; }
.edl-card-icon svg { width: 24px; height: 24px; }

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

.edl-card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edl-card-meta { font-size: 12px; color: var(--text-3); }

.edl-card-right { text-align: right; flex-shrink: 0; }

/* ─── SEARCH ─── */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 38px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.empty-state svg {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  opacity: 0.3;
}

.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 8px;
}

/* ─── REPORT PRINT ─── */
@media print {
  .sidebar, .top-bar, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-body { padding: 0; }
}

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--primary);
  color: white;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

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

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .top-bar { padding: 12px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .etat-selector { grid-template-columns: repeat(2, 1fr); }
  .building-card { flex-direction: column; }
  .modal { max-width: 100%; max-height: 95vh; }
  .mobile-menu-btn { display: flex !important; }
  .top-bar-title { font-size: 18px; }
}

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

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--surface-3);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-2);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* ─── MISC ─── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-3); }
.text-center { text-align: center; }
.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-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface-3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Progress steps */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.step:last-child { flex: none; }

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  background: var(--surface);
  flex-shrink: 0;
  transition: var(--transition);
}

.step.active .step-circle { border-color: var(--accent); background: var(--accent); color: white; }
.step.done .step-circle { border-color: var(--success); background: var(--success); color: white; }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
}

.step-name { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.step.active .step-name { color: var(--accent); font-weight: 600; }

/* ─── STATISTIQUES ─── */
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding: 0 4px;
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chart-bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: height 0.8s ease;
  min-height: 2px;
}

.chart-bar-label {
  font-size: 9px;
  color: var(--text-3);
  text-align: center;
}

.anomalie-row-hs td { background: rgba(239,68,68,0.04); }
.anomalie-row-endommage td { background: rgba(245,158,11,0.04); }

/* ─── EMAIL SENDER ─── */
.email-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}

.email-preview-header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
}

.email-preview-body {
  padding: 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  max-height: 300px;
  overflow-y: auto;
}

/* ─── NAV BADGE STAT ─── */
.nav-item .nav-new-badge {
  margin-left: auto;
  font-size: 9px;
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}
