:root {
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --violet: #7c3aed;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --green: #16a34a;
  --amber: #d97706;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(31, 36, 48, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.screen { min-height: 100vh; min-height: 100dvh; }

/* ---------- Boutons ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.link {
  background: none; border: none; color: var(--indigo);
  font-weight: 600; cursor: pointer; font-size: inherit; padding: 0;
}

/* ---------- Écran de connexion ---------- */
#auth-screen {
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--indigo) 0%, var(--violet) 100%);
}
.auth-card {
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--indigo), var(--violet));
  color: #fff; font-size: 26px; font-weight: 700;
  border-radius: 12px;
}
.brand h1 { font-size: 26px; }
.auth-subtitle { color: var(--muted); margin: 8px 0 24px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); }

form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
input, select {
  font-size: 16px; /* >=16px évite le zoom auto sur iOS */
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--indigo); border-color: var(--indigo); }
.error { color: var(--danger); font-size: 14px; font-weight: 600; }
.info { color: var(--green); font-size: 14px; font-weight: 600; }
.link.small { font-size: 13px; font-weight: 600; align-self: center; margin-top: 2px; }
.btn-block { width: 100%; }
.auth-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- En-tête appli ---------- */
.app-header {
  background: linear-gradient(160deg, var(--indigo) 0%, var(--violet) 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 18px) 18px 22px;
  border-radius: 0 0 24px 24px;
}
.app-header-top { display: flex; align-items: center; justify-content: space-between; }
.app-header-top h1 { font-size: 24px; }
.header-user { display: flex; align-items: center; gap: 10px; }
.user-email { font-size: 13px; opacity: 0.9; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icon {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px; cursor: pointer;
}

.summary { display: flex; gap: 10px; margin-top: 18px; }
.summary-card {
  flex: 1; background: rgba(255,255,255,0.15); border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 4px; backdrop-filter: blur(4px);
}
.summary-label { font-size: 12px; opacity: 0.9; }
.summary-value { font-size: 17px; font-weight: 700; }

/* ---------- Contenu ---------- */
.content { padding: 18px; padding-bottom: 100px; max-width: 640px; margin: 0 auto; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-select { flex: 1; padding: 10px 12px; }

.expense-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.expense-item {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: transform 0.05s ease;
}
.expense-item:active { transform: scale(0.99); }
.expense-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0; background: #eef2ff;
}
/* Miniature du justificatif (remplace l'icône de catégorie) */
.expense-icon.has-thumb { overflow: hidden; background: var(--border); }
.expense-icon .thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.expense-main { flex: 1; min-width: 0; }
.expense-desc { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.expense-right { text-align: right; flex-shrink: 0; }
.expense-amount { font-weight: 700; font-size: 16px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; margin-top: 4px; background: #eef2ff; color: var(--indigo);
}

/* Barre de sélection du mois */
.month-bar { display: flex; align-items: center; gap: 10px; margin-top: 16px; justify-content: center; }
.month-picker {
  background: rgba(255,255,255,0.18); border: none; color: #fff; font-weight: 600;
  text-align: center; border-radius: 12px; padding: 8px 12px; width: auto;
  color-scheme: dark;
}
.month-bar .btn-icon { font-size: 22px; line-height: 1; }

/* Bouton export */
.btn-export {
  width: 100%; background: #fff; color: var(--indigo); border: 2px solid var(--indigo);
  margin-bottom: 16px;
}
.btn-export:hover { background: #eef2ff; }

/* Champ avec libellé (mime un <label> du formulaire) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--muted); }

/* Bouton « Choisir un chantier » (ouvre le sélecteur) */
.picker-btn { width: 100%; text-align: left; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 16px; color: var(--text); cursor: pointer; }
.picker-btn.picker-empty { color: var(--muted); }
.picker-btn:disabled { opacity: .6; }

/* Sélecteur de chantier (modale plein écran avec recherche) */
.picker-search { width: 100%; margin-bottom: 10px; }
.picker-list { list-style: none; display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  border-bottom: 1px solid var(--border); cursor: pointer; }
.picker-item:last-child { border-bottom: none; }
.picker-item:active, .picker-item:hover { background: #eef2ff; }
.picker-item.selected { background: #eef2ff; font-weight: 700; }
.picker-item.picker-none { color: var(--muted); font-style: italic; }
.picker-item.picker-empty-msg { color: var(--muted); cursor: default; }
.picker-label { flex: 1; min-width: 0; }
.fav-star { background: none; border: none; font-size: 22px; line-height: 1; color: #d1d5db;
  cursor: pointer; flex-shrink: 0; padding: 0 2px; }
.fav-star.on { color: #f59e0b; }

/* Bouton « Joindre un justificatif » (sans scan) */
.btn-attach { width: 100%; border: 1px dashed var(--border); margin: 4px 0 10px; }

/* Recherche dans la liste de gestion des chantiers */
.chantiers-search { width: 100%; margin: 8px 0 4px; position: sticky; top: 0; z-index: 1; }

/* Hauteur figée : la fenêtre ne "saute" pas quand la liste filtre (seule la liste défile) */
#chantier-picker .modal-sheet, #chantiers-modal .modal-sheet {
  height: 85vh; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
}
#chantier-picker .picker-list { flex: 1 1 auto; max-height: none; }
#chantiers-modal .chantiers-list { flex: 1 1 auto; max-height: none; }

/* Gestion des chantiers */
.chantier-add { flex-direction: row; gap: 10px; margin-bottom: 8px; }
.chantier-add input { flex: 1; }
.chantiers-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.chantier-item {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.chantier-item .nom { flex: 1; font-weight: 600; }
.chantier-item button { background: #fee2e2; color: var(--danger); border: none; border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; }
.chantier-item button.edit { background: #eef2ff; color: var(--indigo); }

.justif-current { font-size: 14px; font-weight: 600; color: var(--green); margin: -4px 0 8px; }
.justif-current a { color: var(--indigo); }

/* Bouton scan ticket */
.btn-scan {
  width: 100%; background: linear-gradient(160deg, var(--indigo), var(--violet));
  color: #fff; margin-bottom: 12px;
}
.btn-scan:disabled { opacity: 0.6; }
.scan-status { font-size: 14px; font-weight: 600; margin-bottom: 12px; text-align: center; }
.scan-status.working { color: var(--indigo); }
.scan-status.ok { color: var(--green); }
.scan-status.ko { color: var(--danger); }

/* Formulaire */
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 4px; }
.hint span { font-weight: 700; color: var(--text); }

.empty-state { text-align: center; color: var(--muted); margin-top: 60px; line-height: 1.6; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 20px);
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: var(--indigo); color: #fff; font-size: 32px; line-height: 1;
  box-shadow: 0 8px 24px rgba(79,70,229,0.45); cursor: pointer; z-index: 50;
}
.fab:active { transform: scale(0.95); }

/* ---------- Affichage responsive (téléphone + ordinateur) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { touch-action: manipulation; overscroll-behavior-y: none; }
/* Sur grand écran : tout le contenu reste dans une colonne centrée (pas étiré). */
@media (min-width: 760px) {
  .app-header-top, .main-nav { max-width: 720px; margin-left: auto; margin-right: auto; }
  .view { max-width: 720px; margin-left: auto; margin-right: auto; }
  .fab { right: calc(50% - 360px + 18px); }
}

/* ---------- Modale ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-sheet {
  position: relative; background: var(--card); width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0; padding: 12px 20px calc(env(safe-area-inset-bottom) + 24px);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.2); animation: slideUp 0.22s ease;
  max-height: 92vh; overflow-y: auto; overflow-x: hidden;
}
/* Saisie des heures : le slide horizontal change de jour (géré en JS), pas de scroll latéral. */
#heures-modal .modal-sheet { touch-action: pan-y; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 4px; background: var(--border); border-radius: 999px; margin: 4px auto 14px; }
.modal-sheet h2 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-danger { margin-right: auto; }

/* ---------- Bannière config ---------- */
.config-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: #fffbeb; color: #92400e; padding: 12px 16px; text-align: center;
  font-size: 14px; border-top: 1px solid #fde68a;
}
.config-banner code { background: #fef3c7; padding: 2px 6px; border-radius: 6px; }

/* ===================== Équipe / rôles / workflow ===================== */

/* Badge de rôle dans l'en-tête */
.role-badge { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; }
.role-badge.role-admin    { background: #ede9fe; color: #6d28d9; }
.role-badge.role-valideur { background: #dbeafe; color: #1d4ed8; }
.role-badge.role-ouvrier  { background: #f1f5f9; color: #475569; }

/* Barre de navigation par onglets */
.main-nav { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav-btn { flex: 0 0 auto; background: rgba(255,255,255,.18); color: #fff; border: none;
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; cursor: pointer;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.nav-btn.active { background: #fff; color: var(--indigo); }
.nav-count { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px;
  min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.nav-btn.active .nav-count { background: var(--danger); color: #fff; }

/* Vues */
.view { display: block; }
.view-title { padding: 16px 16px 4px; font-size: 20px; }

/* Bandeau de statut de la note du mois */
.note-status { margin: 0 16px 4px; padding: 10px 14px; border-radius: 12px; font-size: 14px;
  background: #f1f5f9; color: #475569; }
.note-status.st-brouillon { background: #f1f5f9; color: #475569; }
.note-status.st-soumise   { background: #fef3c7; color: #92400e; }
.note-status.st-validee    { background: #dcfce7; color: #166534; }
.note-status.st-refusee    { background: #fee2e2; color: #991b1b; }
.note-status.st-transmise  { background: #ede9fe; color: #6d28d9; }
.note-motif { margin-top: 6px; font-size: 13px; font-weight: 600; }

.frais-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.btn-mini { padding: 6px 12px; font-size: 13px; border-radius: 10px; }

/* Liste des notes (validation) */
.note-list { list-style: none; padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.note-item { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; box-shadow: var(--shadow); }
.note-item:active { transform: scale(.99); }
.note-main { flex: 1; }
.note-person { font-weight: 700; }
.note-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.note-arrow { font-size: 24px; color: var(--muted); }
.note-total { text-align: right; font-weight: 800; font-size: 18px; padding: 10px 4px; }
.note-comment { font-size: 13px; color: var(--amber); margin-top: 4px; font-style: italic; }

/* Tableau de bord */
.dash-head { padding-bottom: 8px; }
.dash-table { padding: 0 16px; overflow-x: auto; }
table.dash { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dash th, table.dash td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.dash th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.dash-total { font-weight: 700; white-space: nowrap; }
.st-pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.st-pill.st-brouillon { background: #f1f5f9; color: #475569; }
.st-pill.st-soumise   { background: #fef3c7; color: #92400e; }
.st-pill.st-validee    { background: #dcfce7; color: #166534; }
.st-pill.st-refusee    { background: #fee2e2; color: #991b1b; }
.st-pill.st-transmise  { background: #ede9fe; color: #6d28d9; }
.st-pill.st-aucune     { background: #f8fafc; color: #94a3b8; }
#view-dashboard, #view-comptes { padding-bottom: 40px; }
#export-all-btn { margin-left: 16px; margin-right: 16px; width: calc(100% - 32px); }

/* Gestion des comptes */
.comptes-list { list-style: none; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.compte-item { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow); }
.compte-item.inactif { opacity: .75; border-style: dashed; }
.compte-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.compte-nom { font-weight: 700; }
.compte-email { font-size: 13px; color: var(--muted); }
.compte-controls { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.compte-controls label { flex: 1; min-width: 130px; font-size: 13px; color: var(--muted); }
.compte-controls select { width: 100%; margin-top: 4px; padding: 8px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; background: #fff; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; cursor: pointer; }
.switch input { width: 18px; height: 18px; }

/* Hints dans les vues admin (le .hint de base sert au formulaire) */
.view .hint { padding: 0 16px; margin: 4px 0; }

/* month-bar + summary désormais sur fond clair (déplacés hors de l'en-tête) */
.view .month-bar { margin: 14px 0 4px; }
.view .month-picker { background: var(--card); color: var(--text); border: 1px solid var(--border); color-scheme: light; }
.view .month-bar .btn-icon { background: #eef2ff; color: var(--indigo); }
.view .summary { padding: 0 16px; margin-top: 12px; }
.view .summary-card { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: none; }
.view .summary-label { color: var(--muted); opacity: 1; }
.view .summary-value { color: var(--text); }

/* ===================== Balayage des dépenses (archiver / supprimer) ===================== */
.expense-row { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.expense-row .expense-item {
  position: relative; z-index: 2; box-shadow: none; border-radius: var(--radius);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.swipe-action {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: #fff; font-weight: 800; font-size: 22px;
}
.swipe-action span { font-size: 12px; font-weight: 700; }
.swipe-action.archive { left: 0;  background: var(--amber);  align-items: flex-start;  padding-left: 24px; }
.swipe-action.delete  { right: 0; background: var(--danger); align-items: flex-end;    padding-right: 24px; }

#view-frais .swipe-hint { margin: -4px 0 12px; padding: 0; text-align: center; }

/* Badges de poste (statut affiché) */
.role-badge.poste-directeur  { background: #ede9fe; color: #6d28d9; }
.role-badge.poste-conducteur { background: #dbeafe; color: #1d4ed8; }
.role-badge.poste-ouvrier    { background: #f1f5f9; color: #475569; }

/* ===================== Suivi des heures ===================== */
.weeks { display: flex; flex-direction: column; gap: 8px; }
.week-header {
  margin: 14px 2px 2px; font-size: 13px; font-weight: 800; color: var(--indigo);
  text-transform: uppercase; letter-spacing: .02em;
}
.week-header-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.week-header .week-total { color: var(--muted); font-weight: 700; text-transform: none; letter-spacing: 0; text-align: right; }
.week-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; text-transform: none; letter-spacing: 0; }
.week-controls .btn-mini { margin: 0; }

.day-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 10px 12px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: transform .05s ease;
}
.day-card:active { transform: scale(.99); }
.day-card.weekend { background: #fafafe; }
.day-card.is-absence { border-style: dashed; }
.day-date { width: 42px; flex-shrink: 0; text-align: center; line-height: 1.1; }
.day-dow { display: block; font-size: 11px; font-weight: 800; color: var(--muted); }
.day-num { display: block; font-size: 20px; font-weight: 800; }
.day-body { flex: 1; min-width: 0; }
.day-segs { font-weight: 600; font-size: 14px; }
.day-absence { font-weight: 700; color: var(--violet); }
.day-empty { color: var(--muted); font-weight: 600; }
.day-flags { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; }
.day-flag { font-size: 12px; font-weight: 700; background: #eef2ff; color: var(--indigo); border-radius: 999px; padding: 1px 7px; }
.day-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.day-hours { font-weight: 800; font-size: 16px; }
.day-chevron { font-size: 22px; color: var(--muted); }
.day-pill { font-size: 12px; font-weight: 800; line-height: 1.1; text-align: center; }

/* Modale jour : bascule travaillé / absence */
.seg-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.seg-btn { flex: 1; border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 12px; padding: 10px; font-size: 15px; font-weight: 700; cursor: pointer; }
.seg-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }

.h-lignes { display: flex; flex-direction: column; gap: 10px; }
.h-ligne { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.h-ligne .h-ligne-lieu { width: 100%; min-width: 0; }
.h-ligne-sub { display: flex; align-items: center; gap: 8px; }
.h-ligne-phase { flex: 1; min-width: 0; }
.h-ligne-heures { width: 78px; flex-shrink: 0; text-align: right; }
.h-ligne-h { color: var(--muted); font-weight: 700; }
.h-check.h-check-off { opacity: .45; }
.h-ligne-del { flex-shrink: 0; width: 34px; height: 38px; border: none; border-radius: 10px;
  background: #fee2e2; color: var(--danger); font-weight: 800; cursor: pointer; }
.h-ligne-atelier { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .92rem; }
.h-ligne-atelier input { width: 18px; height: 18px; flex-shrink: 0; }
.btn-add-ligne { width: 100%; margin: 10px 0; border: 1px dashed var(--border); }
.btn-copy-prev { width: 100%; margin-bottom: 10px; }
.h-swipe-hint { text-align: center; color: var(--muted); font-size: .85rem; margin: -4px 0 8px; }

.h-flags { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 6px; }
.h-check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.h-check input { width: 20px; height: 20px; flex-shrink: 0; }

/* Sections « À valider » (frais / heures séparés) */
.valid-section { margin-top: 8px; }
.valid-section-title { padding: 14px 16px 6px; font-size: 14px; font-weight: 800; color: var(--indigo); }
/* Badge de type dans « À valider » */
.type-badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
.type-badge.tb-frais  { background: #dcfce7; color: #166534; }
.type-badge.tb-heures { background: #dbeafe; color: #1d4ed8; }

/* ===================== Mes frais : sous-onglets + notes ===================== */
.subnav { display: flex; gap: 8px; padding: 14px 16px 4px; max-width: 640px; margin: 0 auto; }
.subnav-btn { flex: 1; border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 12px; padding: 9px; font-size: 15px; font-weight: 700; cursor: pointer; }
.subnav-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }

.note-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 12px 16px 2px; max-width: 640px; margin: 0 auto; }
.note-head-title { font-size: 20px; }
#frais-back { white-space: nowrap; }

/* En-tête de section dans la liste (déjà refusées / ajoutées depuis) */
.list-section { list-style: none; font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); margin: 8px 2px 2px; padding: 0; }
.list-section.sec-refused { color: #991b1b; }
.list-section.sec-new { color: #166534; }

/* Liste « Mes notes » */
.notes-by-statut { padding: 8px 16px 40px; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.notes-group-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
  color: var(--indigo); margin: 12px 2px 2px; }
.note-card { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; box-shadow: var(--shadow); }
.note-card:active { transform: scale(.99); }
.note-card-main { flex: 1; min-width: 0; }
.note-card-title { font-weight: 700; }
.note-card-sub { margin-top: 4px; }
.note-card-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.note-card-total { font-weight: 800; }

/* Bascule Frais / Heures du tableau de bord */
.dash-toggle { display: flex; gap: 8px; padding: 4px 16px 12px; }
.dash-tab { flex: 1; border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 12px; padding: 9px; font-size: 14px; font-weight: 700; cursor: pointer; }
.dash-tab.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
#export-heures-btn { margin-left: 16px; margin-right: 16px; width: calc(100% - 32px); }

/* ===== Mes frais — le fil ===== */
/* Bandeau récap en haut de la vue (sous l'en-tête violet) : total à envoyer + bouton */
.frais-head { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; max-width: 640px; margin: 12px auto 0;
  width: calc(100% - 32px); }
.frais-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.frais-head-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.frais-head-total { font-size: 26px; font-weight: 800; color: var(--text); margin-top: 2px; }
#send-btn { white-space: nowrap; }

/* Barre de filtres (À envoyer / Tout) — pilules, inspirées de .dash-tab */
.frais-filter { display: flex; gap: 8px; padding: 4px 16px 12px; max-width: 640px; margin: 0 auto; }
.filter-btn { flex: 1; border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 8px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .05s ease; }
.filter-btn:active { transform: scale(.98); }
.filter-btn.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* Pastille de statut à l'intérieur d'une carte de dépense (sous la description) */
.expense-main .st-pill { margin-top: 4px; font-size: 11px; }

/* Bannière de refus : marge cohérente */
#refus-banner { margin: 8px 16px; }
