/* ── RESET & TOKENS ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #c8d6ee;
  --surface: #e4eeff;
  --surface2: #d8e4f6;
  --border: rgba(80,110,195,.18);
  --text: #16213a;
  --text-muted: #4a5e80;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --danger: #ef4444;
  --green: #10b981;
  --blue: #3b82f6;
  --orange: #f59e0b;
  --purple: #8b5cf6;
  --red: #ef4444;
  --sidebar-w: 260px;
  --radius: 10px;
  --shadow: 0 1px 6px rgba(50,90,200,.10), 0 8px 28px rgba(50,90,200,.14);
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ── SCREENS ─────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ── LOGIN ───────────────────────────────────────────────────────────────── */
#screen-login {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.login-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}
.login-logo svg { width: 36px; height: 36px; }
.login-logo span { letter-spacing: -.5px; }

.login-box h2 { margin-bottom: 1.2rem; font-size: 1.1rem; color: var(--text-muted); font-weight: 500; }

.login-separator { text-align: center; color: var(--text-muted); margin: .8rem 0; font-size: .85rem; }

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */
#screen-app {
  min-height: 100vh;
  flex-direction: row;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 0 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .22s cubic-bezier(.4,0,.2,1);
}

/* ── Bouton toggle collapse ──────────────────────────────────────────────── */
#sb-toggle-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .22s cubic-bezier(.4,0,.2,1);
  opacity: .5;
}
#sb-toggle-btn:hover { background: var(--bg); opacity: 1; }
#sb-toggle-btn.sb-toggle-open svg { transform: rotate(180deg); }
#sb-toggle-btn svg { transition: transform .22s cubic-bezier(.4,0,.2,1); display: block; }

/* ── Mode réduit ─────────────────────────────────────────────────────────── */
#sidebar.sb-collapsed {
  width: 58px;
  min-width: 58px;
}
#sidebar.sb-collapsed .sb-logo-text,
#sidebar.sb-collapsed .sidebar-section-title,
#sidebar.sb-collapsed .sb-sec-toggle,
#sidebar.sb-collapsed .nav-item span:not(.nav-alert-badge),
#sidebar.sb-collapsed .dark-toggle-label,
#sidebar.sb-collapsed .user-info,
#sidebar.sb-collapsed .btn-logout {
  opacity: 0;
  pointer-events: none;
  width: 0; overflow: hidden;
}
#sidebar.sb-collapsed .nav-item {
  justify-content: center;
  padding: .48rem;
  position: relative;
}
#sidebar.sb-collapsed .nav-item svg {
  width: 19px; height: 19px;
}
#sidebar.sb-collapsed .sidebar-nav {
  padding: 0 .35rem;
}
#sidebar.sb-collapsed .sidebar-section-title {
  height: 0; padding: 0; margin: 0;
}
#sidebar.sb-collapsed .sidebar-logo {
  justify-content: center;
  padding: 0 0 1.2rem;
}
#sidebar.sb-collapsed .sidebar-logo > svg:first-child { display: none; }

#sidebar.sb-collapsed .sidebar-bottom {
  justify-content: center;
  padding: .8rem .35rem;
}
#sidebar.sb-collapsed .user-avatar {
  margin: 0;
}
#sidebar.sb-collapsed .dark-toggle-btn {
  justify-content: center;
  padding: .48rem;
}
#sidebar.sb-collapsed #sb-toggle-btn {
  display: flex;
  margin: 0 auto;
  opacity: .75;
}

/* Tooltip au survol en mode réduit */
#sidebar.sb-collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: #1e293b;
  color: #fff;
  font-size: .78rem;
  font-weight: 500;
  padding: .3rem .65rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
#sidebar.sb-collapsed .nav-item:hover::after {
  opacity: 1;
}

/* Bouton expand flottant sur le bord quand collapsed */
#sidebar.sb-collapsed::after {
  content: '›';
  position: absolute;
  right: -12px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
  z-index: 20;
  line-height: 22px; text-align: center;
  pointer-events: none;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.2rem 1.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: .6rem;
}
.sidebar-logo svg { width: 30px; height: 30px; }

