/* ============================================================
   ML INTER SECURITY — dashboard.css
   Design system principal — dark mode par défaut
   ============================================================ */

/* ─── 1. Variables CSS ─────────────────────────────────────── */
:root {
  /* Fonds */
  --bg-base:     #0D0F17;
  --bg-surface:  #171B27;
  --bg-elevated: #1F2337;
  --bg-input:    #272B3F;

  /* Accent */
  --accent:       #E60001;
  --accent-soft:  #FF3333;
  --accent-muted: rgba(230,0,1,.14);

  /* Statuts */
  --status-ok:          #2DD4BF;
  --status-ok-bg:       rgba(45,212,191,.1);
  --status-warn:        #F59E0B;
  --status-warn-bg:     rgba(245,158,11,.1);
  --status-danger:      #E60001;
  --status-danger-bg:   rgba(230,0,1,.12);
  --status-suspect:     #A78BFA;
  --status-suspect-bg:  rgba(167,139,250,.1);

  /* Textes */
  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;

  /* Bordures */
  --border:        rgba(255,255,255,.06);
  --border-hover:  rgba(255,255,255,.13);
  --border-active: rgba(230,0,1,.45);

  /* Ombres */
  --shadow-card:     0 2px 16px rgba(0,0,0,.35);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,.55);

  /* Rayons */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Sidebar */
  --sidebar-w: 240px;
}

/* ─── Light mode ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:     #EFF1F7;
  --bg-surface:  #FFFFFF;
  --bg-elevated: #E5E8F2;
  --bg-input:    #ECF0F8;

  --accent:      #E60001;
  --accent-soft: #FF2222;
  --accent-muted: rgba(230,0,1,.08);

  --status-ok:         #0F9D8A;
  --status-ok-bg:      rgba(15,157,138,.09);
  --status-warn:       #C2710C;
  --status-warn-bg:    rgba(194,113,12,.09);
  --status-danger:     #E60001;
  --status-danger-bg:  rgba(230,0,1,.08);
  --status-suspect:    #6E3FC2;
  --status-suspect-bg: rgba(110,63,194,.09);

  --text-primary:   #0F1117;
  --text-secondary: #374151;
  --text-muted:     #6B7280;

  --border:        rgba(0,0,0,.08);
  --border-hover:  rgba(0,0,0,.14);
  --border-active: rgba(230,0,1,.35);

  --shadow-card:     0 2px 12px rgba(0,0,0,.07);
  --shadow-elevated: 0 8px 24px rgba(0,0,0,.12);
}

/* ─── 2. Reset ────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── 3. Body ─────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 220ms ease, color 220ms ease;
  line-height: 1.5;
}

/* ─── 4. Logo dark/light switch ───────────────────────────── */
.logo-lm { display: none !important; }
.logo-dm { display: block !important; }

[data-theme="light"] .logo-dm { display: none !important; }
[data-theme="light"] .logo-lm { display: block !important; }

/* ─── 5. Icônes thème (lune/soleil) ───────────────────────── */
.icon-dm { display: flex; }
.icon-lm { display: none; }

[data-theme="light"] .icon-dm { display: none; }
[data-theme="light"] .icon-lm { display: flex; }

/* ─── 6. App layout ───────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── 7. Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color 220ms ease, border-color 220ms ease;
  z-index: 100;
}

.sidebar-header {
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  height: 34px;
  width: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 10px 4px;
  user-select: none;
}

/* ─── 8. Nav items ────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 160ms, color 160ms, border-color 160ms;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--border-active);
}

.nav-item.active svg {
  stroke: var(--accent);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-item span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── 9. Nav badge ────────────────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  line-height: 1;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 4px;
}

/* ─── 10. User card ───────────────────────────────────────── */
.user-card {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1.5px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms, background 150ms;
  flex-shrink: 0;
}

.logout-btn:hover {
  color: var(--accent);
  background: var(--accent-muted);
}

.logout-btn svg {
  width: 15px;
  height: 15px;
}

/* ─── 11. Main content ────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── 12. Topbar ──────────────────────────────────────────── */
.topbar {
  height: 58px;
  min-height: 58px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  transition: background-color 220ms ease, border-color 220ms ease;
}

