:root {
  --cht-blue-900: #0a2540;
  --cht-blue-800: #0f3460;
  --cht-blue-700: #14497e;
  --cht-blue-600: #1a5fa3;
  --cht-blue-500: #2276c7;
  --cht-blue-100: #e8f1fa;
  --cht-blue-50: #f4f9fd;
  --white: #ffffff;
  --gray-900: #1c2530;
  --gray-700: #495566;
  --gray-500: #7c8a9c;
  --gray-300: #d7e0ea;
  --gray-100: #f2f5f9;
  --green: #1f9d6b;
  --amber: #c8891a;
  --red: #c0362c;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(10, 37, 64, 0.06);
  --shadow-md: 0 8px 30px rgba(10, 37, 64, 0.12);
}

* { box-sizing: border-box; }

/* Le HTML `hidden` doit toujours l'emporter, même sur des éléments dont une
   classe fixe déjà `display` (sinon la classe écrase la règle native [hidden]
   et l'élément reste visible — c'est ce qui causait le rectangle blanc et le
   double affichage connexion/application). */
[hidden] { display: none !important; }

:root {
  --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Sora", var(--font-ui);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-med: 200ms;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--gray-100);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
}

h1, h2, .brand-name strong, .login-card .brand-name strong { font-family: var(--font-display); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

::selection { background: var(--cht-blue-100); color: var(--cht-blue-900); }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(34, 118, 199, 0.35); } 100% { box-shadow: 0 0 0 10px rgba(34, 118, 199, 0); } }

/* ── Brand ── */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 8px;
  background: linear-gradient(135deg, var(--cht-blue-700), var(--cht-blue-500));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; letter-spacing: 0.5px;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name strong { font-size: 14px; color: var(--cht-blue-900); letter-spacing: 0.3px; }
.brand-name span { font-size: 11px; color: var(--gray-500); letter-spacing: 1px; }

/* ── Login ── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--cht-blue-900) 0%, var(--cht-blue-700) 55%, var(--cht-blue-500) 100%);
}
.login-card {
  background: var(--white); width: 380px; padding: 36px 32px;
  border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-subtitle { text-align: center; color: var(--gray-500); font-size: 13px; margin: 4px 0 24px; }
#login-form label { display: block; font-size: 12.5px; color: var(--gray-700); margin-bottom: 14px; font-weight: 600; }
#login-form input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--gray-300); border-radius: 8px; outline: none;
}
#login-form input:focus { border-color: var(--cht-blue-500); box-shadow: 0 0 0 3px var(--cht-blue-100); }
.error-msg {
  background: #fdecea; color: var(--red); font-size: 13px; padding: 8px 12px;
  border-radius: 6px; margin-bottom: 14px;
}
.login-hint { text-align: center; font-size: 11.5px; color: var(--gray-500); margin-top: 16px; }

/* ── Buttons ── */
.btn {
  border: none; border-radius: 7px; padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--cht-blue-600); color: white; }
