/* ═══════════════════════════════════════════════════════════════════════════
   HOUYOUX CONSTRUCTIONS — Design System
   Couleurs depuis parametres: --color-primary, --color-accent
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --color-primary:    #1B4F8A;
  --color-primary-dk: #163f6e;
  --color-primary-lt: #2563ab;
  --color-accent:     #E8A838;
  --color-accent-dk:  #c98c20;
  --color-success:    #198754;
  --color-danger:     #DC3545;
  --color-warning:    #FD7E14;
  --color-info:       #0DCAF0;
  --color-muted:      #6C757D;
  --bg-app:           #F4F6F9;
  --bg-sidebar:       #0f2d52;
  --bg-card:          #ffffff;
  --bg-input:         #ffffff;
  --text-main:        #212529;
  --text-muted:       #6C757D;
  --text-sidebar:     rgba(255,255,255,0.85);
  --border:           #DEE2E6;
  --border-light:     #F0F2F5;
  --radius:           8px;
  --radius-sm:        4px;
  --radius-lg:        12px;
  --shadow:           0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:        0 8px 32px rgba(0,0,0,.14);
  --sidebar-width:    240px;
  --topbar-height:    56px;
  --transition:       0.18s ease;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Auth Screen ─────────────────────────────────────────────────────────── */
.auth-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f2540 0%, #1a3a5c 60%, #1e4a72 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  text-align: center; max-width: 380px; width: 90%;
  display: flex; flex-direction: column; align-items: center;
}
.auth-logo h1 {
  font-size: 1.6rem; font-weight: 800; color: white; margin-bottom: 6px;
}
.auth-logo p {
  color: rgba(255,255,255,.65); font-size: .9rem; margin-bottom: 40px;
}
.auth-btn {
  width: 100%; gap: 10px; font-size: 1rem; padding: 14px 24px;
  background: white; color: #1a3a5c; border: none;
  border-radius: 10px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; box-shadow: 0 4px 15px rgba(0,0,0,.2);
}
.auth-btn:hover { background: #f0f4f8; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.auth-note { margin-top: 20px; font-size: .78rem; color: rgba(255,255,255,.4); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ──────────────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
  z-index: 200;
}
.sidebar-brand {
  padding: 16px 16px 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: var(--topbar-height);
}
.sidebar-brand img { height: 32px; width: auto; }
#nav-title { font-weight: 700; font-size: .95rem; color: white; }

.sidebar-chantier {
  padding: 10px 16px;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-chantier-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; }
.sidebar-chantier-nom   { font-size: .85rem; color: var(--color-accent); font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-section-title {
  padding: 12px 16px 4px;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; opacity: .5;
}
.nav-links { list-style: none; padding: 4px 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--text-sidebar); font-size: .88rem;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  cursor: pointer;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: white; }
.nav-link.active { background: var(--color-primary); color: white; }
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--color-accent);
}
.nav-link svg { opacity: .75; flex-shrink: 0; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-accent);
  color: white; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
#user-nom  { font-size: .82rem; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#user-role { font-size: .72rem; }

/* TOPBAR */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-width); right: 0;
  height: var(--topbar-height); z-index: 100;
  background: white; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.menu-toggle { display: none; }
.topbar-title { flex: 1; font-weight: 600; font-size: 1rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.notif-btn  { position: relative; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--color-danger); color: white;
  border-radius: 10px; padding: 0 5px;
  font-size: .65rem; font-weight: 700; min-width: 16px;
  text-align: center; line-height: 16px; height: 16px;
}