.topbar-title-group {
  flex: 1;
  min-width: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── 13. Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 150ms, color 150ms, border-color 150ms, opacity 150ms;
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn:active { opacity: .85; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.btn-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: rgba(230,0,1,.25);
}

.btn-danger:hover {
  background: var(--status-danger);
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ─── 14. Bouton bascule thème (topbar) ───────────────────── */
.btn-theme {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms, background 150ms, border-color 150ms;
  flex-shrink: 0;
}

.btn-theme:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-theme svg {
  width: 16px;
  height: 16px;
}

/* ─── 15. Page body ───────────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.page-body::-webkit-scrollbar { width: 6px; }
.page-body::-webkit-scrollbar-track { background: transparent; }
.page-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ─── 16. Live badge ──────────────────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .25; }
}

@media (prefers-reduced-motion: reduce) {
  @keyframes blink {
    0%, 100% { opacity: 1; }
  }
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  background: var(--status-ok-bg);
  border: 1px solid rgba(45,212,191,.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--status-ok);
}

.dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-ok);
  animation: blink 1.6s ease-in-out infinite;
}

/* ─── 17. Stat cards ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
  transition: border-color 180ms, box-shadow 180ms, background 220ms ease;
  cursor: default;
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-elevated);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 16px;
  height: 16px;
}

.stat-icon.ok     { background: var(--status-ok-bg);     color: var(--status-ok); }
.stat-icon.warn   { background: var(--status-warn-bg);   color: var(--status-warn); }
.stat-icon.danger { background: var(--status-danger-bg); color: var(--status-danger); }
.stat-icon.accent { background: var(--accent-muted);     color: var(--accent); }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ─── 18. Section header + count pill + section link ─────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.section-link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 150ms, opacity 150ms;
}

.section-link:hover { opacity: .75; }

.section-link svg {
  width: 12px;
  height: 12px;
}

/* ─── 19. QR grid + QR card ───────────────────────────────── */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) {
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .qr-grid { grid-template-columns: 1fr; }
}

.qr-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-card);
  transition: transform 180ms, border-color 180ms, box-shadow 180ms, background 220ms ease;
  cursor: default;
}

.qr-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-hover);
}

.qr-card.ok      { border-left-color: var(--status-ok); }
.qr-card.warn    { border-left-color: var(--status-warn); }
.qr-card.danger  { border-left-color: var(--status-danger); }
.qr-card.suspect { border-left-color: var(--status-suspect); }
.qr-card.pending { border-left-color: var(--border-hover); }

.qr-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
}

.qr-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.qr-site {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.qr-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.qr-meta-row svg {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── 20. Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.ok {
  background: var(--status-ok-bg);
  color: var(--status-ok);
}

.badge.warn {
  background: var(--status-warn-bg);
  color: var(--status-warn);
}

.badge.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.badge.suspect {
  background: var(--status-suspect-bg);
  color: var(--status-suspect);
}

.badge.muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ─── 21. Alerts list ─────────────────────────────────────── */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background 150ms, border-color 150ms;
}

.alert-row:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
}

.alert-ico {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-ico svg {
  width: 14px;
  height: 14px;
}

.alert-ico.ok      { background: var(--status-ok-bg);      color: var(--status-ok); }
.alert-ico.warn    { background: var(--status-warn-bg);    color: var(--status-warn); }
.alert-ico.danger  { background: var(--status-danger-bg);  color: var(--status-danger); }
.alert-ico.suspect { background: var(--status-suspect-bg); color: var(--status-suspect); }

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-msg {
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

.alert-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── 22. Data table ──────────────────────────────────────── */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: background 220ms ease, border-color 220ms ease;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--bg-elevated);
}

.data-table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-elevated);
}

.data-table tbody td {
  padding: 12px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* Row actions — visibles au hover de la ligne */
.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 150ms;
}

.data-table tbody tr:hover .row-actions {
  opacity: 1;
}

.row-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11.5px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 130ms, color 130ms, border-color 130ms;
}

.row-action-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.row-action-btn.danger:hover {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: rgba(230,0,1,.25);
}

.row-action-btn svg {
  width: 13px;
  height: 13px;
}

/* ─── 23. Actif badges ────────────────────────────────────── */
.actif-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.actif-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.actif-badge.on {
  background: var(--status-ok-bg);
  color: var(--status-ok);
}

.actif-badge.on::before { background: var(--status-ok); }

.actif-badge.off {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.actif-badge.off::before { background: var(--text-muted); }

/* ─── 24. Pagination ──────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 130ms, color 130ms, border-color 130ms;
}

.page-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-btn:disabled,
.page-btn[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
}

/* ─── 25. Login page ──────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Radial glow derrière la card */
.login-page::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(230,0,1,.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-elevated);
  position: relative;
  z-index: 1;
  transition: background 220ms ease, border-color 220ms ease;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.login-logo-wrap img {
  height: 42px;
  width: auto;
}

.login-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 160ms, background 160ms;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--border-active);
  background: var(--bg-input);
}

.form-input.is-invalid {
  border-color: var(--accent);
}

/* Groupe mot de passe avec bouton show/hide */
.form-input-wrap {
  position: relative;
}

.form-input-wrap .form-input {
  padding-right: 42px;
}

.input-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms;
  border-radius: var(--radius-sm);
}

.input-toggle-btn:hover {
  color: var(--text-secondary);
}

.input-toggle-btn svg {
  width: 15px;
  height: 15px;
}

