/**
 * MageStock 2.6.111 — Configuration LDAP / Active Directory
 */
.ldap-settings-card{border-top:3px solid #2563eb}
.ldap-status-badge{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid var(--border);background:var(--surface-2,#f8fafc);font-size:12px;font-weight:700;color:var(--text-muted)}
.ldap-status-badge.is-ok{border-color:#86efac;background:#f0fdf4;color:#166534}
.ldap-status-badge.is-warning{border-color:#fcd34d;background:#fffbeb;color:#92400e}
.ldap-status-badge.is-error{border-color:#fca5a5;background:#fef2f2;color:#991b1b}
.ldap-security-banner{display:grid;gap:4px;padding:14px 16px;border-left:4px solid #2563eb;background:linear-gradient(90deg,rgba(37,99,235,.09),rgba(37,99,235,.02));margin-bottom:16px}
.ldap-security-banner strong{font-size:14px;color:var(--text-primary)}
.ldap-security-banner span{font-size:12px;color:var(--text-muted);line-height:1.5}
.ldap-diagnostics-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-bottom:16px}
.ldap-diagnostic{border:1px solid var(--border);padding:10px 12px;background:var(--surface,#fff);min-width:0}
.ldap-diagnostic span{display:block;font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:3px}
.ldap-diagnostic strong{display:flex;align-items:center;gap:6px;font-size:12px;word-break:break-word}
.ldap-diagnostic strong::before{content:"";width:8px;height:8px;border-radius:50%;background:#94a3b8;flex:0 0 auto}
.ldap-diagnostic.is-ok strong::before{background:#22c55e}.ldap-diagnostic.is-error strong::before{background:#ef4444}.ldap-diagnostic.is-warning strong::before{background:#f59e0b}
.ldap-config-group{border:1px solid var(--border);background:var(--surface,#fff);margin-top:12px}
.ldap-config-group>summary{cursor:pointer;list-style:none;padding:14px 16px;font-weight:700;font-size:14px;color:var(--text-primary);display:flex;align-items:center;justify-content:space-between;background:var(--surface-2,#f8fafc)}
.ldap-config-group>summary::-webkit-details-marker{display:none}.ldap-config-group>summary::after{content:"+";font-size:18px;color:#2563eb}.ldap-config-group[open]>summary::after{content:"−"}
.ldap-config-body{padding:16px;border-top:1px solid var(--border)}
.ldap-toggle-row{display:flex;align-items:flex-start;gap:10px;padding:12px;border:1px solid var(--border);background:var(--surface-2,#f8fafc);cursor:pointer}
.ldap-toggle-row input{width:18px;height:18px;margin-top:1px;accent-color:#2563eb;flex:0 0 auto}
.ldap-toggle-row span{display:grid;gap:3px}.ldap-toggle-row strong{font-size:13px;color:var(--text-primary)}.ldap-toggle-row small{font-size:11px;color:var(--text-muted);line-height:1.4}
.ldap-server-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.ldap-server-card{display:grid;grid-template-columns:minmax(0,2fr) minmax(90px,.7fr);gap:10px;border:1px solid var(--border);padding:14px;margin:0;min-width:0}
.ldap-server-card legend{padding:0 6px;font-size:12px;font-weight:700;color:#2563eb}.ldap-server-card label{display:grid;gap:5px;font-size:11px;font-weight:700;color:var(--text-muted)}
.ldap-inline-options{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}
.ldap-secret-grid{margin-top:12px}.ldap-secret-card{display:grid;gap:10px;border:1px solid var(--border);padding:14px;margin-top:12px;background:var(--surface,#fff)}
.ldap-secret-card>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:12px}.ldap-secret-card>div:first-child strong{font-size:13px}.ldap-secret-card>div:first-child span{font-size:11px;color:var(--text-muted)}
.ldap-actions-row,.ldap-primary-actions{display:flex;flex-wrap:wrap;gap:8px}.ldap-primary-actions{margin-top:14px}.ldap-primary-actions .btn{min-height:40px}
.ldap-attributes-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.ldap-attributes-grid label{display:grid;gap:5px;font-size:11px;font-weight:700;color:var(--text-muted)}
.ldap-group-search-grid{margin-top:12px}.ldap-mono{font-family:var(--font-mono,"DM Mono",monospace);font-size:12px}
.ldap-mapping-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-top:16px}.ldap-mapping-head strong{font-size:13px}.ldap-mapping-head p{font-size:11px;color:var(--text-muted);margin:4px 0 0}
.ldap-mappings{display:grid;gap:10px;margin-top:10px}.ldap-mapping-row{display:grid;grid-template-columns:minmax(220px,1.5fr) minmax(120px,.6fr) minmax(220px,1.2fr) auto;gap:8px;align-items:end;border:1px solid var(--border);padding:12px;background:var(--surface-2,#f8fafc)}
.ldap-mapping-row label{display:grid;gap:5px;font-size:10px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted)}
.ldap-mapping-permissions{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:6px}.ldap-permission-chip{display:inline-flex;align-items:center;gap:5px;padding:5px 7px;border:1px solid var(--border);background:var(--surface,#fff);font-size:11px;cursor:pointer}.ldap-permission-chip input{accent-color:#2563eb}
.ldap-warehouse-select{min-height:80px}
.ldap-test-credentials{display:grid;grid-template-columns:1fr 1fr;gap:10px}.ldap-priority-confirm{margin-top:12px;padding:12px;border:1px solid #f59e0b;background:#fffbeb}
.ldap-test-result{white-space:pre-wrap;word-break:break-word;min-height:110px;max-height:360px;overflow:auto;margin:14px 0 0;padding:14px;border:1px solid #1e293b;background:#0f172a;color:#dbeafe;font:12px/1.55 var(--font-mono,"DM Mono",monospace)}
.ldap-test-result.is-error{border-color:#ef4444;color:#fecaca}.ldap-test-result.is-success{border-color:#22c55e;color:#bbf7d0}
.ldap-account-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;border:1px solid var(--border);font-size:10px;font-weight:700;white-space:nowrap}.ldap-account-badge.is-ldap{border-color:#93c5fd;background:#eff6ff;color:#1d4ed8}.ldap-account-badge.is-local{background:#f8fafc;color:#475569}.ldap-account-badge.is-error{border-color:#fecaca;background:#fef2f2;color:#b91c1c}
html[data-theme="dark"] .ldap-status-badge.is-ok,html[data-theme="dark"] .ldap-diagnostic,html[data-theme="dark"] .ldap-toggle-row,html[data-theme="dark"] .ldap-server-card,html[data-theme="dark"] .ldap-secret-card,html[data-theme="dark"] .ldap-mapping-row{background:rgba(15,23,42,.45)}
html[data-theme="dark"] .ldap-priority-confirm{background:rgba(245,158,11,.1)}
@media(max-width:1100px){.ldap-diagnostics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ldap-attributes-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ldap-mapping-row{grid-template-columns:1fr 1fr}.ldap-mapping-row .ldap-remove-mapping{justify-self:end}}
@media(max-width:720px){.ldap-server-grid,.ldap-inline-options,.ldap-test-credentials{grid-template-columns:1fr}.ldap-server-card{grid-template-columns:1fr}.ldap-attributes-grid{grid-template-columns:1fr 1fr}.ldap-mapping-row{grid-template-columns:1fr}.ldap-mapping-permissions{grid-column:1}.ldap-diagnostics-grid{grid-template-columns:1fr 1fr}.ldap-primary-actions .btn{width:100%;justify-content:center}.ldap-mapping-head{display:grid}.ldap-mapping-head .btn{width:100%}}
@media(max-width:430px){.ldap-diagnostics-grid,.ldap-attributes-grid{grid-template-columns:1fr}.ldap-config-body{padding:12px}.ldap-config-group>summary{padding:13px}.ldap-actions-row .btn{width:100%}}

/* 2.6.109 — Lisibilité sombre et groupes repliés par défaut. */
html[data-theme="dark"] .ldap-settings-card,
html[data-theme="dark"] .ldap-config-group,
html[data-theme="dark"] .ldap-config-body,
html[data-theme="dark"] .ldap-diagnostic,
html[data-theme="dark"] .ldap-server-card,
html[data-theme="dark"] .ldap-secret-card,
html[data-theme="dark"] .ldap-mapping-row,
html[data-theme="dark"] .ldap-permission-chip,
html[data-theme="dark"] .ldap-toggle-row{background:var(--bg-card,#141d2e);border-color:var(--border,#1e2d42);color:var(--text-primary,#f0f6ff)}
html[data-theme="dark"] .ldap-config-group>summary{background:var(--bg-elevated,#1e2d42);color:var(--text-primary,#f0f6ff)}
html[data-theme="dark"] .ldap-config-body{border-top-color:var(--border,#1e2d42)}
html[data-theme="dark"] .ldap-security-banner{background:linear-gradient(90deg,rgba(79,142,247,.16),rgba(79,142,247,.04))}
html[data-theme="dark"] .ldap-status-badge.is-warning{background:rgba(245,158,11,.12);border-color:#a16207;color:#fbbf24}
html[data-theme="dark"] .ldap-status-badge.is-error{background:rgba(239,68,68,.12);border-color:#991b1b;color:#fca5a5}
html[data-theme="dark"] .ldap-status-badge.is-ok{background:rgba(34,197,94,.12);border-color:#166534;color:#86efac}
html[data-theme="dark"] .ldap-diagnostic span,
html[data-theme="dark"] .ldap-server-card label,
html[data-theme="dark"] .ldap-attributes-grid label,
html[data-theme="dark"] .ldap-mapping-row label,
html[data-theme="dark"] .ldap-toggle-row small,
html[data-theme="dark"] .ldap-mapping-head p{color:var(--text-secondary,#8fa3b8)}

/* v2.6.111 — choix explicite entre autorisations LDAP et surcharge locale. */
.ldap-authz-choice{margin-top:16px;padding:12px;border:1px solid var(--border);background:var(--bg-input)}
.ldap-authz-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:7px}
.ldap-authz-help{margin:9px 0 0;font-size:11px;line-height:1.5;color:var(--text-muted)}
.ldap-authz-choice button:disabled,.ldap-authz-choice input:disabled{cursor:not-allowed;opacity:.65}
html[data-theme="dark"] .ldap-authz-choice{background:#111c2e;border-color:#2a3c56}
@media(max-width:600px){.ldap-authz-buttons{display:grid;grid-template-columns:1fr}.ldap-authz-buttons .btn{width:100%}}
