/* ═══════════════════════════════════════════════════════════════
   GestPlan — CSS Bureau v4
   Layout : sidebar fixe 240px + main scrollable
   Compatible : Chrome, Firefox, Safari, Edge (desktop + tablet)
═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Brand palette ── */
  --brand-50:  #eff6fb;
  --brand-100: #d8e9f5;
  --brand-200: #b3d4eb;
  --brand-300: #7eb4d9;
  --brand-400: #4a8ec0;
  --brand-500: #2070a8;
  --brand-600: #0066b3;
  --brand-700: #00477F;
  --brand-800: #003360;
  --brand-900: #001e3c;
  --brand-950: #0a1628;

  /* ── Slate (neutrals) ── */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* ── Semantic colors ── */
  --green-50:  #f0fdf4; --green-100: #dcfce7;
  --green-500: #22c55e; --green-600: #16a34a; --green-700: #15803d;
  --amber-50:  #fffbeb; --amber-100: #fef3c7;
  --amber-500: #f59e0b; --amber-600: #d97706; --amber-700: #b45309;
  --red-50:    #fef2f2; --red-100:   #fee2e2;
  --red-500:   #ef4444; --red-600:   #dc2626; --red-700:   #b91c1c;
  --teal-50:   #f0fdfa; --teal-100:  #ccfbf1;
  --teal-500:  #14b8a6; --teal-600:  #0d9488; --teal-700:  #0f766e;
  --violet-50: #f5f3ff; --violet-600:#7c3aed;

  /* ── Spacing (4px base) ── */
  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;
  --space-4: 16px; --space-5: 20px;  --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;

  /* ── Border radius ── */
  --radius:    10px;
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 24px;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04), 0 0 0 1px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px -2px rgba(15,23,42,.08), 0 2px 4px -1px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px -8px rgba(15,23,42,.12), 0 4px 12px -2px rgba(15,23,42,.06);

  /* ── Typography ── */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* ── Semantic aliases (backward compat) ── */
  --primary:      var(--brand-700);
  --primary-dark: var(--brand-800);
  --blue:         var(--brand-600);
  --blue-dark:    var(--brand-800);
  --blue-mid:     var(--brand-600);
  --blue-light:   var(--brand-50);
  --green:        var(--green-600);
  --green-light:  var(--green-50);
  --teal:         var(--teal-600);
  --teal-light:   var(--teal-50);
  --red:          var(--red-600);
  --red-light:    var(--red-50);
  --amber:        var(--amber-600);
  --amber-light:  var(--amber-50);
  --orange:       var(--amber-600);
  --orange-light: var(--amber-50);
  --purple:       var(--violet-600);
  --purple-light: var(--violet-50);

  /* ── Layout ── */
  --sidebar-width: 260px;
  --sidebar-w:     260px;
  --topbar-height: 60px;
  --topbar-h:      60px;

  /* ── Light mode surface ── */
  --bg:           #ffffff;
  --bg-alt:       var(--slate-50);
  --bg-body:      #f6f8fb;
  --bg-subtle:    var(--slate-50);
  --surface:      #ffffff;
  --sidebar-bg:   #0a1628;
  --text:         var(--slate-900);
  --text-muted:   var(--slate-500);
  --text-hint:    var(--slate-400);
  --border:       var(--slate-200);
  --border-md:    var(--slate-300);

  /* ── Legacy aliases ── */
  --font:       var(--font-sans);
  --radius-sm:  var(--r-sm);
  --radius-lg:  var(--r-lg);
  --radius-xl:  var(--r-xl);
  --shadow:     var(--shadow-sm);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font-sans); font-size: 14px; color: var(--text); background: #f6f8fb; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button { font-family: var(--font-sans); cursor: pointer; }
input, select, textarea { font-family: var(--font-sans); }

/* ════ LAYOUT ════ */
.app-layout, .app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: #0a1628;
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
  z-index: 100;
  transition: width .25s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* Sidebar logo block */