/* Panneau notifications */
.notif-panel {
  position: fixed; top: var(--topbar-height); right: 0;
  width: 340px; max-height: calc(100vh - 56px);
  background: white; border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 150; overflow-y: auto;
}
.notif-panel-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-list { padding: 8px 0; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-app); }
.notif-item.non-lue { background: #EEF4FF; }
.notif-item-titre { font-weight: 600; font-size: .88rem; }
.notif-item-msg   { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.notif-item-date  { font-size: .72rem; color: var(--text-muted); margin-top: 4px; }

/* MAIN */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  overflow-y: auto;
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
}
#page-content { max-width: 1400px; margin: 0 auto; }

/* ── Cards & Layout helpers ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 1rem; font-weight: 700; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-header-left h1 { font-size: 1.4rem; font-weight: 700; }
.page-header-left .breadcrumb { font-size: .82rem; color: var(--text-muted); margin-bottom: 4px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Stats cards */
.stat-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 1.4rem;
}
.stat-val  { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label{ font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  white-space: nowrap;
}
.btn-lg     { padding: 11px 22px; font-size: 1rem; }
.btn-sm     { padding: 5px 11px;  font-size: .8rem; }
.btn-primary{ background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dk); }
.btn-accent { background: var(--color-accent); color: white; border-color: var(--color-accent); }
.btn-accent:hover  { background: var(--color-accent-dk); }
.btn-success{ background: var(--color-success); color: white; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-outline{ background: white; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: white; }
.btn-outline-danger{ border-color: var(--color-danger); color: var(--color-danger); }
.btn-outline-danger:hover{ background: var(--color-danger); color: white; }
.btn-ghost  { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-app); color: var(--text-main); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  cursor: pointer; border: none; background: none;
  color: var(--text-muted); transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-app); color: var(--text-main); }
.btn-icon.active{ color: var(--color-primary); background: rgba(27,79,138,.08); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 5px; color: #374151; }
.form-control {
  display: block; width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-main);
  font-size: .9rem; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27,79,138,.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .76rem; color: var(--text-muted); margin-top: 4px; }
