/* ══════════════════════════════════════════════════════════════════════
   DIS21 Licence — Design System
   Mobile-first : base = mobile, media queries = desktop
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --bg:      #080e1c;
  --muted:   #8898b8;
  --text:    #e9eef8;
  --line:    rgba(255,255,255,.08);
  --accent:  #4f8cff;
  --accent2: #25c2a0;
  --purple:  #a78bfa;
  --orange:  #fb923c;
  --pink:    #f472b6;
  --danger:  #ff5c5c;
  --warning: #fbbf24;
  --shadow:  0 10px 40px rgba(0,0,0,.45);
  --radius:  14px;
  --pad:     14px;
  --font:    system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
  --cell:    rgba(8,12,24,.85);
  --rowHover:rgba(79,140,255,.10);
  --thead:   #0c1526;
  --nav-h:   56px;
  --grad-main: linear-gradient(135deg, #4f8cff, #a78bfa, #25c2a0);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 15%, rgba(79,140,255,.09), transparent),
    radial-gradient(ellipse 55% 45% at 85% 80%, rgba(167,139,250,.08), transparent),
    radial-gradient(ellipse 50% 60% at 70% 5%,  rgba(37,194,160,.06),  transparent),
    radial-gradient(ellipse 40% 35% at 30% 90%, rgba(251,146,60,.05),  transparent);
  animation: body-breathe 14s ease-in-out infinite alternate;
}
@keyframes body-breathe {
  from { background-position: 15% 15%, 85% 80%, 70% 5%, 30% 90%; }
  to   { background-position: 18% 12%, 82% 83%, 73% 8%, 27% 87%; }
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: .9; }

/* ── Container ────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  padding: 14px 12px;
}
@media (min-width: 600px) { .container { padding: 20px 20px; } }
@media (min-width: 900px) { .container { padding: 24px 28px; } }

/* ══════════════════════════════════════════════════════════════════════
   TOPBAR & NAV HAMBURGER
   ══════════════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  backdrop-filter: blur(16px);
  background: linear-gradient(90deg,
    rgba(8,14,28,.96) 0%,
    rgba(20,14,40,.92) 40%,
    rgba(8,24,28,.94) 100%);
  border-bottom: 1px solid transparent;
  box-shadow:
    0 1px 0 0 rgba(79,140,255,.25),
    0 2px 20px rgba(0,0,0,.4);
  position: relative;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    #4f8cff 20%,
    #a78bfa 50%,
    #25c2a0 80%,
    transparent 100%);
  opacity: .7;
  animation: topbar-shimmer 4s ease-in-out infinite alternate;
}
@keyframes topbar-shimmer {
  from { opacity: .5; background-position: 0%; }
  to   { opacity: .9; background-position: 100%; }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 14px;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--muted);
}

/* Bouton hamburger — visible seulement sur mobile */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu mobile : drawer sous la topbar */
.menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: rgba(10,15,28,.97);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px 16px;
  z-index: 199;
  backdrop-filter: blur(16px);
}
.menu.open { display: flex; }

.menu a {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-size: 15px;
  display: block;
}
.menu a.active {
  border-color: rgba(167,139,250,.4);
  background: linear-gradient(135deg, rgba(79,140,255,.18), rgba(167,139,250,.14));
  color: #fff;
}
.menu a.danger { border-color: rgba(255,92,92,.4); background: rgba(255,92,92,.10); color: #ff8080; }

/* Overlay fermeture menu */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-h);
  background: rgba(0,0,0,.5);
  z-index: 198;
}
.nav-open .nav-overlay { display: block; }