.sidebar-logo {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.logo-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #0066b3 0%, #0284c7 50%, #0ea5e9 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 12px -2px rgba(0,102,179,.5), 0 1px 0 rgba(255,255,255,.12) inset;
  flex-shrink: 0;
}
.logo-text { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.logo-sub  { color: rgba(255,255,255,.4); font-size: 11px; font-weight: 500; }

/* Nav sections */
.nav-section { padding: 12px 0 4px; }
.nav-label {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 12px 6px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  cursor: pointer; width: 100%; border: none; background: none;
  transition: color .15s;
  justify-content: space-between; user-select: none;
}
.nav-label:hover { color: rgba(255,255,255,.6); }
.nav-label::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid currentColor; transition: transform .2s; margin-right: 4px; }
.nav-section.collapsed .nav-label::after { transform: rotate(-90deg); }
.nav-section.collapsed .nav-item { display: none; }

/* Nav items */
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  margin: 0 8px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.55);
  cursor: pointer; border: none; background: none; width: calc(100% - 16px);
  text-align: left; transition: all .15s; white-space: nowrap;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.05); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0,102,179,.22) 0%, rgba(0,102,179,.08) 100%);
}
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%);
}

/* Nav badge */
.nav-badge-count { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: flex; align-items: center; justify-content: center; }
.nav-badge { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 100px; margin-left: auto; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; }
.nav-item.active .nav-badge { background: rgba(255,255,255,.15); color: #fff; }
.sidebar-sep { height: 1px; background: rgba(255,255,255,.06); margin: 8px 12px; }

/* Sidebar user footer */
.sidebar-user {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
  margin-top: auto; flex-shrink: 0;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 12.5px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 10.5px; color: rgba(255,255,255,.4); }
.sidebar-logout-btn { margin-left: auto; background: none; border: none; color: rgba(255,255,255,.4); font-size: 16px; padding: 4px; border-radius: 6px; transition: all .15s; }
.sidebar-logout-btn:hover { color: #f87171; background: rgba(255,68,68,.15); }

.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: #f6f8fb; }

/* ── Topbar ── */
.topbar, .header-bar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226,232,240,.7);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-btn { width: 34px; height: 34px; background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--text-muted); cursor: pointer; transition: all .15s; }
.topbar-btn:hover { background: var(--brand-50); border-color: var(--brand-600); color: var(--brand-700); }
.topbar-search { position: relative; width: 220px; }
.topbar-search input { width: 100%; padding: 7px 12px 7px 32px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 13px; color: var(--text); background: var(--bg-alt); outline: none; transition: all .15s; }
.topbar-search input:focus { border-color: var(--brand-600); background: #fff; box-shadow: 0 0 0 3px rgba(0,71,127,.1); }
.topbar-search::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; pointer-events: none; }
.notif-btn { position: relative; }
.notif-btn .badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* Page content */
.page-content, .main-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px; scroll-behavior: smooth; background: #f6f8fb; }
.page-content::-webkit-scrollbar, .main-content::-webkit-scrollbar { width: 6px; height: 6px; }
.page-content::-webkit-scrollbar-track, .main-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb, .main-content::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); border-radius: 8px; }
.page-content::-webkit-scrollbar-thumb:hover, .main-content::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.5); }

.view { display: none; }
.view.active { display: block; }

/* Headers */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header-left h1 { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.page-header-left p { font-size: 13px; color: var(--text-muted); }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-title { font-size: 17px; font-weight: 700; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 700; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--blue); line-height: 1.1; }