.alert-error {
  background: var(--status-danger-bg);
  border: 1px solid rgba(230,0,1,.25);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  font-size: 13px;
  color: var(--status-danger);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.alert-error svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-login {
  width: 100%;
  padding: 11px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 150ms, opacity 150ms;
  margin-top: 8px;
}

.btn-login:hover { background: var(--accent-soft); }
.btn-login:active { opacity: .85; }

.btn-login svg {
  width: 16px;
  height: 16px;
}

.login-footer {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 24px;
}

/* ─── 26. Bouton toggle thème fixe (login) ────────────────── */
.btn-theme-fixed {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms, background 150ms, border-color 150ms, box-shadow 150ms;
  box-shadow: var(--shadow-card);
  z-index: 200;
}

.btn-theme-fixed:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-elevated);
}

.btn-theme-fixed svg {
  width: 18px;
  height: 18px;
}

/* ─── Utilitaires divers ───────────────────────────────────── */
.text-muted  { color: var(--text-muted);     font-size: 13px; }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary);  }
.text-accent { color: var(--accent); }
.text-ok     { color: var(--status-ok);     }
.text-warn   { color: var(--status-warn);   }
.text-danger { color: var(--status-danger); }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: background 220ms ease, border-color 220ms ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ─── Phase 2 — Composants CRUD sites ──────────────────────── */

/* Alertes flash (succès / erreur page) */
.alert-success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
  background: var(--status-ok-bg);
  border: 1px solid var(--status-ok);
  border-radius: var(--radius-md);
  color: var(--status-ok);
  font-size: 13px;
  font-weight: 500;
}

/* Bandeau d'avertissement (configuration incomplète, ex. QR sans plage) */
.alert-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 18px;
  background: var(--status-warn-bg);
  border: 1px solid var(--status-warn);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.45;
}
.alert-warn i { color: var(--status-warn); flex-shrink: 0; margin-top: 1px; }
.alert-warn strong { color: var(--status-warn); }

/* Badge « aucune plage » sur une carte QR */
.qr-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 2px;
  padding: 3px 8px;
  background: var(--status-warn-bg);
  color: var(--status-warn);
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 600;
}

/* Variante d'alerte de la pastille de comptage (créneau sans plage) */
.count-pill.warn {
  gap: 4px;
  background: var(--status-warn-bg);
  border-color: var(--status-warn);
  color: var(--status-warn);
  font-weight: 600;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}
.empty-state svg { opacity: .35; }
.empty-state p { margin: 0; }

/* Table — liens et colonnes secondaires */
.table-link {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms;
}
.table-link:hover { color: var(--accent-soft); }

.td-secondary {
  color: var(--text-secondary);
  font-size: 13px;
}

.td-link {
  color: var(--accent-soft);
  text-decoration: none;
  font-size: 13px;
}
.td-link:hover { text-decoration: underline; }

/* Row actions — icônes d'action en fin de ligne */
.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 150ms;
}
.data-table tbody tr:hover .row-actions { opacity: 1; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms, color 150ms, border-color 150ms;
  padding: 0;
  font-size: 0;
}
.icon-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.icon-btn.del:hover {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: var(--status-danger);
}

/* Pagination wrapper */
.pagination-wrap {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* Dot sm — indicateur statut actif inline */
.dot-sm {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-ok);
  margin-right: 5px;
  vertical-align: middle;
}

/* ─── Formulaires CRUD ──────────────────────────────────────── */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 760px;
  box-shadow: var(--shadow-card);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 64px;
}

.form-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.form-error {
  font-size: 12px;
  color: var(--status-danger);
  margin-top: 2px;
}

.required {
  color: var(--accent);
  font-size: 12px;
  margin-left: 2px;
}

.input-error {
  border-color: var(--status-danger) !important;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ─── Info card (page show) ─────────────────────────────────── */
.info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.info-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  min-width: 80px;
  flex-shrink: 0;
}

.info-value {
  font-size: 14px;
  color: var(--text-primary);
}

/* Badge pending (qr-card) */
.badge.pending {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-color: var(--border);
}
.badge.pending .dot { background: var(--text-muted); }

/* ─── Select natif ──────────────────────────────────────────── */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-input);
  color: var(--text-primary);
}

/* ─── Alerte info (formulaires) ─────────────────────────────── */
.alert-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(99,179,237,.08);
  border: 1px solid rgba(99,179,237,.25);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alert-info svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

/* ─── Responsive form-grid ──────────────────────────────────── */
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group-full { grid-column: 1; }
  .form-card { padding: 18px 16px; }
}

/* ─── Phase 3 — Checkbox grid (sélection multi-sites) ────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 0;
}

.checkbox-item:hover { color: var(--accent); }

/* ─── Phase 6 — Statuts dashboard (statut brut → bordure qr-card) ──── */
.qr-card.manque     { border-left-color: var(--status-danger); }
.qr-card.en_attente { border-left-color: var(--border-hover); opacity: .72; }
.qr-card.hors_plage { border-left-color: var(--status-warn); }

/* ─── Phase 6 — Barre de filtres historique ─────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 140px;
}
@media (max-width: 768px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-input, .filter-bar .form-select { width: 100%; }
}
