:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --border: #e6e8f0;
  --border-strong: #d8dbe6;
  --text: #171a2b;
  --text-muted: #6b7280;
  --text-faint: #9aa1b4;
  --accent: #6d43e8;
  --accent-dark: #5228c4;
  --accent-light: #8b63f2;
  --accent-soft: #f1ebfe;
  --accent-ring: rgba(109, 67, 232, 0.16);
  --danger: #dc3545;
  --danger-dark: #b8202f;
  --danger-soft: #fdeceb;
  --success: #1f9d55;
  --success-soft: #e9f9ee;
  --sidebar-bg: #12152a;
  --sidebar-bg-2: #191d38;
  --sidebar-bg-hover: #23274a;
  --sidebar-border: rgba(255, 255, 255, 0.07);
  --sidebar-text: #9aa1cc;
  --sidebar-text-active: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(18, 21, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(18, 21, 42, 0.06), 0 1px 2px rgba(18, 21, 42, 0.04);
  --shadow-md: 0 10px 28px -6px rgba(18, 21, 42, 0.14), 0 2px 8px rgba(18, 21, 42, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(18, 21, 42, 0.22), 0 4px 12px rgba(18, 21, 42, 0.06);
  --shadow-sidebar: 4px 0 24px rgba(10, 12, 25, 0.18);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 244px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

html { scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b9bfd1; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14.5px;
  line-height: 1.5;
}

::selection { background: var(--accent-soft); color: var(--accent-dark); }

a { color: var(--accent); text-decoration: none; transition: color 0.12s var(--ease); }
a:hover { color: var(--accent-dark); text-decoration: underline; }

h1, h2, h3 { font-weight: 680; letter-spacing: -0.015em; color: var(--text); }
p { line-height: 1.55; }

/* ---------- Voir en tant que ---------- */

.viewas-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, #fef3d8, #fdecc2);
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid #f3dca3;
}

.viewas-banner form { margin: 0; }

.viewas-banner button {
  background: #b45309;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  margin: 0;
  box-shadow: none;
}

.viewas-banner button:hover { background: #93400a; transform: none; }

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg) 55%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1.35rem 0.9rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
  box-shadow: var(--shadow-sidebar);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.3rem 0.5rem 1.6rem;
}
.brand-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 55%, var(--accent-dark));
  color: #fff;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(109, 67, 232, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex: 0 0 32px;
}
.brand-name { color: #fff; font-weight: 700; letter-spacing: -0.01em; font-size: 0.98rem; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #565c86;
  padding: 0.9rem 0.7rem 0.35rem;
}
.nav-group-label:first-child { padding-top: 0.1rem; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.58rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 520;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.nav-item:hover { background: var(--sidebar-bg-hover); color: #fff; text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(109, 67, 232, 0.28), rgba(109, 67, 232, 0.14));
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.9rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  box-shadow: 0 0 10px rgba(139, 99, 242, 0.7);
}
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.9; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.5rem 0.15rem;
  border-top: 1px solid var(--sidebar-border);
  margin-top: 0.65rem;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), #e4d9fd);
  color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.76rem;
  font-weight: 750;
  flex: 0 0 34px;
  box-shadow: inset 0 0 0 1.5px rgba(109, 67, 232, 0.18);
}
.user-info { flex: 1; min-width: 0; }
.user-name { color: #fff; font-size: 0.82rem; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 0.71rem; color: var(--sidebar-text); }
.logout-link { color: var(--sidebar-text); flex: 0 0 auto; padding: 0.35rem; border-radius: 7px; transition: background 0.12s var(--ease), color 0.12s var(--ease); display: flex; }
.logout-link:hover { color: #fff; background: var(--sidebar-bg-hover); }
.logout-link .nav-icon { width: 17px; height: 17px; }

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar-mobile {
  display: none;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-mobile-title { font-weight: 650; }
.sidebar-burger { display: flex; flex-direction: column; gap: 4px; cursor: pointer; padding: 0.3rem; }
.sidebar-burger span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
.sidebar-toggle-checkbox { display: none; }
.sidebar-scrim { display: none; }

.content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}
.content-auth { max-width: none; padding: 0; }

@media (max-width: 880px) {
  .sidebar {
    position: fixed;
    left: -100%;
    transition: left 0.22s var(--ease);
  }
  .sidebar-toggle-checkbox:checked ~ .app-shell .sidebar,
  #sidebar-toggle:checked ~ .app-shell .sidebar { left: 0; }
  .topbar-mobile { display: flex; }
  .sidebar-scrim {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,12,25,0.45);
    backdrop-filter: blur(1px);
    z-index: 15;
  }
  #sidebar-toggle:checked ~ .sidebar-scrim { display: block; }
  .content { padding: 1.25rem 1.1rem 2rem; }
}

/* ---------- Auth pages ---------- */

.auth-box {
  max-width: 380px;
  margin: 4rem auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.35rem 2.1rem;
  position: relative;
  overflow: hidden;
}
.auth-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-light), var(--accent), var(--accent-dark));
}
.auth-box h1 { font-size: 1.35rem; margin: 0 0 0.35rem; }
.auth-box p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0; }