/* ── Buttons (modernized) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 36px; padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 600;
  border-radius: var(--r-md);
  border: none; cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  background: #fff;
  color: var(--slate-700);
  box-shadow: 0 0 0 1px var(--slate-200) inset;
  text-decoration: none;
}
.btn:hover { background: var(--slate-50); box-shadow: 0 0 0 1px var(--slate-300) inset; }
.btn:active { transform: scale(.98); }
.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--brand-700);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 1px 2px rgba(0,71,127,.25);
}
.btn-primary:hover { background: var(--brand-800); box-shadow: 0 1px 0 rgba(255,255,255,.12) inset; color: #fff; }

.btn-success { background: var(--green-600); color: #fff; box-shadow: none; }
.btn-success:hover { background: var(--green-700); color: #fff; }

.btn-danger {
  background: var(--red-50);
  color: var(--red-700);
  box-shadow: 0 0 0 1px var(--red-100) inset;
}
.btn-danger:hover { background: var(--red-100); color: var(--red-700); }

.btn-warning { background: var(--amber-600); color: #fff; box-shadow: none; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); gap: 4px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; border-radius: var(--r-lg); }
.btn-full { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm); }

/* ── Status Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.badge::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.badge-pending, .badge-scheduled { background: rgba(0,102,179,.1); color: #0066b3; }
.badge-reserved   { background: rgba(217,119,6,.1); color: #d97706; }
.badge-confirmed  { background: rgba(22,163,74,.1);  color: #16a34a; }
.badge-realise, .badge-done { background: rgba(100,116,139,.12); color: #64748b; }
.badge-completed  { background: rgba(13,148,136,.1); color: #0d9488; }
.badge-cancelled  { background: rgba(220,38,38,.1);  color: #dc2626; }
.badge-urgent     { background: rgba(220,38,38,.12); color: #dc2626; }
.badge-success    { background: var(--green-100);    color: var(--green-700); }
.badge-warning    { background: var(--amber-100);    color: var(--amber-700); }
.badge-danger     { background: var(--red-100);      color: var(--red-700); }
.badge-info       { background: var(--brand-100);    color: var(--brand-700); }

/* Forms */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border-md); border-radius: var(--radius-sm); font-size: 13px; color: var(--text); background: var(--surface); outline: none; transition: all .15s; font-family: var(--font); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue-mid); box-shadow: 0 0 0 3px rgba(0,71,127,.08); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6a7e' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Tables (modernized) ── */
.table-container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--slate-50); }
th { padding: 10px 16px; text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--slate-500) !important; border-bottom: 1px solid var(--slate-200); white-space: nowrap; cursor: pointer; user-select: none; }
th:hover { color: var(--slate-700) !important; }
td { padding: 10px 16px; font-size: 13px; border-bottom: 1px solid rgba(226,232,240,.6); vertical-align: middle; color: var(--slate-700); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; cursor: pointer; }
tbody tr:hover td { background: var(--slate-50); }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* KPI Cards */
.kpi-card {
  background: #fff;
  border: 1px solid rgba(226,232,240,.7);
  border-radius: var(--r-2xl);
  padding: 20px;
  transition: all .2s;
  box-shadow: var(--shadow-xs);
}
.kpi-card:hover { border-color: var(--slate-300); box-shadow: var(--shadow-md); }
.kpi-card .kpi-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--slate-500); margin-bottom: 12px;
}
.kpi-card .kpi-value {
  font-size: 28px; font-weight: 700; line-height: 1;
  letter-spacing: -.03em; color: var(--slate-900);
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' on;
}
.kpi-card .kpi-sub { font-size: 12px; color: var(--slate-500); margin-top: 4px; }