/* Desktop : menu horizontal classique */
@media (min-width: 820px) {
  .nav-toggle  { display: none; }
  .nav-overlay { display: none !important; }
  .menu {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    background: none;
    border: none;
    padding: 0;
    gap: 6px;
    backdrop-filter: none;
  }
  .menu a {
    padding: 7px 11px;
    font-size: 13px;
    display: inline-block;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════════════════════════════════════ */
h1 {
  margin: 16px 0 14px;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(120deg, #e9eef8 0%, #c7d8ff 50%, #a5f3e8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
h2 { margin: 0 0 14px; font-size: 16px; color: #c7d8ff; }
.muted { color: var(--muted); }

@media (min-width: 600px) {
  h1 { font-size: 26px; }
  h2 { font-size: 18px; }
}

/* ══════════════════════════════════════════════════════════════════════
   GRID & CARDS
   ══════════════════════════════════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) { .grid { gap: 14px; } }
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(12, 1fr); gap: 16px; }
  .span-4  { grid-column: span 4; }
  .span-6  { grid-column: span 6; }
  .span-8  { grid-column: span 8; }
  .span-12 { grid-column: span 12; }
}

.card {
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
  padding: var(--pad);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
}

/* ══════════════════════════════════════════════════════════════════════
   KPI
   ══════════════════════════════════════════════════════════════════════ */
.kpi { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; }
.kpi .label { font-size: 13px; color: var(--muted); }
@media (min-width: 600px) { .kpi .value { font-size: 28px; } }

/* ══════════════════════════════════════════════════════════════════════
   TABLES — scroll horizontal sur mobile, tableau plein sur desktop
   ══════════════════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  /* Indique visuellement qu'on peut scroller */
}
/* Indicateur de scroll sur mobile */
@media (max-width: 599px) {
  .table-wrap::after {
    content: '';
    display: block;
    height: 0;
  }
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  /* Laisse le contenu dicter la largeur sur mobile */
}

.table th, .table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  white-space: nowrap;
}
@media (min-width: 600px) {
  .table th, .table td { padding: 10px 12px; font-size: 14px; }
}

.table td { background: var(--cell); background-clip: padding-box; }
.table tr:nth-child(even) td { background: rgba(10,14,25,.70); }
.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--thead);
  position: relative;
  z-index: 1;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--rowHover); }
