/* ============================================
   IMMOCHECK — STYLES
   Design: Refined minimal, warm neutrals
   Fonts: DM Serif Display + DM Sans
   ============================================ */

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

:root {
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #F0EDE8;
  --border: #E5E0D8;
  --border-2: #D4CEC4;
  --text: #1A1714;
  --text-2: #6B6460;
  --text-3: #9B9491;
  --accent: #2D5A3D;
  --accent-light: #E8F0EA;
  --accent-2: #C8763A;
  --accent-2-light: #FDF0E6;
  --danger: #C0392B;
  --danger-light: #FDEDEC;
  --warning: #E67E22;
  --warning-light: #FEF9E7;
  --success: #27AE60;
  --success-light: #EAFAF1;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.10);
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

html { font-size: 15px; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }

/* ---- UTILS ---- */
.hidden { display: none !important; }
.flex { display: flex; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
em { font-family: 'DM Serif Display', serif; font-style: italic; }

/* ---- BRAND ---- */
.brand-mark {
  width: 32px; height: 32px; background: var(--accent);
  border-radius: 8px; position: relative; flex-shrink: 0;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 6px;
  border: 2.5px solid rgba(255,255,255,.7); border-radius: 3px;
}
.brand-mark.sm { width: 26px; height: 26px; border-radius: 6px; }
.brand-mark.sm::after { inset: 5px; border-width: 2px; }

/* ============================================
   AUTH
   ============================================ */
.auth-screen {
  min-height: 100vh; display: flex;
}
.auth-left {
  width: 52%; background: var(--accent); color: white;
  padding: 48px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden;
}
.auth-left::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.auth-left::after {
  content: ''; position: absolute; bottom: -60px; left: -60px;
  width: 280px; height: 280px; border-radius: 50%;
  background: rgba(255,255,255,.03);
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand .brand-mark { background: rgba(255,255,255,.2); }
.auth-brand .brand-name { font-family: 'DM Serif Display', serif; font-size: 1.3rem; letter-spacing: -.01em; }
.auth-hero { position: relative; z-index: 1; }
.auth-hero h1 { font-family: 'DM Serif Display', serif; font-size: 3rem; line-height: 1.1; margin-bottom: 20px; font-weight: 400; }
.auth-hero h1 em { color: rgba(255,255,255,.7); font-style: italic; }
.auth-hero p { color: rgba(255,255,255,.75); font-size: .95rem; max-width: 380px; }
.auth-stats { display: flex; gap: 40px; position: relative; z-index: 1; }
.auth-stats .stat span { display: block; font-family: 'DM Serif Display', serif; font-size: 1.8rem; }
.auth-stats .stat small { color: rgba(255,255,255,.6); font-size: .8rem; }
.auth-right {
  flex: 1; background: var(--surface); display: flex; flex-direction: column;
  justify-content: center; padding: 48px 64px;
}
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; width: fit-content; margin-bottom: 32px; }
.auth-tab { padding: 8px 20px; border: none; background: none; border-radius: 7px; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: .875rem; font-weight: 500; color: var(--text-2); transition: var(--transition); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-form h2 { font-family: 'DM Serif Display', serif; font-size: 1.8rem; font-weight: 400; margin-bottom: 6px; }
.form-sub { color: var(--text-2); margin-bottom: 28px; font-size: .9rem; }

/* ============================================
   FORM ELEMENTS
   ============================================ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: .9rem;
  transition: var(--transition); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); background: white; box-shadow: 0 0 0 3px var(--accent-light);
}
.field textarea { min-height: 80px; resize: vertical; }
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-2); cursor: pointer; }
.checkbox-label input { width: auto; accent-color: var(--accent); }
.link-small { font-size: .8rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.link-small:hover { text-decoration: underline; }

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; background: var(--accent); color: white; border: none;
  border-radius: var(--radius-sm); font-family: 'DM Sans', sans-serif;
  font-size: .875rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary:hover { background: #234a30; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,90,61,.3); }
.btn-primary.full { width: 100%; }
.btn-primary.sm { padding: 7px 14px; font-size: .8rem; }
.btn-primary.xs { padding: 4px 10px; font-size: .75rem; }
.btn-primary.danger { background: var(--danger); }
.btn-primary.warning { background: var(--warning); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-secondary:hover { background: var(--border); }
.btn-secondary.sm { padding: 6px 12px; font-size: .8rem; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
}
.btn-icon:hover { background: var(--border); }
.btn-icon svg { width: 16px; height: 16px; }

/* ============================================
   DEMO ACCOUNTS
   ============================================ */
.demo-accounts { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.demo-accounts p { font-size: .8rem; color: var(--text-3); margin-bottom: 10px; }
.demo-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-btns button {
  padding: 6px 14px; border: 1.5px solid var(--border); background: var(--bg);
  border-radius: var(--radius-sm); cursor: pointer; font-size: .78rem; font-weight: 500;
  color: var(--text-2); font-family: 'DM Sans', sans-serif; transition: var(--transition);
}
.demo-btns button:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================
   APP LAYOUT
   ============================================ */
.app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform var(--transition);
}
.sidebar-brand {
  padding: 20px 18px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
}
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none;
  font-size: .875rem; font-weight: 500; transition: var(--transition); margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.sidebar-bottom { padding: 12px 10px; border-top: 1px solid var(--border); }
.user-profile {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
  margin-top: 4px;
}
.user-profile:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; background: var(--accent); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info span { display: block; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { color: var(--text-3); font-size: .72rem; }
.logout-btn { background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 4px; display: flex; }
.logout-btn:hover { color: var(--danger); }
.logout-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.topbar-title { font-family: 'DM Serif Display', serif; font-size: 1.1rem; font-weight: 400; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.notif-btn { position: relative; cursor: pointer; padding: 6px; }
.notif-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notif-badge {
  position: absolute; top: 0; right: 0; width: 16px; height: 16px;
  background: var(--danger); color: white; border-radius: 50%;
  font-size: .65rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.page-content { flex: 1; padding: 28px 28px; overflow-y: auto; }

/* ============================================
   CARDS & SURFACES
   ============================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: 'DM Serif Display', serif; font-size: 1.05rem; font-weight: 400; }
.section-title { font-family: 'DM Serif Display', serif; font-size: 1.4rem; font-weight: 400; margin-bottom: 6px; }
.section-sub { color: var(--text-2); font-size: .875rem; margin-bottom: 24px; }

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.green::before { background: var(--accent); }
.stat-card.orange::before { background: var(--accent-2); }
.stat-card.red::before { background: var(--danger); }
.stat-card.blue::before { background: #3498db; }
.stat-label { font-size: .75rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.stat-value { font-family: 'DM Serif Display', serif; font-size: 2.2rem; color: var(--text); line-height: 1; }
.stat-delta { font-size: .78rem; color: var(--text-3); margin-top: 6px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.dashboard-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ACTIVITY  */
.activity-table { width: 100%; border-collapse: collapse; }
.activity-table th { text-align: left; font-size: .72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.activity-table td { padding: 12px 12px; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
.activity-table tr:last-child td { border-bottom: none; }
.activity-table tr:hover td { background: var(--bg); }
.pill {
  display: inline-flex; 
  align-items: center; 
  gap: 4px; /* Réduit de 5px à 4px */
  padding: 2px 8px; /* Réduit pour gagner de la place en largeur */
  border-radius: 20px; 
  font-size: 0.7rem; /* Légèrement plus petit */
  font-weight: 600;
  white-space: nowrap; /* Empêche le badge de revenir à la ligne tout seul */
}
.pill::before {
    width: 4px; /* Point plus petit */
    height: 4px;
}

/* Réduire les espacements dans les cellules du tableau */
th, td {
    padding: 8px 4px ; /* Réduit le padding interne des colonnes */
    font-size: 0.8rem; /* Police plus petite pour tout le tableau */
}
.pill.green { background: var(--success-light); color: var(--success); }
.pill.orange { background: var(--accent-2-light); color: var(--accent-2); }
.pill.red { background: var(--danger-light); color: var(--danger); }
.pill.grey { background: var(--surface-2); color: var(--text-3); }
.pill.blue { background: #EBF5FB; color: #2980b9; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* QUICK ACTIONS */
.quick-actions { display: flex; flex-direction: column; gap: 10px; }
.qa-item {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); text-decoration: none;
}
.qa-item:hover { background: var(--border); transform: translateX(3px); }
.qa-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.qa-icon svg { width: 18px; height: 18px; fill: none; stroke: white; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qa-icon.green { background: var(--accent); }
.qa-icon.orange { background: var(--accent-2); }
.qa-icon.blue { background: #3498db; }
.qa-text span { display: block; font-size: .85rem; font-weight: 600; }
.qa-text small { color: var(--text-3); font-size: .75rem; }

/* ============================================
   PROPERTIES
   ============================================ */
.properties-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.property-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: var(--transition); cursor: pointer;
}
.property-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.property-thumb {
  height: 160px; background: var(--surface-2); display: flex; align-items: center;
  justify-content: center; position: relative; overflow: hidden;
}
.property-thumb-inner { font-size: 3rem; opacity: .3; }
.property-type-badge {
  position: absolute; top: 12px; left: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 10px;
  font-size: .72rem; font-weight: 600; color: var(--text-2);
}
.property-body { padding: 16px; }
.property-addr { font-weight: 600; margin-bottom: 4px; font-size: .9rem; }
.property-sub { font-size: .8rem; color: var(--text-2); margin-bottom: 12px; }
.property-meta { display: flex; gap: 12px; }
.prop-meta-item { font-size: .78rem; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.property-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }

/* ============================================
   INSPECTIONS LIST
   ============================================ */
.inspections-list { display: flex; flex-direction: column; gap: 12px; }
.edl-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: flex; align-items: center; gap: 16px;
  transition: var(--transition); cursor: pointer;
}
.edl-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.edl-type-badge {
  width: 42px; height: 42px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: .7rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0;
}
.edl-type-badge.entree { background: var(--success-light); color: var(--success); }
.edl-type-badge.sortie { background: var(--accent-2-light); color: var(--accent-2); }
.edl-info { flex: 1; }
.edl-addr { font-weight: 600; font-size: .9rem; }
.edl-meta { font-size: .8rem; color: var(--text-2); margin-top: 2px; }
.edl-actions { display: flex; gap: 8px; }

/* ============================================
   CONTACTS
   ============================================ */
.contacts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: var(--transition);
}
.contact-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.contact-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.contact-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: .9rem; color: white; flex-shrink: 0;
}
.contact-name { font-weight: 600; font-size: .9rem; }
.contact-role { font-size: .75rem; color: var(--text-3); }
.contact-detail { font-size: .8rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }

/* ============================================
   DOCUMENTS
   ============================================ */
.documents-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.doc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: var(--transition); cursor: pointer;
}
.doc-card:hover { border-color: var(--accent-2); box-shadow: var(--shadow); }
.doc-icon { font-size: 2rem; }
.doc-name { font-weight: 600; font-size: .875rem; }
.doc-sub { font-size: .78rem; color: var(--text-3); }
.doc-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 90%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-family: 'DM Serif Display', serif; font-size: 1.2rem; font-weight: 400; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.4rem; color: var(--text-3); line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================
   EDL WIZARD (FULLSCREEN)
   ============================================ */
.edl-wizard {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 900; overflow-y: auto;
}
.wizard-topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.wizard-steps {
  display: flex; gap: 6px; flex: 1; justify-content: center;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}
.wizard-topbar-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 24px; gap: 12px;
}
.wizard-step {
  display: flex; align-items: center; gap: 6px; padding: 5px 14px;
  border-radius: 20px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-3); cursor: pointer;
  transition: var(--transition);
}
.wizard-step.active { background: var(--accent); color: white; }
.wizard-step.done { background: var(--accent-light); color: var(--accent); }
.wizard-step .step-num {
  width: 18px; height: 18px; border-radius: 50%; background: currentColor;
  color: var(--surface-2); display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 800;
}
.wizard-step.active .step-num { background: rgba(255,255,255,.3); color: white; }
.wizard-body { max-width: 800px; margin: 0 auto; padding: 32px 24px; }
.wizard-section-title { font-family: 'DM Serif Display', serif; font-size: 1.5rem; margin-bottom: 6px; }
.wizard-section-sub { color: var(--text-2); margin-bottom: 28px; font-size: .875rem; }

/* ROOM SECTIONS */
.room-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.room-header {
  padding: 14px 18px; background: var(--surface-2); display: flex;
  align-items: center; justify-content: space-between; cursor: pointer;
}
.room-header-left { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.room-header-right { display: flex; gap: 8px; align-items: center; }
.room-body { padding: 16px 18px; }

/* ITEMS TABLE */
.items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.items-table th { text-align: left; font-size: .72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 8px; }
.items-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.items-table tr:last-child td { border-bottom: none; }
.items-table input, .items-table select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); font-size: .82rem; font-family: 'DM Sans', sans-serif; }
.items-table input:focus, .items-table select:focus { outline: none; border-color: var(--accent); }

/* STATE PILLS */
.state-select {
  appearance: none; padding: 5px 28px 5px 10px;
  border-radius: 6px; font-weight: 600; font-size: .78rem; cursor: pointer;
  background-repeat: no-repeat; background-position: right 8px center;
}
.state-neuf { background-color: var(--success-light); color: var(--success); border: 1px solid rgba(39,174,96,.2); }
.state-bon { background-color: #EBF5FB; color: #2980b9; border: 1px solid rgba(52,152,219,.2); }
.state-usage { background-color: var(--warning-light); color: var(--warning); border: 1px solid rgba(230,126,34,.2); }
.state-mauvais { background-color: var(--danger-light); color: var(--danger); border: 1px solid rgba(192,57,43,.2); }
.state-non_fonctionnel { background-color: #F5EEF8; color: #7D3C98; border: 1px solid rgba(125,60,152,.2); }

/* METERS */
.meters-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.meter-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.meter-icon { font-size: 1.8rem; margin-bottom: 10px; }
.meter-type { font-weight: 600; font-size: .875rem; margin-bottom: 12px; }
.meter-input-wrap { display: flex; align-items: center; gap: 8px; }
.meter-input-wrap input { flex: 1; }
.meter-unit { font-size: .8rem; color: var(--text-3); }

/* SIGNATURE PAD */
.signature-pad {
  border: 2px dashed var(--border); border-radius: var(--radius);
  min-height: 160px; display: flex; align-items: center; justify-content: center;
  cursor: crosshair; background: var(--bg); position: relative;
}
.signature-pad canvas { display: block; }
.signature-placeholder { text-align: center; color: var(--text-3); font-size: .875rem; pointer-events: none; }
.signature-placeholder svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.5; margin-bottom: 8px; opacity: .5; }

/* COMPARISON VIEW */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.compare-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.compare-header { padding: 12px 16px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; }
.compare-header.entree { background: var(--success-light); color: var(--success); }
.compare-header.sortie { background: var(--accent-2-light); color: var(--accent-2); }
.compare-item { padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.compare-item:last-child { border-bottom: none; }
.compare-item-label { font-weight: 600; margin-bottom: 3px; }
.diff-flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: var(--danger-light); color: var(--danger); border-radius: 4px; font-size: .7rem; font-weight: 700; margin-left: 8px; }

/* ============================================
   SETTINGS
   ============================================ */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.settings-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; height: fit-content; }
.settings-nav-item {
  padding: 9px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: .875rem; font-weight: 500; color: var(--text-2); transition: var(--transition);
}
.settings-nav-item:hover { background: var(--surface-2); color: var(--text); }
.settings-nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.settings-section h3 { font-family: 'DM Serif Display', serif; font-size: 1.1rem; margin-bottom: 4px; }
.settings-section p { font-size: .875rem; color: var(--text-2); margin-bottom: 20px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info span { display: block; font-weight: 500; font-size: .875rem; }
.settings-row-info small { color: var(--text-3); font-size: .78rem; }
.toggle {
  width: 42px; height: 24px; background: var(--border); border-radius: 12px;
  cursor: pointer; position: relative; transition: var(--transition);
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  background: white; border-radius: 50%; top: 3px; left: 3px;
  transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle.on::after { left: 21px; }

/* ============================================
   FILTERS / SEARCH BAR
   ============================================ */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 200px; padding: 9px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'DM Sans', sans-serif; font-size: .875rem;
  background: var(--surface); outline: none; transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.filter-select {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: .875rem; background: var(--surface);
  outline: none; cursor: pointer;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--text); color: white; padding: 12px 20px;
  border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn .25s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state svg { width: 48px; height: 48px; stroke: var(--border-2); fill: none; stroke-width: 1.5; margin-bottom: 16px; }
.empty-state h3 { font-family: 'DM Serif Display', serif; font-size: 1.2rem; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; }

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-wrap { background: var(--surface-2); border-radius: 6px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s ease; }

/* ============================================
   PHOTO UPLOAD ZONE
   ============================================ */
.photo-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 20px;
  text-align: center; cursor: pointer; transition: var(--transition);
}
.photo-zone:hover { border-color: var(--accent); background: var(--accent-light); }
.photo-zone p { font-size: .82rem; color: var(--text-3); margin-top: 6px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.photo-thumb { width: 70px; height: 70px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; cursor: pointer; position: relative; }
.photo-del { position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; background: var(--danger); color: white; border-radius: 50%; font-size: .6rem; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* ============================================
   KEY BADGES
   ============================================ */
.keys-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.key-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; font-size: .85rem;
}
.key-counter { display: flex; align-items: center; gap: 6px; }
.key-counter button { width: 22px; height: 22px; border: 1px solid var(--border); background: var(--surface); border-radius: 4px; cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.key-counter span { font-weight: 700; min-width: 20px; text-align: center; }

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

@media (max-width: 768px) {
  /* AUTH */
  .auth-left { display: none; }
  .auth-right { padding: 32px 24px; }



  /* SIDEBAR — overlay avec fond semi-transparent */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 220ms cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  /* Overlay cliquable pour fermer */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 99;
    background: rgba(0,0,0,.35);
  }
  .sidebar-overlay.visible { display: block; }
  /* Sidebar z-index au-dessus de l'overlay */
  .sidebar { z-index: 100; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }

  /* LAYOUT */
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .field-row-2 { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .meters-grid { grid-template-columns: 1fr; }

  /* WIZARD TOPBAR — 2 lignes sur mobile */
  .wizard-topbar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }
  /* Ligne 1 : fil d'ariane */
  .wizard-steps {
    order: 1;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 10px 14px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--surface);
  }
  .wizard-steps::-webkit-scrollbar { display: none; }
  .wizard-step {
    padding: 5px 12px;
    font-size: .75rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  /* Ligne 2 : boutons Fermer / Précédent / Suivant */
  .wizard-topbar > button:first-child,
  .wizard-topbar > div:last-child {
    order: 2;
  }
  .wizard-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    gap: 8px;
    background: var(--surface);
  }
  .wizard-body { padding: 20px 14px; }

  /* WIZARD GRIDS — colonnes côte à côte → 1 colonne */
  .wizard-body > div[style*="grid-template-columns:1fr 1fr"],
  .wizard-body > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* TABLEAUX — scroll horizontal au lieu de débordement */
  .items-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -18px;   /* compense le padding du room-body */
    padding: 0 18px;
  }
  .items-table { min-width: 520px; width: max-content; }
  .room-body { overflow: hidden; }

  /* ROOM HEADER — bouton supprimer passe en dessous si trop serré */
  .room-header { flex-wrap: wrap; gap: 8px; }
  .room-header-right { flex-wrap: wrap; }

  /* MODAL */
  .modal { width: 96%; max-height: 92vh; }
  .modal-body { padding: 16px; }

  /* SIGNATURES côte à côte → empilées */
  .wizard-body > div[style*="grid-template-columns:1fr 1fr"]:has(canvas) {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .properties-grid { grid-template-columns: 1fr; }
  .contacts-grid { grid-template-columns: 1fr; }
  .documents-list { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .page-content { padding: 12px; }
  .wizard-body { padding: 16px 12px; }
  .btn-primary, .btn-secondary { font-size: .82rem; padding: 8px 14px; }
  .edl-card { flex-wrap: wrap; gap: 8px; }
  .edl-actions { width: 100%; justify-content: flex-end; }
}

/* ── Photo previews dans le formulaire EDL ─────────────────────────── */
.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  justify-content: center;
  align-items: flex-start;
}
.photo-thumb-wrap {
  position: relative;
  width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.photo-thumb-wrap .photo-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  cursor: zoom-in;
  transition: opacity .15s;
  display: block;
}
.photo-thumb-wrap .photo-thumb:hover { opacity: .82; }
.photo-thumb-del {
  position: absolute;
  top: -5px;
  right: 1px;
  width: 17px;
  height: 17px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: .58rem;
  line-height: 17px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.photo-thumb-wrap:hover .photo-thumb-del { opacity: 1; }

.photo-legende-input {
  width: 64px;
  font-size: .6rem;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-1);
  text-align: center;
  line-height: 1.2;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.photo-legende-input::placeholder { color: var(--text-3); font-style: italic; }
.photo-legende-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 45,90,61), .12);
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
}

.main-content {
  width: 100%;
  max-width: 100%;
}

.page-content {
  width: 100%;
  max-width: 100%;
}

.dashboard-grid,
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr;
}