.btn-primary:hover { background: var(--cht-blue-700); box-shadow: 0 3px 10px rgba(26, 95, 163, 0.28); }
.btn-secondary { background: var(--cht-blue-100); color: var(--cht-blue-700); }
.btn-secondary:hover { background: #d9ebf9; }
.btn-ghost { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); border-color: var(--gray-500); }
.btn-danger { background: #fdecea; color: var(--red); }
.btn-danger:hover { background: #fadbd8; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--cht-blue-500); outline-offset: 2px;
}

/* ── App layout ── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--cht-blue-900); color: white;
  display: flex; flex-direction: column; padding: 20px 16px; flex-shrink: 0;
  /* Menu figé : il reste visible quand on fait défiler le contenu (défilement interne si l'écran est petit) */
  position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
}
.sidebar .brand-name strong { color: white; }
.sidebar .brand-name span { color: #9db6d1; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 30px; flex: 1; }
.nav-item {
  text-align: left; background: transparent; border: none; color: #c9d9ea;
  padding: 10px 14px; border-radius: 7px; font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), padding-left var(--t-fast) var(--ease);
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; padding-left: 18px; }
.nav-item.active { background: var(--cht-blue-600); color: white; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 16px; margin-top: 16px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--cht-blue-500);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11.5px; color: #9db6d1; }
.sidebar-footer .btn-ghost { color: #c9d9ea; border-color: rgba(255,255,255,0.2); }
.sidebar-footer .btn-ghost:hover { background: rgba(255,255,255,0.08); }

.main { flex: 1; padding: 28px 34px; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h1 { font-size: 21px; color: var(--cht-blue-900); margin: 0; }

/* ── Cards / Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  border-left: 4px solid var(--cht-blue-500);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
  animation: fadeInUp var(--t-med) var(--ease) backwards;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--cht-blue-900); font-family: var(--font-display); }
.stat-card .stat-label { font-size: 12.5px; color: var(--gray-500); margin-top: 4px; }
.stat-card.warn { border-left-color: var(--amber); }
.stat-card.danger { border-left-color: var(--red); }
.stat-card.ok { border-left-color: var(--green); }

.panel { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; animation: fadeInUp var(--t-med) var(--ease) backwards; }
.panel h2 { font-size: 15px; color: var(--cht-blue-900); margin: 0 0 14px; letter-spacing: 0.1px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--gray-500); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; padding: 10px 12px; border-bottom: 1px solid var(--gray-300); }
td { padding: 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; transition: background var(--t-fast) var(--ease); }
tr:hover td { background: var(--cht-blue-50); }
tbody tr { animation: fadeInUp var(--t-fast) var(--ease) backwards; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.1px; }
.badge-A_FAIRE { background: var(--gray-100); color: var(--gray-700); }
.badge-BLOQUEE { background: #fdecea; color: var(--red); }
.badge-EN_COURS { background: #e8f1fa; color: var(--cht-blue-700); }
.badge-TERMINEE { background: #e6f6ef; color: var(--green); }
.badge-FAIBLE { background: var(--gray-100); color: var(--gray-700); }
.badge-MOYENNE { background: #fff3e0; color: var(--amber); }
.badge-HAUTE { background: #fdecea; color: #c0362c; }
.badge-CRITIQUE { background: var(--cht-blue-900); color: white; }
.badge-overdue { background: var(--red); color: white; animation: pulseRing 1.6s infinite; }
.badge-reportee { background: var(--amber); color: white; }
.badge-ok { background: #e6f6ef; color: var(--green); }
.badge-role { background: var(--cht-blue-100); color: var(--cht-blue-700); }

/* ── Dashboard : barre de sélection de semaine ── */
.dashboard-week-bar { align-items: center; }
.dashboard-week-bar strong { color: var(--cht-blue-900); }
.dashboard-week-bar select#week-picker { margin-left: auto; max-width: 320px; }

/* Catégories de mission — une couleur distincte par pôle métier */
.badge-cat { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-cat::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-cat-MISSION_SOCIALE { background: #eef2fd; color: #4756c9; }
.badge-cat-MISSION_FISCALE { background: #fdf0e6; color: #c17a1f; }
.badge-cat-MISSION_COMPTABLE { background: #e6f6ef; color: #1f9d6b; }
.badge-cat-MISSION_JURIDIQUE { background: #f5e9fb; color: #8a3fbe; }
.badge-default { background: var(--gray-100); color: var(--gray-500); font-size: 10.5px; }

/* ── Filters / toolbar ── */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input[type="text"], .toolbar input[type="search"] {
  padding: 7px 10px; border: 1px solid var(--gray-300); border-radius: 7px; font-size: 13px; background: white;
}
.toolbar input[type="search"] { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,37,64,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { background: white; border-radius: var(--radius); padding: 26px; width: 460px; max-width: 92vw; box-shadow: var(--shadow-md); max-height: 88vh; overflow-y: auto; }
.modal h2 { margin: 0 0 18px; font-size: 16px; color: var(--cht-blue-900); }
.modal label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-700); margin-bottom: 12px; }
.modal input, .modal select, .modal textarea {
  display: block; width: 100%; margin-top: 6px; padding: 8px 10px;
  border: 1px solid var(--gray-300); border-radius: 7px; outline: none;
}
.modal textarea { resize: vertical; min-height: 60px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dep-list { list-style: none; padding: 0; margin: 6px 0 0; max-height: 130px; overflow-y: auto; border: 1px solid var(--gray-300); border-radius: 7px; }
.dep-list li { padding: 7px 10px; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; border-bottom: 1px solid var(--gray-100); }
.dep-list li:last-child { border-bottom: none; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--cht-blue-900); color: white;
  padding: 12px 18px; border-radius: 8px; font-size: 13.5px; box-shadow: var(--shadow-md); z-index: 100;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-500); font-size: 13.5px; }
.muted { color: var(--gray-500); font-size: 12.5px; }
.report-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--gray-100); }
.report-item:last-child { border-bottom: none; }

/* ── Modèles de tâches ── */
.templates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.template-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; animation: fadeInUp var(--t-med) var(--ease) backwards; border-top: 3px solid var(--cht-blue-500); }
.template-card.cat-MISSION_SOCIALE { border-top-color: #4756c9; }
.template-card.cat-MISSION_FISCALE { border-top-color: #c17a1f; }
.template-card.cat-MISSION_COMPTABLE { border-top-color: #1f9d6b; }
.template-card.cat-MISSION_JURIDIQUE { border-top-color: #8a3fbe; }
.template-card h3 { font-size: 14px; margin: 0 0 12px; color: var(--cht-blue-900); font-family: var(--font-display); }
.template-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.template-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; background: var(--gray-100); border-radius: 7px; font-size: 12.8px; transition: background var(--t-fast) var(--ease); }
.template-list li:hover { background: var(--cht-blue-50); }
.template-list .tpl-remove { background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.template-list .tpl-remove:hover { color: var(--red); background: #fdecea; }
.template-add-row { display: flex; gap: 6px; }
.template-add-row input { flex: 1; padding: 7px 9px; border: 1px solid var(--gray-300); border-radius: 7px; font-size: 12.8px; }

/* ── Assistant virtuel (chatbot) ── */
.assistant-widget { position: fixed; bottom: 24px; right: 24px; z-index: 80; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.assistant-fab {
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--cht-blue-600), var(--cht-blue-500)); color: white;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md);
  animation: pulseRing 2.4s infinite; transition: transform var(--t-fast) var(--ease);
}
.assistant-fab:hover { transform: scale(1.06); }
.assistant-panel {
  width: 340px; max-width: 88vw; height: 460px; max-height: 70vh; background: white;
  border-radius: 14px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; overflow: hidden;
  animation: scaleIn var(--t-med) var(--ease);
}
.assistant-header {
  background: linear-gradient(135deg, var(--cht-blue-900), var(--cht-blue-700)); color: white;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.assistant-header strong { display: block; font-size: 13.5px; font-family: var(--font-display); }
.assistant-header .muted { color: #b9cfe6; font-size: 11px; }
.assistant-close { background: rgba(255,255,255,0.12); border: none; color: white; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; }
.assistant-close:hover { background: rgba(255,255,255,0.22); }
.assistant-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--gray-100); }
.msg { max-width: 84%; padding: 9px 12px; border-radius: 12px; font-size: 12.8px; line-height: 1.45; animation: slideInRight var(--t-fast) var(--ease); }
.msg-bot { background: white; color: var(--gray-900); align-self: flex-start; border-bottom-left-radius: 3px; box-shadow: var(--shadow); }
.msg-user { background: var(--cht-blue-600); color: white; align-self: flex-end; border-bottom-right-radius: 3px; }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; flex-shrink: 0; }
.chip { background: var(--cht-blue-100); color: var(--cht-blue-700); border: none; border-radius: 20px; padding: 6px 11px; font-size: 11.5px; font-weight: 600; transition: background var(--t-fast) var(--ease); }
.chip:hover { background: #d9ebf9; }
.assistant-input-row { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--gray-100); flex-shrink: 0; }
.assistant-input-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--gray-300); border-radius: 20px; font-size: 12.8px; outline: none; }
.assistant-input-row input:focus { border-color: var(--cht-blue-500); }
.assistant-input-row .btn { border-radius: 20px; }

/* ── Groupe téléphone (indicatif + numéro) ── */
.phone-group { display: flex; gap: 6px; margin-top: 6px; }
.phone-group select { flex: 0 0 128px; padding: 8px 6px; border: 1px solid var(--gray-300); border-radius: 7px; }
.phone-group input { flex: 1; margin-top: 0 !important; }
.field-hint { font-size: 11px; color: var(--gray-500); font-weight: 400; margin-top: 4px; }
.field-error { font-size: 11.5px; color: var(--red); font-weight: 600; margin-top: 4px; }
.modal input.invalid, .modal select.invalid { border-color: var(--red); }

/* ── Clients ── */
.badge-statut-ACTIF { background: #e6f6ef; color: var(--green); }
.badge-statut-ARCHIVE, .badge-statut-INACTIF { background: var(--gray-100); color: var(--gray-500); }
.inline-new-client { background: var(--cht-blue-50); border: 1px dashed var(--cht-blue-500); border-radius: 8px; padding: 12px; margin: 4px 0 14px; }
.inline-new-client legend { font-size: 11.5px; font-weight: 700; color: var(--cht-blue-700); padding: 0 4px; }
.link-btn { background: none; border: none; color: var(--cht-blue-600); font-size: 12.5px; font-weight: 600; padding: 0; text-decoration: underline; }
.link-btn:hover { color: var(--cht-blue-800); }

/* ── Import Excel ── */
.import-drop { border: 2px dashed var(--gray-300); border-radius: 10px; padding: 24px; text-align: center; color: var(--gray-500); font-size: 12.8px; }
.import-drop input[type="file"] { margin-top: 10px; }
.import-preview-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--gray-300); border-radius: 8px; margin-top: 14px; }
.import-preview-wrap table { font-size: 12px; }
.import-preview-wrap th { position: sticky; top: 0; background: var(--gray-100); }
.import-row-error td { background: #fdecea; }
.import-row-error .row-error-msg { color: var(--red); font-size: 11px; display: block; margin-top: 2px; }
.import-summary { margin-top: 12px; font-size: 12.8px; border-radius: 8px; padding: 10px 12px; line-height: 1.5; }
.import-summary.all-ok { background: #e6f6ef; color: #12734c; }
.import-summary.has-errors { background: #fdf3e6; color: #8a5a10; }
.import-summary ul { margin: 6px 0 0; padding-left: 18px; }
.import-summary li { margin-bottom: 2px; }
.import-summary .ok { color: var(--green); font-weight: 700; }
.import-summary .bad { color: var(--red); font-weight: 700; }
.modal.modal-wide { width: 880px; }

/* ── Champs obligatoires et retours d'erreur ── */
.req { color: var(--red); font-weight: 700; margin-left: 2px; }
.modal .error-msg { margin-bottom: 14px; }
.field-error { display: block; font-size: 11.5px; color: var(--red); margin-top: 4px; }
input.invalid { border-color: var(--red) !important; }

/* ── Modèles : ligne enrichie ── */
.template-list li { align-items: flex-start; }
.tpl-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tpl-name { font-weight: 600; }
.tpl-meta { font-size: 11px; color: var(--gray-500); }
.tpl-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* ── Champ mot de passe avec bouton afficher/masquer ── */
.password-field { position: relative; display: block; }
.password-field input { padding-right: 38px !important; width: 100%; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 4px; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center; border-radius: 5px;
  transition: color var(--t-fast, 0.15s) var(--ease, ease);
}
.password-toggle:hover { color: var(--cht-blue-600); background: var(--gray-100); }
.password-toggle.is-visible { color: var(--cht-blue-600); }

/* ── Sélection multiple et actions groupées ── */
th.sel-col, td.sel-col { width: 34px; padding-right: 0; }
.sel-col input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--cht-blue-600); }
tr.row-selected td { background: var(--cht-blue-100); }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--cht-blue-900); color: white; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; animation: fadeInUp var(--t-fast) var(--ease) backwards; }
.bulk-bar strong { margin-right: 4px; }
.bulk-bar .bulk-spacer { flex: 1; }
.bulk-bar .btn-ghost { background: rgba(255, 255, 255, 0.12); color: white; border-color: transparent; }
.bulk-bar .btn-ghost:hover { background: rgba(255, 255, 255, 0.22); }
.select-all-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--gray-700); margin-bottom: 12px; }
.select-all-line input { width: 16px; height: 16px; accent-color: var(--cht-blue-600); }