.table th:first-child, .table td:first-child {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Conserver la structure table (pas de reflow en blocs) */
.table thead { display: table-header-group !important; }
.table tbody { display: table-row-group !important; }
.table tr    { display: table-row !important; }
.table th    { display: table-cell !important; }
.table td    { display: table-cell !important; }
.table td::before { content: none !important; display: none !important; }

/* Dashboard : pas de scroll horizontal */
body.page-index .table-wrap { overflow-x: hidden; }
body.page-index .table {
  min-width: 0 !important;
  table-layout: auto !important;
}
body.page-index .table th, body.page-index .table td { white-space: normal; font-size: 12px; }
body.page-index .table th:first-child, body.page-index .table td:first-child {
  max-width: none; overflow: visible; text-overflow: clip;
}
@media (min-width: 600px) {
  body.page-index .table th, body.page-index .table td { font-size: 13px; }
}

/* ══════════════════════════════════════════════════════════════════════
   PILLS
   ══════════════════════════════════════════════════════════════════════ */
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  white-space: nowrap;
}
.pill.ok   { border-color: rgba(37,194,160,.6);  background: linear-gradient(135deg,rgba(37,194,160,.2),rgba(37,194,160,.08));  color: #34d9b3; }
.pill.warn { border-color: rgba(251,191,36,.6);  background: linear-gradient(135deg,rgba(251,191,36,.2),rgba(251,191,36,.08));  color: #fcd34d; }
.pill.bad  { border-color: rgba(255,92,92,.6);   background: linear-gradient(135deg,rgba(255,92,92,.2),rgba(251,146,60,.08));   color: #ff8080; }

/* ══════════════════════════════════════════════════════════════════════
   BUTTONS — cibles tactiles ≥ 44px
   ══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn.primary {
  border-color: rgba(79,140,255,.5);
  background: linear-gradient(135deg, rgba(79,140,255,.35), rgba(167,139,250,.25));
  color: #fff;
}
.btn.success {
  border-color: rgba(37,194,160,.5);
  background: linear-gradient(135deg, rgba(37,194,160,.3), rgba(37,194,160,.15));
}
.btn.danger {
  border-color: rgba(255,92,92,.5);
  background: linear-gradient(135deg, rgba(255,92,92,.25), rgba(251,146,60,.15));
}
.btn:hover  { filter: brightness(1.15); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.btn:active { transform: translateY(0); filter: brightness(.95); }
@media (min-width: 600px) {
  .btn { min-height: 38px; padding: 8px 14px; }
}

/* ══════════════════════════════════════════════════════════════════════
   FORMS — inputs larges sur mobile
   ══════════════════════════════════════════════════════════════════════ */
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px; /* évite le zoom iOS sur focus */
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }

/* form-row : 1 col sur mobile, 2 col sur desktop */
.form-row { display: grid; gap: 14px; }
@media (min-width: 600px) { .form-row { grid-template-columns: 1fr 1fr; } }

select option { background: #0a0f1d; color: #e9eef8; }
select option:checked, select option:hover { background: #18325f; color: #fff; }

/* ══════════════════════════════════════════════════════════════════════
   NOTICES
   ══════════════════════════════════════════════════════════════════════ */
.notice {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  font-size: 14px;
}
.notice.ok  { border-color: rgba(37,194,160,.6);  background: rgba(37,194,160,.15); }
.notice.bad { border-color: rgba(255,92,92,.6);   background: rgba(255,92,92,.15); }

/* ══════════════════════════════════════════════════════════════════════
   MODAL — plein écran sur mobile, centré sur desktop
   ══════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.78);
  display: none;
  align-items: flex-end; /* sheet du bas sur mobile */
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255,255,255,.10);
  border-bottom: none;
  background: #0a0f1d;
  box-shadow: 0 -20px 60px rgba(0,0,0,.7);
  padding: 20px 16px 32px;
}
/* Poignée visuelle */
.modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* Desktop : modal centré classique */
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal {
    width: min(820px, 96vw);
    max-height: 90vh;
    border-radius: 16px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    padding: 20px;
  }
  .modal::before {
    display: none; /* pas de poignée sur desktop */
  }
  /* Ligne décorative desktop */
  .modal::after {
    content: '';
    display: block;
    order: -1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(79,140,255,.35), transparent);
    margin: -20px -20px 14px;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 16px;
}
/* Sur mobile : boutons pleine largeur */
@media (max-width: 599px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}
.modal input, .modal select { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
.modal input:focus, .modal select:focus { border-color: rgba(79,140,255,.6); }

/* ══════════════════════════════════════════════════════════════════════
   SUBNAV
   ══════════════════════════════════════════════════════════════════════ */
.subnav {
  display: flex;
  gap: 8px;
  margin: 10px 0 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: inherit;
  border: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
  font-size: 13px;
  flex-shrink: 0;
}
.subnav a.active {
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.03);
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.35);
}

/* ══════════════════════════════════════════════════════════════════════
   POOLS PAGE
   ══════════════════════════════════════════════════════════════════════ */
