/* ─── Nestor Design System — Ivoire (clair) / Minuit (sombre) ─── */
:root {
  /* Ivoire : papeterie de palace */
  --primary: #8c7134;
  --primary-dark: #6f5a26;
  --gold: #c9a44e;
  --gold-light: #e9c87a;
  --bg: #f7f4ee;
  --surface: #fffefb;
  --border: #e6e0d3;
  --text: #211d15;
  --text-muted: #8a8272;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(33,29,21,0.07), 0 1px 2px rgba(33,29,21,0.04);
  --shadow-md: 0 6px 20px rgba(33,29,21,0.14);
  /* Header / navigation : encre en clair */
  --header-bg: #211d15;
  --header-ink: #f3eee2;
  --header-muted: rgba(243,238,226,0.6);
  --header-hover: rgba(255,255,255,0.08);
  /* Chrono : carte encre, temps or */
  --chrono-bg: #211d15;
  --chrono-ink: #f3eee2;
  --chrono-time: #e9c87a;
  --chrono-border: transparent;
  /* Boutons */
  --btn-primary-bg: #211d15;
  --btn-primary-ink: #f3eee2;
  /* Statuts mission */
  --st-a_faire-bg: #ece8df;   --st-a_faire-ink: #7c7462;
  --st-en_cours-bg: #f0e5cc;  --st-en_cours-ink: #8c6d1f;
  --st-terminee-bg: #dfead9;  --st-terminee-ink: #3f7a4a;
  --st-facturee-bg: #e2e6f5;  --st-facturee-ink: #44599e;
  --st-payee-bg: #d6e8dc;     --st-payee-ink: #2f6b45;
  /* Sémantique */
  --danger-bg: #f7e3dd; --danger-ink: #a83a2a; --danger-border: #eccbc2;
}
:root[data-theme="dark"] {
  /* Minuit : nuit & champagne */
  --primary: #c8a35f;
  --primary-dark: #a8853f;
  --gold: #c8a35f;
  --gold-light: #d3b276;
  --bg: #101218;
  --surface: #1b1e2a;
  --border: #262a38;
  --text: #ede8dc;
  --text-muted: #8f8a7b;
  --shadow: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 26px rgba(0,0,0,0.45);
  --header-bg: #14161f;
  --header-ink: #ede8dc;
  --header-muted: rgba(237,232,220,0.55);
  --header-hover: rgba(255,255,255,0.07);
  --chrono-bg: linear-gradient(135deg, #23212b 0%, #1b1a22 100%);
  --chrono-ink: #ede8dc;
  --chrono-time: #c8a35f;
  --chrono-border: rgba(200,163,95,0.45);
  --btn-primary-bg: #c8a35f;
  --btn-primary-ink: #17151c;
  --st-a_faire-bg: rgba(143,138,123,0.16);  --st-a_faire-ink: #a5a08f;
  --st-en_cours-bg: rgba(200,163,95,0.16);  --st-en_cours-ink: #d3b276;
  --st-terminee-bg: rgba(88,168,123,0.16);  --st-terminee-ink: #6dbb90;
  --st-facturee-bg: rgba(127,143,209,0.18); --st-facturee-ink: #9aa8e2;
  --st-payee-bg: rgba(63,143,95,0.2);       --st-payee-ink: #57a878;
  --danger-bg: rgba(216,92,72,0.14); --danger-ink: #e08a76; --danger-border: rgba(216,92,72,0.35);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; font-size: 0.925rem; overflow-x: hidden; }

/* Chiffres élégants : serif New York + chiffres tabulaires */
.num { font-family: ui-serif, 'New York', Georgia, serif; font-variant-numeric: tabular-nums; }

/* ─── LOGIN ─── */
.login-body { background: var(--header-bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; max-width: 380px; padding: 16px; }
.login-card { background: var(--surface); border-radius: 18px; padding: 40px 32px; box-shadow: 0 8px 40px rgba(0,0,0,0.4); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-icon { font-size: 3rem; display: block; margin-bottom: 8px; }
.login-title { margin: 0 0 4px; font-size: 1.5rem; font-weight: 700; font-family: ui-serif, 'New York', Georgia, serif; }
.login-subtitle { margin: 0; color: var(--text-muted); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.alert-error { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 0.85rem; }
.alert-success { background: var(--st-payee-bg); color: var(--st-payee-ink); border: 1px solid var(--st-payee-ink); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 0.85rem; }

/* ─── HEADER ─── */
.header {
  background: var(--header-bg);
  color: var(--header-ink);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.brand-icon { font-size: 1.4rem; }
.brand-name { font-weight: 600; font-size: 1.15rem; letter-spacing: 0.02em; color: var(--gold-light); font-family: ui-serif, 'New York', Georgia, serif; }
.header-right { display: flex; align-items: center; gap: 12px; }
.version { background: rgba(201,164,78,0.18); color: var(--gold-light); border: 1px solid rgba(201,164,78,0.4); padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.theme-btn { background: none; border: 1px solid rgba(255,255,255,0.15); color: var(--header-ink); font-size: 0.95rem; cursor: pointer; padding: 4px 9px; border-radius: 999px; line-height: 1.4; transition: all 0.2s; }
.theme-btn:hover { background: var(--header-hover); }
.btn-logout { color: var(--header-muted); text-decoration: none; font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; transition: all 0.2s; }
.btn-logout:hover { color: var(--header-ink); background: var(--header-hover); }
.nav { display: flex; gap: 4px; }
.nav-link { color: var(--header-muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; transition: all 0.2s; }
.nav-link:hover { color: var(--header-ink); background: var(--header-hover); }
.nav-link.active { color: var(--gold-light); background: rgba(201,164,78,0.12); }

/* ─── MENU "PLUS" (desktop) ─── */
.nav-more { position: relative; display: flex; }
.nav-more-btn { cursor: pointer; background: none; border: none; font-family: inherit; }
.more-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(0,0,0,0.18); padding: 6px; z-index: 300;
  display: none; flex-direction: column; gap: 2px; }
.more-menu.open { display: flex; }
.more-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 0.9rem; font-weight: 500; white-space: nowrap;
  transition: background 0.15s, color 0.15s; }
.more-link span { font-size: 1.05rem; line-height: 1; }
.more-link:hover { background: var(--bg); }
.more-link.active { color: var(--primary); background: rgba(201,164,78,0.12); }

/* ─── BURGER ─── */
.burger-btn { display: none; background: none; border: none; color: var(--header-muted); font-size: 1.4rem; cursor: pointer; padding: 4px 8px; line-height: 1; border-radius: 6px; transition: all 0.2s; }
.burger-btn:hover { color: var(--header-ink); background: var(--header-hover); }
.burger-menu { display: none; position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,0.5); }
.burger-menu.open { display: flex; }
.burger-menu-panel { background: var(--header-bg); width: min(320px, 88vw); height: 100%; display: flex; flex-direction: column; box-shadow: 4px 0 24px rgba(0,0,0,0.4); overflow-y: auto; }
.burger-menu-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.burger-menu-title { font-weight: 600; font-size: 1rem; color: var(--gold-light); font-family: ui-serif, 'New York', Georgia, serif; }
.burger-close { background: none; border: none; color: var(--header-muted); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all 0.2s; }
.burger-close:hover { color: var(--header-ink); background: var(--header-hover); }
.burger-menu-links { display: flex; flex-direction: column; padding: 12px 0; flex: 1; }
.burger-link { display: flex; align-items: center; gap: 14px; padding: 14px 24px; text-decoration: none; color: var(--header-muted); font-size: 1rem; font-weight: 500; transition: all 0.15s; border-left: 3px solid transparent; }
.burger-link span { font-size: 1.25rem; }
.burger-link:hover { color: var(--header-ink); background: rgba(255,255,255,0.06); }
.burger-link.active { color: var(--gold-light); border-left-color: var(--gold); background: rgba(201,164,78,0.08); }
.burger-logout { display: flex; align-items: center; gap: 10px; padding: 16px 24px; color: var(--header-muted); text-decoration: none; font-size: 0.9rem; border-top: 1px solid rgba(255,255,255,0.08); transition: color 0.15s; }
.burger-logout:hover { color: var(--header-ink); }

/* ─── LAYOUT ─── */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 12px; }
.page-title { margin: 0 0 4px; font-size: 1.5rem; font-weight: 700; font-family: ui-serif, 'New York', Georgia, serif; }
.page-subtitle { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }
.page-actions--full { margin-bottom: 16px; }

/* ─── CARDS ─── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-weight: 700; font-size: 1rem; }
.section-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin: 22px 0 10px; }

/* ─── BOUTONS ─── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 999px; padding: 10px 18px; font-weight: 600; cursor: pointer; font-size: 0.875rem; transition: all 0.2s; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-ink); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(33,29,21,0.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--gold); color: var(--primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-border); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ─── CHRONO ─── */
.chrono-card { background: var(--chrono-bg); color: var(--chrono-ink); border: 1px solid var(--chrono-border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-md); }
.chrono-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; margin-bottom: 4px; }
.chrono-mission { font-size: 1.05rem; font-weight: 650; }
.chrono-client { font-size: 0.85rem; opacity: 0.72; }
.chrono-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.chrono-time { font-family: ui-serif, 'New York', Georgia, serif; font-variant-numeric: tabular-nums; font-size: 2.2rem; font-weight: 600; color: var(--chrono-time); line-height: 1; }
.btn-chrono-stop { width: 48px; height: 48px; border-radius: 999px; border: none; cursor: pointer; display: grid; place-items: center; background: var(--gold); color: #211d15; flex-shrink: 0; transition: transform 0.15s; }
.btn-chrono-stop:hover { transform: scale(1.06); }
.btn-chrono-stop::before { content: ''; width: 15px; height: 15px; border-radius: 3px; background: currentColor; }
.btn-chrono-play { min-width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface); color: var(--primary); font-size: 0.95rem; padding: 0 12px; transition: all 0.15s; }
.btn-chrono-play:hover { border-color: var(--gold); background: var(--st-en_cours-bg); }
.btn-chrono-play.running { background: var(--st-en_cours-bg); border-color: var(--gold); color: var(--st-en_cours-ink); font-weight: 700; }
.mini-time { font-family: ui-serif, 'New York', Georgia, serif; font-variant-numeric: tabular-nums; }

/* ─── KPI ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 8px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-value { font-family: ui-serif, 'New York', Georgia, serif; font-variant-numeric: tabular-nums; font-size: 1.55rem; font-weight: 650; color: var(--primary); line-height: 1.1; }
.kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ─── CHIPS STATUT ─── */
.chip { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.75rem; font-weight: 650; white-space: nowrap; }
.param-checks { display: flex; flex-wrap: wrap; gap: 10px; }
.param-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.param-check input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.param-radios { display: flex; flex-direction: column; gap: 8px; }
.param-radio { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.param-radio input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
/* Alerte chrono oublie (tableau de bord) */
.chrono-alerte { margin-top: 12px; padding: 8px 12px; border-radius: 10px; font-size: 0.82rem; font-weight: 600;
  background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-border); }
/* Section « En retard » du tableau de bord */
.section-title-retard { color: var(--danger-ink); }
.item-card-retard { border-color: var(--danger-border); border-left: 3px solid var(--danger-ink); }
.chip-retard { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-border); }
.chip.st-a_faire { background: var(--st-a_faire-bg); color: var(--st-a_faire-ink); }
.chip.st-en_cours { background: var(--st-en_cours-bg); color: var(--st-en_cours-ink); }
.chip.st-terminee { background: var(--st-terminee-bg); color: var(--st-terminee-ink); }
.chip.st-facturee { background: var(--st-facturee-bg); color: var(--st-facturee-ink); }
.chip.st-payee { background: var(--st-payee-bg); color: var(--st-payee-ink); }
select.statut-select { width: auto; font-weight: 600; border-radius: 999px; padding: 6px 10px; }
select.statut-select.st-a_faire { border-left: 3px solid var(--st-a_faire-ink); color: var(--st-a_faire-ink); }
select.statut-select.st-en_cours { border-left: 3px solid var(--st-en_cours-ink); color: var(--st-en_cours-ink); }
select.statut-select.st-terminee { border-left: 3px solid var(--st-terminee-ink); color: var(--st-terminee-ink); }
select.statut-select.st-facturee { border-left: 3px solid var(--st-facturee-ink); color: var(--st-facturee-ink); }
select.statut-select.st-payee { border-left: 3px solid var(--st-payee-ink); color: var(--st-payee-ink); }

/* Badge deadline */
.badge-deadline { font-size: 0.72rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; white-space: nowrap; background: var(--st-facturee-bg); color: var(--st-facturee-ink); }
.badge-deadline.retard { background: var(--danger-bg); color: var(--danger-ink); }
.badge-deadline.jour { background: var(--st-en_cours-bg); color: var(--st-en_cours-ink); }
.item-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge-date { font-size: 0.72rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; white-space: nowrap; flex-shrink: 0; background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-echeance { display: inline-block; font-size: 0.72rem; padding: 1px 8px; border-radius: 6px; font-weight: 600; white-space: nowrap; background: var(--danger-bg); color: var(--danger-ink); border: 1px solid var(--danger-border); }
.badge-echeance.jour { background: var(--st-en_cours-bg); color: var(--st-en_cours-ink); border-color: transparent; }
.badge-debours { font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; font-weight: 650; background: var(--st-en_cours-bg); color: var(--st-en_cours-ink); border: none; cursor: pointer; font-family: inherit; }
.badge-debours:hover { filter: brightness(0.96); }

/* ─── FILTRES ONGLET ─── */
.filter-chips { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip { padding: 5px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; text-decoration: none; background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); transition: all 0.15s; }
.filter-chip:hover { border-color: var(--gold); }
.filter-chip.active { background: var(--btn-primary-bg); color: var(--btn-primary-ink); border-color: var(--btn-primary-bg); }
.filter-bar { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }

/* ─── RECHERCHE LIBRE TRANSVERSALE ─── */
.search-block { margin-bottom: 14px; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 14px; font-size: 1rem; pointer-events: none; opacity: 0.7; }
.search-input { width: 100%; padding: 12px 40px 12px 40px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 1rem; box-shadow: var(--shadow); }
.search-input:focus { outline: none; border-color: var(--gold); }
.search-clear { position: absolute; right: 8px; width: 30px; height: 30px; border: none; background: transparent;
  color: var(--text-muted); font-size: 1rem; cursor: pointer; border-radius: 50%; }
.search-clear:hover { background: var(--bg); color: var(--text); }
.search-results { margin-top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.search-hint { margin: 0; padding: 10px 14px; font-size: 0.8rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.search-result { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; text-decoration: none;
  color: var(--text); border-bottom: 1px solid var(--border); }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg); }
.search-result-ico { font-size: 1.15rem; line-height: 1.4; flex-shrink: 0; }
.search-result-body { min-width: 0; flex: 1; }
.search-result-top { display: flex; align-items: center; gap: 8px; }
.search-result-titre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-tag { flex-shrink: 0; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.search-result-sub { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.search-extra { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.flash-cible { animation: flashCible 2s ease-out; }
@keyframes flashCible {
  0%, 25% { box-shadow: 0 0 0 2px var(--gold); border-color: var(--gold); }
  100% { box-shadow: var(--shadow); }
}

/* ─── TABLES ─── */
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); font-size: 0.82rem; color: var(--text-muted); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
td.num, th.num { text-align: right; }

/* ─── FORMS ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; }
.form-full { grid-column: 1 / -1; }
label { font-weight: 600; margin-bottom: 5px; font-size: 0.85rem; color: var(--text); }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 0.875rem; background: var(--surface); color: var(--text); transition: border-color 0.2s; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,78,0.14); }
.select-sm { padding: 6px 8px; font-size: 0.82rem; width: auto; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ─── MODAL ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-title { font-weight: 700; font-size: 1rem; font-family: ui-serif, 'New York', Georgia, serif; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 4px; }
.modal-close:hover { background: var(--bg); }
#modal-body { padding: 20px 24px; }

/* ─── LISTES MISSIONS / ITEMS ─── */
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
.item-row { display: flex; align-items: center; gap: 12px; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 0.95rem; }
.item-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.item-foot { display: flex; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); align-items: center; flex-wrap: wrap; }

/* ─── STARS ─── */
.star { cursor: pointer; color: var(--border); font-size: 1.1rem; transition: color 0.15s; background: none; border: none; padding: 0; }
.star.active { color: var(--gold); }
.star:hover { color: var(--gold-light); }
.stars { color: var(--gold); font-size: 0.9rem; }

/* ─── PRESTAS ─── */
.prestas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.presta-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 0; }
.presta-cat { display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--st-a_faire-bg); color: var(--st-a_faire-ink); margin-bottom: 6px; }
.presta-links { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.presta-link { font-size: 0.8rem; text-decoration: none; color: var(--primary); font-weight: 600; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; }
.presta-link:hover { border-color: var(--gold); }

/* ─── FACTURATION ─── */
.mois-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 18px; }
.mois-nav a { text-decoration: none; color: var(--primary); font-weight: 700; font-size: 1.1rem; padding: 5px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.mois-nav a:hover { border-color: var(--gold); }
.mois-label { font-family: ui-serif, 'New York', Georgia, serif; font-size: 1.2rem; font-weight: 650; min-width: 170px; text-align: center; text-transform: capitalize; }
.facture-total { display: flex; justify-content: space-between; align-items: baseline; }
.montant { font-family: ui-serif, 'New York', Georgia, serif; font-variant-numeric: tabular-nums; font-weight: 650; }
.montant-lg { font-size: 1.4rem; color: var(--primary); }

/* Lignes de facture (temps/forfait, débours, commission) */
.facture-lignes { margin-top: 10px; border-top: 1px solid var(--border); }
.facture-ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 0.85rem; }
.facture-ligne:last-child { border-bottom: none; }
.facture-ligne > span:first-child { color: var(--text-muted); }

/* Détail dépliable du « reste à facturer » */
.reste-detail { margin: -2px 0 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.reste-detail > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--primary); list-style: none; display: flex; align-items: center; gap: 6px; }
.reste-detail > summary::-webkit-details-marker { display: none; }
.reste-detail > summary::before { content: "▸"; color: var(--gold); transition: transform 0.15s; }
.reste-detail[open] > summary::before { transform: rotate(90deg); }
.reste-detail .facture-lignes { margin-top: 10px; }
.reste-detail-total { border-top: 1px solid var(--border); border-bottom: none !important; font-weight: 700; margin-top: 2px; }
.reste-detail-total > span:first-child { color: var(--text) !important; }
.reste-detail-note { margin: 8px 0 0; font-size: 0.75rem; color: var(--text-muted); }

/* Rappels dates clés (dashboard) */
.rappel-card { border-left: 3px solid var(--gold); }

/* ─── STATS ANNUELLES ─── */
.annee-chart { display: flex; gap: 6px; align-items: stretch; }
.annee-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.annee-valeur { font-family: ui-serif, 'New York', Georgia, serif; font-variant-numeric: tabular-nums; font-size: 0.68rem; color: var(--text-muted); height: 1em; line-height: 1; white-space: nowrap; }
.annee-barre-zone { height: 130px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.annee-barre { width: min(26px, 80%); min-height: 2px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--gold-light), var(--gold)); }
.annee-mois { font-size: 0.66rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }

