/* Coin du matériel : extrait de module-frontend.php (v1.22.1). */
.am-wrap { font-family: system-ui, sans-serif; max-width: 900px; margin: 0 auto;
           font-size: 15px; color: #1f2937; min-width: 0; }

/* Login */
.am-login-box { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
                padding: 32px 28px; text-align: center; max-width: 400px;
                margin: 0 auto; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.am-login-box h2 { color: #1e3a5f; margin: 0 0 8px; font-size: 20px; }
.am-login-input { width: 100%; padding: 11px 14px; border: 2px solid #d1d5db;
                  border-radius: 8px; font-size: 16px; text-align: center;
                  letter-spacing: .12em; margin-bottom: 12px; box-sizing: border-box; }
.am-login-input:focus { outline: none; border-color: #1e3a5f; }
.am-btn-primary { background: #1e3a5f; color: #fff; border: none; border-radius: 8px;
                  padding: 12px 24px; font-size: 15px; font-weight: 700;
                  cursor: pointer; width: 100%; }
.am-btn-primary:hover { background: #162d4a; }

/* Topbar */
.am-topbar { display: flex; align-items: center; justify-content: space-between;
             background: #1e3a5f; color: #fff; padding: 12px 16px;
             border-radius: 10px; margin-bottom: 0; }
.am-topbar-name { font-weight: 700; font-size: 15px; }
.am-topbar-role { font-size: 12px; background: rgba(255,255,255,.18);
                  padding: 2px 10px; border-radius: 20px; margin-left: 10px; }
.am-deconnect { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
                color: #fff; border-radius: 6px; padding: 5px 12px;
                cursor: pointer; font-size: 12px; }

/* Onglets : voir « Structure » plus bas */
.am-tab-content { display: none; }
.am-tab-content.active { display: block; }
.am-panel { background: #fff; border: 1px solid #e5e7eb;
            border-radius: 10px; padding: 20px; }

/* Tableaux */
.am-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.am-table { border-collapse: collapse; width: 100%; margin-top: 0;
            border-radius: 0; overflow: hidden; box-shadow: none; }
.am-table th { background: #1e3a5f; color: #fff; padding: 9px 13px;
               text-align: left; font-size: 12px; font-weight: 600; }
.am-table td { padding: 8px 13px; border-bottom: 1px solid #f0f0f0;
               font-size: 13px; vertical-align: middle; }
.am-table tr:last-child td { border-bottom: none; }
.am-table tr:hover td { background: #dbe6f2; }

/* Tri d'en-tête */
.am-sort-btn { cursor: pointer; user-select: none; }
.am-sort-btn:hover { text-decoration: underline; }
.am-sort-arrow { font-size: 9px; margin-left: 3px; opacity: .5; }
.am-sort-btn.asc .am-sort-arrow::before { content: '\25B2'; opacity: 1; }
.am-sort-btn.desc .am-sort-arrow::before { content: '\25BC'; opacity: 1; }
.am-sort-btn:not(.asc):not(.desc) .am-sort-arrow::before { content: '\25B3'; }

/* Badges statut */
.am-badge { display: inline-block; padding: 2px 9px; border-radius: 20px;
            font-size: 11px; font-weight: 700; white-space: nowrap; }
.am-badge-disponible   { background: #d1fae5; color: #065f46; }
.am-badge-prete        { background: #dbeafe; color: #1e40af; }
.am-badge-maintenance  { background: #fef3c7; color: #92400e; }
.am-badge-hors_service { background: #fee2e2; color: #991b1b; }

/* Modale (formulaires ajout/modification) */
.am-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55);
                     z-index: 1000; display: flex; align-items: flex-start;
                     justify-content: center; overflow-y: auto; padding: 40px 16px; }
.am-modal-box { background: #fff; border-radius: 10px; width: 100%; max-width: 720px;
                box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.am-modal-header { display: flex; align-items: center; justify-content: space-between;
                    padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
                    font-weight: 700; font-size: 15px; color: #1e3a5f; }
.am-modal-close { background: none; border: none; font-size: 22px; line-height: 1;
                   color: #9ca3af; cursor: pointer; padding: 0 4px; }
.am-modal-close:hover { color: #374151; }
.am-modal-body { padding: 20px; }
.am-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; width: 100%; box-sizing: border-box; }
.am-field { display: flex; flex-direction: column; gap: 3px; }
.am-field.full { grid-column: 1 / -1; }
.am-field label { font-size: 12px; font-weight: 700; color: #374151; }
.am-field input:not([type=radio]):not([type=checkbox]), .am-field select, .am-field textarea {
    width: 100%; padding: 8px 10px; border: 2px solid #d1d5db;
    border-radius: 7px; font-size: 13px; box-sizing: border-box; }
.am-field input:focus, .am-field select:focus, .am-field textarea:focus {
    outline: none; border-color: #1e3a5f; }
.am-field textarea { resize: vertical; min-height: 56px; }
.am-radio-group { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 2px; }
.am-radio { display: inline-flex; align-items: center; gap: 5px; font-weight: 400; font-size: 13px; color: #374151; cursor: pointer; }
.am-hint { font-size: 11px; color: #9ca3af; margin: 2px 0 0; }
.am-sep { border: none; border-top: 1px solid #e5e7eb; margin: 10px 0;
          grid-column: 1 / -1; }

/* Boutons */
.am-btn { border: none; border-radius: 7px; padding: 8px 16px; font-size: 13px;
          font-weight: 600; cursor: pointer; }
.am-btn-save { background: #1e3a5f; color: #fff; }
.am-btn-save:hover { background: #162d4a; }
.am-btn-cancel { background: #f3f4f6; color: #374151;
                 border: 1px solid #d1d5db; }
#am-wrap .am-info-icon, #am-wrap .am-icon-btn {
             display: inline-flex !important; align-items: center !important; justify-content: center !important;
             width: 26px !important; height: 26px !important; margin-left: 4px; padding: 0 !important;
             border: none !important; background: none !important;
             border-radius: 6px; line-height: 1; cursor: pointer !important;
             color: #6b7280; vertical-align: middle; }
#am-wrap .am-info-icon:hover, #am-wrap .am-icon-btn:hover { background: #e5e7eb !important; color: #1e3a5f !important; }
#am-wrap .am-icon-btn { color: #1e3a5f; }
#am-wrap .am-info-icon svg, #am-wrap .am-icon-btn svg {
             width: 15px !important; height: 15px !important; display: inline-block !important;
             stroke: currentColor !important; fill: none !important; }

/* Notices */
.am-notice-ok  { background: #dcfce7; color: #15803d; border: 1px solid #86efac;
                 border-radius: 7px; padding: 10px 14px; margin-bottom: 12px;
                 font-weight: 600; font-size: 13px; }
.am-notice-err { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5;
                 border-radius: 7px; padding: 10px 14px; margin-bottom: 12px;
                 font-weight: 600; font-size: 13px; }
.am-alert-box  { background: #fef3c7; border: 1px solid #f59e0b;
                 border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; }
.am-alert-box.danger { background: #fee2e2; border-color: #ef4444; }
.am-add-toggle { margin-bottom: 12px; }
.am-empty { color: #9ca3af; font-style: italic; font-size: 13px; padding: 12px 0; }
.am-denied { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
             padding: 32px; text-align: center; max-width: 480px; margin: 0 auto; }

/* Panneaux d'aide */
.am-export-btn { background: none; border: 1.5px solid #86efac; color: #15803d;
               border-radius: 20px; padding: 3px 12px; font-size: 12px; font-weight: 600;
               cursor: pointer; white-space: nowrap; margin: 0 0 12px 8px; }
.am-export-btn:hover { background: #f0fdf4; }
.am-help-panel { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px;
                  padding: 14px 16px; margin: 0 0 14px; font-size: 12px; line-height: 1.6; }
.am-help-panel h4 { color: #1e40af; font-size: 13px; margin: 0 0 8px; }
.am-help-panel h5 { color: #1e3a5f; font-size: 12px; font-weight: 700; margin: 10px 0 3px; }
.am-help-panel ul { margin: 4px 0 8px 18px; padding: 0; }
.am-help-note { font-size: 11px; color: #6b7280; margin-top: 10px; font-style: italic; }

@media (max-width: 600px) {
    .am-grid { grid-template-columns: 1fr; }
    .am-field.full { grid-column: 1; }
    .am-sep { grid-column: 1; }
    .am-table { font-size: 12px; }
    .am-table th, .am-table td { padding: 6px 8px; }
}

/* ── Structure (v1.23.0) : indicateurs, À traiter, onglets à icônes, aide par onglet ── */
#am-wrap [hidden] { display: none !important; }
.am-ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.am-aide { margin: 0 0 12px; }
.am-aide .am-help-panel { margin: 0; font-size: 13px; }

.am-veille { background: #1e3a5f; border-radius: 12px; padding: 12px; margin: 0 0 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#am-wrap .am-chip { all: unset; box-sizing: border-box; cursor: pointer; background: rgba(255,255,255,.08) !important; border: 1px solid rgba(255,255,255,.2) !important; border-radius: 10px !important; padding: 8px 11px !important; color: #fff !important; display: flex; flex-direction: column; gap: 1px; min-width: 0; text-transform: none !important; letter-spacing: normal !important; font-size: 14px; line-height: 1.4; }
#am-wrap .am-chip:hover { background: rgba(255,255,255,.15) !important; }
.am-chip .k { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.am-chip .v { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.am-chip .s { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.am-dot.ok { background: #4ade80; } .am-dot.warn { background: #fbbf24; } .am-dot.bad { background: #f87171; } .am-dot.neutre { background: #93c5fd; }

.am-afaire { background: #fff; border: 1px solid #dbe3ec; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.am-afaire h2 { font-size: 14px !important; margin: 0 0 4px !important; display: flex; gap: 8px; align-items: center; color: #16263a !important; font-weight: 700; }
.am-afaire h2 .n { font-weight: 400; color: #5b6b7f; }
.am-afaire ul { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.am-afaire li { margin: 0 !important; padding: 0 !important; }
#am-wrap .am-afaire li button { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; gap: 10px; align-items: center; padding: 8px 4px !important; border-top: 1px solid #dbe3ec !important; font-size: 14px; color: #16263a !important; background: none !important; text-transform: none !important; letter-spacing: normal !important; }
#am-wrap .am-afaire li:first-child button { border-top: 0 !important; }
#am-wrap .am-afaire li button:hover { background: #e6eef7 !important; }
.am-afaire-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.am-afaire-txt .l { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.am-afaire-txt small { color: #5b6b7f; font-size: 12.5px; }
.am-afaire li button > .am-ico { color: #5b6b7f; }
.am-pill { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 9px; white-space: nowrap; line-height: 1.6; }
.am-pill.bad { background: #fee2e2; color: #b91c1c; } .am-pill.warn { background: #fef3c7; color: #b45309; }
.am-pill .am-ico { width: 13px; height: 13px; vertical-align: -2px; }

.am-tabs { display: flex; gap: 4px; background: #fff; border: 1px solid #dbe3ec; border-radius: 12px; padding: 4px; margin: 0 0 12px; }
#am-wrap .am-tab-btn { all: unset; box-sizing: border-box; cursor: pointer; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px !important; border-radius: 9px !important; font-size: 14px; font-weight: 600; color: #6b7280 !important; background: none !important; text-transform: none !important; letter-spacing: normal !important; position: relative; white-space: nowrap; }
#am-wrap .am-tab-btn.active { background: #1e3a5f !important; color: #fff !important; }
.am-tab-btn b { font-variant-numeric: tabular-nums; }
.am-tab-rouge { background: #dc2626; color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11.5px; font-weight: 700; line-height: 1.5; }
#am-wrap .am-chip:focus-visible, #am-wrap .am-tab-btn:focus-visible, #am-wrap .am-afaire li button:focus-visible { outline: 2px solid #0e7490 !important; outline-offset: 2px; }

@media (max-width: 720px) {
    .am-wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
    .am-veille { padding: 8px; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #am-wrap .am-chip { padding: 7px 8px !important; }
    .am-chip .v { font-size: 14px; }
    .am-chip .s { display: none; }
    .am-tabs { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 0; border-width: 1px 0 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 16px rgba(0,0,0,.08); z-index: 9990; }
    #am-wrap .am-tab-btn { flex-direction: column; gap: 2px; font-size: 11.5px; padding: 6px 2px !important; min-height: 48px; }
    #am-wrap .am-tab-btn.active { background: #eef2f6 !important; color: #1e3a5f !important; }
    #am-wrap .am-tab-btn .am-ico { width: 22px; height: 22px; }
    .am-tab-n { display: none; }
    .am-tab-rouge { position: absolute; top: 2px; left: calc(50% + 6px); }
    .am-panel { padding: 14px 12px; }
}

/* ── Inventaire (v1.24.0) : recherche, pastilles, tableau, cartes, fiche en feuille ── */
.am-modal-overlay { z-index: 10000; }   /* au-dessus de la barre d'onglets fixe du téléphone (9990) */
.am-mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #6b7280; white-space: nowrap; }
.am-pill.info { background: #dbeafe; color: #1d4ed8; } .am-pill.ok { background: #dcfce7; color: #15803d; } .am-pill.lock { background: #eceff3; color: #6b7280; }

#am-wrap .am-recherche { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 9px 12px !important; border: 1.5px solid #dbe3ec !important; border-radius: 10px !important; background: #fff !important; color: #16263a !important; margin: 0 0 10px; }
.am-outils { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 8px; }
.am-outils-d { display: flex; gap: 8px; }
.am-pastilles { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 0 8px; }
.am-outils .am-pastilles { margin: 0; }
#am-wrap .am-pastille { all: unset; box-sizing: border-box; cursor: pointer; border: 1px solid #d1d5db !important; background: #fff !important; border-radius: 999px !important; padding: 5px 13px !important; font-size: 13.5px !important; font-weight: 600 !important; color: #4b5563 !important; white-space: nowrap; text-transform: none !important; letter-spacing: normal !important; line-height: 1.4; display: inline-flex; gap: 6px; align-items: center; }
#am-wrap .am-pastille[hidden] { display: none !important; }
.am-pastille b { color: #16263a; font-variant-numeric: tabular-nums; }
#am-wrap .am-pastille[aria-pressed="true"] { background: #1e3a5f !important; border-color: #1e3a5f !important; color: #fff !important; }
.am-pastille[aria-pressed="true"] b { color: #fff; }
.am-pastilles.petites .am-pastille { font-size: 12.5px !important; padding: 3px 11px !important; }
.am-pastille.alerte b { color: #b45309; }
.am-pastille.alerte[aria-pressed="true"] b { color: #fff; }
#am-wrap .am-pastille:focus-visible, #am-wrap .am-btn-prim:focus-visible, #am-wrap .am-btn-sec:focus-visible { outline: 2px solid #0e7490 !important; outline-offset: 2px; }

#am-wrap .am-btn-prim, #am-wrap .am-btn-sec { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: center; border-radius: 8px !important; padding: 8px 14px !important; font-size: 14px; font-weight: 700; min-height: 40px; text-transform: none !important; letter-spacing: normal !important; white-space: nowrap; }
#am-wrap .am-btn-prim { background: #1e3a5f !important; color: #fff !important; }
#am-wrap .am-btn-sec { background: #fff !important; color: #16263a !important; border: 1px solid #dbe3ec !important; font-weight: 600; }
#am-wrap .am-btn-prim:hover, #am-wrap .am-btn-sec:hover { filter: brightness(.94); }

.am-inv-table { table-layout: fixed; }
.am-inv-table td { vertical-align: middle; }
.am-inv-table td small { display: block; color: #6b7280; font-size: 12px; }
.am-inv-table td small .am-ico, .am-mc .am-ico { width: 13px; height: 13px; vertical-align: -2px; }
tr.am-mat-row { cursor: pointer; }
.am-faits { display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: 13px; color: #5b6b7f; align-items: center; }
.am-faits b { color: #16263a; font-weight: 600; }
.am-inv-pc { display: none; flex-direction: column; gap: 8px; }
.am-mc { cursor: pointer; background: #fff; border: 1px solid #dbe3ec; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.am-mc:hover { border-color: #1e3a5f; }
.am-mc[hidden] { display: none !important; }
.am-mc .tete { display: flex; gap: 8px; align-items: center; }
.am-mc .tete .nm { flex: 1; min-width: 0; font-weight: 700; color: #16263a; }

/* Feuille : fiche d'un matériel (fenêtre centrée sur ordinateur, feuille du bas sur téléphone) */
.am-feuille-voile { position: fixed; inset: 0; background: rgba(10,20,35,.5); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.am-feuille { background: #fff; border-radius: 14px; max-width: 480px; width: 100%; max-height: 88%; overflow-y: auto; box-shadow: 0 10px 36px rgba(15,40,66,.25); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.am-feuille-poignee { display: none; }
.am-feuille-haut { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.am-feuille-haut h3 { margin: 0; font-size: 17px; color: #16263a; }
.am-feuille-haut .sous { font-size: 13px; color: #5b6b7f; }
.am-carac { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 0; }
.am-carac dt { color: #5b6b7f; margin: 0; }
.am-carac dd { margin: 0; font-weight: 600; color: #16263a; word-break: break-word; }
.am-encart { border-radius: 10px; padding: 8px 11px; font-size: 13.5px; background: #dbeafe; }
.am-encart.retard { background: #fee2e2; }
.am-encart .am-ico { width: 14px; height: 14px; vertical-align: -2px; }
.am-menu { display: flex; flex-direction: column; }
#am-wrap .am-menu button { all: unset; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 12px 4px !important; border-top: 1px solid #dbe3ec !important; font-size: 15px; font-weight: 600; color: #16263a !important; background: none !important; text-transform: none !important; letter-spacing: normal !important; }
#am-wrap .am-menu button:first-child { border-top: 0 !important; }
#am-wrap .am-menu button:hover { background: #e6eef7 !important; }
#am-wrap .am-menu button.danger { color: #b91c1c !important; }
#am-wrap .am-menu button[disabled] { opacity: .45; cursor: not-allowed; background: none !important; }
.am-menu button small { display: block; font-weight: 400; color: #5b6b7f; font-size: 12.5px; }
.am-menu button .am-ico { width: 18px; height: 18px; }

@media (max-width: 720px) {
    .am-inv-tw { display: none; }
    .am-inv-pc { display: flex; }
    .am-outils .am-btn-sec .txt { display: none; }
    .am-feuille-voile { align-items: flex-end; padding: 0; }
    .am-feuille { border-radius: 16px 16px 0 0; max-height: 88%; max-width: none; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
    .am-feuille-poignee { display: block; width: 40px; height: 4px; border-radius: 2px; background: #dbe3ec; margin: -6px auto 0; }
}

/* ── Prêts (v1.25.0) : listes groupées par sortie, choix du matériel et de l'emprunteur ── */
.am-liste { background: #fff; border: 1px solid #dbe3ec; border-radius: 12px; overflow: hidden; }
.am-ln { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid #dbe3ec; }
.am-ln:first-child { border-top: 0; }
.am-ln[hidden] { display: none !important; }
.am-ln .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.am-ln .txt .l { font-weight: 700; color: #16263a; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.am-ln .am-ico, .am-lot-h h3 .am-ico { width: 14px; height: 14px; vertical-align: -2px; }
.am-lot { margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.am-lot[hidden] { display: none !important; }
.am-lot-h { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.am-lot-h h3 { margin: 0 !important; font-size: 15px !important; color: #16263a !important; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#am-wrap .am-lot-t { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; padding: 6px 8px !important; border-radius: 8px !important; font-size: 15px; font-weight: 700; color: #16263a !important; }
#am-wrap .am-lot-t:hover { background: #e6eef7 !important; }
#am-wrap .am-lot-t:focus-visible { outline: 2px solid #0e7490 !important; outline-offset: 2px; }
.am-lot-t .am-ico:first-child { transition: transform .15s; }
.am-lot-t[aria-expanded="true"] .am-ico:first-child { transform: rotate(90deg); }
.am-lot-h h3 { flex: 1; min-width: 0; }
.am-lot-h h3 small { flex-basis: 100%; font-weight: 400; color: #5b6b7f; font-size: 12.5px; }
#am-wrap .am-btn-sec.petit, #am-wrap .am-btn-prim.petit { padding: 6px 10px !important; font-size: 13px; min-height: 34px; }
.am-choixlist { display: flex; flex-direction: column; max-height: 210px; overflow-y: auto; border: 1px solid #dbe3ec; border-radius: 10px; margin: 0 0 4px; }
#am-wrap .am-choixlist button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 9px 12px !important; border-top: 1px solid #dbe3ec !important; font-size: 14.5px; color: #16263a !important; background: #fff !important; text-transform: none !important; letter-spacing: normal !important; }
#am-wrap .am-choixlist button:first-child { border-top: 0 !important; }
#am-wrap .am-choixlist button[hidden] { display: none !important; }
#am-wrap .am-choixlist button:hover { background: #e6eef7 !important; }
#am-wrap .am-choixlist button[aria-pressed="true"] { background: #dbeafe !important; font-weight: 700; }
.am-choixlist button > span:first-child { flex: 1; min-width: 0; }
.am-choixlist small { color: #5b6b7f; font-weight: 400; }
#am-np-err { margin: 10px 0 0; }

/* ── Maintenance et incidents (v1.26.0) ── */
.am-cliquable { cursor: pointer; }
.am-ln.am-cliquable:hover { background: #e6eef7; }
.am-ln q { quotes: none; font-style: italic; font-size: 13.5px; color: #16263a; }
.am-ln > .am-ico { color: #5b6b7f; width: 16px; height: 16px; }
.am-liste[hidden] { display: none !important; }

/* ── Formulaire Ajouter / Modifier un matériel (v1.27.0) : plein écran sur téléphone, pied fixe ── */
#am-wrap .am-mf-voile { align-items: center; overflow: hidden; padding: 20px; }
#am-wrap .am-mf-box { max-width: 620px; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.am-mf { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; }
#am-wrap .am-mf [hidden] { display: none !important; }
.am-mf-haut { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #dbe3ec; flex: none; }
.am-mf-titre { flex: 1; min-width: 0; }
#am-wrap .am-mf-titre h3 { margin: 0 !important; font-size: 17px !important; color: #16263a !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-mf-sous { font-size: 12.5px; color: #5b6b7f; }
#am-wrap .am-mf-icobtn { all: unset; cursor: pointer; box-sizing: border-box; color: #5b6b7f !important; border-radius: 8px; font-size: 24px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 38px; }
#am-wrap .am-mf-icobtn:hover { background: #e6eef7 !important; }
.am-mf-icobtn .am-ico { width: 20px; height: 20px; }
.am-mf-corps { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; }
#am-mf-etape1, #am-mf-etape2, .am-mf-etape { display: flex; flex-direction: column; gap: 16px; }
.am-mf-pied { flex: none; display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid #dbe3ec; background: #fff; flex-wrap: wrap; align-items: center; }
.am-mf-pied .am-btn-sec, .am-mf-pied .am-btn-prim { flex: 1; }
#am-wrap .am-mf-pied .am-mf-lien { flex-basis: 100%; order: 3; text-align: center; padding: 8px; }

.am-mf-sec { display: flex; flex-direction: column; gap: 10px; margin: 0; }
#am-wrap .am-mf-sec h4 { margin: 0 !important; font-size: 13px !important; letter-spacing: .06em; text-transform: uppercase; color: #5b6b7f !important; display: flex; gap: 8px; align-items: center; font-weight: 700; }
.am-mf-sec h4::after { content: ""; flex: 1; height: 1px; background: #dbe3ec; }
.am-mf-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.am-mf-champ { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.am-mf-champ > label { font-size: 13px; font-weight: 700; color: #16263a; margin: 0; }
#am-wrap .am-mf-champ input:not([type=radio]):not([type=checkbox]):not([type=search]), #am-wrap .am-mf-champ textarea {
    font: inherit; font-size: 16px; font-weight: 400; padding: 9px 10px !important; border: 1.5px solid #dbe3ec !important; border-radius: 8px !important;
    background: #fff !important; color: #16263a !important; width: 100%; box-sizing: border-box; min-width: 0; }
#am-wrap .am-mf-champ input:focus, #am-wrap .am-mf-champ textarea:focus { outline: none; border-color: #1e3a5f !important; }
.am-mf-champ textarea { min-height: 70px; resize: vertical; }
#am-wrap .am-mf-champ.err input:not([type=radio]):not([type=checkbox]):not([type=search]) { border-color: #b91c1c !important; }
.am-mf-msg { color: #b91c1c; font-weight: 600; font-size: 12.5px; }
.am-mf-oblig { color: #b91c1c; }
.am-mf-aide { margin: 0; font-size: 12.5px; color: #5b6b7f; font-weight: 400; }

/* Choix à toucher : de vrais boutons radio, masqués, dont le libellé fait le bouton */
.am-mf-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.am-mf-opts-col { flex-direction: column; }
.am-mf-opts-col .am-opt { display: flex; }
#am-wrap .am-mf-opts-col .am-opt span { flex: 1; justify-content: flex-start; text-align: left; }
.am-opt { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.am-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
#am-wrap .am-opt span { box-sizing: border-box; min-width: 46px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border: 1.5px solid #dbe3ec; background: #fff; border-radius: 9px; font-weight: 700; font-size: 14px; color: #5b6b7f; }
#am-wrap .am-opt input:checked + span { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
#am-wrap .am-opt-disponible input:checked + span { background: #dcfce7; border-color: #16a34a; color: #15803d; }
#am-wrap .am-opt-hors_service input:checked + span { background: #fee2e2; border-color: #b91c1c; color: #b91c1c; }
#am-wrap .am-opt input:focus-visible + span, #am-wrap .am-bascule input:focus-visible ~ .case { outline: 2px solid #0e7490; outline-offset: 2px; }

.am-bascule { position: relative; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid #dbe3ec; border-radius: 9px; font-size: 14.5px; font-weight: 600; color: #16263a; cursor: pointer; margin: 0; }
.am-bascule input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.am-bascule .case { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid #dbe3ec; display: grid; place-items: center; color: transparent; flex: none; background: #fff; }
.am-bascule .case .am-ico { width: 14px; height: 14px; stroke-width: 3; }
#am-wrap .am-bascule input:checked ~ .case { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.am-mf-sous-bloc { padding-left: 12px; border-left: 3px solid #dbe3ec; margin-top: 10px; }

/* Étape 1 : catégorie */
.am-mf-tuiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#am-wrap .am-mf-tuile { all: unset; cursor: pointer; box-sizing: border-box; border: 1.5px solid #dbe3ec !important; border-radius: 12px; padding: 16px 6px 12px !important; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; background: #fff !important; color: #16263a !important; }
.am-mf-tuile .am-ico { width: 34px; height: 34px; stroke-width: 1.6; color: #1e3a5f; }
#am-wrap .am-mf-tuile:hover, #am-wrap .am-mf-pastille:hover { border-color: #1e3a5f !important; }
#am-wrap .am-mf-tuile[aria-pressed="true"], #am-wrap .am-mf-pastille[aria-pressed="true"] { background: #dbeafe !important; border-color: #1e3a5f !important; }
.am-mf-pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
#am-wrap .am-mf-pastille { all: unset; cursor: pointer; box-sizing: border-box; border: 1.5px solid #dbe3ec !important; background: #fff !important; border-radius: 9px; padding: 8px 12px !important; font-weight: 700; font-size: 14px; color: #5b6b7f !important; }
#am-wrap .am-mf-tuile:focus-visible, #am-wrap .am-mf-pastille:focus-visible, #am-wrap .am-mf-lien:focus-visible, #am-wrap .am-mf-icobtn:focus-visible { outline: 2px solid #0e7490 !important; outline-offset: 2px; }

/* Encarts : catégorie choisie, propriétaire choisi, contrôles, état verrouillé */
.am-mf-cat { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 10px; background: #dbeafe; font-weight: 700; font-size: 14px; color: #16263a; }
#am-wrap .am-mf-lien { all: unset; cursor: pointer; color: #0e7490 !important; font-weight: 600; font-size: 13.5px; padding: 6px 8px; border-radius: 8px; }
#am-wrap .am-mf-lien:hover { background: rgba(14, 116, 144, .1) !important; }
.am-mf-ajoute { background: #dcfce7; color: #15803d; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; font-weight: 600; }
.am-mf-verifs { display: flex; flex-direction: column; gap: 6px; }
.am-mf-encart { border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.am-mf-encart.ok { background: #dcfce7; color: #15803d; }
.am-mf-encart.bad { background: #fee2e2; color: #b91c1c; }
.am-mf-encart .l { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.am-mf-verrou { background: #eceff3; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; color: #16263a; }
.am-mf-verrou .l { display: flex; gap: 8px; align-items: center; }
.am-mf-verrou .am-ico { width: 15px; height: 15px; }
.am-mf-verrou .am-mf-lien { align-self: flex-start; padding-left: 0; }
details.am-mf-plus { border: 1px dashed #dbe3ec; border-radius: 10px; padding: 8px 12px; }
details.am-mf-plus summary { cursor: pointer; font-weight: 700; font-size: 14px; color: #0e7490; }
details.am-mf-plus[open] summary { margin-bottom: 10px; }

@media (min-width: 721px) {
    .am-mf-pied { justify-content: flex-end; }
    .am-mf-pied .am-btn-sec, .am-mf-pied .am-btn-prim { flex: none; }
    #am-wrap .am-mf-pied .am-mf-lien { flex-basis: auto; order: -1; margin-right: auto; text-align: left; }
}
@media (max-width: 720px) {
    #am-wrap .am-mf-voile { padding: 0; align-items: stretch; }
    #am-wrap .am-mf-box { max-width: none; max-height: none; height: 100%; height: 100dvh; border-radius: 0; }
}
@media (max-width: 340px) { .am-mf-deux { grid-template-columns: 1fr; } }
#am-wrap .am-mf-champ select { font: inherit; font-size: 16px; padding: 9px 10px !important; border: 1.5px solid #dbe3ec !important; border-radius: 8px !important; background: #fff !important; color: #16263a !important; width: 100%; box-sizing: border-box; min-width: 0; }
.am-mf-champ .am-choixlist, .am-mf-champ .am-recherche { margin: 0 0 8px; }
.am-mf-champ .am-pastilles { margin: 0 0 8px; }
.am-mf-champ.err .am-recherche { border-color: #b91c1c !important; }
.am-mf-verrou { font-weight: 400; }

/* Historique d'un matériel : une ligne par événement, pastille de couleur selon le type */
.am-hist { display: flex; flex-direction: column; gap: 8px; }
.am-hist-ev { border-left: 4px solid #9aa9bb; background: #f6f8fb; border-radius: 0 10px 10px 0; padding: 8px 12px; }
.am-hist-ev .h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 14px; color: #16263a; }
.am-hist-ev .d { font-size: 12.5px; color: #5b6b7f; font-variant-numeric: tabular-nums; }
.am-hist-ev p { margin: 2px 0 0; font-size: 13px; color: #44566c; overflow-wrap: anywhere; }
.am-hist-ev.k-maint { border-left-color: #0e7490; }
.am-hist-ev.k-inc { border-left-color: #d97706; }
.am-hist-ev.k-trait { border-left-color: #16a34a; }
.am-hist-ev.k-pret, .am-hist-ev.k-retour { border-left-color: #1e3a5f; }
.am-hist-ev.alerte p { color: #b91c1c; font-weight: 600; }

/* ── Nouveau prêt : choix multiple, lest et ceinture (v1.30.0) ── */
#am-wrap .am-np-multi button { position: relative; padding-left: 40px !important; }
#am-wrap .am-np-multi button::before { content: ""; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; box-sizing: border-box; border: 1.5px solid #9ca3af; border-radius: 4px; background: #fff; }
#am-wrap .am-np-multi button[aria-pressed="true"]::before { background: #1e3a5f; border-color: #1e3a5f; }
#am-wrap .am-np-multi button[aria-pressed="true"]::after { content: ""; position: absolute; left: 17px; top: 50%; width: 4px; height: 8px; margin-top: -6px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#am-wrap .am-np-multi button.bloque { cursor: not-allowed; background: #f6f8fb !important; color: #6b7280 !important; }
#am-wrap .am-np-multi button.bloque::before { background: #eceff3; border-color: #cbd5e1; }
.am-np-raison { display: block; color: #b91c1c !important; font-size: 12.5px; }
.am-np-raison[hidden] { display: none !important; }
.am-np-case { display: flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 600; margin: 8px 0 0; cursor: pointer; }
#am-wrap .am-np-case input { width: 20px; height: 20px; margin: 0; flex: none; }
.am-np-case small { font-weight: 400; color: #5b6b7f; }
.am-np-pas { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-weight: 600; font-size: 14px; margin: 10px 0 4px; }
.am-np-pas output { min-width: 64px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
#am-wrap .am-np-pas button { all: unset; box-sizing: border-box; cursor: pointer; width: 42px; height: 40px; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: #1e3a5f !important; background: #f3f6fa !important; border: 1.5px solid #cfd8e3 !important; border-radius: 9px !important; }

/* ── Cadre du prêt (v1.33.0) : drapeau Espagne, emprunteur grisé, zone de dérogation ── */
.am-drapeau { width: 21px; height: 14px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
#am-wrap .am-choixlist button.bloque { cursor: not-allowed; background: #f6f8fb !important; color: #6b7280 !important; }
#am-wrap .am-choixlist button .am-pill { flex: none; }
.am-np-info { flex: none; }
.am-mf-pastilles[hidden], .am-mf-champ[hidden], details.am-mf-plus[hidden] { display: none !important; }
details.am-mf-plus > .am-mf-champ { gap: 8px; }

/* ── Écran Prêts sur téléphone (v1.33.1) : bouton rond « Ajouter un prêt », recherche + cadre + export sur une ligne ── */
.am-filtres { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.am-filtres .am-recherche { flex: 1 1 auto; min-width: 0; margin: 0; }
#am-wrap .am-select-cadre { flex: none; max-width: 46%; font: inherit; font-size: 14px; padding: 9px 8px !important; border: 1.5px solid #dbe3ec !important; border-radius: 10px !important; background: #fff !important; color: #16263a !important; text-overflow: ellipsis; }
.am-filtres .am-btn-sec { flex: none; }
.am-fab { display: none; }
#am-wrap .am-lot-h h3 small { text-transform: none !important; letter-spacing: normal !important; }
@media (max-width: 720px) {
    .am-outils .am-pastilles { flex: 1 1 0; min-width: 0; }
    .am-outils-d { flex: none; }
    .am-ajout-pc { display: none !important; }
    .am-filtres .am-btn-sec .txt { display: none; }
    #am-prets, #am-inv, #am-maint { padding-bottom: 80px; }
    #am-wrap .am-fab { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%; background: #1e3a5f !important; color: #fff !important; box-shadow: 0 4px 14px rgba(0, 0, 0, .28); z-index: 9980; }
    #am-wrap .am-fab:focus-visible { outline: 2px solid #0e7490 !important; outline-offset: 3px; }
    .am-fab .am-ico { width: 28px; height: 28px; color: #fff; stroke: #fff; }
}