/* Filters */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-chip { padding: 5px 12px; border-radius: 100px; font-size: 12px; font-weight: 600; border: 1px solid var(--border-md); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all .15s; white-space: nowrap; }
.filter-chip:hover  { border-color: var(--blue-mid); color: var(--blue); }
.filter-chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all .15s; }
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Interventions list */
.inter-list { display: flex; flex-direction: column; }
.inter-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: background .12s; border-left: 4px solid transparent; }
.inter-item:hover { background: var(--bg); }
.inter-item:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.inter-item:last-child  { border-bottom: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.inter-item.status-confirmed { border-left-color: var(--green); }
.inter-item.status-pending,
.inter-item.status-reserved  { border-left-color: var(--amber); }
.inter-item.status-realise   { border-left-color: var(--teal); }
.inter-item.status-proposition,
.inter-item.status-draft,
.inter-item.status-done      { border-left-color: var(--text-hint); }
.inter-item.status-cancelled { border-left-color: var(--red); }
.inter-item-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.inter-item-meta  { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.inter-item-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Calendar */
.calendar-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav-btn { width: 30px; height: 30px; border: 1px solid var(--border-md); border-radius: var(--radius-sm); background: var(--surface); font-size: 18px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.week-nav-btn:hover { background: var(--blue-light); color: var(--blue); }
.week-label { font-size: 15px; font-weight: 700; min-width: 200px; text-align: center; }
.today-btn { padding: 5px 12px; font-size: 12px; }
.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid transparent; margin-bottom: 12px; }
.alert-danger  { background: var(--red-light);  color: var(--red);   border-color: #f5c6c6; }
.alert-warning { background: var(--amber-light); color: #9a4e00;     border-color: #fddba8; }
.alert-info    { background: var(--blue-light);  color: var(--blue);  border-color: #b3d4f0; }
.alert-success { background: var(--green-light); color: var(--green); border-color: #b8dfb8; }

/* Modals */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.72); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: min(100%, 640px); max-width: 96vw; height: auto; max-height: 94vh; min-height: 220px; min-width: 320px; display: flex; flex-direction: column; animation: slideUp .2s ease; resize: both; overflow: hidden; position: relative; }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.modal-sm  { width: min(100%, 440px); }
.modal-lg  { width: min(100%, 900px); }
.modal-xl  { width: min(100%, 1200px); }
/* Plus large pour les modals a onglets complexes (profil tech etc.) */
#modal-tech-profile .modal-box,
#modal-new-inter .modal-box,
#modal-calendar-import .modal-box { width: min(100%, 1100px); max-height: 94vh; }
/* Poignee de redimensionnement visible en bas-droit */
.modal-box::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 14px; height: 14px; background: linear-gradient(135deg, transparent 45%, var(--border-md) 46%, var(--border-md) 56%, transparent 57%, transparent 75%, var(--border-md) 76%, var(--border-md) 86%, transparent 87%); pointer-events: none; opacity: .55; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; background: var(--bg); border: none; border-radius: 50%; font-size: 14px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .15s; }
.modal-close:hover { background: var(--red-light); color: var(--red); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; justify-content: flex-end; }
/* Permettre aux contenus directs non-headers/footers de defiler si trop grands */
.modal-box > *:not(.modal-header):not(.modal-footer) { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* ── Scrollbar visible globale pour toutes les zones scrollables ── */
.modal-body::-webkit-scrollbar,
.modal-box > *:not(.modal-header):not(.modal-footer)::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track,
.modal-box > *:not(.modal-header):not(.modal-footer)::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb,
.modal-box > *:not(.modal-header):not(.modal-footer)::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 4px; border: 2px solid var(--surface); }
.modal-body::-webkit-scrollbar-thumb:hover,
.modal-box > *:not(.modal-header):not(.modal-footer)::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.modal-body, .modal-box > *:not(.modal-header):not(.modal-footer) { scrollbar-width: thin; scrollbar-color: var(--border-md) transparent; }
.modal-box > .modal-header,
.modal-box > .modal-footer { flex: 0 0 auto; }
/* Mobile : desactiver resize (utilite limitee, gere nativement) */
@media (max-width: 768px) {
  .modal-box { resize: none; width: 100% !important; max-width: 100% !important; height: auto; max-height: 94vh; }
  .modal-box::after { display: none; }
}

/* Toast — discret, bas-droite */
#toast-container { position: fixed; bottom: 20px; right: 20px; top: auto; z-index: 9999; display: flex; flex-direction: column; gap: 7px; pointer-events: none; max-width: 300px; }
.toast { background: var(--text); color: #fff; border-radius: var(--radius); padding: 9px 13px; font-size: 12.5px; font-weight: 500; box-shadow: 0 4px 14px rgba(0,0,0,.16); animation: toastIn .22s ease; pointer-events: all; display: flex; align-items: center; gap: 9px; opacity: .97; }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:.97; transform:translateY(0); } }
/* le JS applique soit ".success" soit ".toast-success" — on couvre les deux */
.toast.success, .toast-success { background: var(--green); }
.toast.error,   .toast-error   { background: var(--red); }
.toast.warn,    .toast-warn    { background: var(--amber); }
.toast.info,    .toast-info    { background: var(--blue); }

/* Spinner */
.spinner { width: 28px; height: 28px; border: 3px solid var(--border-md); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 48px 20px; gap: 10px; text-align: center; }
.empty-icon  { font-size: 40px; opacity: .35; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text-muted); }
.empty-text  { font-size: 13px; color: var(--text-hint); }

/* Planning calendar */
#planning-calendar, #planning-month-calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }

/* PWA */
.pwa-install-banner { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--blue); color: #fff; padding: 10px 16px; font-size: 13px; z-index: 800; align-items: center; gap: 10px; }
.pwa-install-banner.visible { display: flex; }
.pwa-install-banner button  { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.close-banner { background: none !important; border: none !important; font-size: 18px !important; padding: 0 !important; opacity: .7; }

/* Detail panel */
.detail-panel { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.detail-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.detail-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-hint); margin-bottom: 12px; }
.detail-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row-icon  { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.detail-row-label { font-size: 12px; color: var(--text-muted); }
.detail-row-value { font-size: 13px; font-weight: 500; }

/* Mobile bottom nav — caché bureau */
.mobile-bottom-nav { display: none; }
.mobile-fab        { display: none; }

/* ════ RESPONSIVE MOBILE ════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .app-layout { flex-direction: column; }
  .main-area { height: 100%; padding-bottom: calc(60px + var(--safe-bottom)); }
  .page-content { padding: 12px 14px; }

  .mobile-bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: calc(60px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 8px rgba(0,0,0,.08); z-index: 200; padding-bottom: var(--safe-bottom); }
  .mobile-nav-items { display: flex; width: 100%; align-items: stretch; }
  .mobile-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 4px 4px; font-size: 10px; font-weight: 600; color: var(--text-hint); background: none; border: none; cursor: pointer; transition: color .15s; }
  .mobile-nav-item svg { width: 22px; height: 22px; }
  .mobile-nav-item.active { color: var(--blue); }
  .mobile-nav-item.active svg { stroke: var(--blue); }

  .mobile-fab { display: flex; position: fixed; bottom: calc(72px + var(--safe-bottom)); right: 16px; width: 56px; height: 56px; border-radius: 50%; background: var(--blue); color: #fff; border: none; box-shadow: 0 6px 20px rgba(0,71,127,.45); align-items: center; justify-content: center; z-index: 250; cursor: pointer; transition: transform .15s; animation: fabPulse 2.6s ease-in-out infinite; }
  .mobile-fab:active { transform: scale(.93); animation: none; }
  @keyframes fabPulse { 0%,100% { box-shadow: 0 6px 20px rgba(0,71,127,.45); } 50% { box-shadow: 0 6px 26px rgba(0,71,127,.6), 0 0 0 6px rgba(37,99,235,.12); } }
  @media (prefers-reduced-motion: reduce) { .mobile-fab { animation: none; } }

  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 15px; }
  .topbar-search { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value  { font-size: 22px; }

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

  .modal-box { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; margin: 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  /* P1-F : footer sticky sur mobile — le bouton Créer/Enregistrer reste visible */
  .modal-box .modal-footer { position: sticky; bottom: 0; background: var(--surface); z-index: 2; box-shadow: 0 -2px 8px rgba(0,0,0,.08); }

  .tabs { gap: 0; }
  .tab  { padding: 8px 12px; font-size: 12px; }

  .desktop-only { display: none !important; }
}

/* ════ P2-E : Breakpoint tablette 768-1024px ════ */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .sidebar { width: var(--sidebar-w); }
  .page-content { padding: 14px 16px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-box { max-width: 96vw; }
  .form-row { grid-template-columns: 1fr 1fr; }
}

/* ════ P2-E : WCAG min-height 44px sur boutons cibles tactiles ════ */
@media (max-width: 1024px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .mobile-nav-item { min-height: 44px; }
  .form-select, .form-input { min-height: 44px; }
}

/* ════ MODALE NOUVELLE INTERVENTION — grille 2 colonnes ════ */
.ni-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 700px) { .ni-grid { grid-template-columns: 1fr; } .ni-grid > div { grid-column: auto !important; } }

/* ════ ALIASES COMPATIBILITÉ (classes existantes dans app.js) ════ */
.user-avatar { width: 36px; height: 36px; border-radius: var(--r-md); background: linear-gradient(135deg, #0ea5e9, #0284c7); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.user-role { font-size: 11px; color: rgba(255,255,255,.45); }
.btn-logout { background: none; border: none; color: rgba(255,255,255,.5); padding: 6px; border-radius: 6px; transition: all .15s; }
.btn-logout:hover { color: #f87171; background: rgba(255,68,68,.15); }
.btn-logout svg { display: block; }

.search-input { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 13px; background: var(--slate-50); color: var(--text); outline: none; width: 200px; transition: all .15s; font-family: var(--font-sans); }
.search-input:focus { border-color: var(--brand-600); background: #fff; box-shadow: 0 0 0 3px rgba(0,71,127,.08); }

.dark-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 14px; cursor: pointer; color: var(--text-muted); transition: all .15s; }
.dark-toggle:hover { background: var(--bg); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Nav badge (ancien) */
.nav-badge { background: var(--red); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 100px; margin-left: auto; }

/* Config container */
#config-container .config-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; }
#config-container .config-section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* Frais */
.frais-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.frais-item:last-child { border-bottom: none; }
.frais-item:hover { background: #f8fafc; }

/* ── Animations ── */
@keyframes gp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}
.gp-pulse { animation: gp-pulse 2s cubic-bezier(.4,0,.6,1) infinite; }

@keyframes gp-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gp-fade-up { animation: gp-fade-up .35s ease-out both; }

/* Global scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.5); }

/* Monospace numbers */
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* Dark mode (toggle) */
body.dark-mode { --bg: #0f172a; --surface: #1e293b; --text: #e2e8f0; --text-muted: #94a3b8; --text-hint: #64748b; --border: #334155; --border-md: #475569; --sidebar-bg: #020817; }
body.dark-mode .form-input, body.dark-mode .form-select, body.dark-mode .form-textarea { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark-mode thead tr { background: #1e293b; }
body.dark-mode tr:hover td { background: #1e293b; }
body.dark-mode .search-input { background: #1e293b; color: #e2e8f0; }

/* ── T48 (2026-05-22) : correctifs dark mode — éléments à fond clair codé en dur ── */
body.dark-mode { background: var(--bg); }
body.dark-mode .main-area,
body.dark-mode .page-content,
body.dark-mode .main-content { background: var(--bg); }
body.dark-mode .kpi-card { background: var(--surface); border-color: var(--border); }
body.dark-mode .inter-item:hover,
body.dark-mode .frais-item:hover { background: var(--surface); }
body.dark-mode .topbar-search input:focus,
body.dark-mode .search-input:focus { background: var(--surface); color: var(--text); }
/* Boutons par défaut/secondaires uniquement — on ne touche pas aux variantes colorées (R8/contraste) */
body.dark-mode .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-secondary):not(.btn-ghost) {
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset;
}