.pools-kpis {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(79,140,255,.07), rgba(37,194,160,.04));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.pkpi { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.pkpi + .pkpi { border-left: 1px solid rgba(255,255,255,.07); padding-left: 12px; }
.pkpi-val { font-size: 24px; font-weight: 800; line-height: 1; }
.pkpi-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.pkpi-bar { flex: 1 1 100%; min-width: 100%; align-items: flex-start; border-left: none !important; padding-left: 0 !important; border-top: 1px solid rgba(255,255,255,.07); padding-top: 10px; margin-top: 4px; }
.pkpi-btn { width: 100%; margin-top: 4px; }
@media (min-width: 600px) {
  .pkpi-val   { font-size: 28px; }
  .pkpi-bar   { flex: 1 1 180px; min-width: 180px; border-top: none; border-left: 1px solid rgba(255,255,255,.07) !important; padding-left: 14px !important; padding-top: 0; margin-top: 0; }
  .pkpi-btn   { width: auto; margin-top: 0; margin-left: auto; }
}
.global-bar-track { width: 100%; height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.global-bar-fill  { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .6s ease; }

.pools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 500px) { .pools-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.pool-card {
  background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .2s, box-shadow .2s;
}
@media (hover: hover) {
  .pool-card:hover { border-color: rgba(79,140,255,.35); box-shadow: 0 10px 36px rgba(0,0,0,.45); transform: translateY(-2px); }
  .pool-card.pool-full:hover { border-color: rgba(255,92,92,.45); }
}
.pool-card.pool-full { border-color: rgba(255,92,92,.2); }
.pool-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pool-name { font-weight: 700; font-size: 14px; line-height: 1.3; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-email { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: -4px; }
.pool-bar-wrap  { display: flex; align-items: center; gap: 10px; }
.pool-bar-track { flex: 1; height: 7px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.pool-bar-fill  { height: 100%; border-radius: 999px; transition: width .5s ease; }
.bar-ok     { background: linear-gradient(90deg, #25c2a0, #4f8cff); }
.bar-warn   { background: linear-gradient(90deg, #ffcc66, #ff9f43); }
.bar-danger { background: linear-gradient(90deg, #ff5c5c, #c0392b); }
.pool-bar-pct { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 34px; text-align: right; }
.pool-counts { display: flex; align-items: center; background: rgba(0,0,0,.25); border-radius: 10px; padding: 10px 12px; }
.pool-count { flex: 1; text-align: center; }
.pool-count-val { font-size: 20px; font-weight: 800; line-height: 1; }
.pool-count-val.used     { color: var(--warning); }
.pool-count-val.free     { color: var(--accent2); }
.pool-count-val.expiring { color: var(--danger); }
.pool-count-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.pool-count-sep { width: 1px; height: 28px; background: rgba(255,255,255,.08); flex-shrink: 0; }
.pool-actions { display: flex; gap: 8px; }
.pool-actions .btn { flex: 1; text-align: center; font-size: 13px; padding: 9px 8px; }

/* ══════════════════════════════════════════════════════════════════════
   ANTIVIRUS DUES PAGE
   ══════════════════════════════════════════════════════════════════════ */
.av-period-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(79,140,255,.06), rgba(37,194,160,.04));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.av-nav-btn { font-size: 18px; padding: 8px 14px !important; font-weight: 700; line-height: 1; min-height: 44px; }
.av-period-center { text-align: center; min-width: 110px; }
.av-month-name { font-size: 20px; font-weight: 800; line-height: 1; }
.av-year-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.av-jump-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; }
.av-jump-form input[type=number] { width: 72px; flex-shrink: 0; }
.av-jump-form select { flex: 1; min-width: 120px; }
@media (min-width: 600px) {
  .av-jump-form { width: auto; margin-left: auto; }
}

.av-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
@media (min-width: 700px) {
  .av-kpi-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .av-kpi-pools { grid-column: span 2; }
}
.av-kpi-card {
  background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.av-kpi-primary {
  align-items: center; text-align: center;
  border-color: rgba(79,140,255,.25);
  background: linear-gradient(160deg, rgba(79,140,255,.10), rgba(79,140,255,.04));
}
.av-kpi-money {
  align-items: center; text-align: center;
  border-color: rgba(37,194,160,.2);
  background: linear-gradient(160deg, rgba(37,194,160,.08), rgba(37,194,160,.03));
}
.av-kpi-icon { font-size: 22px; margin-bottom: 6px; }
.av-kpi-big  { font-size: 28px; font-weight: 900; line-height: 1; }
.av-kpi-lbl  { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 5px; }
.av-partial  { font-size: 10px; color: var(--warning); text-transform: none; letter-spacing: 0; }
.av-kpi-urgences { border-color: rgba(255,92,92,.15); }
.av-urg-rows { display: flex; flex-direction: column; gap: 8px; }
.av-urg-row  { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.av-urg-count { font-size: 18px; font-weight: 800; }
.av-pool-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.av-pool-name { font-size: 12px; color: var(--muted); width: 160px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-pool-bar-track { flex: 1; height: 6px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.av-pool-bar-fill  { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .4s ease; }
.av-pool-cnt { font-size: 13px; font-weight: 700; min-width: 22px; text-align: right; }
.av-week-chart { display: flex; gap: 6px; align-items: flex-end; height: 64px; }
.av-week-col  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; }
.av-week-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.av-week-bar  { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--accent), rgba(79,140,255,.35)); transition: height .4s ease; }
.av-week-lbl  { font-size: 10px; color: var(--muted); }
.av-week-num  { font-size: 11px; font-weight: 700; min-height: 14px; }
.av-table-card { padding: 0; overflow: hidden; }
.av-table-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.av-table-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.av-row.urg-overdue td { background: rgba(255,92,92,.09) !important; }
.av-row.urg-hot td     { background: rgba(255,92,92,.05) !important; }
.av-row.urg-warn td    { background: rgba(255,204,102,.04) !important; }
.av-urgency-pill { min-width: 64px; text-align: center; font-weight: 700; }
.av-date-cell { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.av-client    { font-weight: 600; }
.av-pack-pill { font-size: 11px; }
.av-device    { font-size: 13px; }
.av-price     { white-space: nowrap; }
.av-renew-btn { font-size: 13px; padding: 7px 10px !important; white-space: nowrap; min-height: 38px !important; }

/* ══════════════════════════════════════════════════════════════════════
   SUBSCRIPTIONS — toolbar + table
   ══════════════════════════════════════════════════════════════════════ */
.subs-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.subs-toolbar select { width: auto; min-width: 130px; flex-shrink: 0; font-size: 14px; }
.subs-search { position: relative; flex: 1; min-width: 160px; }
.subs-search input { width: 100%; }
.subs-notes { max-width: 200px; white-space: normal; font-size: 13px; color: var(--muted); line-height: 1.4; }
.row-actions { display: flex; gap: 5px; justify-content: center; align-items: center; }
.icon-btn { padding: 7px 10px !important; font-size: 13px !important; line-height: 1 !important; min-width: 0 !important; min-height: 38px !important; }

/* ══════════════════════════════════════════════════════════════════════
   ASSIGNMENTS — search bar
   ══════════════════════════════════════════════════════════════════════ */
.searchbar { margin: 8px 0 14px; }
.searchrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.searchrow .input { flex: 1; min-width: 180px; }
.thlink { color: inherit; text-decoration: none; }
.thlink:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════
   IMPORT CSV
   ══════════════════════════════════════════════════════════════════════ */
body.page-import .container { max-width: 1400px; }

/* ══════════════════════════════════════════════════════════════════════
   SCROLLBAR globale (desktop WebKit)
   ══════════════════════════════════════════════════════════════════════ */
@media (min-width: 820px) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
}


/* ══════════════════════════════════════════════════════════════════════
   MOBILE NAV — recherche dans le tiroir + ajustements
   ══════════════════════════════════════════════════════════════════════ */

/* Barre de recherche desktop : cachée sous 820px */
@media (max-width: 819px) {
  .nav-search-form { display: none !important; }
}

/* Recherche dans le menu mobile */
.nav-search-mobile {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.nav-search-mobile input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  min-height: 44px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.nav-search-mobile input::placeholder { color: var(--muted); }
.nav-search-mobile button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 14px;
  font-size: 16px;
  min-height: 44px;
}
/* Cachée dans le menu desktop */
@media (min-width: 820px) {
  .nav-search-mobile { display: none; }
}

/* ── Barre de recherche desktop : style ──────────────────────────────── */
.nav-search-form {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  max-width: 260px;
}
.nav-search-form input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-height: unset;
}
.nav-search-form input::placeholder { color: var(--muted); }
.nav-search-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 14px;
}
.nav-search-btn:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════
   MOBILE — barre d'actions en masse (bulk bar)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 599px) {
  #bulkBar {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  #bulkBar > div[style*="flex:1"] { display: none; }
  #bulkBar select,
  #bulkBar button,
  #bulkBar label { font-size: 13px !important; }
  #bulkBar button { flex: 1; min-width: 140px; }
  .bulk-bar { flex-wrap: wrap !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE — toolbar filtres (subscriptions, assignments)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 599px) {
  .subs-toolbar select,
  .subs-toolbar .btn,
  .searchrow select,
  .searchrow .btn { font-size: 14px; min-height: 44px; }
  .subs-toolbar { gap: 8px; }
  .subs-search { max-width: 100%; }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE — pagination
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 599px) {
  .pagination { gap: 4px; }
  .page-btn { min-width: 38px; height: 38px; font-size: 13px; }
  .page-info { width: 100%; text-align: center; margin-left: 0; margin-top: 4px; }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE — finance forecast KPI cards
   ══════════════════════════════════════════════════════════════════════ */
.big { font-size: 28px; font-weight: 800; line-height: 1; }
@media (max-width: 599px) {
  .big { font-size: 22px; }
}

/* ══════════════════════════════════════════════════════════════════════
   AJAX SEARCH DROPDOWN
   ══════════════════════════════════════════════════════════════════════ */
.nav-search-wrap { position: relative; flex: 1; max-width: 300px; }
@media (max-width: 819px) {
  .nav-search-wrap#searchWrapDesktop { display: none !important; }
  .nav-search-wrap#searchWrapMobile  { max-width: 100%; width: 100%; }
}
@media (min-width: 820px) {
  .nav-search-wrap#searchWrapMobile { display: none; }
}

.search-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: #0d1424;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  z-index: 500;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 819px) {
  .search-drop { position: static; border-radius: 10px; margin-top: 4px; min-width: 0; }
}

.sd-group-label {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,.06);
}
.sd-group-label:first-child { border-top: none; }

.sd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--text);
  transition: background .12s;
  cursor: pointer;
  border-radius: 0;
}
.sd-item:hover, .sd-item--focus {
  background: rgba(79,140,255,.12);
}

.sd-item-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sd-item-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 1px;
}
.sd-item-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-item-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-item-date {
  font-size: 11px;
  flex-shrink: 0;
}

.sd-footer {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.07);
  text-decoration: none;
  transition: background .12s;
}
.sd-footer:hover { background: rgba(79,140,255,.08); }

.sd-empty {
  padding: 18px 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.sd-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
}
.sd-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Barre de recherche desktop */
.nav-search-form {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}
.nav-search-form input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-height: unset;
}
.nav-search-form input::placeholder { color: var(--muted); }
.nav-search-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px 10px; font-size: 14px; }
.nav-search-btn:hover { color: var(--accent); }