/* ── Corbeille : temps restant ── */
.ttl { font-weight: 600; font-size: 12.5px; color: var(--gray-700); white-space: nowrap; }
.ttl-warn { color: var(--amber); }
.ttl-danger { color: var(--red); }
.trash-note { font-size: 12.5px; color: var(--gray-500); margin: -4px 0 14px; }

/* ── Import clients : vérification avant import ── */
.import-map { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; margin-top: 12px; }
.import-map label { font-size: 11.5px; font-weight: 600; color: var(--gray-700); }
.import-map select { width: 100%; margin-top: 3px; padding: 6px; border: 1px solid var(--gray-300); border-radius: 7px; font-size: 12.5px; }
.import-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.import-chip { background: var(--gray-100); color: var(--gray-700); border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.import-chip.c-create { background: #e6f6ef; color: var(--green); }
.import-chip.c-update { background: var(--cht-blue-100); color: var(--cht-blue-700); }
.import-chip.c-warn { background: #fff3e0; color: var(--amber); }
.import-chip.c-bad { background: #fdecea; color: var(--red); }
.import-row-warn td { background: #fff8eb; }
.import-detail { font-size: 11.5px; color: var(--gray-700); line-height: 1.45; }
.import-detail .old { color: var(--gray-500); text-decoration: line-through; }
.import-detail .warn { color: var(--amber); display: block; }

/* ── Tâches récurrentes ── */
.badge-rec-ACTIVE { background: #e6f6ef; color: var(--green); }
.badge-rec-PAUSED { background: #fff3e0; color: var(--amber); }
.badge-rec-STOPPED { background: var(--gray-100); color: var(--gray-500); }
.rec-preview { background: var(--cht-blue-50); border: 1px dashed var(--cht-blue-500); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--cht-blue-800); margin: 4px 0 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .import-map { grid-template-columns: 1fr; } .form-row-2 { grid-template-columns: 1fr; } }

/* ── Boutons d'action « icône seule » (libellé dans title / aria-label) ── */
.btn-icon { padding: 5px 8px; min-width: 32px; justify-content: center; line-height: 1; font-size: 14px; position: relative; }
.btn-icon .btn-count {
  position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px;
  background: var(--cht-blue-600); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.btn-icon[disabled] { pointer-events: auto; } /* garde l'infobulle visible sur un bouton désactivé */
.row-actions .btn-icon { flex: 0 0 auto; }

/* ── Multi-sélection de clients (liste déroulante à cases à cocher) ── */
.ms-field { margin-bottom: 12px; }
.ms-title { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-700); }
.ms { position: relative; margin-top: 6px; }
.ms-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
  padding: 8px 10px; border: 1px solid var(--gray-300); border-radius: 7px; background: #fff; color: var(--gray-900);
  font-size: 13px; cursor: pointer;
}
.ms-toggle:focus-visible { outline: 2px solid var(--cht-blue-500); outline-offset: 2px; }
.ms-toggle:disabled { background: var(--gray-100); cursor: not-allowed; color: var(--gray-500); }
.ms-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { color: var(--gray-500); flex-shrink: 0; }
.ms-panel {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); background: #fff;
  border: 1px solid var(--gray-300); border-radius: 8px; box-shadow: var(--shadow-md); padding: 6px;
}
.ms-panel[hidden] { display: none; }
.modal .ms-panel input.ms-search { margin: 0 0 6px; width: 100%; }
.ms-list { max-height: 190px; overflow-y: auto; }
.modal .ms-option, .ms-option {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 6px;
  font-size: 13px; font-weight: 400; color: var(--gray-900); cursor: pointer;
}
.ms-option[hidden] { display: none; }
.ms-option:hover { background: var(--cht-blue-50); }
.modal .ms-option input[type="checkbox"], .ms-option input[type="checkbox"] { display: inline-block; width: auto; margin: 0; flex-shrink: 0; }
.ms.ms-disabled { opacity: 0.55; }

/* ── Filtres de la vue Clients ── */
.toolbar .filter-select { min-width: 170px; max-width: 280px; }

/* ── Cases à cocher des assignés + bloc Répétition ── */
.cb-list { margin-top: 6px; max-height: 160px; overflow-y: auto; border: 1px solid var(--gray-300); border-radius: 8px; padding: 4px; background: #fff; }
.field-hint { font-size: 12px; color: var(--cht-blue-700, #1d4e89); margin-top: 6px; min-height: 0; }
.field-hint:empty { display: none; }
fieldset.rec-schedule { border: 1px solid var(--gray-300); border-radius: 10px; padding: 10px 14px 4px; margin: 4px 0 14px; }
fieldset.rec-schedule legend { font-size: 12.5px; font-weight: 700; color: var(--gray-700); padding: 0 6px; }
@media (max-width: 720px) { .sidebar { position: static; height: auto; } }

/* ── Recherche de client : aucun résultat / ajout rapide ── */
.ms-empty { padding: 8px; font-size: 12.5px; }
.ms-empty[hidden], .ms-add[hidden] { display: none; }
.ms-add { padding: 6px 4px 2px; }
.ms-add .btn { width: 100%; justify-content: center; white-space: normal; }

/* ── Navigation Mission → Tâche → Clients (Tâches et Récurrences) ── */
.seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn { border: 0; background: transparent; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--gray-700); }
.seg-btn + .seg-btn { border-left: 1px solid var(--gray-300); }
.seg-btn:hover { background: var(--cht-blue-50); }
.seg-btn.active { background: var(--cht-blue-600); color: #fff; font-weight: 600; }
.seg-btn:focus-visible { outline: 2px solid var(--cht-blue-500); outline-offset: -2px; }

.drill-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 14px; font-size: 14px; }
.drill-crumbs .crumb { border: 0; background: none; padding: 4px 8px; border-radius: 6px; color: var(--cht-blue-600); font-weight: 600; cursor: pointer; font-size: 14px; }
.drill-crumbs .crumb:hover { background: var(--cht-blue-50); text-decoration: underline; }
.drill-crumbs .crumb-current { font-weight: 700; color: var(--gray-900); padding: 4px 8px; }
.drill-crumbs .crumb-sep { color: var(--gray-500); }

.drill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 8px; }
.drill-card {
  text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: #fff; cursor: pointer;
  border: 1px solid var(--gray-300); border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); font: inherit; color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.drill-card:hover { transform: translateY(-2px); border-color: var(--cht-blue-500); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10); }
.drill-card:focus-visible { outline: 2px solid var(--cht-blue-500); outline-offset: 2px; }
.drill-card-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.drill-card-sub { font-size: 13px; color: var(--gray-500); }
.drill-card-add { border-style: dashed; background: var(--cht-blue-50); justify-content: center; }
.drill-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.drill-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--gray-100); color: var(--gray-700); }
.drill-chip.chip-danger { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.drill-chip.chip-ok { background: #dcfce7; color: #15803d; }

.drill-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px; }
.drill-head h3 { margin: 0; font-size: 18px; }
.drill-table td { vertical-align: top; }
.client-chip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.client-chip + .client-chip { border-top: 1px dashed var(--gray-200, #e5e7eb); }
.client-chip .link-btn { margin: 0; font-size: 14px; }
.client-chip .btn-icon { padding: 2px 6px; min-width: 26px; font-size: 12px; }
