/* Sameline Intranet - CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:      #0370d0;
    --color-primary-dark: #025aac;
    --color-secondary:    #6b7280;
    --color-success:      #0e9f6e;
    --color-warning:      #c27803;
    --color-danger:       #e02424;
    --color-bg:           #EFF4FA;
    --color-white:        #ffffff;
    --color-border:       #d4e2ef;
    --color-text:         #111827;
    --color-muted:        #5a7a9a;
    --radius:             8px;
    --shadow:             0 1px 3px rgba(0,0,0,.08);
    --nav-bg:             #0b2239;
    --nav-bg-top:         #0b2a4a;
    --nav-gold:           #f2c94c;
    --nav-gold-muted:     #c5a059;
    --nav-blue-light:     #9ad1f9;
    --sidebar-w:          210px;
}

body { font-family: system-ui, -apple-system, sans-serif; background: var(--color-bg); color: var(--color-text); line-height: 1.5; }

/* ── Layout app (sidebar + contenu) ─────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.app-right   { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--nav-bg); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 100; }

.sidebar-logo { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.sidebar-logo-top { display: flex; align-items: flex-start; justify-content: space-between; }
.sidebar-logo-name { font-size: 21px; font-weight: 600; color: #fff; letter-spacing: .02em; }
.sidebar-logo-sub  { font-size: 12px; color: var(--nav-blue-light); margin-top: 2px; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-logo-bar  { width: 32px; height: 2px; background: var(--nav-gold); border-radius: 1px; margin-top: 8px; }
.sidebar-close { display: none; min-width: 36px; min-height: 36px; background: rgba(255,255,255,.12); border: none; border-radius: 6px; color: rgba(255,255,255,.8); font-size: 22px; line-height: 1; cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; }

.sidebar-nav { padding: 8px 6px; flex: 1; }

/* Groupes depliants */
.sidebar-group-header {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: none; border: none; cursor: pointer;
    font-size: 11px; font-weight: 600; color: var(--nav-gold-muted);
    text-transform: uppercase; letter-spacing: .1em;
    padding: 12px 10px 4px; margin-top: 4px; font-family: inherit;
}
.sidebar-group-header:hover { color: var(--nav-gold); }
.sidebar-chevron {
    display: inline-block; width: 7px; height: 7px; flex-shrink: 0;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform .2s ease; margin-bottom: 3px;
}
.sidebar-group.collapsed .sidebar-chevron { transform: rotate(-45deg); margin-bottom: 0; margin-top: 3px; }
.sidebar-group-content {
    overflow: hidden;
    max-height: 600px;
    opacity: 1;
    transition: max-height .28s ease, opacity .2s ease;
}
.sidebar-group.collapsed .sidebar-group-content { max-height: 0; opacity: 0; }
/* Pendant le chargement, on fige les transitions de la nav pour que la
   restauration de l'etat (localStorage) ne rejoue pas l'animation : evite
   le clignotement des groupes (ex : Administration) a chaque navigation. */
body.nav-booting .sidebar-group-content,
body.nav-booting .sidebar-chevron { transition: none !important; }

/* Sous-groupes depliants (interieur d'Administration) */
.sidebar-sub-header {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: none; border: none; cursor: pointer;
    color: var(--nav-gold-muted); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .1em;
    padding: 10px 10px 3px; margin-top: 4px; font-family: inherit;
}
.sidebar-sub-header:hover { color: var(--nav-gold); }
.sidebar-sub-chevron {
    display: inline-block; width: 5px; height: 5px; flex-shrink: 0;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg); transition: transform .2s ease; margin-bottom: 2px;
}
.sidebar-sub-group.collapsed .sidebar-sub-chevron { transform: rotate(-45deg); margin-bottom: 0; margin-top: 2px; }
.sidebar-sub-content {
    overflow: hidden; max-height: 400px; opacity: 1;
    transition: max-height .25s ease, opacity .18s ease;
}
.sidebar-sub-group.collapsed .sidebar-sub-content { max-height: 0; opacity: 0; }
body.nav-booting .sidebar-sub-content,
body.nav-booting .sidebar-sub-chevron { transition: none !important; }

.sidebar-section { font-size: 11px; font-weight: 600; color: var(--nav-gold-muted); text-transform: uppercase; letter-spacing: .1em; padding: 12px 10px 4px; margin-top: 4px; }