/* Recherche dans le tiroir mobile */
.nav-search-mobile {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}
.nav-search-mobile input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  min-height: 44px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.nav-search-mobile input::placeholder { color: var(--muted); }
.nav-search-mobile button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 10px 14px; font-size: 16px; min-height: 44px; }

/* ══════════════════════════════════════════════════════════════════════
   KLARIO UI KIT 2026 — composants additifs (préfixe .k-)
   Ajouté pour harmoniser les modules. Ne touche pas aux classes existantes.
   ══════════════════════════════════════════════════════════════════════ */

/* ─── Accessibilité : focus clavier visible partout ─── */
:focus-visible {
  outline: 2px solid var(--primary, #1d4ed8);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Pas d'outline disgracieux sur clic souris (uniquement clavier) */
:focus:not(:focus-visible) { outline: none; }

/* ─── Micro-interactions : transition douce sur éléments interactifs ─── */
button, a.btn, .k-btn, .doc-card, .hub-card, .sb-item {
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
button:active, .k-btn:active { transform: translateY(1px); }

/* ─── État vide unifié (.k-empty) ─── */
.k-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted, #64748b);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
}
.k-empty-icon { font-size: 46px; line-height: 1; opacity: .55; margin-bottom: 12px; }
.k-empty-title { font-size: 15px; font-weight: 700; color: var(--text-secondary); margin: 0 0 4px; }
.k-empty-text { font-size: 13px; line-height: 1.5; margin: 0; }
.k-empty-cta {
  display: inline-block; margin-top: 16px;
  background: var(--primary); color: var(--primary-fg);
  padding: 9px 18px; border-radius: 8px; text-decoration: none;
  font-weight: 600; font-size: 13px;
}
.k-empty-cta:hover { background: var(--primary-hover); }

/* ─── Skeleton de chargement (.k-skeleton) ─── */
.k-skeleton {
  position: relative; overflow: hidden;
  background: var(--bg-muted, rgba(255,255,255,.05));
  border-radius: 6px;
}
.k-skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  transform: translateX(-100%);
  animation: k-shimmer 1.3s infinite;
}
@keyframes k-shimmer { to { transform: translateX(100%); } }
.k-skeleton-line { height: 12px; margin: 8px 0; }
.k-skeleton-line.w60 { width: 60%; }
.k-skeleton-line.w40 { width: 40%; }
.k-skeleton-line.w80 { width: 80%; }

/* ─── Badge de statut générique (.k-badge) — couleur via --k-c ─── */
.k-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.5;
  background: color-mix(in srgb, var(--k-c, var(--primary)) 18%, transparent);
  color: var(--k-c, var(--primary));
  border: 1px solid color-mix(in srgb, var(--k-c, var(--primary)) 45%, transparent);
}
.k-badge.dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--k-c, var(--primary)); flex-shrink: 0;
}
/* Variantes sémantiques */
.k-badge.is-success { --k-c: var(--success); }
.k-badge.is-warning { --k-c: var(--warning); }
.k-badge.is-danger  { --k-c: var(--danger); }
.k-badge.is-info    { --k-c: var(--info); }
.k-badge.is-muted   { --k-c: var(--text-muted); }