.table-container {
  width: 100%;
  overflow-x: auto; /* Crée une barre de défilement horizontale si nécessaire */
  -webkit-overflow-scrolling: touch; /* Pour un défilement fluide sur iOS */
}

/* Empêche le tableau de déborder */
.activity-table, .report-table {
  width: 100%;
  table-layout: auto; /* Laisse le navigateur calculer les largeurs intelligemment */
}

/* Force les cellules à gérer le trop-plein */
td {
  max-width: 120px; /* Limite la largeur des colonnes de texte */
  overflow: hidden;
  text-overflow: ellipsis; /* Ajoute "..." si l'adresse est trop longue */
  white-space: nowrap;
}

/* Solution ultime : rendre le tableau scrollable horizontalement */
.card {
  width: 100%;
  overflow-x: auto; /* Permet de scroller le tableau sans casser le design global */
  -webkit-overflow-scrolling: touch;
}

.actions-header {
  display: flex;
  flex-wrap: wrap; /* Les boutons passent à la ligne au lieu de pousser les murs */
  gap: 10px;
}

table {
    min-width: 600px; /* Force le tableau à garder une forme lisible sans s'écraser */
    width: 100%;
}

/* Grille de contacts responsive */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
  padding: 10px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
}

.contact-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* On s'assure que les longs emails ne cassent pas le design */
.contact-details p {
  font-size: 0.9rem;
  color: var(--text-2);
  word-break: break-all; 
} 