/* ================================================================
   admin.css — Interface d'administration Timbrage
   Esthétique : industriel / précis — sidebar sombre, contenu clair
   Typo : Barlow Condensed (titres) + DM Sans (corps)
   ================================================================ */

:root {
  --adm-sidebar-w:      240px;
  --adm-sidebar-bg:     #0f1117;
  --adm-sidebar-border: #1e2130;
  --adm-sidebar-text:   #8b93a7;
  --adm-sidebar-hover:  #1a1f2e;
  --adm-sidebar-active: #1e2540;
  --adm-topbar-h:       56px;
  --adm-topbar-bg:      #ffffff;
  --adm-topbar-border:  #e5e9f0;
  --adm-bg:             #f4f6fb;
  --adm-card-bg:        #ffffff;
  --adm-text:           #1a1f2e;
  --adm-text-muted:     #6b7280;
  --adm-border:         #e5e9f0;
  --adm-radius:         10px;
  --adm-shadow:         0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --adm-shadow-md:      0 4px 24px rgba(0,0,0,.10);
  --adm-primary:        #2563eb;
  --adm-primary-light:   #dbeafe;
  --adm-accent:         #2563eb;
  --adm-acc-text:       #ffffff;
  --adm-success:        #059669;
  --adm-warning:        #d97706;
  --adm-danger:         #dc2626;
  --adm-info:           #0284c7;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body.admin-body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--adm-bg);
  color: var(--adm-text);
  min-height: 100vh;
  display: flex;
}

/* ---------------------------------------------------------------
   SIDEBAR
   --------------------------------------------------------------- */
.adm-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--adm-sidebar-w);
  background: var(--adm-sidebar-bg);
  border-right: 1px solid var(--adm-sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.adm-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--adm-topbar-h);
  border-bottom: 1px solid var(--adm-sidebar-border);
  flex-shrink: 0;
}
.adm-sidebar__brand-icon {
  width: 32px;
  height: 32px;
  background: var(--adm-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--adm-acc-text);
  font-size: .95rem;
  flex-shrink: 0;
}
.adm-sidebar__brand-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--adm-sidebar-border) transparent;
}
.adm-sidebar__nav::-webkit-scrollbar { width: 3px; }
.adm-sidebar__nav::-webkit-scrollbar-thumb { background: var(--adm-sidebar-border); }