.form-error{ font-size: .76rem; color: var(--color-danger); margin-top: 4px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Color input */
input[type="color"].form-control { height: 40px; padding: 4px 8px; cursor: pointer; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { background: var(--bg-app); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); color: var(--text-muted); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--border-light); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ── Badges & Pills ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700;
}
.badge-blue   { background: rgba(27,79,138,.12);  color: var(--color-primary); }
.badge-orange { background: rgba(232,168,56,.15);  color: #a06800; }
.badge-green  { background: rgba(25,135,84,.12);   color: var(--color-success); }
.badge-red    { background: rgba(220,53,69,.12);   color: var(--color-danger); }
.badge-gray   { background: rgba(108,117,125,.12); color: var(--text-muted); }
.badge-cyan   { background: rgba(13,202,240,.15);  color: #0a7080; }

/* Priorité */
.prio-urgente { color: var(--color-danger); font-weight: 700; }
.prio-haute   { color: var(--color-warning); }
.prio-normale { color: var(--text-muted); }

/* Statut pill coloré depuis DB */
.statut-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: .76rem; font-weight: 600;
}

/* ── Filtres ─────────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; background: white; border-radius: var(--radius);
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.filters-bar .form-control { max-width: 200px; }
.search-box { position: relative; }
.search-box input { padding-left: 32px; }
.search-box svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px; font-size: .88rem; font-weight: 500;
  color: var(--text-muted); border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-btn:hover  { color: var(--text-main); }
.tab-content > div { display: none; }
.tab-content > div.active { display: block; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: white; border-radius: var(--radius-lg); width: 100%; max-width: 600px;
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-xl { max-width: 1100px; }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-body   { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2937; color: white; padding: 12px 18px;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font-size: .88rem; display: flex; align-items: center; gap: 10px;
  animation: toastIn .2s ease; max-width: 360px;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); }
@keyframes toastIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: none; } }

/* ── Offline badge ───────────────────────────────────────────────────────── */
#offline-badge { font-size: .78rem; padding: 4px 10px; }

/* ── Remarques vue liste ─────────────────────────────────────────────────── */
.remarque-item {
  background: white; border-radius: var(--radius); margin-bottom: 8px;
  border-left: 4px solid var(--border);
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: start; padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: box-shadow var(--transition);
}
.remarque-item:hover { box-shadow: var(--shadow); }
.remarque-numero { font-weight: 700; font-size: .82rem; color: var(--text-muted); min-width: 36px; }
.remarque-body   { flex: 1; min-width: 0; }
.remarque-titre  { font-weight: 600; font-size: .92rem; }
.remarque-meta   { font-size: .78rem; color: var(--text-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.remarque-meta span { display: flex; align-items: center; gap: 4px; }
.remarque-actions{ display: flex; gap: 4px; }

/* Kanban remarques */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col {
  flex-shrink: 0; width: 280px; background: var(--bg-app);
  border-radius: var(--radius); padding: 12px;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-weight: 600; font-size: .88rem;
}
.kanban-count { background: white; border-radius: 10px; padding: 1px 7px; font-size: .78rem; }
.kanban-item {
  background: white; border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: pointer;
  border-left: 3px solid;
  transition: box-shadow var(--transition);
}
.kanban-item:hover { box-shadow: var(--shadow); }
.kanban-item-num   { font-size: .72rem; color: var(--text-muted); font-weight: 700; }
.kanban-item-titre { font-size: .85rem; font-weight: 500; margin-top: 2px; }
.kanban-item-meta  { font-size: .72rem; color: var(--text-muted); margin-top: 6px; display: flex; gap: 8px; }

/* ── Plan viewer ─────────────────────────────────────────────────────────── */
.plan-viewer-wrap { position: relative; overflow: auto; background: #333; border-radius: var(--radius); }
.plan-canvas-wrap { position: relative; display: inline-block; }
.plan-canvas-wrap canvas { display: block; }
.plan-overlay {
  position: absolute; inset: 0; pointer-events: none;
}
.plan-overlay.clickable { pointer-events: all; cursor: crosshair; }
.pastille {
  position: absolute; transform: translate(-50%, -100%);
  pointer-events: all; cursor: pointer; z-index: 10;
}
.pastille-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-warning);
  border: 2.5px solid white;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  transition: transform var(--transition);
}
.pastille:hover .pastille-dot { transform: scale(1.2); }
.pastille.cloturee .pastille-dot { background: var(--color-success); }
.pastille.en_attente .pastille-dot { background: var(--color-info); }
.plan-toolbar {
  display: flex; gap: 4px; align-items: center;
  background: rgba(0,0,0,.7); padding: 6px 10px; border-radius: var(--radius);
  position: absolute; top: 10px; left: 10px; z-index: 20;
}
.plan-toolbar .btn-icon { color: white; }
.plan-toolbar .btn-icon.active { background: rgba(255,255,255,.2); color: white; }

/* ── Progress bars ───────────────────────────────────────────────────────── */
.progress { height: 8px; background: var(--bg-app); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-primary); border-radius: 4px; transition: width .5s ease; }
.progress-bar.orange { background: var(--color-accent); }
.progress-bar.green  { background: var(--color-success); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-muted);
}
.empty-state svg { opacity: .3; margin-bottom: 16px; }
.empty-state h3  { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-main); }
.empty-state p   { font-size: .88rem; margin-bottom: 20px; }