/* ---------- Forms ---------- */

label { display: block; font-size: 0.81rem; font-weight: 630; color: var(--text-muted); margin-bottom: 0.34rem; margin-top: 1.1rem; }
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:hover, select:hover, textarea:hover { border-color: #c3c8d8; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-ring);
}
textarea { min-height: 84px; resize: vertical; }

.field-hint { font-size: 0.78rem; color: var(--text-muted); margin: 0.35rem 0 0; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.62rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 630;
  cursor: pointer;
  margin-top: 1.4rem;
  transition: filter 0.12s var(--ease), transform 0.08s var(--ease), box-shadow 0.12s var(--ease);
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(82, 40, 196, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
button:hover, .btn:hover { filter: brightness(1.05); text-decoration: none; box-shadow: 0 4px 14px rgba(82, 40, 196, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
button:active, .btn:active { transform: translateY(1px); filter: brightness(0.97); }
button:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; box-shadow: none; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: #fafbfd; border-color: #c3c8d8; filter: none; box-shadow: var(--shadow-sm); }

/* ---------- Flash messages ---------- */

.flash {
  padding: 0.75rem 1rem 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.1rem;
  font-size: 0.87rem;
  font-weight: 550;
  border-left: 3px solid transparent;
  box-shadow: var(--shadow-xs);
}
.flash-error { background: var(--danger-soft); color: var(--danger-dark); border-left-color: var(--danger); }
.flash-success { background: var(--success-soft); color: #146c3b; border-left-color: var(--success); }

/* ---------- Page structure ---------- */

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.7rem; gap: 1rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 1.5rem; }

.breadcrumb { display: flex; align-items: center; gap: 0.45rem; font-size: 0.81rem; margin-bottom: 0.65rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-faint); }
.breadcrumb-current { color: var(--text); font-weight: 630; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.7rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.16s var(--ease);
}
.panel h2 { font-size: 1.02rem; margin: 0 0 1.1rem; display: flex; align-items: center; gap: 0.55rem; letter-spacing: -0.01em; }
.panel h2::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: linear-gradient(135deg, var(--accent-light), var(--accent)); flex: 0 0 9px; }

/* ---------- Stage stepper ---------- */

.panel-stepper { padding: 1rem 1.1rem; }
.stage-rejet-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  color: var(--danger);
  font-weight: 600;
}

.stage-rejet-action { margin-top: 0.75rem; }

.btn-text-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-weight: 620;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  margin: 0;
  box-shadow: none;
}

.btn-text-danger:hover { text-decoration: underline; background: none; filter: none; box-shadow: none; }

.btn-text {
  background: none;
  border: none;
  color: var(--accent-dark);
  font-weight: 620;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  margin: 0;
  box-shadow: none;
}

.btn-text:hover { text-decoration: underline; background: none; filter: none; box-shadow: none; }

.stage-phase-group { margin-bottom: 1.15rem; }
.stage-phase-group:last-child { margin-bottom: 0; }