/* ─── MISC ─── */
.empty-msg { color: var(--text-muted); font-style: italic; text-align: center; padding: 24px 0; }
.text-muted { color: var(--text-muted); }
.link-plain { color: inherit; text-decoration: none; }
.link-plain:hover { color: var(--primary); text-decoration: underline; }
small { font-size: 0.8em; }
.desktop-only { display: initial; }

/* ─── BOTTOM NAV (mobile) ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--header-bg);
  border-top: 2px solid rgba(201,164,78,0.25);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner { display: flex; }
.bottom-nav-link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px 10px;
  text-decoration: none;
  color: var(--header-muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.15s;
  border-top: 2px solid transparent;
}
.bottom-nav-link .nav-emoji { font-size: 1.3rem; line-height: 1; }
.bottom-nav-link span:last-child { white-space: nowrap; }
.bottom-nav-link.active { color: var(--gold-light); border-top-color: var(--gold); }

/* ─── INSTALL PWA (Ajouter a l'ecran d'accueil) ───────────────────────────── */
.install-banner {
  display: none;
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 300;
  max-width: 460px;
  margin: 0 auto;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px 44px 14px 16px;
  animation: install-in 0.28s ease;
}
.install-banner.show { display: flex; }
@keyframes install-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.install-icon { font-size: 1.8rem; line-height: 1; flex: 0 0 auto; }
.install-body { flex: 1 1 auto; min-width: 0; }
.install-title { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.install-text { display: none; margin: 3px 0 0; font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.install-banner.ios .install-text-ios { display: block; }
.install-banner.android .install-text-android { display: block; }
.install-share { display: inline-flex; align-items: center; vertical-align: -0.25em; color: var(--primary); }
.install-share svg { width: 1em; height: 1.2em; }
.install-action { display: none; flex: 0 0 auto; white-space: nowrap; }
.install-banner.android .install-action { display: inline-flex; }
.install-close {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; line-height: 1;
  width: 28px; height: 28px; border-radius: 8px;
}
.install-close:hover { background: var(--bg); color: var(--text); }

/* ─── Bouton Aide (header) ─── */
.aide-btn { text-decoration: none; display: inline-flex; align-items: center; gap: 2px; font-size: 0.85rem; font-weight: 500; }
.aide-btn.active { border-color: var(--gold); color: var(--gold-light); }

/* ─── Inscription / approbation (beta) ─── */
.login-signup { text-align: center; margin: 16px 0 0; font-size: 0.85rem; color: var(--text-muted); }
.login-signup a { color: var(--gold); font-weight: 600; text-decoration: none; }
.login-signup a:hover { text-decoration: underline; }
.login-beta { text-align: center; margin: 16px 0 0; font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.03em; }
.beta-banner { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--gold);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; font-size: 0.85rem; color: var(--text); }
.beta-banner p { margin: 6px 0 0; line-height: 1.45; }
.beta-title { font-weight: 700; font-size: 0.95rem; }
.beta-sub { color: var(--text-muted); }

/* ─── Parcours d'accueil (onboarding) ─── */
.onboarding-card { border-left: 3px solid var(--gold); }
.onboarding-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.onboarding-title { font-weight: 700; font-size: 1.02rem; }
.onboarding-sub { color: var(--text-muted); font-size: 0.83rem; margin-top: 2px; }
.onboarding-hide { flex-shrink: 0; font-size: 0.75rem; color: var(--text-muted); text-decoration: none;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.onboarding-hide:hover { border-color: var(--gold); color: var(--primary); }
.onboarding-progress { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.onboarding-bar { flex: 1; height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.onboarding-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 999px; transition: width 0.4s ease; }
.onboarding-count { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.onboarding-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.onboarding-step { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; transition: all 0.15s; }
.onboarding-step:hover { border-color: var(--gold); transform: translateX(2px); }
.onboarding-step-mark { flex-shrink: 0; width: 26px; height: 26px; border-radius: 999px; display: flex;
  align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.onboarding-step.current { border-color: var(--gold); background: var(--bg); }
.onboarding-step.current .onboarding-step-mark { border-color: var(--gold); color: var(--primary); }
.onboarding-step.done .onboarding-step-mark { background: var(--gold); border-color: var(--gold); color: #fff; }
.onboarding-step.done .onboarding-step-title { color: var(--text-muted); text-decoration: line-through; }
.onboarding-step-body { display: flex; flex-direction: column; gap: 1px; }
.onboarding-step-title { font-weight: 600; font-size: 0.9rem; }
.onboarding-step-text { font-size: 0.78rem; color: var(--text-muted); }

/* ─── Page Aide ─── */
.aide-hero { display: flex; align-items: center; gap: 16px; border-left: 3px solid var(--gold); }
.aide-hero-icon { font-size: 2.4rem; line-height: 1; }
.aide-hero-title { margin: 0; font-size: 1.3rem; }
.aide-hero-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 0.88rem; }
.aide-card p { line-height: 1.5; }
.aide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.aide-feature { margin-bottom: 0; }
.aide-feature-icon { font-size: 1.5rem; }
.aide-feature-title { font-weight: 700; font-size: 0.98rem; margin: 6px 0 4px; }
.aide-feature p { margin: 0; font-size: 0.82rem; color: var(--text-muted); line-height: 1.45; }
.aide-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.aide-list li { font-size: 0.85rem; line-height: 1.45; }

@media (max-width: 768px) {
  .aide-btn-label { display: none; }
  .aide-grid { grid-template-columns: 1fr; }
  .desktop-only { display: none !important; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .burger-btn { display: block; }
  .bottom-nav { display: block; }
  .container { padding: 16px 12px 84px; }
  .page-header { flex-direction: column; gap: 10px; align-items: stretch; }
  .page-header .btn { width: 100%; }
  .page-actions { flex-direction: column; }
  .missions-header { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .missions-header .btn-modeles { width: auto; flex-shrink: 0; }
  .modal-overlay { padding: 0; flex-direction: column; justify-content: flex-end; align-items: stretch; }
  .modal { max-height: 92vh; max-width: 100%; width: 100%; border-radius: 18px 18px 0 0; }
  #modal-body { padding: 16px; }
  .modal-header { padding: 16px 16px 12px; }
  .kpi-value { font-size: 1.2rem; }
  .prestas-grid { grid-template-columns: 1fr; }
  table { font-size: 0.8rem; }
  th, td { padding: 8px 6px; white-space: nowrap; }
  .card { overflow-x: hidden; }
  img, video { max-width: 100%; }
  .chrono-time { font-size: 1.9rem; }
  .annee-chart { gap: 3px; }
  .annee-barre-zone { height: 100px; }
  .annee-valeur { display: none; }
  .annee-mois { font-size: 0.56rem; }
}

/* Pieces jointes d'un feedback (historique) */
.fb-pieces { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fb-piece-thumb {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
}
.fb-piece-pdf {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); text-decoration: none; font-size: 0.85rem;
}