.adm-nav-group {
  padding: 0 12px;
  margin-bottom: 4px;
}
.adm-nav-group__label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #2d3450;
  padding: 14px 8px 5px;
}
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--adm-sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.adm-nav-item:hover  { background: var(--adm-sidebar-hover); color: #c8cedd; text-decoration: none; }
.adm-nav-item.active { background: var(--adm-sidebar-active); color: #ffffff; }
.adm-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 3px;
  background: var(--adm-accent);
  border-radius: 0 2px 2px 0;
}
.adm-nav-item i { font-size: .9rem; width: 18px; text-align: center; flex-shrink: 0; opacity: .65; }
.adm-nav-item.active i { opacity: 1; color: var(--adm-accent); }
.adm-nav-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.adm-nav-badge {
  background: var(--adm-danger);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  flex-shrink: 0;
}

.adm-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--adm-sidebar-border);
  flex-shrink: 0;
}
.adm-sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--adm-accent);
  color: var(--adm-acc-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.adm-sidebar__user-info { flex: 1; overflow: hidden; }
.adm-sidebar__user-name {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: #c8cedd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-sidebar__user-role {
  display: block;
  font-size: .72rem;
  color: #2d3450;
}
.adm-sidebar__logout {
  color: #2d3450;
  font-size: .9rem;
  padding: 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  text-decoration: none;
}
.adm-sidebar__logout:hover { color: #e74c3c; background: rgba(231,76,60,.12); text-decoration: none; }

/* ---------------------------------------------------------------
   OVERLAY + WRAP
   --------------------------------------------------------------- */
.adm-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  visibility: hidden;
}
.adm-overlay.visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.adm-wrap {
  margin-left: var(--adm-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------------------------------------------------------------
   TOPBAR
   --------------------------------------------------------------- */
.adm-topbar {
  position: sticky;
  top: 0; z-index: 100;
  height: var(--adm-topbar-h);
  background: var(--adm-topbar-bg);
  border-bottom: 1px solid var(--adm-topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}
.adm-topbar__left { display: flex; align-items: center; gap: 14px; overflow: hidden; }
.adm-topbar__burger {
  display: none;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--adm-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.adm-topbar__burger:hover { background: var(--adm-bg); }

.adm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  overflow: hidden;
}
.adm-breadcrumb__link { color: var(--adm-text-muted); text-decoration: none; transition: color .15s; white-space: nowrap; }
.adm-breadcrumb__link:hover { color: var(--adm-accent); }
.adm-breadcrumb__sep { color: #d1d5db; font-size: .75rem; }
.adm-breadcrumb__current { color: var(--adm-text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.adm-topbar__right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.adm-topbar__clock { font-size: .78rem; color: var(--adm-text-muted); white-space: nowrap; }

/* ---------------------------------------------------------------
   MAIN + FOOTER
   --------------------------------------------------------------- */
.adm-main {
  flex: 1;
  padding: 28px 28px 20px;
}
.adm-footer {
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: #b0b8cc;
  border-top: 1px solid var(--adm-border);
}

/* ---------------------------------------------------------------
   ALERTES
   --------------------------------------------------------------- */
.adm-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--adm-radius);
  margin-bottom: 20px;
  font-size: .88rem;
  font-weight: 500;
  animation: adm-slide-down .3s ease;
}
@keyframes adm-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.adm-alert--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.adm-alert--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.adm-alert--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.adm-alert i { font-size: 1rem; }
.adm-alert__close { margin-left: auto; background: none; border: none; color: inherit; opacity: .5; cursor: pointer; font-size: .8rem; padding: 2px 6px; }
.adm-alert__close:hover { opacity: 1; }

/* ---------------------------------------------------------------
   PAGE HEADER
   --------------------------------------------------------------- */
.adm-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.adm-page-header__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--adm-text);
  letter-spacing: -.01em;
  line-height: 1;
  margin-bottom: 3px;
}
.adm-page-header__sub { font-size: .82rem; color: var(--adm-text-muted); }
.adm-page-header__actions { display: flex; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }

/* ---------------------------------------------------------------
   STAT CARDS
   --------------------------------------------------------------- */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.adm-stat-card {
  background: var(--adm-card-bg);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--adm-shadow);
  transition: box-shadow .2s, transform .2s;
  text-decoration: none;
  color: inherit;
}
.adm-stat-card:hover { box-shadow: var(--adm-shadow-md); transform: translateY(-2px); text-decoration: none; color: inherit; }
.adm-stat-card__icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.adm-stat-card__icon--blue   { background: #eff6ff; color: #2563eb; }
.adm-stat-card__icon--green  { background: #f0fdf4; color: #059669; }
.adm-stat-card__icon--orange { background: #fff7ed; color: #d97706; }
.adm-stat-card__icon--red    { background: #fef2f2; color: #dc2626; }
.adm-stat-card__icon--purple { background: #faf5ff; color: #7c3aed; }
.adm-stat-card__body { flex: 1; overflow: hidden; }
.adm-stat-card__value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem; font-weight: 700; line-height: 1;
  color: var(--adm-text); margin-bottom: 2px;
}
.adm-stat-card__label { font-size: .78rem; color: var(--adm-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------
   CARTES GÉNÉRIQUES
   --------------------------------------------------------------- */
.adm-card {
  background: var(--adm-card-bg);
  border-radius: var(--adm-radius);
  border: 1px solid var(--adm-border);
  box-shadow: var(--adm-shadow);
  padding: 24px;
}
.adm-card--tight { padding: 16px; }
.adm-card__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--adm-text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------
   DASHBOARD GRID
   --------------------------------------------------------------- */
.adm-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}

/* ---------------------------------------------------------------
   TABLEAUX
   --------------------------------------------------------------- */
.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.adm-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--adm-text-muted);
  border-bottom: 2px solid var(--adm-border);
  white-space: nowrap;
  background: #fafbfd;
}
.adm-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f2f7;
  color: var(--adm-text);
  vertical-align: middle;
}
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover td { background: #f8faff; }
.adm-table a { color: var(--adm-accent); text-decoration: none; font-weight: 500; }
.adm-table a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------
   BADGES
   --------------------------------------------------------------- */
.adm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 12px;
  font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.adm-badge--active    { background: #dcfce7; color: #166534; }
.adm-badge--inactive  { background: #f3f4f6; color: #6b7280; }
.adm-badge--start     { background: #dbeafe; color: #1e40af; }
.adm-badge--end       { background: #fee2e2; color: #991b1b; }
.adm-badge--warning   { background: #fef9c3; color: #854d0e; }
.adm-badge--root      { background: #faf5ff; color: #6d28d9; }
.adm-badge--admin     { background: #eff6ff; color: #1e40af; }
.adm-badge--superuser { background: #f0fdfa; color: #065f46; }
.adm-badge--user      { background: #f3f4f6; color: #374151; }

/* ---------------------------------------------------------------
   BOUTONS
   --------------------------------------------------------------- */
.adm-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px;
  font-size: .875rem; font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .1s, opacity .15s;
  white-space: nowrap; line-height: 1.4;
}
.adm-btn:hover { text-decoration: none; }
.adm-btn:active { transform: scale(.98); }
.adm-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.adm-btn--primary { background: var(--adm-accent); color: var(--adm-acc-text); border-color: var(--adm-accent); }
.adm-btn--primary:hover { opacity: .88; box-shadow: 0 3px 12px rgba(37,99,235,.25); color: var(--adm-acc-text); }
.adm-btn--secondary { background: #fff; color: var(--adm-text); border-color: var(--adm-border); }
.adm-btn--secondary:hover { background: var(--adm-bg); color: var(--adm-text); }
.adm-btn--danger { background: #fef2f2; color: var(--adm-danger); border-color: #fecaca; }
.adm-btn--danger:hover { background: #fee2e2; color: var(--adm-danger); }
.adm-btn--sm { padding: 5px 11px; font-size: .78rem; }
.adm-btn--lg { padding: 11px 22px; font-size: .95rem; }

/* ---------------------------------------------------------------
   FORMULAIRES
   --------------------------------------------------------------- */
.adm-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.adm-form-group { display: flex; flex-direction: column; gap: 6px; }
.adm-form-group--full { grid-column: 1 / -1; }
.adm-label { font-size: .82rem; font-weight: 600; color: var(--adm-text); }
.adm-label .required { color: var(--adm-danger); margin-left: 3px; }
.adm-input, .adm-select, .adm-textarea {
  padding: 9px 12px;
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--adm-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.adm-input:focus, .adm-select:focus, .adm-textarea:focus {
  border-color: var(--adm-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.adm-textarea { resize: vertical; min-height: 90px; }
.adm-hint { font-size: .75rem; color: var(--adm-text-muted); }
.adm-form-actions { display: flex; gap: 10px; padding-top: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------
   TIMELINE (dernier timbrages)
   --------------------------------------------------------------- */
.adm-timeline { list-style: none; display: flex; flex-direction: column; }
.adm-timeline__item {
  display: flex; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid #f0f2f7; align-items: flex-start;
}
.adm-timeline__item:last-child { border-bottom: none; }
.adm-timeline__dot {
  width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
}
.adm-timeline__dot--start { background: var(--adm-info); }
.adm-timeline__dot--end   { background: var(--adm-danger); }
.adm-timeline__body { flex: 1; overflow: hidden; }
.adm-timeline__name { font-size: .875rem; font-weight: 600; color: var(--adm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-timeline__detail { font-size: .76rem; color: var(--adm-text-muted); margin-top: 1px; }
.adm-timeline__time {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .85rem; font-weight: 600;
  color: var(--adm-text-muted); flex-shrink: 0;
}

/* ---------------------------------------------------------------
   OUBLIS WIDGET
   --------------------------------------------------------------- */
.adm-missed-list { list-style: none; }
.adm-missed-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f0f2f7; font-size: .86rem;
}
.adm-missed-item:last-child { border-bottom: none; }
.adm-missed-item__warn { color: var(--adm-warning); flex-shrink: 0; }
.adm-missed-item__name { flex: 1; font-weight: 600; color: var(--adm-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-missed-item__date { color: var(--adm-text-muted); font-size: .76rem; flex-shrink: 0; }
.adm-missed-item__fix { color: var(--adm-accent); text-decoration: none; font-size: .76rem; font-weight: 600; flex-shrink: 0; }
.adm-missed-item__fix:hover { text-decoration: underline; }

/* ---------------------------------------------------------------
   PAGINATION
   --------------------------------------------------------------- */
.adm-pagination {
  display: flex; align-items: center; gap: 4px;
  padding: 16px 0 0; justify-content: center;
}
.adm-pagination a, .adm-pagination span {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; border-radius: 8px;
  font-size: .84rem; font-weight: 500;
  text-decoration: none; transition: background .15s, color .15s;
  color: var(--adm-text-muted);
}
.adm-pagination a:hover { background: var(--adm-bg); color: var(--adm-text); }
.adm-pagination .current { background: var(--adm-accent); color: var(--adm-acc-text); }
.adm-pagination .disabled { opacity: .3; pointer-events: none; }

/* ---------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------- */
@media (max-width: 1100px) {
  .adm-dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .adm-sidebar { transform: translateX(-100%); }
  .adm-sidebar.open { transform: translateX(0); }
  .adm-overlay { display: block; }
  .adm-wrap { margin-left: 0 !important; max-width:100%;}
  .adm-topbar__burger { display: flex; }
  .adm-main { padding: 20px 16px 16px; }
}

/* ── Onglets (profil, etc.) ─────────────────────────────────── */
.adm-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--adm-border);
  margin-bottom: 24px;
}
.adm-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: .875rem;
  font-weight: 500;
  color: var(--adm-text-muted, #64748b);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.adm-tab:hover { color: var(--adm-accent); background: var(--adm-bg-alt, #f8faff); }
.adm-tab.active {
  color: var(--adm-accent);
  border-bottom-color: var(--adm-accent);
  font-weight: 600;
}
.adm-tab-panel { display: none; }
.adm-tab-panel.active { display: block; }

/* ── Radio cards (OTP, etc.) ────────────────────────────────── */
.adm-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--adm-border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.adm-radio-card:hover { border-color: var(--adm-accent); }
.adm-radio-card--selected {
  border-color: var(--adm-accent);
  background: var(--adm-primary-light, #eff6ff);
}
.adm-radio-card input[type=radio] { margin-top: 3px; accent-color: var(--adm-accent); }
.adm-radio-card__icon {
  font-size: 1.2rem;
  color: var(--adm-accent);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.adm-radio-card strong { display: block; font-size: .9rem; margin-bottom: 2px; }
.adm-radio-card span { font-size: .78rem; color: var(--adm-text-muted, #64748b); }

/* ── Drag & Drop plages horaires ────────────────────────────── */
.period-row.drag-over {
  outline: 2px dashed var(--adm-accent);
  outline-offset: -2px;
  background: var(--adm-primary-light, #eff6ff);
}
.drag-handle:hover { color: var(--adm-accent); }

/* ================================================================
   RESPONSIVE MOBILE — patch29
   Corrections complètes pour < 900px et < 480px
   ================================================================ */

/* ── Utilitaires de layout adaptatif ──────────────────────────── */

/* Grille sidebar-droite : 1fr + colonne fixe → empilé sur mobile */
.adm-layout-sidebar {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* Grille sidebar-gauche : colonne fixe + 1fr → empilé sur mobile */
.adm-layout-sidebar-left {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

/* Grille 3 colonnes (settings) */
.adm-layout-3col {
  display: grid;
  grid-template-columns: 360px 1fr 300px;
  gap: 24px;
  align-items: start;
}

/* Scroll horizontal pour grilles trop larges (ex: plages horaires) */
.adm-scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Topbar mobile améliorée ──────────────────────────────────── */
/* Masquer horloge sur mobile */
@media (max-width: 900px) {
  .adm-topbar__clock { display: none; }
  .adm-topbar { padding: 0 14px; gap: 10px; }
  .adm-topbar__right { gap: 8px; }
  /* Nom complet dans le bouton profil → masqué sur petit écran */
  .adm-topbar__username { display: none; }
  /* Compacter le sélecteur de compagnie */
  #companyPickerBtn { max-width: 120px !important; font-size: .72rem !important; }
}

/* ── Main overflow ────────────────────────────────────────────── */
.adm-main {
  min-width: 0;
}

/* ── Grids adaptatifs sur mobile ──────────────────────────────── */
@media (max-width: 900px) {
  .adm-layout-sidebar,
  .adm-layout-sidebar-left,
  .adm-layout-3col {
    grid-template-columns: 1fr !important;
  }

  /* Tableaux : scroll horizontal dans leur conteneur */
  .adm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Stat cards : 2 colonnes égales sans minmax (évite le débordement) */
  .adm-stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .adm-stat-card {
    padding: 14px;
    gap: 10px;
    min-width: 0; /* empêche le card de forcer sa largeur minimale */
  }
  .adm-stat-card__value { font-size: 1.5rem; }
  .adm-stat-card__icon  { width: 36px; height: 36px; font-size: .9rem; flex-shrink: 0; }
  .adm-stat-card__label { font-size: .72rem; }

  /* Page header : boutons en bas */
  .adm-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .adm-page-header__actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Formulaires : une colonne */
  .adm-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard grid */
  .adm-dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  /* Main padding réduit */
  .adm-main { padding: 16px 14px 14px; }
  .adm-footer { padding: 10px 14px; }
}

@media (max-width: 480px) {
  /* Tableaux : texte plus petit */
  .adm-table { font-size: .78rem; }
  .adm-table th, .adm-table td { padding: 8px 10px; }

  /* Boutons sm encore plus compacts */
  .adm-btn--sm { padding: 4px 8px; font-size: .72rem; }

  /* Cacher les colonnes non essentielles dans certains tableaux */
  .adm-table .col-hide-mobile { display: none; }

  /* Breadcrumb simplifié */
  .adm-breadcrumb__link:not(:last-of-type) { display: none; }
  .adm-breadcrumb__sep { display: none; }
}

/* ── Grids inline critiques dans les vues — override par classe ─ */
/* Ces règles ciblent des éléments avec style inline via :is() fallback */
@media (max-width: 900px) {
  /* schedules index, messages, timesheets form : grilles 2 colonnes */
  [data-mobile-stack] {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
}

/* ── Tabs ─────────────────────────────────────── */
.adm-tabs{display:flex;gap:4px;border-bottom:2px solid var(--adm-border);margin-bottom:20px;flex-wrap:wrap}
.adm-tab{padding:9px 18px;border:none;background:none;cursor:pointer;font-family:inherit;font-size:.88rem;font-weight:600;color:var(--adm-text-muted);border-bottom:2px solid transparent;margin-bottom:-2px;border-radius:6px 6px 0 0;transition:color .15s,background .15s}
.adm-tab:hover{color:var(--adm-text);background:var(--adm-bg)}
.adm-tab.active{color:var(--adm-accent);border-bottom-color:var(--adm-accent)}
.adm-tab-panel{display:none}.adm-tab-panel.active{display:block}

/* ── Form layout ──────────────────────────────── */
.adm-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.adm-form-group{display:flex;flex-direction:column;gap:4px;margin-bottom:0}
.adm-form-group--full{grid-column:1/-1}
.adm-form-actions{display:flex;gap:10px;flex-wrap:wrap}
.adm-label{font-size:.82rem;font-weight:600;color:var(--adm-text)}
.adm-label .required{color:var(--adm-danger)}
.adm-hint{font-size:.74rem;color:var(--adm-text-muted);margin-top:2px}
.adm-input,.adm-select,.adm-textarea{width:100%;padding:9px 12px;border:1px solid var(--adm-border);border-radius:8px;font-size:.88rem;font-family:inherit;outline:none;background:#fff;color:var(--adm-text);transition:border-color .15s,box-shadow .15s}
.adm-input:focus,.adm-select:focus,.adm-textarea:focus{border-color:var(--adm-accent);box-shadow:0 0 0 3px rgba(37,99,235,.09)}
.adm-textarea{resize:vertical;min-height:90px}

/* ── Radio card ───────────────────────────────── */
.adm-radio-card{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border:2px solid var(--adm-border);border-radius:10px;cursor:pointer;transition:border-color .15s,background .15s}
.adm-radio-card:hover{border-color:var(--adm-accent)}
.adm-radio-card input[type=radio]{margin-top:3px;accent-color:var(--adm-accent)}
.adm-radio-card__icon{font-size:1.1rem;color:var(--adm-accent);margin-top:1px}
.adm-radio-card div{display:flex;flex-direction:column;gap:2px}
.adm-radio-card strong{font-size:.88rem;font-weight:600}
.adm-radio-card span{font-size:.76rem;color:var(--adm-text-muted)}

/* ── Stats / Dashboard ───────────────────────── */
.adm-stats-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px;margin-bottom:22px}
.adm-stat-card{display:flex;align-items:center;gap:14px;background:#fff;border:1px solid var(--adm-border);border-radius:12px;padding:16px 18px;text-decoration:none;color:inherit;transition:box-shadow .15s,transform .15s}
.adm-stat-card:hover{box-shadow:0 4px 18px rgba(0,0,0,.08);transform:translateY(-1px)}
.adm-stat-card__icon{width:42px;height:42px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:1.1rem;flex-shrink:0}
.adm-stat-card__icon--blue{background:#eff6ff;color:#2563eb}
.adm-stat-card__icon--green{background:#f0fdf4;color:#059669}
.adm-stat-card__icon--orange{background:#fff7ed;color:#d97706}
.adm-stat-card__icon--purple{background:#f5f3ff;color:#7c3aed}
.adm-stat-card__value{font-size:1.5rem;font-weight:700;line-height:1;font-family:'Barlow Condensed',sans-serif}
.adm-stat-card__label{font-size:.76rem;color:var(--adm-text-muted);margin-top:2px}
.adm-dashboard-grid{display:grid;grid-template-columns:1fr 280px;gap:20px;align-items:start}

/* ── Card ────────────────────────────────────── */
.adm-card{background:#fff;border:1px solid var(--adm-border);border-radius:12px;padding:20px 22px}
.adm-card__title{font-size:.82rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--adm-text-muted);margin-bottom:16px;display:flex;align-items:center;gap:7px}
.adm-card__title i{font-size:.95rem}

/* ── Table ───────────────────────────────────── */
.adm-table-wrap{overflow-x:auto}
.adm-table{width:100%;border-collapse:collapse;font-size:.86rem}
.adm-table th{padding:8px 12px;text-align:left;font-size:.73rem;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--adm-text-muted);border-bottom:2px solid var(--adm-border)}
.adm-table td{padding:10px 12px;border-bottom:1px solid #f0f2f7;vertical-align:middle}
.adm-table tbody tr:hover{background:#fafbff}

/* ── Badges ──────────────────────────────────── */
.adm-badge{display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:20px;font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.adm-badge--active{background:#f0fdf4;color:#166534}
.adm-badge--inactive{background:#f3f4f6;color:#6b7280}
.adm-badge--warning{background:#fff7ed;color:#c2410c}
.adm-badge--end{background:#fef2f2;color:#991b1b}
.adm-badge--start{background:#eff6ff;color:#1d4ed8}
.adm-badge--root{background:#fdf4ff;color:#7e22ce}
.adm-badge--admin{background:#eff6ff;color:#1d4ed8}
.adm-badge--user{background:#f0fdf4;color:#166534}

/* ── Buttons ─────────────────────────────────── */
.adm-btn{display:inline-flex;align-items:center;gap:7px;padding:9px 16px;border-radius:8px;font-size:.86rem;font-weight:600;font-family:inherit;border:none;cursor:pointer;text-decoration:none;transition:opacity .15s,background .15s;white-space:nowrap}
.adm-btn--primary{background:var(--adm-accent,#2563eb);color:#fff}.adm-btn--primary:hover{opacity:.88}
.adm-btn--secondary{background:#f0f2f7;color:var(--adm-text);border:1px solid var(--adm-border)}.adm-btn--secondary:hover{background:#e5e9f0}
.adm-btn--danger{background:#fee2e2;color:#dc2626;border:1px solid #fecaca}.adm-btn--danger:hover{background:#fecaca}
.adm-btn--sm{padding:5px 10px;font-size:.78rem}

/* ── Page header ─────────────────────────────── */
.adm-page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:22px;flex-wrap:wrap}
.adm-page-header__title{font-family:'Barlow Condensed',sans-serif;font-size:1.6rem;font-weight:700;line-height:1.1}
.adm-page-header__sub{font-size:.82rem;color:var(--adm-text-muted);margin-top:3px}
.adm-page-header__actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* ── Pagination ──────────────────────────────── */
.adm-pagination{display:flex;gap:4px;justify-content:center;margin-top:16px;padding-top:14px;border-top:1px solid var(--adm-border);flex-wrap:wrap}
.adm-pagination a,.adm-pagination span{display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:0 8px;border-radius:7px;font-size:.84rem;font-weight:600;text-decoration:none;border:1px solid var(--adm-border)}
.adm-pagination a{color:var(--adm-accent);background:#fff}.adm-pagination a:hover{background:#eff6ff}
.adm-pagination span.current{background:var(--adm-accent);color:#fff;border-color:var(--adm-accent)}

/* ── Flash messages ──────────────────────────── */
.adm-flash{padding:12px 16px;border-radius:9px;margin-bottom:18px;font-size:.88rem;display:flex;align-items:center;gap:10px}
.adm-flash--success{background:#f0fdf4;color:#166534;border:1px solid #bbf7d0}
.adm-flash--error{background:#fef2f2;color:#991b1b;border:1px solid #fecaca}
.adm-flash--info{background:#eff6ff;color:#1e40af;border:1px solid #bfdbfe}
.adm-flash--warning{background:#fff7ed;color:#c2410c;border:1px solid #fed7aa}

@media(max-width:768px){
  .adm-form-grid{grid-template-columns:1fr}
  .adm-dashboard-grid{grid-template-columns:1fr}
  [data-mobile-stack]{grid-template-columns:1fr!important}
}