.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 6px;
    font-size: 15px; color: rgba(255,255,255,.65);
    cursor: pointer; margin-bottom: 1px;
    border-left: 2px solid transparent;
    text-decoration: none;
}
.sidebar-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.92); }
.sidebar-item.active { background: rgba(242,201,76,.12); color: var(--nav-gold); border-left-color: var(--nav-gold); }
.sidebar-item.disabled { color: rgba(255,255,255,.28); font-style: italic; pointer-events: none; }
.sidebar-item i { font-size: 18px; min-width: 18px; }
.sidebar-badge { margin-left: auto; background: rgba(242,201,76,.22); color: var(--nav-gold); font-size: 11px; padding: 1px 6px; border-radius: 10px; font-style: normal; }

.sidebar-sep { margin: 6px 10px; border: none; border-top: 1px solid rgba(255,255,255,.07); }

.sidebar-footer { padding: 8px; border-top: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--color-primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; min-width: 34px; }
.sidebar-uname { font-size: 14px; color: rgba(255,255,255,.75); }
.sidebar-urole { font-size: 12px; color: var(--nav-blue-light); }

/* ── Topbar ──────────────────────────────────────────── */
.topbar { background: var(--nav-bg-top); padding: 0 18px; height: 44px; min-height: 44px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 13px; color: rgba(255,255,255,.8); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-btn { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); border: none; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 5px; font-family: inherit; text-decoration: none; }
.topbar-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.topbar-hamburger { display: none; min-width: 44px; min-height: 44px; background: rgba(255,255,255,.18); border: none; border-radius: 6px; cursor: pointer; padding: 10px; align-items: center; justify-content: center; flex-shrink: 0; }
.hamburger-icon { display: flex; flex-direction: column; gap: 5px; width: 22px; pointer-events: none; }
.hamburger-icon span { display: block; height: 2.5px; background: #fff; border-radius: 2px; }

/* ── Overlay sidebar mobile ──────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
.sidebar-overlay.open { display: block; }

/* ── Main content ────────────────────────────────────── */
.main-content { flex: 1; padding: 1.75rem 2rem; }

/* ── Footer ──────────────────────────────────────────── */
.footer { padding: 1rem 2rem; font-size: .8rem; color: var(--color-muted); border-top: 1px solid var(--color-border); margin-top: auto; }

/* ── Auth (layout separe) ────────────────────────────── */
.auth-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 420px; padding: 1rem; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo h1 { color: var(--color-primary); font-size: 2rem; }
.auth-logo p { color: var(--color-muted); font-size: .9rem; }
.auth-card { background: var(--color-white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.auth-card h2 { margin-bottom: 1.5rem; font-size: 1.25rem; }

/* ── Formulaires ─────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .55rem .75rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: .95rem; background: #fff;
    /* font-family explicite : sinon les <textarea> retombent sur la police
       monospace par defaut du navigateur (petite et serree). */
    font-family: inherit; line-height: 1.55; color: var(--color-text);
}
/* Zones de texte : confort de saisie (hauteur mini + redimensionnable). */
.form-group textarea { min-height: 5rem; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(3,112,208,.15);
}
.form-group small { color: var(--color-muted); font-size: .8rem; }

/* ── Boutons ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem 1rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; font-family: inherit; line-height: 1.4; vertical-align: middle; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-white); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: #e8f0f8; }
.btn-full { width: 100%; justify-content: center; margin-top: .5rem; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }

/* ── Barres de recherche ─────────────────────────────── */
.search-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.search-bar input[type="text"], .search-bar select {
    padding: .5rem .75rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: .9rem; background: #fff;
}
.search-bar input[type="text"]:focus, .search-bar select:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(3,112,208,.15);
}

/* ── Alertes ─────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-extra   { margin-top: .5rem; padding: .5rem .75rem; background: rgba(0,0,0,.06); border-radius: 4px; font-family: monospace; font-size: .9rem; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Tableaux ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { background: #e8f0f8; text-align: left; padding: .75rem 1rem; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--color-border); }
.table th[data-col] { cursor: pointer; user-select: none; white-space: nowrap; }
.table th[data-col]:hover { background: #cfe0f5; }
.table th[data-col]::after { content: ' \2195'; opacity: .35; font-size: .8em; }
.table th[data-col][data-dir="asc"]::after,
.table th[data-col][data-dir="desc"]::after { display: none; }
.sort-icon { opacity: .65; font-size: .8em; margin-left: .2rem; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f0f5fb; }

/* ── Stats ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--color-border); padding: 1.5rem; text-align: center; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: .85rem; color: var(--color-muted); margin-top: .25rem; }

/* ── Sections ────────────────────────────────────────── */
.section { background: #fff; border-radius: var(--radius); border: 1px solid var(--color-border); padding: 1.5rem; margin-bottom: 1.5rem; }
.section h2 { font-size: 1.1rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--color-border); }
.section-actions { margin-top: 1rem; display: flex; gap: .75rem; }

/* ── Page header ─────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.page-header > div:first-child h1 { font-size: 1.5rem; font-weight: 700; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--color-muted); margin-top: .25rem; }
/* Surtitre = type d'objet (facon Salesforce) : situe la fiche au premier coup d'oeil. */
.page-header-eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--color-muted); margin-bottom: .15rem; }
/* Ligne meta : badges + infos cles. Espace les enfants sans bricolage inline. */
.page-header-meta { color: var(--color-muted); margin-top: .35rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
/* Barre d'actions a droite du titre : remplace les style="display:flex;gap.." repetes. */
.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ── Badges statut session ───────────────────────────── */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-potentielle { background: #e2e8f0; color: #475569; }
.badge-planifiee   { background: #dbeafe; color: #1e40af; }
.badge-confirmee   { background: #d1fae5; color: #065f46; }
.badge-en_cours    { background: #fef3c7; color: #92400e; }
.badge-terminee    { background: #f3f4f6; color: #374151; }
.badge-annulee     { background: #fee2e2; color: #991b1b; }
.badge-reportee    { background: #ede9fe; color: #5b21b6; }

/* ── Formulaires mise en page ────────────────────────── */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.required { color: var(--color-danger); }
.detail-grid { display: flex; flex-direction: column; gap: 1rem; }
.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: .5rem 1rem; }
.detail-list dt { font-weight: 600; font-size: .875rem; color: var(--color-muted); }
.detail-list dd { font-size: .9rem; }
.qualiopi-tag { background: #eff6ff; color: #1e40af; border-radius: 4px; padding: .1rem .4rem; font-size: .7rem; font-weight: 600; margin-left: .5rem; }

/* ── Bulles d'aide ───────────────────────────────────── */
.help-btn { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:50%; border:1.5px solid #b0bbc6; background:#fff; color:#5a7a9a; font-size:.72rem; font-weight:700; cursor:pointer; line-height:1; font-family:inherit; transition:border-color .12s, color .12s; flex-shrink:0; vertical-align:middle; }
.help-btn:hover { border-color:#0370d0; color:#0370d0; }
.help-popover { display:none; position:absolute; top:calc(100% + 6px); left:0; z-index:200; background:#fff; border:1px solid #d4e2ef; border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,.1); padding:14px 16px; min-width:320px; max-width:380px; }
.help-popover.open { display:block; }
.help-popover-row { display:flex; gap:10px; margin-bottom:10px; }
.help-popover-row:last-child { margin-bottom:0; }
.help-popover-icon { font-size:1rem; flex-shrink:0; margin-top:1px; }
.help-popover-text strong { display:block; font-size:.82rem; color:#0b2239; font-weight:600; margin-bottom:2px; }
.help-popover-text span { font-size:.78rem; color:#5a7a9a; line-height:1.4; }

.help-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    background: #93c5fd; color: #1e3a5f; font-size: 10px; font-weight: 700;
    cursor: pointer; margin-left: 5px; position: relative;
    vertical-align: middle; flex-shrink: 0; user-select: none;
}
.help-icon:hover .help-tooltip, .help-icon:focus .help-tooltip { display: block; }
.help-tooltip {
    display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%); background: #1e293b; color: #f1f5f9;
    font-size: .8rem; font-weight: 400; line-height: 1.5;
    padding: .6rem .85rem; border-radius: 6px; width: 260px;
    white-space: normal; z-index: 100; pointer-events: none;
}
.help-tooltip::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: #1e293b;
}
.help-icon.left .help-tooltip { left: 0; transform: none; }
.help-icon.left .help-tooltip::after { left: 12px; transform: none; }
.help-icon.right .help-tooltip { left: auto; right: 0; transform: none; }
.help-icon.right .help-tooltip::after { left: auto; right: 8px; transform: none; }

/* ── Documents ───────────────────────────────────────── */
.badge-doc-type { background: #ede9fe; color: #5b21b6; font-size: .75rem; }

/* ── Emargement presences ────────────────────────────── */
.presence-select { padding: .25rem .5rem; border-radius: var(--radius); border: 1px solid var(--color-border); font-size: .85rem; cursor: pointer; }
.presence-present { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.presence-absent  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.presence-retard  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge-warning    { background: #fffbeb; color: #92400e; }

/* ── Filtre / Checkbox / Code ────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.checkbox-label input[type="checkbox"] { width: auto; }
code { background: #f3f4f6; padding: .1rem .35rem; border-radius: 4px; font-size: .85rem; }

/* ── Badges inscription / session ────────────────────── */
.badge-statut-pre_inscrit  { background: #e0f2fe; color: #0369a1; }
.badge-statut-inscrit      { background: #d1fae5; color: #065f46; }
.badge-statut-present      { background: #bbf7d0; color: #14532d; }
.badge-statut-absent       { background: #fee2e2; color: #991b1b; }
.badge-statut-abandonne    { background: #fef3c7; color: #92400e; }
.badge-statut-annule       { background: #f3f4f6; color: #6b7280; }
.badge-type-intra  { background: #ede9fe; color: #5b21b6; }
.badge-type-inter  { background: #dbeafe; color: #1e40af; }

/* ── Bouton defaut inline ────────────────────────────── */
.btn-defaut {
    display: inline-block; margin-left: .5rem; padding: .1rem .45rem;
    font-size: .72rem; font-weight: 600; color: var(--color-primary);
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 4px;
    cursor: pointer; vertical-align: middle;
}
.btn-defaut:hover { background: #dbeafe; }

/* ── Menu "Actions" deroulant (standard de gestion d'un element) ──────────
   Repere unique : partout ou un element propose des actions (modifier,
   supprimer, definir...), on affiche UN bouton "Actions" qui ouvre ce menu.
   Le menu est en position:fixed (positionne par app.js) pour ne pas etre
   rogne par l'overflow des tableaux. */
.actions-menu { position: relative; display: inline-block; }
/* Bouton "Actions" : meme couleur et taille qu'un bouton secondaire, juste le
   texte un peu plus gras pour mieux se reperer. */
.actions-toggle { white-space: nowrap; font-weight: 600; }
.actions-menu.open .actions-toggle { background: #e8f0f8; border-color: #b0bbc6; color: #0b2239; }
.actions-caret { font-size: .9em; display: inline-block; transition: transform .15s ease; }
.actions-menu.open .actions-caret { transform: rotate(180deg); }
.actions-dropdown {
    position: fixed; z-index: 9999; min-width: 200px;
    background: #fff; border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12);
    padding: 4px 0;
}
.actions-dropdown[hidden] { display: none; }
.actions-item {
    display: block; width: 100%; box-sizing: border-box;
    padding: 7px 14px; font-size: .85rem; font-family: inherit;
    color: var(--color-text); text-decoration: none; text-align: left;
    background: none; border: none; cursor: pointer; white-space: nowrap;
}
.actions-item:hover { background: var(--color-bg); color: #0b2239; }
.actions-item--danger { color: var(--color-danger); }
.actions-item--danger:hover { background: #fef2f2; color: var(--color-danger); }
.actions-item:disabled, .actions-item[disabled] { color: var(--color-muted); cursor: not-allowed; background: none; }
.actions-sep  { height: 1px; background: var(--color-border); margin: 4px 0; }
.actions-head { padding: 4px 14px 2px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); }
.actions-menu form { margin: 0; }

/* ── Divers ──────────────────────────────────────────── */
#section_certif { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--color-border); }
.text-muted { color: var(--color-muted); }
.mt-2 { margin-top: .5rem; }
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 4rem; color: var(--color-muted); }
.error-page p { margin: 1rem 0 2rem; }

/* ============================================================
   Lieu Lookup
   ============================================================ */
.lieu-lookup { position: relative; }
.lieu-lookup-wrap {
    display: flex; align-items: center; border: 1px solid var(--color-border);
    border-radius: var(--radius); background: #fff; transition: border-color .15s;
}
.lieu-lookup-wrap:focus-within {
    border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(3,112,208,.15);
}
.lieu-lookup-icon { padding: 0 .6rem; color: var(--color-muted); font-size: 1rem; pointer-events: none; user-select: none; }
.lieu-lookup-text { flex: 1; border: none; outline: none; padding: .45rem .4rem .45rem 0; font-size: .9rem; background: transparent; min-width: 0; }
.lieu-lookup-clear { padding: 0 .6rem; color: var(--color-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; display: none; }
.lieu-lookup-clear:hover { color: var(--color-danger); }
.lieu-lookup-dropdown {
    position: absolute; top: calc(100% + 3px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--color-border);
    border-radius: var(--radius); z-index: 200; max-height: 260px; overflow-y: auto;
    list-style: none; margin: 0; padding: 4px 0;
}
.lieu-lookup-item { padding: .5rem .85rem; cursor: pointer; border-bottom: 1px solid #f3f4f6; }
.lieu-lookup-item:last-child { border-bottom: none; }
.lieu-lookup-item:hover, .lieu-lookup-item.active { background: #eff6ff; }
.lieu-lookup-item-nom { font-weight: 600; font-size: .9rem; }
.lieu-lookup-item-adr { font-size: .78rem; color: var(--color-muted); margin-top: 1px; }
.lieu-lookup-empty { padding: .6rem .85rem; font-size: .85rem; color: var(--color-muted); font-style: italic; }

/* ── Modal Lieu ──────────────────────────────────────── */
.lieu-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1000;
    align-items: center; justify-content: center;
}
.lieu-modal-overlay.open { display: flex; }
.lieu-modal-box {
    background: #fff; border-radius: 8px;
    padding: 1.5rem; width: 100%; max-width: 480px; margin: 1rem;
}
.lieu-modal-box h3 { margin-bottom: 1rem; font-size: 1.05rem; }
.lieu-modal-error { color: var(--color-danger); font-size: .85rem; margin-top: .5rem; min-height: 1.2rem; }

/* ── Modal générique ─────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1000; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--color-border); }
.modal-head h3 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--color-muted); cursor: pointer; padding: 0 .25rem; }
.modal-close:hover { color: var(--color-text); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); }

.modal-head { background: #f8fafc; border-radius: 12px 12px 0 0; }

/* Contrôle segmenté (choix de type) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--color-border); border-radius: 8px; background: #fff; color: var(--color-text); font-size: .9rem; font-family: inherit; cursor: pointer; }
.seg-btn:hover { background: #f1f5f9; }
.seg-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* Champ de recherche multi-sélection (pastilles) , collaborateurs, etc. */
.people-picker { position: relative; }
.pp-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 6px 8px; background: #fff; }
.pp-box:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(3,112,208,.15); }
.pp-input { border: none; outline: none; flex: 1; min-width: 150px; font-size: .9rem; padding: 4px; background: transparent; }
.pp-chip { display: inline-flex; align-items: center; gap: 4px; background: #eff4fa; border: 1px solid var(--color-border); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .85rem; }
.pp-x { background: none; border: none; cursor: pointer; font-size: 1.05rem; line-height: 1; color: var(--color-muted); padding: 0 4px; }
.pp-x:hover { color: var(--color-danger); }
.pp-dropdown { position: absolute; z-index: 1100; left: 0; right: 0; margin-top: 3px; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); max-height: 220px; overflow-y: auto; list-style: none; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 0; }
.pp-item { padding: 8px 12px; cursor: pointer; font-size: .9rem; }
.pp-item:hover, .pp-item.active { background: #eff6ff; }

/* Champ fichier stylé (remplace le bouton "Parcourir" natif) */
.file-field { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.file-field input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.file-field .file-names { font-size: .85rem; color: var(--color-muted); }
.file-field label.btn { cursor: pointer; margin: 0; }

/* ── Wrap tableau scrollable ─────────────────────────── */
.table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ============================================================
   Responsive mobile (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    /* Layout : sidebar sort du flux, contenu prend toute la largeur */
    .app-layout { display: block; }
    .app-right   { width: 100%; }

    /* Sidebar : panneau glissant par-dessus le contenu */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: var(--sidebar-w);
        min-width: var(--sidebar-w);
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 300;
    }
    .sidebar.open { transform: translateX(0); }

    /* Overlay sombre derriere la sidebar */
    .sidebar-overlay { z-index: 299; }

    /* Hamburger visible + bouton fermer dans la sidebar */
    .topbar-hamburger { display: flex; }
    .sidebar-close    { display: flex; }

    /* Contenu : moins de padding lateral */
    .main-content { padding: 1rem; }

    /* Tableaux : scroll horizontal si debordement */
    .table-scroll-wrap { margin-bottom: .5rem; }
}