/* ── Loader ──────────────────────────────────────────────────────────────── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--text-muted);
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin ───────────────────────────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-tab {
  padding: 8px 18px; border-radius: var(--radius-sm); font-size: .88rem;
  cursor: pointer; background: white; border: 1px solid var(--border);
  color: var(--text-muted); font-weight: 500; transition: all var(--transition);
}
.admin-tab.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.admin-tab:hover  { border-color: var(--color-primary); color: var(--color-primary); }

.params-grid { display: grid; gap: 20px; }
.params-section { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.params-section-title {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border-light);
}
.param-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; align-items: start; padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.param-row:last-child { border-bottom: none; }
.param-label { font-size: .85rem; font-weight: 500; }
.param-desc  { font-size: .76rem; color: var(--text-muted); margin-top: 2px; }
.param-input-wrap { display: flex; gap: 8px; align-items: center; }
.param-saved { color: var(--color-success); font-size: .8rem; animation: fadeIn .3s; }

/* ── Sidebar overlay (mobile) ────────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190;
}

/* ── Text helpers ────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .82rem; }
.text-xs     { font-size: .72rem; }
.text-bold   { font-weight: 700; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-primary{ color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-success{ color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-1 { flex: 1; }
.d-none { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: none; }
  .sidebar-overlay.open { display: block; }
  .topbar { left: 0; }
  .menu-toggle { display: inline-flex; }
  .main-content { margin-left: 0; padding: 16px; }
  .kanban { min-height: 70vh; }
  .param-row { grid-template-columns: 1fr; }
  .modal-box.modal-lg, .modal-box.modal-xl { max-width: 100%; }
}

@media (max-width: 600px) {
  .main-content { padding: 12px; }
  .page-header  { flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-end; }
  .filters-bar  { gap: 6px; }
  .filters-bar .form-control { max-width: 100%; }
  .table-wrap table { font-size: .82rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kanban-col { width: 260px; }
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .topbar-actions, .page-actions,
  .btn, .filters-bar, #btn-login { display: none !important; }
  .main-content { margin: 0; padding: 0; }
}

/* ── Sélecteur de chantier ───────────────────────────────────────────────── */
.chantier-selector {
  position: relative;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  border-top: 1px solid rgba(255,255,255,.08);
}
.chantier-selector-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; background: rgba(255,255,255,.08);
  transition: background var(--transition);
  user-select: none;
}
.chantier-selector-btn:hover { background: rgba(255,255,255,.14); }
.chantier-selector-ico   { font-size: 1rem; flex-shrink: 0; }
.chantier-selector-nom   { flex: 1; font-size: .82rem; font-weight: 600; color: var(--color-accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chantier-selector-arrow { color: rgba(255,255,255,.5); font-size: .7rem; flex-shrink: 0; transition: transform var(--transition); }
.chantier-selector-btn.open .chantier-selector-arrow { transform: rotate(180deg); }

.chantier-selector-dropdown {
  position: absolute; left: 8px; right: 8px; top: calc(100% - 4px);
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 300; overflow: hidden;
  border: 1px solid var(--border);
}
.chantier-search-wrap { padding: 8px; border-bottom: 1px solid var(--border-light); }
.chantier-search-input {
  width: 100%; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .85rem;
}
.chantier-selector-list { max-height: 240px; overflow-y: auto; }
.chantier-selector-item {
  padding: 10px 14px; cursor: pointer; font-size: .85rem;
  display: flex; align-items: center; gap: 8px;
  transition: background var(--transition); color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
}
.chantier-selector-item:hover    { background: var(--bg-app); }
.chantier-selector-item.active   { background: rgba(27,79,138,.08); font-weight: 600; color: var(--color-primary); }
.chantier-selector-item .statut-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.chantier-selector-footer {
  padding: 8px; border-top: 1px solid var(--border-light);
}

/* ── Menu contextuel (clic droit) ────────────────────────────────────────── */
.context-menu {
  position: fixed; z-index: 9000;
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  min-width: 180px; overflow: hidden;
}
.context-menu ul { list-style: none; padding: 4px 0; }
.context-menu li {
  padding: 8px 16px; cursor: pointer; font-size: .88rem;
  display: flex; align-items: center; gap: 8px;
  transition: background var(--transition);
}
.context-menu li:hover { background: var(--bg-app); }
.context-menu li.danger { color: var(--color-danger); }
.context-menu li.separator { border-top: 1px solid var(--border-light); margin-top: 4px; padding-top: 8px; }