.stage-phase-label {
  font-size: 0.7rem;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.stage-phase-current .stage-phase-label { color: var(--accent-dark); }
.stage-phase-done .stage-phase-label { color: var(--success); }
.stage-phase-upcoming { opacity: 0.5; }

.stage-stepper { display: flex; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stage-step {
  flex: 1 0 132px;
  border: none;
  background: #eef0f5;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  padding: 0.78rem 1.4rem 0.78rem 1.8rem;
  margin: 0;
  margin-right: -14px;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
  transition: filter 0.12s var(--ease);
}
.stage-step:first-child {
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
  padding-left: 1.2rem;
}
.stage-step:last-child { margin-right: 0; }
.stage-step:hover { filter: brightness(0.94); }
.stage-step-done { color: #fff; opacity: 0.72; }
.stage-step-current { color: #fff; z-index: 2; position: relative; box-shadow: 0 3px 10px rgba(18, 21, 42, 0.18); }
.stage-color-slate   { background: #94a3b8; }
.stage-color-blue    { background: #3b82f6; }
.stage-color-indigo  { background: #6366f1; }
.stage-color-violet  { background: #a855f7; }
.stage-color-amber   { background: #f59e0b; }
.stage-color-green   { background: #22c55e; }
.stage-color-teal    { background: #14b8a6; }
.stage-color-cyan    { background: #06b6d4; }
.stage-color-emerald { background: #10b981; }
.stage-color-red     { background: var(--danger); }

/* ---------- Stat tiles ---------- */

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.1rem; margin-bottom: 1.6rem; }
.stat-tile {
  position: relative;
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  color: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.stat-tile::after {
  content: '';
  position: absolute;
  top: -40%; right: -20%;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 70%);
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-tile .stat-label { font-size: 0.79rem; font-weight: 630; opacity: 0.92; margin-bottom: 0.35rem; letter-spacing: 0.005em; }
.stat-tile .stat-value { font-size: 2.05rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat-tile-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.stat-tile-orange { background: linear-gradient(135deg, #c2410c, #f59e0b); }
.stat-tile-green  { background: linear-gradient(135deg, #15803d, #22c55e); }
.stat-tile-red    { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.stat-tile-violet { background: linear-gradient(135deg, #5228c4, #8b63f2); }

/* ---------- Counters & filters ---------- */

.kanban-count {
  background: #e3e6f0;
  color: var(--text);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.71rem;
  font-weight: 720;
  display: inline-block;
  vertical-align: middle;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.filter-bar select { width: auto; min-width: 200px; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.87rem; }
table th {
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--text-muted);
  font-weight: 700;
  background: #fafbfd;
  border-bottom: 1px solid var(--border-strong);
}
table tbody tr { transition: background 0.1s var(--ease); }
table tbody tr:hover { background: #f8f7fe; }
table thead th a { color: inherit; }
table thead th a:hover { color: var(--accent); text-decoration: none; }
.row-link { cursor: pointer; }

.planning-date-row td {
  background: #fafbfd;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.5rem 0.6rem;
}
.planning-date-row-today td { color: var(--accent); }
.planning-date-row-passee td { color: #b8b6c4; }

.planning-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.planning-vue-tabs { display: flex; gap: 0.3rem; background: #f1f2f7; border-radius: var(--radius-sm); padding: 0.2rem; }
.planning-vue-tab { padding: 0.4rem 0.9rem; border-radius: calc(var(--radius-sm) - 2px); font-size: 0.84rem; font-weight: 600; color: var(--text-muted); }
.planning-vue-tab:hover { color: var(--text); text-decoration: none; }
.planning-vue-tab-active { background: #fff; color: var(--accent-dark); box-shadow: var(--shadow-xs); }
.planning-periode-nav { display: flex; align-items: center; gap: 0.5rem; }
.planning-periode-nav .btn-secondary { display: inline-flex; align-items: center; padding: 0.4rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 600; }
.planning-periode-label { font-size: 1rem; margin: 0 0 1rem; text-transform: capitalize; }

.calendar-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; min-width: 900px; }
.calendar-weekday { background: #fafbfd; padding: 0.5rem 0.6rem; font-size: 0.71rem; text-transform: uppercase; letter-spacing: 0.045em; color: var(--text-muted); font-weight: 700; }
.calendar-day { background: #fff; min-height: 96px; padding: 0.4rem; display: flex; flex-direction: column; gap: 0.2rem; }
.calendar-day-hors-mois { background: #fafbfd; }
.calendar-day-hors-mois .calendar-day-number { color: var(--text-faint); }
.calendar-day-today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day-number { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.15rem; }
.calendar-day-semaine { min-height: 200px; }

.planning-chip {
  display: block;
  white-space: normal;
  text-align: left;
  font-size: 0.71rem;
  line-height: 1.25;
  padding: 0.14rem 0.4rem;
}
.planning-chip-equipe { display: block; font-size: 0.65rem; font-weight: 600; opacity: 0.85; }
.planning-chip-ref { display: block; font-size: 0.63rem; font-weight: 500; opacity: 0.75; }
.calendar-day-semaine .planning-chip { font-size: 0.76rem; }
.calendar-day-semaine .planning-chip-ref { font-size: 0.68rem; }
.planning-chip-plus { font-size: 0.71rem; color: var(--text-muted); font-weight: 600; }
.planning-chip-plus:hover { color: var(--accent); }
.planning-chip-vide { font-size: 0.78rem; color: var(--text-faint); }
.planning-chip-meteo { margin-right: 0.2rem; }

.planning-scroll-hint { display: none; }

@media (max-width: 720px) {
  .planning-nav { flex-direction: column; align-items: stretch; }
  .planning-vue-tabs { justify-content: center; }
  .planning-periode-nav { justify-content: center; }
  .planning-scroll-hint { display: block; font-size: 0.78rem; color: var(--text-muted); text-align: center; margin: 0 0 0.6rem; }
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }

.activity-item { border-bottom: 1px solid var(--border); padding: 0.72rem 0; font-size: 0.86rem; }
.activity-item:last-child { border-bottom: none; }
.activity-item .meta { color: var(--text-muted); font-size: 0.74rem; margin-bottom: 0.15rem; }

.badge { display: inline-block; padding: 0.22rem 0.68rem; border-radius: 999px; font-size: 0.73rem; font-weight: 680; background: var(--accent-soft); color: var(--accent-dark); white-space: nowrap; border: 1px solid rgba(0,0,0,0.03); }
.badge-slate   { background: #eef0f4; color: #475569; }
.badge-blue    { background: #e5edff; color: #2563eb; }
.badge-indigo  { background: #eae7fd; color: #4f46e5; }
.badge-violet  { background: #f2e9fe; color: #7c3aed; }
.badge-amber   { background: #fef3d8; color: #b45309; }
.badge-green   { background: #e1f6e8; color: #16a34a; }
.badge-teal    { background: #d9f5f0; color: #0d9488; }
.badge-cyan    { background: #d9f4f8; color: #0891b2; }
.badge-emerald { background: #d9f7ea; color: #059669; }
.badge-red     { background: var(--danger-soft); color: var(--danger); }
.badge-yellow  { background: #fdf6d8; color: #a16207; }
.badge-pink    { background: #fce7f3; color: #be185d; }

/* Puces d'étapes de checklist (dossiers) — chaque étape garde sa propre
   couleur en continu ; seul le remplissage change avec le statut :
   contour neutre = à faire, badge (couleur douce) = en cours, plein = terminé. */
.etape-chip-form { display: inline-block; margin: 0 0.35rem 0.35rem 0; }
.etape-chip { display: inline-flex; align-items: center; padding: 0.32rem 0.78rem; border-radius: 999px; font-size: 0.77rem; font-weight: 680; white-space: nowrap; border: none; cursor: pointer; font-family: inherit; transition: filter 0.12s var(--ease), transform 0.08s var(--ease); }
.etape-chip:hover { filter: brightness(0.96); }
.etape-chip:active { transform: translateY(1px); }
.etape-chip-todo { background: #f1f3f6; color: #8a93a3; border: 1.5px dashed #c7ccd6; }
.etape-chip-solid-slate   { background: #64748b; color: #fff; }
.etape-chip-solid-blue    { background: #2563eb; color: #fff; }
.etape-chip-solid-indigo  { background: #4f46e5; color: #fff; }
.etape-chip-solid-violet  { background: #7c3aed; color: #fff; }
.etape-chip-solid-amber   { background: #b45309; color: #fff; }
.etape-chip-solid-green   { background: #16a34a; color: #fff; }
.etape-chip-solid-teal    { background: #0d9488; color: #fff; }
.etape-chip-solid-cyan    { background: #0891b2; color: #fff; }
.etape-chip-solid-emerald { background: #059669; color: #fff; }
.etape-chip-solid-red     { background: #dc2626; color: #fff; }
.etape-chip-solid-yellow  { background: #a16207; color: #fff; }
.etape-chip-solid-pink    { background: #be185d; color: #fff; }

/* Mini puces non cliquables (liste transversale des dossiers) */
.etape-dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; margin: 0 3px 3px 0; }
.etape-dot-todo { background: #e4e7ec; border: 1.5px dashed #c7ccd6; }
.etape-dot-slate,.etape-dot-solid-slate     { background: #94a3b8; }
.etape-dot-blue,.etape-dot-solid-blue       { background: #3b82f6; }
.etape-dot-indigo,.etape-dot-solid-indigo   { background: #6366f1; }
.etape-dot-violet,.etape-dot-solid-violet   { background: #9c6bff; }
.etape-dot-amber,.etape-dot-solid-amber     { background: #f59e0b; }
.etape-dot-green,.etape-dot-solid-green     { background: #22c55e; }
.etape-dot-teal,.etape-dot-solid-teal       { background: #14b8a6; }
.etape-dot-cyan,.etape-dot-solid-cyan       { background: #22d3ee; }
.etape-dot-emerald,.etape-dot-solid-emerald { background: #34d399; }
.etape-dot-red,.etape-dot-solid-red         { background: #ef4444; }
.etape-dot-yellow,.etape-dot-solid-yellow   { background: #eab308; }
.etape-dot-pink,.etape-dot-solid-pink       { background: #ec4899; }
.etape-dot-solid-slate,.etape-dot-solid-blue,.etape-dot-solid-indigo,.etape-dot-solid-violet,.etape-dot-solid-amber,.etape-dot-solid-green,.etape-dot-solid-teal,.etape-dot-solid-cyan,.etape-dot-solid-emerald,.etape-dot-solid-red,.etape-dot-solid-yellow,.etape-dot-solid-pink { border: 1.5px solid rgba(0,0,0,0.15); }
.etape-dot-slate,.etape-dot-blue,.etape-dot-indigo,.etape-dot-violet,.etape-dot-amber,.etape-dot-green,.etape-dot-teal,.etape-dot-cyan,.etape-dot-emerald,.etape-dot-red,.etape-dot-yellow,.etape-dot-pink { opacity: 0.45; }

.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.5rem; flex: 0 0 9px; }
.status-dot-slate   { background: #94a3b8; }
.status-dot-blue    { background: #3b82f6; }
.status-dot-indigo  { background: #6366f1; }
.status-dot-violet  { background: #a855f7; }
.status-dot-amber   { background: #f59e0b; }
.status-dot-green   { background: #22c55e; }
.status-dot-teal    { background: #14b8a6; }
.status-dot-cyan    { background: #06b6d4; }
.status-dot-emerald { background: #10b981; }
.status-dot-red     { background: var(--danger); }

/* ---------- Autocomplete ---------- */

.autocomplete-wrapper { position: relative; }
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 30;
}
.autocomplete-item {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--accent-soft); }
.autocomplete-item strong { display: block; color: var(--text); }
.autocomplete-item span { display: block; color: var(--text-muted); font-size: 0.75rem; margin-top: 0.1rem; }

/* ---------- Facture ---------- */

.facture-document { font-size: 0.92rem; }
.facture-entete { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; line-height: 1.5; }
.facture-titre { text-align: right; }
.facture-titre h2::before { content: none; }
.facture-titre p { margin: 0.2rem 0; color: var(--text-muted); }
.facture-destinataire { line-height: 1.5; margin-bottom: 1.5rem; }
.facture-totaux { margin-top: 1rem; text-align: right; line-height: 1.8; }
.facture-totaux .facture-ttc { font-size: 1.15rem; margin-top: 0.4rem; }
.facture-mentions { font-size: 0.76rem; color: var(--text-muted); margin-top: 1.5rem; line-height: 1.5; }


/* ---------- Contrat ---------- */

.contrat-document { font-size: 0.92rem; line-height: 1.6; }
.contrat-document h1 { text-align: center; font-size: 1.3rem; margin-bottom: 1.25rem; }
.contrat-document h3 { margin-top: 1.25rem; }
.contrat-document table.tarif { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.contrat-document table.tarif th { background: var(--accent-soft, #f1ebfe); color: var(--accent); text-align: left; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.contrat-document table.tarif td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.contrat-document table.signatures { width: 100%; border-collapse: collapse; margin-top: 2rem; }
.contrat-document table.signatures td { width: 50%; vertical-align: top; padding: 0.75rem; border: 1px solid var(--border); }


/* ---------- Choix du type de dossier ---------- */

.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.type-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.3rem 1.45rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), border-color 0.14s var(--ease);
}
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.type-card-label { font-size: 1.05rem; font-weight: 720; color: var(--text); }
.type-card-meta { font-size: 0.77rem; font-weight: 630; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.type-card-slate   { border-left-color: #475569; }
.type-card-blue    { border-left-color: #2563eb; }
.type-card-indigo  { border-left-color: #4f46e5; }
.type-card-violet  { border-left-color: #7c3aed; }
.type-card-amber   { border-left-color: #b45309; }
.type-card-green   { border-left-color: #16a34a; }
.type-card-teal    { border-left-color: #0d9488; }
.type-card-cyan    { border-left-color: #0891b2; }
.type-card-emerald { border-left-color: #059669; }
.type-card-red     { border-left-color: var(--danger); }
.type-card-yellow  { border-left-color: #a16207; }
.type-card-pink    { border-left-color: #be185d; }

/* ---------- Tuiles de synthèse (aperçu live création dossier) ---------- */

.summary-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1.5rem; }
.summary-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid #475569;
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.14s var(--ease);
}
.summary-tile:hover { box-shadow: var(--shadow-sm); }
.summary-tile-label { font-size: 0.69rem; font-weight: 720; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 0.28rem; }
.summary-tile-value { font-size: 1.08rem; font-weight: 720; color: var(--text); letter-spacing: -0.01em; }
.summary-tile-slate   { border-top-color: #475569; }
.summary-tile-blue    { border-top-color: #2563eb; }
.summary-tile-indigo  { border-top-color: #4f46e5; }
.summary-tile-violet  { border-top-color: #7c3aed; }
.summary-tile-amber   { border-top-color: #b45309; }
.summary-tile-green   { border-top-color: #16a34a; }
.summary-tile-teal    { border-top-color: #0d9488; }
.summary-tile-cyan    { border-top-color: #0891b2; }
.summary-tile-emerald { border-top-color: #059669; }
.summary-tile-red     { border-top-color: var(--danger); }
.summary-tile-yellow  { border-top-color: #a16207; }
.summary-tile-pink    { border-top-color: #be185d; }

/* ---------- Vue scindée : liste des dossiers + formulaire ---------- */

.dossier-split { display: flex; gap: 1.5rem; align-items: flex-start; }
.dossier-split-sidebar {
  flex: 0 0 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  position: sticky;
  top: 1rem;
  box-shadow: var(--shadow-xs);
}
.dossier-split-sidebar h3 { font-size: 0.85rem; margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.4rem; }
.dossier-split-main { flex: 1; min-width: 0; }
.dossier-mini-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s var(--ease);
}
.dossier-mini-item:hover { background: var(--accent-soft); text-decoration: none; }
.dossier-mini-item strong { display: block; font-size: 0.85rem; }
.dossier-mini-item span { display: block; font-size: 0.76rem; color: var(--text-muted); }
.dossier-mini-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 0.35rem; flex: 0 0 9px; }
.dossier-mini-dot-slate   { background: #475569; }
.dossier-mini-dot-blue    { background: #2563eb; }
.dossier-mini-dot-indigo  { background: #4f46e5; }
.dossier-mini-dot-violet  { background: #7c3aed; }
.dossier-mini-dot-amber   { background: #b45309; }
.dossier-mini-dot-green   { background: #16a34a; }
.dossier-mini-dot-teal    { background: #0d9488; }
.dossier-mini-dot-cyan    { background: #0891b2; }
.dossier-mini-dot-emerald { background: #059669; }
.dossier-mini-dot-red     { background: var(--danger); }
.dossier-mini-dot-yellow  { background: #a16207; }
.dossier-mini-dot-pink    { background: #be185d; }

/* ---------- Barre de progression d'un parcours (CEE / MPR) ---------- */

.parcours-progress { margin-bottom: 1rem; }
.parcours-progress:last-child { margin-bottom: 0; }
.parcours-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.parcours-progress-label { font-weight: 700; font-size: 0.86rem; }
.parcours-progress-track { height: 9px; border-radius: 999px; background: #eef0f4; overflow: hidden; }
.parcours-progress-fill { height: 100%; border-radius: 999px; transition: width 0.3s var(--ease); }
.parcours-progress-fill-slate { background: #94a3b8; }
.parcours-progress-fill-amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.parcours-progress-fill-green { background: linear-gradient(90deg, #16a34a, #4ade80); }
.parcours-progress-next { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }
.parcours-progress-done { color: #16a34a; font-weight: 650; }

/* ---------- Cartes dossiers (liste Dossiers) ---------- */

.dossier-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.dossier-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: box-shadow 0.16s var(--ease), transform 0.12s var(--ease);
}
.dossier-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.dossier-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.dossier-card-ref { font-weight: 720; font-size: 0.98rem; }
.dossier-card-client { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }
.dossier-card-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.dossier-card-progress { display: flex; flex-direction: column; gap: 0.7rem; padding-top: 0.2rem; }
.dossier-card-progress-empty { font-size: 0.79rem; color: var(--text-faint); }
.dossier-card-actions { display: flex; align-items: center; gap: 0.75rem; font-size: 0.79rem; margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--border); flex-wrap: wrap; }

.statut-nav-group { font-size: 0.69rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 720; margin: 1.1rem 0 0.35rem; padding: 0 0.4rem; }
.statut-nav-group:first-of-type { margin-top: 1rem; }
.statut-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 520;
  transition: background 0.1s var(--ease);
}
.statut-nav-item:hover { background: var(--bg); text-decoration: none; }
.statut-nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 680; }
.statut-nav-item-label { display: flex; align-items: center; gap: 0.55rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Recherche globale ---------- */

.topbar-search-bar { max-width: 1200px; margin: 0 auto; padding: 1.15rem 2rem 0; }
.global-search { position: relative; max-width: 420px; }
.global-search-icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }
.global-search-input {
  width: 100%;
  padding: 0.58rem 2.8rem 0.58rem 2.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.global-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-ring);
}
.global-search-kbd {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.67rem;
  font-weight: 720;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08rem 0.4rem;
  pointer-events: none;
}
.global-search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: 30;
}
.global-search-group-label { padding: 0.55rem 0.9rem 0.2rem; font-size: 0.67rem; font-weight: 720; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.global-search-item { display: block; padding: 0.5rem 0.9rem; text-decoration: none; color: var(--text); }
.global-search-item:hover, .global-search-item.active { background: var(--accent-soft); text-decoration: none; }
.global-search-item strong { display: block; font-size: 0.86rem; font-weight: 660; }
.global-search-item span { display: block; font-size: 0.76rem; color: var(--text-muted); }
.global-search-empty { padding: 0.9rem; font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 880px) {
  .topbar-search-bar { padding: 0.75rem 1.1rem 0; }
  .global-search-kbd { display: none; }
}

/* ---------- Onglets (fiche chantier) ---------- */

.tab-radio { display: none; }
.tab-nav { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-label { padding: 0.72rem 1rem; font-size: 0.86rem; font-weight: 620; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none; transition: color 0.12s var(--ease), border-color 0.12s var(--ease); }
.tab-label:hover { color: var(--text); }
.tab-panel { display: none; }
#tab-info:checked ~ .tab-panels #panel-info,
#tab-administratif:checked ~ .tab-panels #panel-administratif,
#tab-planification:checked ~ .tab-panels #panel-planification,
#tab-financier:checked ~ .tab-panels #panel-financier,
#tab-documents:checked ~ .tab-panels #panel-documents,
#tab-journal:checked ~ .tab-panels #panel-journal {
  display: block;
}
#tab-info:checked ~ .tab-nav label[for=tab-info],
#tab-administratif:checked ~ .tab-nav label[for=tab-administratif],
#tab-planification:checked ~ .tab-nav label[for=tab-planification],
#tab-financier:checked ~ .tab-nav label[for=tab-financier],
#tab-documents:checked ~ .tab-nav label[for=tab-documents],
#tab-journal:checked ~ .tab-nav label[for=tab-journal] {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

@media (max-width: 900px) {
  .dossier-split { flex-direction: column; }
  .dossier-split-sidebar { flex: none; width: 100%; position: static; max-height: none; }
}