/* ─── Tableaux responsive : bascule en cartes sur mobile (.k-table) ─── */
.k-table { width: 100%; border-collapse: collapse; }
.k-table th, .k-table td { padding: 10px 12px; text-align: left; }
.k-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.k-table tbody tr { border-bottom: 1px solid var(--border); }
@media (max-width: 640px) {
  .k-table thead { display: none; }
  .k-table, .k-table tbody, .k-table tr, .k-table td { display: block; width: 100%; }
  .k-table tr {
    margin-bottom: 12px; border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 12px; background: var(--bg-card);
  }
  .k-table td {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 6px 0; border: 0; text-align: right;
  }
  .k-table td::before {
    content: attr(data-label); font-weight: 600; color: var(--text-muted);
    font-size: 12px; text-align: left; flex-shrink: 0;
  }
}

/* ─── Formulaires (.k-field / .k-label / .k-input…) ─── */
.k-form-grid { display: grid; gap: 10px; }
.k-form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.k-form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) {
  .k-form-grid.cols-2, .k-form-grid.cols-3 { grid-template-columns: 1fr; }
}
.k-field { margin-bottom: 10px; }
.k-label {
  display: block; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 600; margin-bottom: 4px;
}
.k-input, .k-select, .k-textarea {
  width: 100%; padding: 8px 11px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text); font-size: 14px; font-family: inherit;
}
.k-input::placeholder, .k-textarea::placeholder { color: var(--text-subtle); }
.k-textarea { resize: vertical; min-height: 60px; }
.k-input:focus, .k-select:focus, .k-textarea:focus {
  border-color: var(--primary); outline: none;
}
.k-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }

/* ─── Boutons d'action génériques (couleur via --k-c) ─── */
.k-btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 0; padding: 9px 18px; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 13px; text-decoration: none; line-height: 1.2;
  background: var(--k-c, var(--primary)); color: #fff;
}
.k-btn:hover { filter: brightness(1.08); }
.k-btn.ghost {
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--border);
}
.k-btn.ghost:hover { background: var(--bg-card-hover); filter: none; }
.k-btn.danger { --k-c: var(--danger); }
.k-btn.success { --k-c: var(--success); }