.sidebar-section-title {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .08em;
  padding: .6rem 1.2rem .2rem;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .6rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .45rem .8rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: .85rem;
  transition: all .15s;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: #eef2ff; color: var(--primary); }

.sidebar-bottom {
  flex-shrink: 0;
  padding: .8rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.user-card { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .75rem; color: var(--text-muted); }

.btn-logout {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: .4rem; border-radius: 6px;
}
.btn-logout:hover { background: var(--bg); color: var(--danger); }
.btn-logout svg { width: 16px; height: 16px; display: block; }

/* ── MAIN ────────────────────────────────────────────────────────────────── */
#main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.8rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: .75rem;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,.04);
}
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: -.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

#view-container { padding: 1.8rem; flex: 1; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 8px; border: none;
  font-size: .88rem; font-weight: 600; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.hidden { display: none !important; }

/* ── FORMS ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border .15s;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px #6366f120; }
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-row .flex-2 { flex: 2; }

/* ── CHIPS ───────────────────────────────────────────────────────────────── */
.chip {
  display: inline-block; padding: .2rem .6rem;
  border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.chip-todo     { background: #f1f5f9; color: #64748b; }
.chip-progress { background: #dbeafe; color: #1d4ed8; }
.chip-done     { background: #dcfce7; color: #166534; }
.chip-blocked  { background: #fee2e2; color: #991b1b; }

.priority-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
}
.pri-low      { background: #94a3b8; }
.pri-medium   { background: var(--blue); }
.pri-high     { background: var(--orange); }
.pri-critical { background: var(--red); }

.status-picker { display: flex; gap: .6rem; flex-wrap: wrap; }
.status-opt { cursor: pointer; }
.status-opt input { display: none; }
.status-opt input:checked + .chip { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── MINI AVATAR ─────────────────────────────────────────────────────────── */
.mini-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  color: #fff; font-size: .65rem; font-weight: 700; flex-shrink: 0;
}
.mini-avatar.sm { width: 26px; height: 26px; font-size: .7rem; }
.mini-avatar.lg { width: 36px; height: 36px; font-size: .85rem; }

/* ── STATS ───────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  border-left: 4px solid transparent;
  box-shadow: var(--shadow);
}
.accent-indigo { border-color: var(--primary); }
.accent-green  { border-color: var(--green); }
.accent-blue   { border-color: var(--blue); }
.accent-red    { border-color: var(--red); }
.accent-orange { border-color: var(--orange); }
.accent-purple { border-color: var(--purple); }

.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

.progress-bar-wrap {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border-radius: var(--radius);
  padding: 1rem 1.4rem; margin-bottom: 1.5rem; box-shadow: var(--shadow);
}
.progress-label { font-size: .88rem; font-weight: 600; white-space: nowrap; }
.progress-track {
  flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden;
}
.progress-track.sm { height: 6px; width: 80px; flex: none; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }
.progress-pct { font-size: .88rem; font-weight: 700; color: var(--primary); white-space: nowrap; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 1.2rem 1.4rem; box-shadow: var(--shadow); }
.panel-title { font-size: .88rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

.bar-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.bar-label { width: 60px; font-size: .82rem; }
.bar-track { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.bar-fill.pri-low { background: #94a3b8; }
.bar-fill.pri-medium { background: var(--blue); }
.bar-fill.pri-high { background: var(--orange); }
.bar-fill.pri-critical { background: var(--red); }
.bar-count { font-size: .82rem; font-weight: 600; width: 20px; text-align: right; }

.recent-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .5rem 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.recent-row:last-child { border: none; }
.recent-row:hover .recent-title { color: var(--primary); }
.recent-title { flex: 1; font-size: .88rem; }
.recent-date { font-size: .78rem; color: var(--text-muted); }

/* ── KANBAN ──────────────────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
}

.kanban-col {
  background: var(--bg);
  border-radius: var(--radius);
  padding: .8rem;
  border-top: 3px solid transparent;
}
.col-todo     { border-color: #94a3b8; }
.col-progress { border-color: var(--blue); }
.col-done     { border-color: var(--green); }
.col-blocked  { border-color: var(--red); }

.kanban-col-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .8rem; font-weight: 700; font-size: .9rem;
}
.col-count {
  background: var(--surface); border-radius: 99px;
  padding: .1rem .5rem; font-size: .78rem; font-weight: 700;
}

.kanban-cards { display: flex; flex-direction: column; gap: .6rem; }
.empty-col { text-align: center; color: var(--text-muted); font-size: .82rem; padding: 1.5rem 0; }

/* ── TASK CARD ───────────────────────────────────────────────────────────── */
.task-card {
  background: var(--surface);
  border-radius: 8px;
  padding: .8rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  border: 1px solid var(--border);
}
.task-card:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.task-card-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.task-card-title { font-weight: 600; font-size: .9rem; flex: 1; }
.task-card-desc { font-size: .82rem; color: var(--text-muted); margin-bottom: .6rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-card-footer { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.due-date { font-size: .75rem; color: var(--text-muted); margin-left: auto; }
.due-date.overdue { color: var(--red); font-weight: 600; }
.comment-count { font-size: .75rem; color: var(--text-muted); }

/* ── LIST ────────────────────────────────────────────────────────────────── */
.list-filters {
  display: flex; gap: .8rem; margin-bottom: 1rem; align-items: center;
}
.list-filters input { flex: 1; padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.list-filters select { padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.list-filters input:focus, .list-filters select:focus { outline: none; border-color: var(--primary); }

.list-table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-table { width: 100%; border-collapse: collapse; }
.list-table thead tr { background: var(--bg); }
.list-table th {
  padding: .7rem 1rem; text-align: left; font-size: .78rem;
  font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
}
.list-row { border-top: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.list-row:hover { background: #f8f9ff; }
.list-table td { padding: .75rem 1rem; font-size: .88rem; }
.task-title-cell { font-weight: 600; }
.pri-label { margin-left: .4rem; font-size: .82rem; }
.empty { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ── CALENDAR ────────────────────────────────────────────────────────────── */
.calendar-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.4rem; border-bottom: 1px solid var(--border);
  font-size: 1rem; font-weight: 700;
}

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.cal-head {
  text-align: center; padding: .6rem; font-size: .78rem;
  font-weight: 700; color: var(--text-muted); background: var(--bg);
}
.cal-cell {
  min-height: 90px; padding: .4rem; border: 1px solid var(--border);
  vertical-align: top; position: relative;
}
.cal-cell.empty { background: var(--bg); }
.cal-cell.today { background: #eef2ff; }
.cal-day { font-size: .82rem; font-weight: 600; display: block; margin-bottom: .3rem; }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-task {
  font-size: .72rem; padding: .15rem .4rem; border-radius: 4px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; color: var(--text);
}
.cal-task.pri-low      { background: #f1f5f9; }
.cal-task.pri-medium   { background: #dbeafe; }
.cal-task.pri-high     { background: #fef3c7; }
.cal-task.pri-critical { background: #fee2e2; }
.cal-more { font-size: .7rem; color: var(--text-muted); }

/* ── TEAMS (legacy, conservé pour compatibilité admin) ───────────────────── */
.teams-wrap { display: flex; flex-direction: column; gap: 1.5rem; }
.team-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.team-header { background: linear-gradient(135deg, var(--primary), var(--purple)); color: #fff; padding: 1rem 1.4rem; }
.team-name { font-size: 1rem; font-weight: 700; }
.team-leader { font-size: .82rem; opacity: .85; margin-top: .2rem; }
.team-members { padding: .6rem 0; }
.member-row { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.4rem; border-bottom: 1px solid var(--border); }
.member-row:last-child { border: none; }
.member-info { flex: 1; }
.member-name { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.member-stats { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.member-progress { display: flex; align-items: center; gap: .5rem; }

/* ── TEAMS NEW DESIGN ────────────────────────────────────────────────────── */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
.tcard {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow .2s, transform .2s;
}
.tcard:hover { box-shadow: 0 8px 32px rgba(0,0,0,.13); transform: translateY(-2px); }
.tcard-top {
  padding: 1.1rem 1.3rem;
  display: flex; align-items: center; gap: .9rem;
  color: #fff;
}
.tcard-avatar {
  width: 46px; height: 46px; border-radius: 11px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 800; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.tcard-head-info { flex: 1; min-width: 0; }
.tcard-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.tcard-leader { font-size: .78rem; opacity: .82; margin-top: 3px; }
.tcard-rate-badge {
  font-size: 1.2rem; font-weight: 800;
  background: rgba(255,255,255,.22);
  padding: .28rem .65rem; border-radius: 9px;
  letter-spacing: -.02em; flex-shrink: 0;
}
.tcard-progress-wrap { padding: 0 1.3rem; background: var(--surface); }
.tcard-prog-track { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: -2px; }
.tcard-prog-fill { height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.tcard-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: center; gap: .25rem;
}
.tcard-kpi { display: flex; flex-direction: column; gap: 1px; }
.tcard-kpi-val { font-size: 1.2rem; font-weight: 700; line-height: 1.1; }
.tcard-kpi-lbl { font-size: .67rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.tcard-members { padding: .5rem .7rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.tmember-row {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .45rem; border-radius: 9px;
  transition: background .12s; cursor: default;
}
.tmember-row:hover { background: var(--bg); }
.tmember-info { flex: 1; min-width: 0; }
.tmember-name { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmember-right { display: flex; flex-direction: column; align-items: flex-end; gap: .28rem; flex-shrink: 0; }
.tmember-chips { display: flex; gap: .25rem; }
.tchip {
  font-size: .68rem; font-weight: 700;
  padding: .1rem .38rem; border-radius: 99px; line-height: 1.5;
}
.tchip.blue  { background: #eff6ff; color: #2563eb; }
.tchip.green { background: #f0fdf4; color: #16a34a; }
.tchip.gray  { background: var(--bg); color: var(--text-muted); }
.tmember-bar-wrap { display: flex; align-items: center; gap: .35rem; }
.tmember-pct { font-size: .72rem; color: var(--text-muted); min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.tcard-empty-members { font-size: .83rem; color: var(--text-muted); text-align: center; padding: .75rem .5rem; }

/* Dark mode overrides */
body.dark .tchip.blue  { background: rgba(37,99,235,.18); color: #93c5fd; }
body.dark .tchip.green { background: rgba(22,163,74,.18);  color: #86efac; }
body.dark .tcard:hover { box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.role-badge {
  background: #eef2ff; color: var(--primary);
  font-size: .72rem; padding: .1rem .5rem; border-radius: 99px; font-weight: 600;
}

/* ── PROJECTS ────────────────────────────────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.project-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem; border: 1px solid var(--border);
}
.project-name { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; }
.project-meta { font-size: .78rem; color: var(--text-muted); margin-bottom: .8rem; }
.project-stats-row { display: flex; gap: 1rem; margin-bottom: .8rem; }
.project-stats-row span { font-size: .8rem; color: var(--text-muted); }
.project-completion { font-size: .8rem; color: var(--primary); font-weight: 600; margin-top: .4rem; }
.project-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; border: 2px dashed var(--border); color: var(--text-muted);
  min-height: 140px; gap: .5rem; transition: all .15s;
}
.project-add:hover { border-color: var(--primary); color: var(--primary); }
.add-icon { font-size: 2rem; line-height: 1; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box {
  position: relative; background: var(--surface); border-radius: 14px;
  padding: 1.8rem; width: 480px; max-width: calc(100vw - 2rem);
  box-shadow: 0 24px 64px rgba(0,0,0,.2); max-height: 90vh; overflow-y: auto;
}
.modal-large { width: 680px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.btn-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); padding: .2rem; border-radius: 4px; }
.btn-close:hover { background: var(--bg); }
.modal-body { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.4rem; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid var(--border); }
.modal-box h3 { margin-bottom: 1.2rem; font-size: 1.05rem; }

/* ── COMMENTS ────────────────────────────────────────────────────────────── */
.comments-list { background: var(--bg); border-radius: 8px; padding: .8rem; margin-bottom: .6rem; max-height: 180px; overflow-y: auto; }
.comment { display: flex; gap: .7rem; margin-bottom: .8rem; }
.comment:last-child { margin-bottom: 0; }
.comment strong { font-size: .85rem; }
.comment-date { font-size: .75rem; color: var(--text-muted); }
.comment-input { display: flex; gap: .6rem; }
.comment-input input { flex: 1; }

/* ── ADMIN PANEL ─────────────────────────────────────────────────────────── */
.admin-kpi-row {
  display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.admin-kpi {
  background: var(--surface); border-radius: var(--radius);
  padding: .9rem 1.2rem; flex: 1; min-width: 100px;
  box-shadow: var(--shadow); border-left: 3px solid var(--border);
}
.kpi-val   { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.kpi-label { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

.admin-tabs {
  display: flex; gap: .3rem; margin-bottom: 1.2rem;
  background: var(--bg); padding: .3rem; border-radius: 10px;
  width: fit-content;
}
.admin-tab {
  padding: .45rem 1.1rem; border: none; border-radius: 8px;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-muted); transition: all .15s;
}
.admin-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.admin-toolbar {
  display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.admin-search { flex: 1; min-width: 200px; padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.admin-search:focus { outline: none; border-color: var(--primary); }
.admin-filter-sel { padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.toolbar-count { font-size: .9rem; color: var(--text-muted); font-weight: 600; margin-right: auto; }

/* Admin users table */
.admin-users-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-users-table thead tr { background: var(--bg); }
.admin-users-table th {
  padding: .7rem 1rem; text-align: left; font-size: .75rem;
  font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
}
.admin-user-row { border-top: 1px solid var(--border); transition: background .1s; }
.admin-user-row:hover { background: #f8f9ff; }
.admin-users-table td { padding: .75rem 1rem; font-size: .88rem; vertical-align: middle; }
.user-cell { display: flex; align-items: center; gap: .7rem; }
.user-cell-name { font-weight: 600; }
.user-cell-email { font-size: .76rem; color: var(--text-muted); }
.role-badge-lg { padding: .25rem .7rem; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.team-tag { background: #f1f5f9; color: #475569; padding: .2rem .6rem; border-radius: 6px; font-size: .78rem; }
.text-muted { color: var(--text-muted); }
.user-task-mini { display: flex; gap: .3rem; align-items: center; }
.utask-chip { padding: .15rem .4rem; border-radius: 4px; font-size: .75rem; font-weight: 700; }
.utask-chip.done     { background: #dcfce7; color: #166534; }
.utask-chip.progress { background: #dbeafe; color: #1d4ed8; }
.utask-chip.total    { background: var(--bg); color: var(--text-muted); }
.row-actions { display: flex; gap: .3rem; }
.btn-icon {
  background: none; border: none; cursor: pointer; font-size: .9rem;
  padding: .25rem .4rem; border-radius: 5px; transition: background .1s;
}
.btn-icon:hover { background: var(--bg); }
.btn-icon.danger:hover { background: #fee2e2; }
.empty-small { font-size: .82rem; color: var(--text-muted); padding: .5rem; }

/* Admin teams grid */
.admin-teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.admin-team-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--border); }
.atc-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.atc-name { font-weight: 700; font-size: .95rem; }
.atc-actions { display: flex; gap: .2rem; }
.atc-meta { display: flex; gap: 1rem; padding: .6rem 1.2rem; font-size: .8rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.atc-progress { display: flex; align-items: center; gap: .7rem; padding: .6rem 1.2rem; }
.atc-progress span { font-size: .8rem; font-weight: 700; color: var(--primary); }
.atc-members { padding: .4rem .8rem .8rem; }
.atc-member {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem .4rem; border-radius: 6px; cursor: pointer; transition: background .1s;
}
.atc-member:hover { background: var(--bg); }
.atc-member-name { flex: 1; font-size: .85rem; font-weight: 500; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 3rem; text-align: center; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; }

/* User modal role picker */
.user-avatar-preview-wrap { display: flex; justify-content: center; margin-bottom: .5rem; }
.user-avatar-preview {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem; font-weight: 800;
  background: #e2e8f0; transition: background .2s;
}

.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.role-opt input { display: none; }
.role-opt-box {
  border: 2px solid var(--border); border-radius: 10px; padding: .8rem;
  cursor: pointer; transition: all .15s; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
}
.role-opt-box svg { width: 22px; height: 22px; color: var(--text-muted); }
.role-opt-box span { font-weight: 600; font-size: .88rem; }
.role-opt-box small { font-size: .75rem; color: var(--text-muted); }
.role-opt:hover .role-opt-box { border-color: var(--primary); background: #eef2ff; }
.role-opt.selected .role-opt-box { border-color: var(--primary); background: #eef2ff; }
.role-opt.selected .role-opt-box svg { color: var(--primary); }
.role-opt input:checked + .role-opt-box { border-color: var(--primary); background: #eef2ff; }
.role-opt input:checked + .role-opt-box svg { color: var(--primary); }

/* Team modal member checkboxes */
.members-checkboxes { display: flex; flex-direction: column; gap: .4rem; max-height: 220px; overflow-y: auto; padding: .4rem; background: var(--bg); border-radius: 8px; }
.member-check {
  display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem;
  border-radius: 6px; cursor: pointer; transition: background .1s;
}
.member-check:hover { background: var(--surface); }
.member-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.member-check span:nth-child(3) { flex: 1; font-size: .88rem; font-weight: 500; }

/* ── TOPBAR BACK BUTTON ──────────────────────────────────────────────────── */
.btn-back { display: inline-flex; align-items: center; gap: .3rem; margin-right: .6rem; }
.btn-back svg { width: 14px; height: 14px; }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* ── CLIENTS TOOLBAR & GRID ──────────────────────────────────────────────── */
.clients-toolbar { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; }
.clients-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }

.client-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 1.2rem; cursor: pointer; transition: transform .1s, box-shadow .1s;
  display: flex; flex-direction: column; gap: .8rem;
}
.client-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.1); }

.client-card-top { display: flex; align-items: center; gap: .8rem; }
.client-logo {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .9rem; font-weight: 800;
}
.client-card-info { flex: 1; min-width: 0; }
.client-card-name { font-weight: 700; font-size: 1rem; }
.client-card-contact { font-size: .8rem; color: var(--text-muted); }
.client-card-actions { display: flex; gap: .2rem; flex-shrink: 0; }

.client-card-details { display: flex; flex-wrap: wrap; gap: .4rem; }
.client-detail-chip { font-size: .78rem; color: var(--text-muted); background: var(--bg); padding: .2rem .6rem; border-radius: 6px; }

.client-card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
.client-teams-row { display: flex; flex-wrap: wrap; gap: .3rem; }
.client-proj-count { font-size: .78rem; color: var(--text-muted); font-weight: 600; }

/* ── CLIENT EXTRANET ─────────────────────────────────────────────────────── */
.ce-wrap { display: flex; flex-direction: column; gap: 1.4rem; }

/* Hero */
.ce-hero {
  display: flex; align-items: center; gap: 1.4rem;
  background: var(--surface); border-radius: var(--radius);
  padding: 1.6rem 2rem; box-shadow: var(--shadow);
}
.ce-hero-left  { display: flex; align-items: flex-start; gap: 1.2rem; flex: 1; }
.ce-hero-actions { display: flex; gap: .6rem; flex-shrink: 0; }
.ce-logo {
  width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.2rem; font-weight: 800;
}
.ce-client-name { font-size: 1.5rem; font-weight: 800; line-height: 1.1; margin-bottom: .4rem; }
.ce-contact-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .4rem; }
.ce-contact-chip {
  font-size: .8rem; color: var(--text-muted);
  background: var(--bg); padding: .2rem .6rem; border-radius: 6px;
}
.ce-contact-chip a { color: var(--primary); text-decoration: none; }
.ce-contact-chip a:hover { text-decoration: underline; }
.ce-teams-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }

/* KPI row */
.ce-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .8rem;
}
.ce-kpi {
  background: var(--surface); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
  border-top: 3px solid var(--kc, var(--border));
  text-align: center;
}
.ce-kpi-alert  { background: #fffbeb; border-top-color: #f59e0b; }
.ce-kpi-urgent { background: #fef2f2; border-top-color: #ef4444; animation: pulse-alert 2s infinite; }
@keyframes pulse-alert { 0%,100%{opacity:1} 50%{opacity:.8} }
.ce-kpi-icon { font-size: 1.3rem; margin-bottom: .3rem; }
.ce-kpi-val  { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.ce-kpi-label { font-size: .72rem; color: var(--text-muted); margin-top: .2rem; }

/* Alerts panel */
.ce-alerts-panel {
  background: #fffbeb; border-radius: var(--radius);
  border: 1px solid #fde68a; box-shadow: var(--shadow); overflow: hidden;
}
.ce-alerts-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1.2rem; background: #fef3c7; border-bottom: 1px solid #fde68a;
}
.ce-alerts-title { font-weight: 700; font-size: .95rem; }
.ce-alerts-count { font-size: .82rem; font-weight: 700; color: #92400e; background: #fde68a; padding: .15rem .6rem; border-radius: 99px; }
.ce-alerts-list { padding: .4rem; display: flex; flex-direction: column; gap: .3rem; }

.ce-alert-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1rem; border-radius: 8px; cursor: pointer; transition: background .1s;
}
.ce-alert-escalade { background: #fef2f2; }
.ce-alert-escalade:hover { background: #fee2e2; }
.ce-alert-overdue  { background: #fffbeb; }
.ce-alert-overdue:hover  { background: #fef3c7; }
.ce-alert-blocked  { background: #f5f3ff; }
.ce-alert-blocked:hover  { background: #ede9fe; }

.ce-alert-badge {
  white-space: nowrap; font-size: .75rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 6px; flex-shrink: 0;
}
.ce-alert-badge.escalade { background: #fee2e2; color: #991b1b; }
.ce-alert-badge.overdue  { background: #fef3c7; color: #92400e; }
.ce-alert-badge.blocked  { background: #ede9fe; color: #5b21b6; }

.ce-alert-body { flex: 1; min-width: 0; }
.ce-alert-task { font-weight: 600; font-size: .9rem; display: block; }
.ce-alert-note { font-size: .8rem; color: var(--text-muted); }
.ce-alert-meta { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; font-size: .78rem; color: var(--text-muted); }
.ce-alert-date { font-size: .75rem; color: var(--text-muted); }

/* Main 3-col grid */
.ce-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1fr;
  gap: 1.2rem;
  align-items: start;
}
.ce-row-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

/* Panel */
.ce-panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden;
}
.ce-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.ce-panel-title { font-size: .9rem; font-weight: 700; }
.ce-badge {
  background: var(--border); color: var(--text-muted);
  font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px;
}
.ce-sub-header { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: .6rem 1.2rem .2rem; }
.ce-done-header { color: #10b981; }
.ce-more { font-size: .78rem; color: var(--text-muted); padding: .4rem 1.2rem; }

/* Project rows in panel */
.ce-project-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--border);
}
.ce-project-row:last-child { border: none; }
.ce-project-main { flex: 1; min-width: 0; }
.ce-project-name  { font-weight: 600; font-size: .9rem; }
.ce-project-stats { font-size: .78rem; color: var(--text-muted); margin: .2rem 0; }
.text-danger { color: var(--red); font-weight: 600; }
.text-green  { color: var(--green); font-weight: 600; }
.ce-project-progress { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; }
.ce-project-progress .progress-track { flex: 1; }
.ce-project-progress span { font-size: .75rem; font-weight: 700; color: var(--primary); }

.pst-chip { font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 6px; white-space: nowrap; flex-shrink: 0; }
.pst-done    { background: #dcfce7; color: #166534; }
.pst-active  { background: #dbeafe; color: #1d4ed8; }
.pst-blocked { background: #fee2e2; color: #991b1b; }
.pst-planned { background: #f1f5f9; color: #475569; }

/* Task rows */
.ce-task-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .75rem 1.2rem; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .1s;
}
.ce-task-row:last-child { border: none; }
.ce-task-row:hover { background: #f8f9ff; }
.ce-task-row.todo  { opacity: .85; }
.ce-task-body { flex: 1; min-width: 0; }
.ce-task-name { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-task-meta { font-size: .76rem; color: var(--text-muted); }
.ce-task-right { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex-shrink: 0; }
.ce-due { font-size: .75rem; color: var(--text-muted); }
.ce-due.overdue { color: var(--red); font-weight: 700; }
.escalade-dot { font-size: .75rem; }

/* Devis rows */
.ce-devis-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .1s;
}
.ce-devis-row:hover { background: #f8f9ff; }
.ce-devis-row:last-of-type { border: none; }
.ce-devis-left { flex: 1; min-width: 0; }
.ce-devis-num   { font-size: .75rem; font-weight: 700; color: var(--text-muted); letter-spacing: .05em; }
.ce-devis-title { font-weight: 600; font-size: .9rem; }
.ce-devis-validity { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.ce-devis-validity.expired { color: var(--red); }
.ce-devis-right { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex-shrink: 0; }
.ce-devis-amount { font-size: .95rem; font-weight: 800; }
.ce-devis-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: .7rem 1.2rem; background: var(--bg); font-size: .8rem; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Devis status chips */
.ce-devis-status { font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 6px; }
.ds-draft    { background: #f1f5f9; color: #475569; }
.ds-sent     { background: #dbeafe; color: #1d4ed8; }
.ds-progress { background: #fef3c7; color: #92400e; }
.ds-accepted { background: #dcfce7; color: #166534; }
.ds-refused  { background: #fee2e2; color: #991b1b; }

/* Info grid (custom fields) */
.ce-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1rem 1.2rem; }
.ce-info-field {}
.ce-info-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .2rem; }
.ce-info-value { font-size: .9rem; font-weight: 500; }
.ce-notes      { padding: 1rem 1.2rem; font-size: .9rem; line-height: 1.7; color: var(--text); }
.empty-state-sm { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.5rem; text-align: center; color: var(--text-muted); }

/* Escalation toggle in task modal */
.escalation-toggle { display: flex; align-items: center; }
.toggle-label { display: flex; align-items: center; gap: .7rem; cursor: pointer; font-size: .88rem; font-weight: 500; }
.toggle-label input { display: none; }
.toggle-track {
  width: 36px; height: 20px; background: var(--border); border-radius: 99px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-label input:checked ~ .toggle-track { background: var(--red); }
.toggle-label input:checked ~ .toggle-track .toggle-thumb { transform: translateX(16px); }

/* Responsive */
@media (max-width: 1100px) {
  .ce-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .ce-grid { grid-template-columns: 1fr; }
  .ce-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .ce-row-extra { grid-template-columns: 1fr; }
}

/* ── MODAL INNER TABS ────────────────────────────────────────────────────── */
.modal-inner-tabs {
  display: flex; gap: .2rem; padding: 0 1.8rem;
  border-bottom: 1px solid var(--border); margin: -.4rem 0 0;
}
.modal-tab {
  padding: .6rem 1rem; background: none; border: none; cursor: pointer;
  font-size: .88rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
}
.modal-tab:hover  { color: var(--text); }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.ctab-pane { display: flex; flex-direction: column; gap: 1rem; }
.ctab-pane.hidden { display: none; }
.ctab-hint { font-size: .82rem; color: var(--text-muted); background: #f8f9ff; padding: .6rem .8rem; border-radius: 8px; border-left: 3px solid var(--primary); }
.modal-xlarge { width: 740px; }

.client-avatar-preview-wrap { display: flex; align-items: flex-end; justify-content: center; padding-bottom: .4rem; }
.client-avatar-preview {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; font-weight: 800; background: #e2e8f0;
  transition: background .2s;
}

/* ── ADMIN FIELDS TAB ────────────────────────────────────────────────────── */
.fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }
.field-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1rem;
  box-shadow: var(--shadow);
}
.field-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.field-type-badge { background: #eef2ff; color: var(--primary); font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 4px; }
.field-label { font-weight: 700; font-size: .95rem; margin-bottom: .4rem; }
.field-options { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.field-opt-chip { background: var(--bg); font-size: .72rem; padding: .1rem .4rem; border-radius: 4px; color: var(--text-muted); }

/* ── MISC ────────────────────────────────────────────────────────────────── */
.overdue { color: var(--red); }
.pri-label { color: var(--text-muted); }

@media (max-width: 900px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kanban-board { grid-template-columns: 1fr; }
}


/* ── GANTT ─────────────────────────────────────────────────────────────────── */
.gantt-scroll { height: calc(100vh - 64px); overflow: auto; padding: 0; }

.gantt-labels {
  position: sticky; left: 0; z-index: 4;
  background: var(--surface); border-right: 2px solid var(--border);
}
.gantt-corner {
  position: sticky; top: 0; z-index: 6;
  background: var(--surface); border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 6px; padding: 0 14px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
}
.gantt-group-label {
  display: flex; align-items: center; padding: 0 14px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.gantt-task-label {
  display: flex; align-items: center; gap: 7px; padding: 0 12px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  font-size: .84rem; overflow: hidden; transition: background .1s;
}
.gantt-task-label:hover { background: rgba(99,102,241,.06); }
.gantt-lbl-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gantt-timeline-hdr {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface); border-bottom: 2px solid var(--border); overflow: hidden;
}
.gantt-week-lbl {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: .72rem; color: var(--text-muted); white-space: nowrap; pointer-events: none;
}
.gantt-today-hdr { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; }
.gantt-grid-v    { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); pointer-events: none; }
.gantt-today-line { position: absolute; top: 0; width: 2px; background: rgba(239,68,68,.35); pointer-events: none; z-index: 1; }

.gantt-group-strip { background: var(--bg); border-bottom: 1px solid var(--border); }
.gantt-bar-row {
  position: relative; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.gantt-bar-row:hover { background: rgba(99,102,241,.05); }
.gantt-bar {
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 24px; border-radius: 6px; padding: 0 10px;
  display: flex; align-items: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: filter .15s; z-index: 2; min-width: 28px;
}
.gantt-bar:hover { filter: brightness(1.12); }
.gantt-bar-txt {
  font-size: .72rem; color: #fff; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}

/* ── Notifications / Alertes ─────────────────────────────────────────────── */
.nav-alert-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  border-radius: 99px; text-align: center;
  pointer-events: none;
}

.notif-count-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  border-radius: 99px; text-align: center;
  pointer-events: none;
}

.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; max-height: 480px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 200; display: flex; flex-direction: column;
  overflow: hidden;
}
.notif-panel.hidden { display: none; }

.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--bg); flex-shrink: 0;
}
.notif-panel-title { font-weight: 700; font-size: .9rem; }

.notif-list {
  overflow-y: auto; flex: 1;
}
.notif-empty {
  padding: 2rem 1rem; text-align: center;
  color: var(--text-muted); font-size: .88rem;
}

.notif-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }

.notif-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; margin-top: 1px;
}
.notif-icon.overdue   { background: #fef2f2; }
.notif-icon.today     { background: #fff7ed; }
.notif-icon.tomorrow  { background: #fefce8; }
.notif-icon.escalated { background: #fef2f2; }

.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: .875rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-meta { font-size: .775rem; color: var(--text-muted); margin-top: 2px; }

.notif-tag {
  font-size: .7rem; font-weight: 700; padding: .15rem .45rem;
  border-radius: 4px; flex-shrink: 0; align-self: center;
}
.notif-tag.overdue   { background: #fee2e2; color: #991b1b; }
.notif-tag.today     { background: #ffedd5; color: #9a3412; }
.notif-tag.tomorrow  { background: #fef9c3; color: #854d0e; }
.notif-tag.escalated { background: #fee2e2; color: #991b1b; }

.notif-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  padding: .5rem 1rem .25rem; background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.btn-xs { padding: .2rem .4rem; font-size: .75rem; }

/* ── Global Search Ctrl+K ─────────────────────────────────────────────────── */
.search-trigger-btn {
  display: flex; align-items: center; gap: 6px;
  padding: .35rem .65rem; font-size: .82rem;
  color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: background .15s, color .15s;
}
.search-trigger-btn:hover { background: var(--bg); color: var(--text); }
.search-trigger-hint {
  font-size: .72rem; opacity: .6;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: .05rem .3rem;
}

.search-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  z-index: 9999; display: flex; align-items: flex-start;
  justify-content: center; padding-top: 10vh;
}
.search-overlay.hidden { display: none; }

.search-box {
  width: min(640px, 92vw);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
}

.search-input-wrap {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem; border-bottom: 1px solid var(--border);
}
.search-icon { opacity: .5; flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: transparent;
  font-size: 1rem; color: var(--text); outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-esc-hint {
  font-size: .7rem; color: var(--text-muted); opacity: .6;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: .1rem .35rem;
  flex-shrink: 0;
}

.search-results {
  max-height: 420px; overflow-y: auto;
}
.search-empty {
  padding: 2.5rem 1rem; text-align: center;
  color: var(--text-muted); font-size: .9rem;
}
.search-group-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  padding: .6rem 1rem .3rem; background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.search-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1rem; cursor: pointer;
  transition: background .1s; border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.active { background: var(--bg); }
.search-item-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.search-item-icon.task-icon     { background: #eff6ff; }
.search-item-icon.client-icon   { background: #f0fdf4; }
.search-item-icon.project-icon  { background: #faf5ff; }
.search-item-body { flex: 1; min-width: 0; }
.search-item-title {
  font-size: .875rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-item-title mark {
  background: #fef08a; border-radius: 2px; padding: 0 1px;
  font-weight: inherit; color: inherit;
}
.search-item-meta { font-size: .775rem; color: var(--text-muted); margin-top: 2px; }
.search-item-badge {
  font-size: .7rem; font-weight: 700; padding: .15rem .45rem;
  border-radius: 4px; flex-shrink: 0;
}
.search-footer {
  padding: .5rem 1rem; border-top: 1px solid var(--border);
  background: var(--bg); display: flex; gap: 1rem;
  font-size: .75rem; color: var(--text-muted);
}
.search-footer kbd {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 3px; padding: .05rem .3rem; font-size: .7rem;
}

/* ── Filtres avancés Liste & Gantt ────────────────────────────────────────── */
.list-filters {
  display: flex; gap: .6rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap;
}
.gantt-filter-bar {
  display: flex; gap: .6rem; padding: .75rem 1rem .5rem;
  border-bottom: 1px solid var(--border); background: var(--bg);
  flex-wrap: wrap; align-items: center;
}
.gantt-filter-bar select {
  padding: .4rem .7rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: .82rem; background: var(--surface);
  color: var(--text); cursor: pointer;
}
.gantt-filter-bar select:focus { outline: none; border-color: var(--primary); }

/* ── Modal tabs ───────────────────────────────────────────────────────────── */
.modal-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg); padding: 0 1rem; gap: 0; flex-shrink: 0;
}
.modal-tab {
  padding: .65rem 1rem; font-size: .85rem; font-weight: 500;
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; color: var(--text-muted); transition: all .15s;
  display: flex; align-items: center; gap: 5px;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.task-tab-panel { display: block; }
.task-tab-panel.hidden { display: none; }
.tab-badge {
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  border-radius: 99px; text-align: center;
}

/* ── Tags ─────────────────────────────────────────────────────────────────── */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; min-height: 36px;
}
.tag-input-wrap:focus-within { border-color: var(--primary); }
.tag-input-wrap input { border: none; background: transparent; outline: none; flex: 1; min-width: 80px; font-size: .875rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #ede9fe; color: #6d28d9; border-radius: 20px;
  padding: 2px 8px; font-size: .75rem; font-weight: 600;
}
.tag-chip-del { background: none; border: none; cursor: pointer; font-size: 13px; color: inherit; padding: 0; line-height: 1; }
.tag-chip-sm  { background: #ede9fe; color: #6d28d9; border-radius: 99px; padding: 1px 7px; font-size: .68rem; font-weight: 600; margin-right: 2px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }

/* ── Checklist ────────────────────────────────────────────────────────────── */
.checklist-list { padding: .5rem 0; }
.checklist-progress { display: flex; align-items: center; gap: 8px; margin-bottom: .5rem; padding: 0 .5rem; font-size: .8rem; color: var(--text-muted); }
.checklist-bar { height: 6px; background: var(--primary); border-radius: 3px; }
.checklist-progress { flex-wrap: wrap; }
.checklist-progress > div { height: 6px; background: var(--primary); border-radius: 3px; transition: width .3s; }
/* Override: wrap the bar in a track */
.checklist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .5rem; border-radius: 6px; gap: 8px;
}
.checklist-item:hover { background: var(--bg); }
.checklist-item label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; font-size: .875rem; }
.checklist-item.done label span { text-decoration: line-through; color: var(--text-muted); }
.checklist-add { display: flex; gap: 8px; padding: .5rem; border-top: 1px solid var(--border); margin-top: .25rem; }
.checklist-add input { flex: 1; padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 6px; font-size: .875rem; }
.checklist-add input:focus { outline: none; border-color: var(--primary); }
.cl-mini { font-size: .7rem; color: var(--text-muted); margin-left: 4px; padding: 1px 5px; background: var(--bg); border-radius: 4px; }

/* ── Time tracking ────────────────────────────────────────────────────────── */
.time-summary { padding: .5rem .5rem 0; }
.time-total { font-size: .95rem; font-weight: 700; color: var(--primary); }
.time-list { padding: .25rem 0; }
.time-entry {
  display: flex; align-items: center; gap: .75rem;
  padding: .4rem .5rem; border-radius: 6px;
}
.time-entry:hover { background: var(--bg); }
.time-amount { font-size: .9rem; font-weight: 700; color: var(--text); min-width: 50px; }
.time-meta { flex: 1; font-size: .78rem; color: var(--text-muted); }
.time-add-form {
  display: flex; gap: 6px; align-items: center;
  padding: .5rem; border-top: 1px solid var(--border); margin-top: .25rem; flex-wrap: wrap;
}
.time-add-form input { padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; }
.time-add-form input:focus { outline: none; border-color: var(--primary); }

/* ── Attachments ──────────────────────────────────────────────────────────── */
.attachments-list { padding: .25rem 0; }
.attachment-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .5rem; border-radius: 6px; border-bottom: 1px solid var(--border);
}
.attachment-item:last-child { border-bottom: none; }
.attachment-item:hover { background: var(--bg); }
.attachment-icon { font-size: 1.25rem; flex-shrink: 0; }
.attachment-body { flex: 1; min-width: 0; }
.attachment-name { font-size: .875rem; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.attachment-name:hover { text-decoration: underline; }
.attachment-meta { font-size: .75rem; color: var(--text-muted); }
.attachment-upload { display: flex; align-items: center; gap: .75rem; padding: .75rem .5rem; border-top: 1px solid var(--border); }
.upload-status { font-size: .82rem; color: var(--text-muted); }

/* ── Bulk actions ─────────────────────────────────────────────────────────── */
.bulk-action-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; margin-bottom: .75rem;
}
.bulk-count { font-size: .85rem; font-weight: 700; color: #1d4ed8; margin-right: .25rem; }
.list-csv-bar { display: flex; gap: .5rem; margin-bottom: .5rem; }

/* ── Activity feed ────────────────────────────────────────────────────────── */
.activity-feed { max-width: 740px; margin: 0 auto; padding: 1.5rem 1rem; }
.activity-day-header {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding: 1rem 0 .4rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem;
}
.activity-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .45rem 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
}
.activity-icon { font-size: 14px; flex-shrink: 0; }
.activity-body { flex: 1; font-size: .83rem; color: var(--text); }
.activity-entity { font-weight: 600; color: var(--primary); cursor: pointer; }
.activity-time { font-size: .72rem; color: var(--text-muted); flex-shrink: 0; }

/* ── Dashboard charts ─────────────────────────────────────────────────────── */
.chart-row { display: flex; align-items: center; gap: 1.5rem; padding: .75rem 0; }
.chart-legend { display: flex; flex-direction: column; gap: .4rem; }
.legend-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-item strong { margin-left: auto; font-size: .85rem; }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.field-hint { font-size: .75rem; color: var(--text-muted); margin-top: 3px; display: block; }

/* ── DARK MODE ─────────────────────────────────────────────────── */
body.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #6366f1;
  --topbar-bg: #1e293b;
  --input-bg: #1e293b;
  --input-border: #475569;
  --modal-bg: #1e293b;
  --chip-bg: #334155;
  --chip-text: #cbd5e1;
  --table-stripe: #243044;
}
body.dark .modal-overlay { background: rgba(0,0,0,.6); }
body.dark .btn-secondary { background: #334155; color: #f1f5f9; border-color: #475569; }
body.dark .btn-ghost { color: #94a3b8; }
body.dark input, body.dark select, body.dark textarea {
  background: var(--input-bg); border-color: var(--input-border); color: var(--text);
}
body.dark .card { background: var(--surface); border-color: var(--border); }
body.dark .topbar { background: var(--topbar-bg); border-color: var(--border); box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,.25); }
body.dark .sidebar { background: var(--sidebar-bg); }
body.dark .modal { background: var(--modal-bg); }
body.dark .search-overlay { background: rgba(0,0,0,.7); }
body.dark .search-box { background: var(--surface); }
body.dark .gantt-bar { opacity: .85; }
body.dark table thead { background: var(--surface2); }
body.dark table tr:nth-child(even) { background: var(--table-stripe); }

/* ── MOBILE ──────────────────────────────────────────────────────── */
#hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  font-size: 1.3rem;
  color: var(--text);
}
@media (max-width: 768px) {
  #hamburger { display: flex; align-items: center; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0; bottom: 0;
    z-index: 200;
    transition: left .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 199;
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0 !important; }
  .topbar { padding: .5rem .75rem; }
  .topbar-right { gap: .25rem; }
  .view-header { padding: .75rem 1rem; flex-wrap: wrap; gap: .5rem; }
  .view-container { padding: .75rem; }
  .modal { width: 96vw !important; max-width: none !important; margin: 2vw auto; }
  .task-row { flex-wrap: wrap; }
  .gantt-container { overflow-x: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .filter-bar { flex-wrap: wrap; gap: .4rem; }
  .filter-bar select, .filter-bar input { min-width: 0; flex: 1; }
  .bulk-action-bar { flex-wrap: wrap; gap: .4rem; padding: .5rem; }
  table { display: block; overflow-x: auto; }
}

/* ── UX IMPROVEMENTS ─────────────────────────────────────────── */

/* 1. Bordure priorité + hover tâche */
.list-row { transition: background .12s ease; }
.list-row:hover { background: var(--surface2, #f8fafc); }

/* 2. Actions rapides au survol */
.row-actions {
  display: flex; gap: .25rem;
  flex-shrink: 0;
}
.list-row .row-actions {
  opacity: 0; transition: opacity .15s;
}
.list-row:hover .row-actions { opacity: 1; }
.btn-row-action {
  background: none; border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px; cursor: pointer; padding: .18rem .38rem;
  font-size: .8rem; color: var(--text-muted, #64748b);
  transition: background .1s, color .1s, border-color .1s;
  line-height: 1;
}
.btn-row-action:hover { background: var(--surface2, #f1f5f9); color: var(--text, #1e293b); }
.btn-row-action.danger:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* 3. Chip statut cliquable */
.chip-clickable {
  cursor: pointer; transition: opacity .15s, transform .1s; user-select: none;
}
.chip-clickable:hover { opacity: .8; transform: scale(1.06); }

/* 4. Animations */
#view-container > * { animation: fadeInUp .18s ease both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal { animation: modalIn .2s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.btn { transition: background .12s, color .12s, box-shadow .12s, transform .08s; }
.btn:active { transform: scale(.97); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.nav-item { transition: background .12s, color .12s; }

/* 5. Export menu dropdown */
.export-menu { position: relative; }
.export-dropdown {
  position: absolute; right: 0; top: calc(100% + .4rem);
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 195px; z-index: 500; padding: .4rem;
  animation: fadeInUp .15s ease both;
}
.export-dropdown button {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .5rem .75rem; background: none; border: none;
  cursor: pointer; font-size: .88rem; color: var(--text, #1e293b);
  border-radius: 7px; text-align: left; transition: background .1s;
}
.export-dropdown button:hover { background: var(--surface2, #f8fafc); }

/* 6. Stat cards enrichies */
.stat-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px; padding: 1.4rem 1.5rem;
  display: flex; flex-direction: column; gap: .2rem;
  transition: box-shadow .15s, transform .15s; position: relative; overflow: hidden;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.stat-icon { font-size: 1.5rem; margin-bottom: .2rem; }
.stat-value { font-size: 2.1rem; font-weight: 700; line-height: 1; color: var(--text, #1e293b); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--text-muted, #64748b); text-transform: uppercase; letter-spacing: .04em; }
.stat-sub { font-size: .78rem; color: var(--text-muted, #94a3b8); margin-top: .1rem; }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 14px 14px 0 0;
}
.stat-card.accent-indigo::before { background: #6366f1; }
.stat-card.accent-green::before  { background: #10b981; }
.stat-card.accent-blue::before   { background: #3b82f6; }
.stat-card.accent-red::before    { background: #ef4444; }
.stat-card.accent-orange::before { background: #f97316; }
.stat-card.accent-purple::before { background: #8b5cf6; }

/* 7. États vides uniformes */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60vh; color: var(--text-muted, #64748b); text-align: center; gap: .5rem;
}
.empty-icon { font-size: 3.5rem; margin-bottom: .5rem; opacity: .7; }
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text, #1e293b); }
.empty-sub { font-size: .875rem; max-width: 320px; }

/* 8. Sidebar — indicateur actif + hover svg */
.nav-item.active { position: relative; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--primary, #6366f1); border-radius: 0 3px 3px 0;
}
.nav-item svg { transition: transform .15s; }
.nav-item:hover svg { transform: scale(1.12); }

/* 9. Quick-add */
.quick-add-row {
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem;
  cursor: pointer; color: var(--text-muted, #94a3b8); border-radius: 8px;
  transition: background .12s, color .12s; font-size: .9rem; margin-top: .25rem;
}
.quick-add-row:hover { background: var(--surface2, #f8fafc); color: var(--primary, #6366f1); }
.quick-add-icon { font-size: 1.1rem; font-weight: 600; width: 20px; text-align: center; }
.quick-add-form { padding: .4rem .5rem; }
.quick-add-form input {
  width: 100%; padding: .6rem .85rem; border: 2px solid var(--primary, #6366f1);
  border-radius: 8px; font-size: .95rem; background: var(--surface, #fff);
  color: var(--text, #1e293b); outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* ── PROJECTS PAGE ────────────────────────────────────────────── */
.projects-page { display: flex; flex-direction: column; gap: 2rem; padding: .5rem 0; }
.project-group { }
.project-group-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem 0 .75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 1rem;
}
.client-group-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.project-group-title {
  font-weight: 700; font-size: 1rem; color: var(--text, #1e293b);
}
.project-group-title.muted { color: var(--text-muted, #64748b); font-weight: 600; }
.project-group-title:hover { text-decoration: underline; }
.project-group-count {
  font-size: .78rem; color: var(--text-muted, #94a3b8);
  background: var(--surface2, #f1f5f9); border-radius: 20px;
  padding: .1rem .55rem; font-weight: 600;
}
.project-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
  margin-bottom: .25rem;
}
.project-url-btn {
  font-size: .95rem; text-decoration: none; flex-shrink: 0;
  opacity: .6; transition: opacity .15s;
}
.project-url-btn:hover { opacity: 1; }
.ce-projects-grid { margin-top: .75rem; }

/* ── CLIENT PROJECT CARDS (vue Projets) ───────────────────────── */
.cpc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: .5rem 0;
}
.cpc-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.cpc-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.09);
  transform: translateY(-2px);
}
.cpc-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1rem .75rem;
  background: var(--surface, #fff);
}
.cpc-avatar {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .95rem;
  flex-shrink: 0; letter-spacing: .02em;
}
.cpc-client-info { flex: 1; min-width: 0; }
.cpc-client-name {
  font-weight: 700; font-size: .97rem;
  color: var(--text, #1e293b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cpc-client-meta { font-size: .75rem; color: var(--text-muted, #94a3b8); margin-top: .1rem; }
.cpc-header-actions { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.cpc-global-progress {
  display: flex; align-items: center; gap: .5rem;
  padding: 0 1rem .6rem;
}
.cpc-global-pct { font-size: .75rem; font-weight: 600; color: var(--text-muted, #64748b); min-width: 32px; text-align: right; }
.cpc-projects { padding: 0 .75rem; flex: 1; border-top: 1px solid var(--border, #f1f5f9); }
.cpc-project-row {
  padding: .55rem .25rem;
  border-bottom: 1px solid var(--border, #f1f5f9);
}
.cpc-project-row:last-child { border-bottom: none; }
.cpc-project-info {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .3rem;
}
.cpc-project-name {
  font-size: .875rem; font-weight: 600;
  color: var(--text, #1e293b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cpc-project-bar {
  display: flex; align-items: center; gap: .5rem;
}
.cpc-pct { font-size: .72rem; color: var(--text-muted, #94a3b8); min-width: 28px; text-align: right; }
.cpc-tasks { font-size: .72rem; color: var(--text-muted, #94a3b8); min-width: 50px; text-align: right; }
.cpc-footer {
  display: flex; gap: .75rem; padding: .6rem 1rem;
  border-top: 1px solid var(--border, #f1f5f9);
  background: var(--surface2, #f8fafc);
}
.cpc-stat { font-size: .75rem; color: var(--text-muted, #64748b); }
.cpc-stat.active { color: #3b82f6; }
.cpc-stat.done   { color: #10b981; }
@media (max-width: 768px) { .cpc-grid { grid-template-columns: 1fr; } }

/* ── PROJECT ROW CLICKABLE ───────────────────────────────────── */
.cpc-project-row {
  cursor: pointer;
  transition: background .12s;
  border-radius: 6px;
  margin: 0 -.25rem;
  padding-left: .5rem !important;
  padding-right: .5rem !important;
}
.cpc-project-row:hover { background: var(--surface2, #f1f5f9); }
.cpc-arrow {
  font-size: 1rem; color: var(--text-muted, #94a3b8);
  transition: transform .15s, color .15s;
}
.cpc-project-row:hover .cpc-arrow { transform: translateX(3px); color: var(--primary, #6366f1); }
.cpc-task-chips { display: flex; gap: .25rem; flex-shrink: 0; }
.cpc-chip {
  font-size: .68rem; font-weight: 600; padding: .1rem .35rem;
  border-radius: 4px; white-space: nowrap;
}
.cpc-chip.blue  { background: #dbeafe; color: #1d4ed8; }
.cpc-chip.green { background: #dcfce7; color: #15803d; }
.cpc-chip.gray  { background: var(--surface2, #f1f5f9); color: var(--text-muted, #64748b); }


/* ═══════════════════════════════════════════════════════════════
   SMTP CONFIG TAB
═══════════════════════════════════════════════════════════════ */
.smtp-config-panel { padding: .5rem 0; }
.smtp-loading { color: var(--text-muted); padding: 2rem; text-align: center; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.smtp-spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.smtp-error { color: #ef4444; padding: 1.5rem; background: #fef2f2; border-radius: 8px; border: 1px solid #fecaca; }

.smtp-section { display: flex; flex-direction: column; gap: 1.4rem; }
.smtp-title { font-size: 1rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: .5rem; margin: 0; }

/* Type selector */
.smtp-type-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.smtp-type-opt { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; font-size: .88rem; color: var(--text-muted); transition: border-color .15s, background .15s, color .15s; user-select: none; }
.smtp-type-opt input { display: none; }
.smtp-type-opt:hover { border-color: var(--primary); color: var(--text); }
.smtp-type-opt.active { border-color: var(--primary); background: #eff6ff; color: var(--primary); font-weight: 600; }

/* Form blocks */
.smtp-form-block { border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; background: var(--surface, #fff); }
.smtp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.2rem; }
.smtp-wide { grid-column: span 1; }
.smtp-full { grid-column: span 2; }

/* Info box OAuth */
.smtp-info-box { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: .9rem 1.1rem; font-size: .84rem; line-height: 1.6; color: #0369a1; margin-bottom: 1rem; }
.smtp-info-box code { background: #e0f2fe; padding: .15rem .4rem; border-radius: 4px; font-size: .82rem; word-break: break-all; display: inline-block; margin-top: .3rem; }

/* OAuth row */
.smtp-oauth-row { display: flex; gap: .6rem; }
.smtp-oauth-row input { flex: 1; }

/* Badge refresh token */
.smtp-badge { font-size: .72rem; font-weight: 600; padding: .18rem .55rem; border-radius: 20px; margin-left: .4rem; vertical-align: middle; }
.smtp-badge.ok   { background: #dcfce7; color: #16a34a; }
.smtp-badge.warn { background: #fef3c7; color: #d97706; }

/* Test row */
.smtp-test-row { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.1rem; background: var(--surface2, #f8fafc); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.smtp-test-row input { flex: 0 0 220px; }
#smtp-test-result { font-size: .85rem; font-weight: 500; }

/* Actions */
.smtp-actions { display: flex; justify-content: flex-end; }

/* Dark mode */
.dark .smtp-type-opt.active { background: #1e3a5f; }
.dark .smtp-form-block { background: var(--surface); }
.dark .smtp-info-box { background: #0c2340; border-color: #1e4976; color: #7dd3fc; }
.dark .smtp-info-box code { background: #1e3a5f; }
.dark .smtp-test-row { background: var(--surface2); }

/* ── ALERT BANNER ───────────────────────────────────────────────────────── */
.alert-banner {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  padding: .55rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: .01em;
  border-bottom: 2px solid rgba(0,0,0,.15);
  transition: opacity .2s;
  user-select: none;
}
.alert-banner:hover { opacity: .88; }
.alert-banner.hidden { display: none !important; }
.alert-banner-warn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ── GANTT RESIZE HANDLE ──────────────────────────────────────────────── */
.gantt-resize-handle {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 8px;
  cursor: ew-resize;
  background: rgba(255,255,255,.3);
  border-radius: 0 4px 4px 0;
  transition: background .15s;
}
.gantt-resize-handle:hover { background: rgba(255,255,255,.6); }

/* ── PROJECT STATUS BADGE ─────────────────────────────────────────────── */
.proj-status-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 20px;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.proj-status-badge.late { background: #fee2e2; color: #b91c1c; }
.proj-status-badge.risk { background: #fef3c7; color: #b45309; }
.proj-status-badge.ok   { background: #d1fae5; color: #065f46; }
.dark .proj-status-badge.late { background: #450a0a; color: #fca5a5; }
.dark .proj-status-badge.risk { background: #451a03; color: #fcd34d; }
.dark .proj-status-badge.ok   { background: #022c22; color: #6ee7b7; }

/* ── CHRONO BAR ───────────────────────────────────────────────────────── */
.chrono-display {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  min-width: 70px;
}


/* ── Passe 1 & 2 UX ────────────────────────────────────────────────────────── */

/* Stat-cards cliquables */
.stat-clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.stat-clickable:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.stat-clickable:active { transform: translateY(-1px); }

/* Quick-filter bar */
.quick-filter-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .6rem 1rem .4rem; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.quick-filter-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .7rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--bg-primary); color: var(--text-secondary);
  font-size: .78rem; font-weight: 500; cursor: pointer; transition: all .15s;
  line-height: 1.4;
}
.quick-filter-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg,#f0f4ff); }
.quick-filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.qf-context-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .7rem; border-radius: 999px;
  background: #6366f120; color: var(--accent); font-size: .78rem; font-weight: 500;
  border: 1.5px solid #6366f140;
}
.qf-clear-btn {
  background: none; border: none; cursor: pointer; color: var(--accent); font-size: .8rem;
  padding: 0 .1rem; line-height: 1; opacity: .7;
}
.qf-clear-btn:hover { opacity: 1; }

/* Lignes overdue */
.row-overdue > td { background: rgba(239,68,68,.05); }
.row-overdue > td:first-child { border-left-color: #ef4444 !important; }

/* Badge âge tâche */
.age-badge {
  display: inline-block; font-size: .67rem; font-weight: 700;
  padding: .05rem .35rem; border-radius: 4px; margin-left: .3rem; vertical-align: middle;
  background: #f59e0b22; color: #b45309; border: 1px solid #f59e0b44;
  line-height: 1.5;
}
.dark .age-badge { background: #f59e0b30; color: #fbbf24; border-color: #f59e0b50; }

/* Colonnes triables */
.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-th:hover { color: var(--accent); }
.sortable-th .sort-neutral { opacity: .3; font-size: .75rem; }

/* Entités journal cliquables */
.activity-entity-link {
  color: var(--accent); cursor: pointer; font-weight: 500;
  text-decoration: underline dotted; text-underline-offset: 2px;
  transition: opacity .1s;
}
.activity-entity-link:hover { opacity: .75; }

/* RAG dot emoji */
.rag-dot-emoji { font-size: .85rem; cursor: default; vertical-align: middle; }

/* ── Azure SSO ────────────────────────────────────────────────────────────── */
.sso-divider {
  display: flex; align-items: center; gap: .75rem; margin: 1rem 0;
  color: var(--text-muted); font-size: .8rem;
}
.sso-divider::before, .sso-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.btn-microsoft {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .65rem 1rem; border-radius: 8px;
  background: #fff; color: #3c4043; font-size: .9rem; font-weight: 500;
  border: 1.5px solid #dadce0; cursor: pointer;
  transition: background .15s, box-shadow .15s;
  font-family: inherit;
}
.btn-microsoft:hover { background: #f8f9fa; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.btn-microsoft:active { background: #f1f3f4; }
.dark .btn-microsoft { background: #2d2d2d; color: #e8eaed; border-color: #5f6368; }
.dark .btn-microsoft:hover { background: #3c3c3c; }

/* Encart tutoriel SSO */
.sso-tutorial {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; margin-top: 1.5rem;
}
.sso-tutorial-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem; cursor: pointer; user-select: none;
  background: var(--bg-secondary); gap: .5rem;
}
.sso-tutorial-header:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }
.sso-tutorial-title { font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: .5rem; }
.sso-tutorial-toggle { font-size: .8rem; color: var(--text-muted); transition: transform .2s; }
.sso-tutorial-body { padding: 1.2rem 1.4rem; border-top: 1px solid var(--border); }
.sso-step {
  display: flex; gap: .9rem; margin-bottom: 1.1rem; align-items: flex-start;
}
.sso-step:last-child { margin-bottom: 0; }
.sso-step-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: #6366f1; color: #fff; font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: .1rem;
}
.sso-step-content { flex: 1; }
.sso-step-title { font-weight: 600; font-size: .87rem; margin-bottom: .2rem; }
.sso-step-desc { font-size: .82rem; color: var(--text-secondary); line-height: 1.5; }
.sso-code {
  display: inline-block; font-family: monospace; font-size: .8rem;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 4px; padding: .1rem .45rem; margin: .15rem 0;
  word-break: break-all;
}
.sso-note {
  font-size: .8rem; padding: .6rem .85rem; border-radius: 7px;
  background: #3b82f614; border-left: 3px solid #3b82f6;
  color: var(--text-secondary); margin-top: .75rem; line-height: 1.5;
}
.sso-warn {
  font-size: .8rem; padding: .6rem .85rem; border-radius: 7px;
  background: #f59e0b14; border-left: 3px solid #f59e0b;
  color: var(--text-secondary); margin-top: .75rem; line-height: 1.5;
}
.az-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.2rem;
}
@media (max-width: 600px) { .az-form-grid { grid-template-columns: 1fr; } }
.az-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 1.2rem;
}
.az-toggle-label { font-weight: 600; font-size: .9rem; }
.az-toggle-sub   { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.az-redirect-box {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1.2rem;
}
.az-redirect-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }
.az-redirect-uri {
  font-family: monospace; font-size: .82rem; color: var(--accent);
  word-break: break-all; line-height: 1.5;
}

/* ── Import BD Wizard ───────────────────────────────────────────────────────── */
.import-wizard { max-width: 900px; padding: .5rem 0 2rem; }

/* Step bar */
.import-stepbar { display:flex; align-items:center; gap:0; margin-bottom:2rem; padding: 1rem 0; border-bottom:1px solid var(--border); }
.import-stepbar-item { display:flex; align-items:center; gap:.5rem; font-size:.82rem; color:var(--text-muted); font-weight:500; }
.import-stepbar-item.active { color:var(--accent); font-weight:700; }
.import-stepbar-item.done   { color:#10b981; }
.isb-num { width:22px; height:22px; border-radius:50%; background:var(--border); color:var(--text-muted); font-size:.72rem; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.import-stepbar-item.active .isb-num { background:var(--accent); color:#fff; }
.import-stepbar-item.done .isb-num   { background:#10b981; color:#fff; }
.import-stepbar-sep { flex:1; height:2px; background:var(--border); min-width:20px; }

/* Section */
.import-section { margin-bottom:1.5rem; }
.import-section-title { font-weight:700; font-size:.88rem; color:var(--text-primary); margin-bottom:.75rem; display:flex; align-items:center; gap:.4rem; }

/* Entity cards */
.import-entity-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:.75rem; }
@media(max-width:700px) { .import-entity-grid { grid-template-columns:repeat(2,1fr); } }
.import-entity-card { padding:.9rem .75rem; border:2px solid var(--border); border-radius:10px; cursor:pointer; text-align:center; transition:all .15s; }
.import-entity-card:hover { border-color:var(--accent); background:var(--accent-bg,#f0f4ff); }
.import-entity-card.active { border-color:var(--accent); background:var(--accent-bg,#f0f4ff); }
.iec-icon  { font-size:1.6rem; margin-bottom:.35rem; }
.iec-label { font-weight:700; font-size:.88rem; margin-bottom:.2rem; }
.iec-sub   { font-size:.72rem; color:var(--text-muted); line-height:1.4; }

/* Drop zone */
.import-dropzone { border:2px dashed var(--border); border-radius:12px; padding:2.5rem 1.5rem; text-align:center; transition:all .15s; background:var(--bg-secondary); }
.import-dropzone.dragover { border-color:var(--accent); background:var(--accent-bg,#f0f4ff); }
.idz-icon { font-size:2.2rem; margin-bottom:.6rem; }
.idz-main { font-weight:600; font-size:.95rem; margin-bottom:.3rem; }
.idz-sub  { color:var(--text-muted); font-size:.82rem; margin-bottom:.6rem; }
.idz-hint { font-size:.75rem; color:var(--text-muted); margin-top:.6rem; }
.import-uploading { font-size:.88rem; color:var(--text-secondary); padding:.5rem 0; }

/* File badge */
.import-file-badge { display:flex; align-items:center; flex-wrap:wrap; gap:.3rem; padding:.6rem .9rem; background:var(--bg-secondary); border:1px solid var(--border); border-radius:8px; font-size:.82rem; margin-bottom:1rem; }
.ifb-sep { color:var(--text-muted); }

/* Preview table */
.import-preview-scroll { overflow-x:auto; margin-top:.5rem; border-radius:8px; border:1px solid var(--border); }
.import-preview-table { border-collapse:collapse; font-size:.78rem; min-width:100%; }
.import-preview-table th { background:var(--bg-secondary); padding:.45rem .7rem; text-align:left; font-weight:700; white-space:nowrap; border-bottom:1px solid var(--border); }
.import-preview-table td { padding:.35rem .7rem; border-bottom:1px solid var(--border); max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.import-preview-table tr:last-child td { border-bottom:none; }

/* Mapping table */
.import-map-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.import-map-table thead th { background:var(--bg-secondary); padding:.5rem .75rem; text-align:left; font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; border-bottom:1px solid var(--border); }
.import-map-table tbody tr:hover td { background:var(--bg-hover,rgba(0,0,0,.02)); }
.import-map-table td { padding:.45rem .75rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.imp-field-name { font-weight:600; white-space:nowrap; }
.req-star { color:#ef4444; }
.imp-map-sel { width:100%; padding:.3rem .5rem; border:1px solid var(--border); border-radius:6px; background:var(--bg-primary); font-size:.83rem; }
.imp-field-sample { color:var(--text-muted); font-size:.75rem; }
.imp-sample-val { background:var(--bg-secondary); border:1px solid var(--border); border-radius:4px; padding:.1rem .35rem; margin-right:.25rem; }

/* Transforms */
.import-transforms-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem; }
.import-transform-group { background:var(--bg-secondary); border:1px solid var(--border); border-radius:8px; padding:.9rem 1rem; }
.import-transform-title { font-weight:700; font-size:.82rem; margin-bottom:.65rem; }
.import-vmap-row { display:flex; align-items:center; gap:.5rem; margin-bottom:.4rem; }
.import-vmap-src { flex:0 0 100px; background:var(--bg-primary); border:1px solid var(--border); border-radius:5px; padding:.2rem .45rem; font-size:.78rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.import-vmap-arr { color:var(--text-muted); flex-shrink:0; }
.import-vmap-row select { flex:1; padding:.2rem .4rem; border:1px solid var(--border); border-radius:5px; font-size:.78rem; background:var(--bg-primary); }

/* Options */
.import-options-row { display:flex; gap:1.5rem; flex-wrap:wrap; }
.import-opt-label { display:flex; align-items:center; gap:.5rem; font-size:.85rem; cursor:pointer; }

/* Actions */
.import-actions { display:flex; gap:.75rem; align-items:center; padding-top:.5rem; }

/* Result */
.import-result-summary { display:flex; gap:1rem; margin-bottom:1.5rem; flex-wrap:wrap; }
.import-result-card { flex:1; min-width:120px; padding:1.2rem 1rem; text-align:center; border-radius:12px; border:2px solid var(--border); }
.import-result-card.green { border-color:#10b981; background:#10b98112; }
.import-result-card.orange{ border-color:#f59e0b; background:#f59e0b12; }
.import-result-card.red   { border-color:#ef4444; background:#ef444412; }
.import-result-card.gray  { border-color:var(--border); }
.irc-icon  { font-size:1.5rem; margin-bottom:.3rem; }
.irc-count { font-size:2rem; font-weight:800; }
.irc-label { font-size:.78rem; color:var(--text-muted); margin-top:.2rem; }
.import-success-msg { text-align:center; font-size:1rem; font-weight:600; color:#10b981; padding:1rem; margin-bottom:1rem; }
.import-errors-list { background:var(--bg-secondary); border:1px solid #ef444430; border-radius:8px; padding:.75rem 1rem; max-height:250px; overflow-y:auto; }
.import-error-row { display:flex; gap:.75rem; padding:.3rem 0; border-bottom:1px solid var(--border); font-size:.82rem; }
.import-error-row:last-child { border-bottom:none; }
.ier-row { flex-shrink:0; font-weight:700; color:#ef4444; min-width:60px; }
.ier-msg { color:var(--text-secondary); }

/* ── Import wizard — confidence badges ─────────────────────────────────────── */
.imp-conf { display:inline-flex; align-items:center; font-size:.7rem; font-weight:600;
  padding:.1rem .35rem; border-radius:4px; margin-left:.4rem; vertical-align:middle; }
.imp-conf.high   { background:#10b98120; color:#059669; }
.imp-conf.medium { background:#f59e0b20; color:#d97706; }
.imp-conf.none   { display:none; }
.imp-row-uncertain { background: color-mix(in srgb, var(--bg) 92%, #f59e0b); }
.imp-row-uncertain:hover { background: color-mix(in srgb, var(--bg) 88%, #f59e0b); }

/* ── Import wizard — modal de validation ────────────────────────────────────── */
.imp-modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:9999;
  display:flex; align-items:center; justify-content:center;
  animation: fadeIn .15s ease;
}
.imp-modal-box {
  background:var(--bg); border-radius:14px; box-shadow:0 8px 40px rgba(0,0,0,.25);
  padding:1.5rem 1.75rem 1.25rem; max-width:640px; width:calc(100% - 2rem);
  max-height:85vh; overflow-y:auto;
  animation: slideUp .18s ease;
}
.imp-modal-header {
  display:flex; align-items:flex-start; gap:.9rem; margin-bottom:1rem;
}
.imp-modal-icon { font-size:2rem; line-height:1; }
.imp-modal-title { font-size:1.05rem; font-weight:700; color:var(--text); }
.imp-modal-sub   { font-size:.85rem; color:var(--text-muted); margin-top:.2rem; }
.imp-modal-table { margin:.25rem 0 1rem; }
.imp-modal-sel   { width:100%; }
.imp-modal-footer {
  display:flex; justify-content:flex-end; gap:.75rem; padding-top:.75rem;
  border-top:1px solid var(--border);
}
@keyframes slideUp {
  from { transform:translateY(12px); opacity:0; }
  to   { transform:translateY(0);    opacity:1; }
}

/* ── Billing — layout commun ─────────────────────────────────────────────── */
.billing-view { padding:.5rem 0 3rem; max-width:1100px; }
.billing-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:1.25rem; flex-wrap:wrap; gap:.75rem; }
.billing-title { font-size:1.35rem; font-weight:700; color:var(--text); margin:0; }
.billing-sub   { font-size:.85rem; color:var(--text-muted); margin:.2rem 0 0; }
.billing-toolbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; flex-wrap:wrap; gap:.5rem; }
.billing-tabs { display:flex; gap:.25rem; flex-wrap:wrap; }
.billing-tab { padding:.35rem .8rem; border-radius:6px; border:1px solid var(--border); background:var(--bg); color:var(--text-muted); font-size:.82rem; cursor:pointer; transition:all .12s; }
.billing-tab:hover { border-color:var(--accent); color:var(--accent); }
.billing-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600; }
.billing-search { padding:.35rem .75rem; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:var(--text); font-size:.875rem; width:220px; }
.billing-table-wrap { overflow-x:auto; }
.billing-table { width:100%; border-collapse:collapse; font-size:.875rem; }
.billing-table thead th { padding:.6rem .75rem; text-align:left; font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--text-muted); border-bottom:2px solid var(--border); white-space:nowrap; }
.billing-table tbody td { padding:.65rem .75rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.billing-table-hover tbody tr { cursor:pointer; transition:background .1s; }
.billing-table-hover tbody tr:hover { background:var(--bg-secondary); }
.billing-empty { text-align:center; padding:3rem 1rem; color:var(--text-muted); font-size:1rem; }
.text-right { text-align:right !important; }
.amount-cell { font-weight:600; font-variant-numeric:tabular-nums; }
.doc-number { font-family:monospace; font-size:.85rem; color:var(--accent); font-weight:600; }
.doc-actions { white-space:nowrap; }

/* ── Statut badges ────────────────────────────────────────────────────────── */
.status-badge { display:inline-block; padding:.2rem .6rem; border-radius:20px; font-size:.75rem; font-weight:600; white-space:nowrap; }
.s-brouillon { background:#f3f4f6; color:#6b7280; }
.s-envoye    { background:#dbeafe; color:#1d4ed8; }
.s-accepte   { background:#d1fae5; color:#059669; }
.s-refuse    { background:#fee2e2; color:#dc2626; }
.s-expire    { background:#fef3c7; color:#92400e; }

/* ── Inventaire ──────────────────────────────────────────────────────────── */
.inv-ref { font-family:monospace; font-size:.8rem; color:var(--text-muted); }
.inv-row-inactive { opacity:.5; }
.inv-type-badge { display:inline-block; padding:.15rem .5rem; border-radius:4px; font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.3px; }
.inv-type-product { background:#dbeafe; color:#1d4ed8; }
.inv-type-service { background:#ede9fe; color:#7c3aed; }
.inv-type-labor   { background:#fef3c7; color:#92400e; }
.inv-type-forfait { background:#d1fae5; color:#059669; }
.badge-active   { font-size:.75rem; color:#059669; font-weight:600; }
.badge-inactive { font-size:.75rem; color:#9ca3af; }
.inv-actions { white-space:nowrap; }

/* ── KPIs facturation ─────────────────────────────────────────────────────── */
.billing-kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:.75rem; margin-bottom:1.25rem; }
@media(max-width:700px) { .billing-kpis { grid-template-columns:repeat(2,1fr); } }
.billing-kpi { padding:1rem 1.1rem; border-radius:10px; border:2px solid var(--border); background:var(--bg-secondary); }
.billing-kpi.bk-warning { border-color:#f59e0b; background:#f59e0b0d; }
.billing-kpi.bk-success { border-color:#10b981; background:#10b9810d; }
.billing-kpi.bk-danger  { border-color:#ef4444; background:#ef44440d; }
.bk-label { font-size:.75rem; font-weight:600; text-transform:uppercase; letter-spacing:.4px; color:var(--text-muted); margin-bottom:.3rem; }
.bk-value { font-size:1.3rem; font-weight:800; color:var(--text); font-variant-numeric:tabular-nums; }
.bk-sub   { font-size:.75rem; color:var(--text-muted); margin-top:.15rem; }

/* ── Détail devis / facture ──────────────────────────────────────────────── */
.doc-detail-view { max-width:1000px; }
.doc-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.5rem; margin-bottom:1.5rem; }
@media(max-width:700px) { .doc-form-grid { grid-template-columns:1fr; } }
.doc-form-left, .doc-form-right {}
.form-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:.75rem; }
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:.75rem; }
.form-control-sm { padding:.25rem .5rem; font-size:.82rem; }
.billing-info-box { background:#dbeafe; color:#1d4ed8; padding:.6rem .9rem; border-radius:8px; margin-bottom:.75rem; font-size:.85rem; }

/* Lignes document */
.doc-items-section { margin-top:1.5rem; }
.doc-items-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.75rem; flex-wrap:wrap; gap:.5rem; }
.doc-items-title { font-size:.85rem; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--text-muted); }
.doc-lines-empty { text-align:center; padding:2rem; color:var(--text-muted); background:var(--bg-secondary); border-radius:8px; border:1px dashed var(--border); }
.doc-lines-table { width:100%; border-collapse:collapse; font-size:.83rem; }
.doc-lines-table thead th { padding:.5rem .4rem; text-align:left; font-size:.72rem; font-weight:700; text-transform:uppercase; color:var(--text-muted); border-bottom:2px solid var(--border); }
.doc-lines-table tbody td { padding:.3rem .4rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.doc-line-total { font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }

/* Totaux */
.doc-totals { display:flex; justify-content:flex-end; margin-top:.75rem; }
.doc-totals-inner { min-width:220px; }
.doc-total-row { display:flex; justify-content:space-between; padding:.3rem 0; font-size:.88rem; gap:1.5rem; }
.doc-total-row span:last-child { font-variant-numeric:tabular-nums; font-weight:500; }
.doc-total-ttc { font-size:1.1rem; font-weight:800; color:var(--accent); border-top:2px solid var(--accent); padding-top:.5rem; margin-top:.25rem; }

/* ── Sidebar — sections repliables ─────────────────────────────────────────── */
.sidebar-section-title {
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-section-title:hover { opacity: .8; }

.sb-sec-toggle {
  background: none; border: none; padding: 2px; margin: 0;
  cursor: pointer; color: inherit; opacity: .35;
  display: flex; align-items: center; flex-shrink: 0;
  border-radius: 3px; transition: opacity .15s;
  line-height: 1;
}
.sb-sec-toggle:hover { opacity: 1; }
.sb-sec-toggle svg   { display: block; transition: transform .22s ease; }
.sb-chevron-down svg { transform: rotate(180deg); }

/* Animation repli (max-height pour transition fluide) */
.sidebar-nav {
  overflow: hidden;
  max-height: 600px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.sb-nav-collapsed {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}


/* ── TASK LIST REDESIGN ───────────────────────────────────────────────────── */

/* Stats summary bar */
.list-stats-bar {
  display: flex; gap: .6rem; margin-bottom: 1rem;
}
.list-stat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; padding: .65rem .5rem; background: var(--surface);
  border-radius: 10px; border: 1.5px solid var(--border);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  user-select: none;
}
.list-stat:hover { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.list-stat.lst-active { border-color: var(--primary) !important; background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.lst-val { font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.lst-lbl { font-size: .69rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-top: .18rem; }
.lst-todo .lst-val    { color: #64748b; }
.lst-progress .lst-val { color: #2563eb; }
.lst-overdue .lst-val  { color: #dc2626; }
.lst-done .lst-val     { color: #16a34a; }
.dark .lst-todo .lst-val     { color: #94a3b8; }
.dark .lst-progress .lst-val { color: #60a5fa; }
.dark .lst-overdue .lst-val  { color: #f87171; }
.dark .lst-done .lst-val     { color: #4ade80; }

/* Due date labels */
.due-over      { color: #dc2626; font-weight: 600; font-size: .82rem; }
.due-today-lbl { background: #f59e0b; color: #fff; font-size: .72rem; font-weight: 700;
                 padding: .1rem .45rem; border-radius: 4px; }
.due-soon      { color: #2563eb; font-weight: 500; font-size: .82rem; }
.due-future    { color: var(--text-muted); font-size: .82rem; }
.due-none      { color: var(--text-muted); opacity: .4; }
.due-cell      { white-space: nowrap; }
.dark .due-over  { color: #f87171; }
.dark .due-soon  { color: #60a5fa; }

/* Assignee cell */
.assignee-cell { display: flex; align-items: center; gap: .35rem; }
.assignee-name { font-size: .82rem; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-avatar.sm { width: 22px; height: 22px; font-size: .6rem; flex-shrink: 0; }
.unassigned-lbl { color: var(--text-muted); opacity: .45; font-size: .85rem; }

/* Project name cell */
.proj-name-cell { font-size: .8rem; color: var(--text-muted); max-width: 130px;
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Blocked indicator in row */
.lrow-blocked { color: #ef4444; font-size: .85rem; margin-left: .3rem; vertical-align: middle; }

/* Tag row inside title cell */
.tag-row { display: inline-flex; flex-wrap: wrap; gap: 3px; margin-left: .35rem; vertical-align: middle; }

/* Priority column — dot only, no label text */
.list-table th:nth-child(2) { padding-left: .75rem; padding-right: .5rem; }
.list-table td:nth-child(2) { padding-left: .75rem; padding-right: .5rem; text-align: center; }
.priority-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Row hover — very subtle */
.list-row:hover { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.dark .list-row:hover { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }

/* Alternating row tint */
.list-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 50%, var(--surface)); }
.list-table tbody tr:nth-child(even):hover { background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }

@media (max-width: 768px) {
  .list-stats-bar { gap: .35rem; }
  .lst-val { font-size: 1.1rem; }
  .lst-lbl { font-size: .6rem; }
  .assignee-name { max-width: 60px; }
  .proj-name-cell { max-width: 80px; }
}


/* ── TEAMS CARD ACTIONS + DETAIL MODAL ───────────────────────────────────── */

/* Make tcard clickable */
.tcard { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tcard:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,.13); }

/* Action buttons on card top */
.tcard-top-actions { display: flex; align-items: center; gap: .3rem; }
.tcard-act-btn {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px; color: #fff; cursor: pointer; padding: .2rem .42rem;
  font-size: .78rem; line-height: 1.4; transition: background .15s;
  opacity: 0; transition: opacity .2s;
}
.tcard:hover .tcard-act-btn { opacity: 1; }
.tcard-act-btn:hover { background: rgba(255,255,255,.35); }
.tcard-act-btn.danger:hover { background: rgba(239,68,68,.55); border-color: rgba(239,68,68,.6); }

/* Team detail modal panel */
.td-panel {
  background: var(--surface); border-radius: 16px; width: 520px; max-width: 95vw;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,.22);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1) both;
  position: relative; z-index: 1;
}
.td-banner {
  padding: 1.4rem 1.4rem 1.2rem; border-radius: 16px 16px 0 0;
  display: flex; align-items: center; gap: 1rem; color: #fff; position: relative;
}
.td-banner-avatar {
  width: 52px; height: 52px; border-radius: 14px;
  background: rgba(255,255,255,.22); display: flex; align-items: center;
  justify-content: center; font-size: 1.35rem; font-weight: 800; flex-shrink: 0;
}
.td-banner-info { flex: 1; }
.td-banner-name { font-size: 1.25rem; font-weight: 700; }
.td-banner-leader { font-size: .85rem; opacity: .88; margin-top: .15rem; }
.td-leader-role { background: rgba(255,255,255,.2); border-radius: 4px; padding: .05rem .35rem; font-size: .72rem; margin-left: .3rem; }
.td-close-btn {
  position: absolute; top: .9rem; right: .9rem;
  background: rgba(255,255,255,.18); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  font-size: .9rem; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.td-close-btn:hover { background: rgba(255,255,255,.35); }

.td-kpis {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
}
.td-kpi {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: .85rem .5rem; border-right: 1px solid var(--border);
}
.td-kpi:last-child { border-right: none; }
.td-kpi-val { font-size: 1.4rem; font-weight: 700; line-height: 1; color: var(--text); }
.td-kpi-lbl { font-size: .69rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-top: .2rem; }

.td-prog-wrap {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.4rem; border-bottom: 1px solid var(--border);
}
.td-prog-track { flex: 1; height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; }
.td-prog-fill  { height: 100%; border-radius: 99px; transition: width .4s; }
.td-prog-pct   { font-size: .82rem; font-weight: 700; color: var(--text-muted); min-width: 36px; text-align: right; }

.td-members-section { padding: 1rem 1.4rem; }
.td-section-title { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: .75rem; }
.td-member-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .5rem; border-radius: 8px; transition: background .12s;
}
.td-member-row:hover { background: var(--bg); }
.td-member-info { flex: 1; min-width: 0; }
.td-member-name { font-size: .9rem; font-weight: 600; }
.td-leader-crown { color: #f59e0b; font-size: .8rem; }
.td-member-stats { display: flex; gap: .3rem; align-items: center; }
.td-member-bar { display: flex; align-items: center; gap: .4rem; min-width: 80px; }
.td-pct { font-size: .75rem; font-weight: 600; color: var(--text-muted); min-width: 30px; text-align: right; }
.td-empty { text-align: center; color: var(--text-muted); padding: 1.5rem; font-size: .88rem; }

.td-footer {
  display: flex; gap: .5rem; justify-content: flex-end;
  padding: .9rem 1.4rem; border-top: 1px solid var(--border); background: var(--bg);
  border-radius: 0 0 16px 16px;
}

/* Dark mode adjustments */
.dark .tcard:hover { box-shadow: 0 8px 28px rgba(0,0,0,.4); }


/* ── ORGCHART — rôles + vignette chef de projet ──────────────────────────── */

/* Role badge colors */
.role-badge[class*="commercial"],
span.role-badge:has(~ [value="commercial"]) { background:#fff7ed; color:#c2410c; }

/* Generic role badge coloring via data or direct span */
.rb-admin        { background:#ede9fe; color:#6d28d9; }
.rb-direction    { background:#f5f3ff; color:#7c3aed; }
.rb-pm           { background:#ede9fe; color:#7c3aed; }
.rb-team-leader  { background:#dbeafe; color:#1d4ed8; }
.rb-commercial   { background:#fff7ed; color:#c2410c; }
.rb-comptable    { background:#e0f2fe; color:#0369a1; }
.rb-technician   { background:#dcfce7; color:#15803d; }

/* PM section */
.pm-section { margin-bottom: 1.5rem; }
.pm-section-title {
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .75rem; padding-left: .1rem;
}
.pm-cards-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* PM vignette card */
.pm-vignette {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: .9rem 1rem;
  min-width: 260px; flex: 1; max-width: 420px;
  transition: border-color .15s, box-shadow .15s;
}
.pm-vignette:hover { border-color: #8b5cf6; box-shadow: 0 0 0 3px #8b5cf620; }
.pm-vig-header { display: flex; align-items: center; gap: .65rem; margin-bottom: .6rem; }
.pm-vig-info { flex: 1; min-width: 0; }
.pm-vig-name { font-size: .95rem; font-weight: 700; }
.pm-role { background: #ede9fe !important; color: #6d28d9 !important; }
.pm-vig-kpis { display: flex; flex-direction: column; gap: .25rem; align-items: flex-end; }
.pm-kpi-pill {
  font-size: .68rem; font-weight: 600; padding: .12rem .5rem;
  border-radius: 99px; background: var(--bg); border: 1px solid var(--border);
  white-space: nowrap;
}
.pm-vig-teams { display: flex; flex-wrap: wrap; gap: .3rem; }
.pm-team-chip {
  font-size: .72rem; font-weight: 600; padding: .15rem .55rem;
  border-radius: 6px; background: #ede9fe; color: #6d28d9;
  border: 1px solid #ddd6fe;
}
.pm-vig-noteam { font-size: .78rem; color: var(--text-muted); font-style: italic; }

/* PM line on team card */
.tcard-pm-line {
  font-size: .72rem; opacity: .82; margin-top: .12rem;
  color: rgba(255,255,255,.85);
}

/* Dark mode */
.dark .pm-vignette { border-color: var(--border); }
.dark .pm-vignette:hover { border-color: #8b5cf6; box-shadow: 0 0 0 3px #8b5cf630; }
.dark .pm-team-chip { background: #4c1d9540; color: #c4b5fd; border-color: #6d28d940; }
.dark .pm-kpi-pill { background: var(--surface2); border-color: var(--border); }

@media (max-width: 768px) {
  .pm-vignette { min-width: 100%; }
  .pm-vig-kpis { flex-direction: row; }
}

/* Nav-item tooltip: ONLY in collapsed mode, never in normal mode */
.nav-item::after { display: none !important; }
#sidebar.sb-collapsed .nav-item::after { display: block !important; }

/* Icons-only in collapsed sidebar */
#sidebar.sb-collapsed .nav-item { gap: 0; }
#sidebar.sb-collapsed .nav-label { display: none; }


/* ══════════════════════════════════════════════════════════════════════════
   FROST LIGHT THEME
   ══════════════════════════════════════════════════════════════════════════ */

/* Gradient background — three soft radial light sources over a blue canvas */
body:not(.dark) {
  background:
    radial-gradient(ellipse 75% 55% at 18% 45%, rgba(160,198,255,.50) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 82% 12%, rgba(180,212,255,.42) 0%, transparent 100%),
    radial-gradient(ellipse 40% 50% at 55% 88%, rgba(140,175,240,.28) 0%, transparent 100%),
    #c4d4ec;
  background-attachment: fixed;
}

/* Glass sidebar */
body:not(.dark) #sidebar {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(196,216,255,.60) !important;
  border-right: 1px solid rgba(100,140,230,.20) !important;
}

/* Glass topbar */
body:not(.dark) .topbar {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(208,226,255,.76) !important;
  box-shadow: 0 1px 0 rgba(80,120,220,.14), 0 2px 14px rgba(60,100,210,.08) !important;
}

/* Nav items */
body:not(.dark) .nav-item            { color: #364e72; }
body:not(.dark) .nav-item:hover      { background: rgba(90,130,220,.13) !important; color: #16213a; }
body:not(.dark) .nav-item.active     { background: rgba(90,130,230,.20) !important; color: var(--primary); }
body:not(.dark) .sidebar-section-title { color: #4a5e80; }
body:not(.dark) .sb-logo-text        { color: var(--primary); }

/* Glass cards & table */
body:not(.dark) .list-table-wrap,
body:not(.dark) .tcard,
body:not(.dark) .card {
  background: rgba(224,236,255,.82) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(100,138,220,.16) !important;
}

/* Modals */
body:not(.dark) .modal-content,
body:not(.dark) .modal-box {
  background: rgba(232,242,255,.94) !important;
  border: 1px solid rgba(100,140,220,.18) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Forms */
body:not(.dark) input:not([type="checkbox"]):not([type="radio"]),
body:not(.dark) select,
body:not(.dark) textarea {
  background: rgba(216,230,255,.72) !important;
  border-color: rgba(90,128,210,.24) !important;
}
body:not(.dark) input:focus,
body:not(.dark) select:focus,
body:not(.dark) textarea:focus {
  background: rgba(225,238,255,.90) !important;
  border-color: var(--primary) !important;
}

/* Ghost buttons */
body:not(.dark) .btn-ghost {
  border-color: rgba(80,120,210,.24);
  color: #364e72;
}
body:not(.dark) .btn-ghost:hover {
  background: rgba(90,130,220,.12);
  color: #16213a;
}

/* Topbar progress / stat bars */
body:not(.dark) .bar-track,
body:not(.dark) .progress-track { background: rgba(80,120,210,.15) !important; }

/* List table rows */
body:not(.dark) .list-row:hover { background: rgba(190,215,255,.45) !important; }
body:not(.dark) table thead      { background: rgba(200,220,255,.55) !important; }
body:not(.dark) table tr:nth-child(even) { background: rgba(200,220,255,.25) !important; }

/* Sidebar bottom border */
body:not(.dark) .sidebar-bottom { border-top-color: rgba(100,140,220,.18); }

/* Dark-toggle button */
body:not(.dark) .dark-toggle-btn { color: #4a5e80; }
body:not(.dark) .dark-toggle-btn:hover { background: rgba(90,130,220,.14); }

/* ══════════════════════════════════════════════════════════════════════════
   KANBAN BOARD
   ══════════════════════════════════════════════════════════════════════════ */

.kb-board {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 1.5rem;
  min-height: calc(100vh - 160px);
}

.kb-col {
  flex: 1;
  min-width: 230px;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  transition: border-color .15s, background .15s;
}
.kb-col.kb-over {
  border-color: var(--primary);
  background: rgba(99,102,241,.06);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.kb-col-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 9px;
  border-bottom: 1px solid var(--border);
}
.kb-pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kb-col-lbl {
  flex: 1;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text);
}
.kb-col-cnt {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
}

.kb-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 48px;
}

.kb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .15s, border-color .15s;
  user-select: none;
}
.kb-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(50,90,200,.16);
  border-color: var(--primary);
}
.kb-card.kb-dragging {
  opacity: .4;
  transform: rotate(1.5deg) scale(.98);
}

.kb-card-top {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 3px;
}
.kb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.kb-card-title {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  flex: 1;
}
.kb-card-proj {
  font-size: .70rem;
  color: var(--text-muted);
  padding-left: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-card-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 14px;
  margin-top: 4px;
}
.kb-due        { font-size: .69rem; font-weight: 500; color: var(--text-muted); }
.kb-due.kb-over  { color: #ef4444; font-weight: 700; }
.kb-due.kb-today { color: #f59e0b; font-weight: 700; }
.kb-due.kb-soon  { color: #f97316; font-weight: 600; }

.kb-add {
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  padding: 6px 8px;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background .12s, border-color .12s, color .12s;
  margin-top: 2px;
}
.kb-add:hover {
  background: rgba(99,102,241,.07);
  border-color: var(--primary);
  color: var(--primary);
}

/* Dark mode */
body.dark .kb-col { background: var(--surface2); }
body.dark .kb-card { background: var(--surface); }
body.dark .kb-col.kb-over { background: rgba(99,102,241,.12); }

/* ── Kanban filter bar ──────────────────────────────────────────────────────── */

.kb-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kb-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
body:not(.dark) .kb-filter-bar {
  background: rgba(218,232,255,.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(100,140,220,.18);
}

.kb-filter-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  flex: 0 1 220px;
  min-width: 140px;
}
body:not(.dark) .kb-filter-search {
  background: rgba(204,222,255,.55);
  border-color: rgba(90,130,210,.22);
}
.kb-filter-search svg { flex-shrink: 0; color: var(--text-muted); }

.kb-search-input {
  border: none;
  background: none;
  font-size: .82rem;
  color: var(--text);
  outline: none;
  width: 100%;
  min-width: 0;
}
.kb-search-input::placeholder { color: var(--text-muted); }

.kb-filter-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

.kb-filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.kb-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .14s, background .14s, color .14s, transform .1s;
  white-space: nowrap;
  line-height: 1;
}
.kb-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99,102,241,.07);
  transform: translateY(-1px);
}
.kb-chip.active {
  border-color: var(--primary);
  background: rgba(99,102,241,.14);
  color: var(--primary);
  font-weight: 600;
}
.kb-chip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kb-avatar-chip {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .63rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .12s, border-color .14s, box-shadow .14s;
}
.kb-avatar-chip:hover { transform: scale(1.12); box-shadow: 0 2px 8px rgba(0,0,0,.22); }
.kb-avatar-chip.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,.32);
  transform: scale(1.06);
}

.kb-proj-select {
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .78rem;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: border-color .14s;
}
body:not(.dark) .kb-proj-select { background: rgba(210,226,255,.55); }
.kb-proj-select:hover, .kb-proj-select:focus { border-color: var(--primary); }

.kb-filter-reset {
  margin-left: auto;
  background: none;
  border: 1.5px solid rgba(239,68,68,.35);
  border-radius: 7px;
  color: #ef4444;
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 11px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.kb-filter-reset:hover { background: rgba(239,68,68,.08); border-color: #ef4444; }
