/* ============================================================
   SKY FITNESS — Backoffice
   Design system : noir / orange / blanc
   ============================================================ */

:root {
  /* Palette noire (sidebar, headers) */
  --black:      #0a0a0a;
  --ink-950:    #0c0d10;
  --ink-900:    #141518;
  --ink-800:    #1f2125;
  --ink-700:    #2a2c31;
  --ink-600:    #4a4d54;
  --ink-500:    #6b6e75;
  --ink-400:    #969aa2;
  --ink-300:    #c5c8cd;
  --ink-200:    #e3e5e8;
  --ink-150:    #ecedf0;
  --ink-100:    #f1f2f4;
  --ink-50:     #f7f8fa;

  /* Accent : orange Sky Fitness — énergique, sportif */
  --brand:      #ff5b1f;
  --brand-600:  #f24a0c;
  --brand-700:  #cc3d0a;
  --brand-100:  #ffe8df;
  --brand-50:   #fff5f0;

  /* Indicateurs */
  --success:    #16a34a;
  --success-50: #f0fdf4;
  --warning:    #d97706;
  --warning-50: #fffbeb;
  --danger:     #dc2626;
  --danger-50:  #fef2f2;
  --info:       #2563eb;
  --info-50:    #eff6ff;

  /* Layout */
  --sidebar-w:  244px;
  --topbar-h:   60px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;

  --shadow:       0 1px 3px rgba(15,15,18,.06), 0 4px 14px rgba(15,15,18,.04);
  --shadow-lg:    0 10px 30px rgba(15,15,18,.10);
  --ring:         0 0 0 3px rgba(255,91,31,.18);

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
button { cursor: pointer; font-family: inherit; border: 0; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
input:focus, textarea:focus, select:focus { outline: none; }
svg { flex-shrink: 0; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-muted { color: var(--ink-500); }
.text-brand { color: var(--brand); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

/* ============================================================
   LAYOUT GLOBAL
   ============================================================ */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--black);
  color: var(--ink-300);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   LOGO + BRAND
   ============================================================ */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-logo {
  width: 38px; height: 38px;
  background: var(--brand);
  border-radius: 8px;
  display: grid; place-items: center;
  color: white;
  position: relative;
}
.brand-logo::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 -10px 16px rgba(0,0,0,.18);
}
.brand-logo svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.brand-text { display: flex; flex-direction: column; gap: 0; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: white;
  line-height: 1;
}
.brand-sub {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-top: 5px;
}

/* ============================================================
   NAVIGATION SIDEBAR
   ============================================================ */

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-600);
  padding: 14px 10px 4px;
}
.nav-section:first-child { padding-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  border-radius: 7px;
  color: var(--ink-400);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: color .12s ease, background .12s ease;
  margin-bottom: 1px;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { color: white; background: rgba(255,255,255,.04); }
.nav-item.active {
  color: white;
  background: var(--ink-800);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.nav-pill {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-family: var(--font-mono);
}

/* User card (en bas de sidebar) */
.user-card {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  gap: 10px;
  align-items: center;
}
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { color: white; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-tel { font-family: var(--font-mono); color: var(--ink-500); font-size: 11px; }
.logout-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--ink-500);
}
.logout-btn:hover { background: rgba(255,255,255,.06); color: white; }
.logout-btn svg { width: 16px; height: 16px; }

/* ============================================================
   TOPBAR (barre du haut, fixe sous main)
   ============================================================ */

.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--ink-150);
  display: flex;
  align-items: center;
  padding: 0 26px;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search svg {
  position: absolute;
  left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-400);
}
.topbar-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  font-size: 13.5px;
  background: var(--ink-50);
  color: var(--ink-900);
}
.topbar-search input:focus {
  border-color: var(--brand);
  background: white;
  box-shadow: var(--ring);
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 0 14px;
  height: 38px;
  border: 1px solid var(--ink-150);
  border-radius: 8px;
  background: white;
}
.topbar-time .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .5; transform: scale(.8); }
}

/* ============================================================
   CONTENU PRINCIPAL
   ============================================================ */

.content {
  padding: 28px;
  flex: 1;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink-150);
}
.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.page-sub {
  font-size: 13.5px;
  color: var(--ink-500);
}
.page-actions { display: flex; gap: 8px; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  transition: all .12s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--ink-900);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--ink-800); }

.btn-brand {
  background: var(--brand);
  color: white;
}
.btn-brand:hover:not(:disabled) { background: var(--brand-600); box-shadow: 0 6px 18px -6px rgba(255,91,31,.5); }

.btn-ghost {
  background: white;
  color: var(--ink-800);
  border: 1px solid var(--ink-200);
}
.btn-ghost:hover:not(:disabled) { background: var(--ink-50); border-color: var(--ink-300); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--ink-500);
  background: transparent;
  transition: all .12s ease;
}
.icon-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */

.field { display: flex; flex-direction: column; gap: 7px; }
.label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
  letter-spacing: 0.01em;
}
.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: white;
  font-size: 14px;
  color: var(--ink-900);
  transition: all .12s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }

.field-hint { font-size: 11.5px; color: var(--ink-500); }
.field-error { font-size: 12px; color: var(--danger); }

.search-wrap { position: relative; }
.search-wrap > svg {
  position: absolute;
  left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-400);
  pointer-events: none;
}
.search-wrap .input { padding-left: 40px; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: white;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.005em;
}
.card-desc { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
.card-body { padding: 20px; }

/* ============================================================
   KPI TILES (stats principales)
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  background: white;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.kpi-icon {
  width: 28px; height: 28px;
  background: var(--ink-100);
  border-radius: 7px;
  color: var(--ink-700);
  display: grid; place-items: center;
}
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-icon.brand   { background: var(--brand-100); color: var(--brand); }
.kpi-icon.success { background: var(--success-50); color: var(--success); }
.kpi-icon.warning { background: var(--warning-50); color: var(--warning); }
.kpi-icon.danger  { background: var(--danger-50); color: var(--danger); }
.kpi-icon.info    { background: var(--info-50); color: var(--info); }

.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-value .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-500);
  margin-left: 4px;
}
.kpi-foot {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-500);
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
}
.kpi-trend.up   { color: var(--success); background: var(--success-50); }
.kpi-trend.down { color: var(--danger);  background: var(--danger-50); }
.kpi-trend.flat { color: var(--ink-500); background: var(--ink-100); }
.kpi-trend svg { width: 10px; height: 10px; }

.kpi-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 10px; margin-top: 10px; border-top: 1px dashed var(--ink-200); font-size: 12.5px; }
.kpi-row .lbl { color: var(--ink-500); }
.kpi-row .val { font-family: var(--font-mono); font-weight: 600; color: var(--ink-900); }

/* ============================================================
   BADGES
   ============================================================ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tag .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.success { background: var(--success-50); color: var(--success); }
.tag.warning { background: var(--warning-50); color: var(--warning); }
.tag.danger  { background: var(--danger-50); color: var(--danger); }
.tag.info    { background: var(--info-50); color: var(--info); }
.tag.brand   { background: var(--brand-100); color: var(--brand-700); }
.tag.neutral { background: var(--ink-100); color: var(--ink-700); }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table thead th {
  background: var(--ink-50);
  color: var(--ink-600);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ink-150);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-800);
  vertical-align: middle;
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--ink-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }

/* Tri sur les headers */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-600);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.th-sort:hover { color: var(--ink-900); }
.th-sort.is-active { color: var(--ink-900); }
.th-sort svg { width: 11px; height: 11px; opacity: 0.6; }
.th-sort.is-active svg { opacity: 1; color: var(--brand); }

/* Cellule "membre" : avatar + nom */
.cell-user {
  display: flex;
  gap: 11px;
  align-items: center;
}
.cell-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ink-800), var(--black));
  color: white;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.cell-user .info { min-width: 0; }
.cell-user .name { font-weight: 600; color: var(--ink-900); }
.cell-user .meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-500); }

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--ink-150);
  font-size: 13px;
  color: var(--ink-600);
  background: var(--ink-50);
}
.pagination {
  display: flex;
  gap: 4px;
}
.pagination a, .pagination span {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  border: 1px solid var(--ink-200);
  background: white;
}
.pagination a:hover { background: var(--ink-100); color: var(--ink-900); }
.pagination .current { background: var(--ink-900); color: white; border-color: var(--ink-900); }
.pagination .disabled { color: var(--ink-300); cursor: not-allowed; background: var(--ink-50); }

/* ============================================================
   FILTRES / TOOLBAR
   ============================================================ */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  background: white;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.toolbar .search-wrap { flex: 1; min-width: 250px; }
.toolbar .input,
.toolbar .select {
  height: 38px;
}
.toolbar .select {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6e75' stroke-width='2.5'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-600);
  background: transparent;
  transition: all .12s ease;
}
.tab-pill:hover { background: var(--ink-100); color: var(--ink-900); }
.tab-pill.active { background: var(--ink-900); color: white; }
.tab-pill .n {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}
.tab-pill:not(.active) .n { background: var(--ink-100); color: var(--ink-600); }

/* ============================================================
   GRID HELPERS
   ============================================================ */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.flex { display: flex; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }

/* ============================================================
   CHARTS
   ============================================================ */

.chart-wrap { position: relative; height: 280px; padding: 4px; }
.chart-wrap.tall { height: 340px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-500);
}
.empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  background: var(--ink-100);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-400);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { color: var(--ink-700); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 380px; margin: 0 auto; }

/* ============================================================
   DETAIL HEADER (fiche membre, etc.)
   ============================================================ */

.detail-hero {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 24px 26px;
  background: var(--ink-950);
  color: white;
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 90% 0%, rgba(255,91,31,.2), transparent 50%);
  pointer-events: none;
}
.detail-hero > * { position: relative; z-index: 1; }
.detail-avatar {
  width: 78px; height: 78px;
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 8px 24px -6px rgba(255,91,31,.5);
}
.detail-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--ink-400);
  font-size: 13px;
}
.detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.detail-meta svg { width: 13px; height: 13px; opacity: .8; }
.detail-meta .mono { color: var(--ink-300); }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }
.detail-actions .btn-ghost {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
  color: white;
}
.detail-actions .btn-ghost:hover { background: rgba(255,255,255,.12); }

/* ============================================================
   TABS (onglets internes)
   ============================================================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--ink-150);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s ease;
}
.tab:hover { color: var(--ink-900); }
.tab.active { color: var(--ink-900); border-bottom-color: var(--brand); }
.tab .n {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-left: 5px;
  color: var(--ink-400);
}
.tab.active .n { color: var(--brand); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   INFO GRID (fiche détail)
   ============================================================ */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 22px;
}
.info-item .label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 3px;
}
.info-item .value {
  font-size: 14px;
  color: var(--ink-900);
  font-weight: 500;
  word-break: break-word;
}

/* ============================================================
   SEGMENT CARDS (campagnes ciblées)
   ============================================================ */

.segment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}
.segment-card {
  background: white;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all .18s ease;
  cursor: pointer;
  position: relative;
}
.segment-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.segment-card .seg-icon {
  width: 40px; height: 40px;
  border-radius: 9px;
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.segment-card .seg-icon svg { width: 20px; height: 20px; }
.segment-card h3 {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.segment-card .desc {
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.5;
  min-height: 36px;
  margin-bottom: 12px;
}
.segment-card .seg-count {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.segment-card .seg-count small {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--ink-500);
  font-weight: 500;
  margin-left: 5px;
}
.segment-card .seg-action {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}

/* ============================================================
   HEATMAP
   ============================================================ */

.heatmap {
  display: grid;
  grid-template-columns: 60px repeat(24, 1fr);
  gap: 2px;
  font-family: var(--font-mono);
}
.heatmap .h-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--ink-100);
  display: grid; place-items: center;
  font-size: 9px;
  font-weight: 600;
  color: white;
  transition: transform .12s ease;
}
.heatmap .h-cell:hover {
  transform: scale(1.2);
  z-index: 1;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
.heatmap .h-label {
  font-size: 11px;
  color: var(--ink-500);
  text-align: right;
  padding-right: 8px;
  align-self: center;
}
.heatmap .h-header {
  font-size: 9.5px;
  color: var(--ink-400);
  text-align: center;
  padding-bottom: 3px;
}

/* ============================================================
   LOCK BANNER (envoi notif en cours)
   ============================================================ */

.lock-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(90deg, var(--warning-50), white);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.spin {
  width: 18px; height: 18px;
  border: 2.5px solid #fed7aa;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lock-meta { font-size: 12.5px; color: var(--warning); }
.btn-unlock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 6px;
  background: white;
  border: 1px solid #fed7aa;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-unlock:hover { background: var(--warning-50); }

/* ============================================================
   FORM CHOICES (cartes radio)
   ============================================================ */

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.target-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: all .14s ease;
  position: relative;
}
.target-option input { position: absolute; opacity: 0; pointer-events: none; }
.target-option:hover { border-color: var(--ink-400); }
.target-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-50);
}
.target-option:has(input:checked) .target-icon {
  background: var(--brand);
  color: white;
}
.target-icon {
  width: 40px; height: 40px;
  background: var(--ink-100);
  border-radius: 9px;
  display: grid; place-items: center;
  margin-bottom: 10px;
  color: var(--ink-700);
  transition: all .14s ease;
}
.target-icon svg { width: 20px; height: 20px; }
.target-name { font-size: 13.5px; font-weight: 700; color: var(--ink-900); margin-bottom: 2px; }
.target-desc { font-size: 11.5px; color: var(--ink-500); }

/* User picker (recherche utilisateurs notifications) */
.user-list {
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
  background: white;
}
.user-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--ink-500);
  font-size: 13px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink-100);
  cursor: pointer;
  transition: background .12s ease;
}
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: var(--ink-50); }
.user-row.selected { background: var(--brand-50); }
.user-row .avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--ink-800), var(--black));
  color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11.5px;
}
.user-row.selected .avatar {
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
}
.user-row .meta { flex: 1; min-width: 0; }
.user-row .name { font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.user-row .sub { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-500); }
.user-row .chk {
  width: 22px; height: 22px;
  border: 2px solid var(--ink-300);
  border-radius: 6px;
  display: grid; place-items: center;
  transition: all .12s ease;
}
.user-row.selected .chk {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.user-row .chk svg { width: 13px; height: 13px; opacity: 0; }
.user-row.selected .chk svg { opacity: 1; }

.selected-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: 8px;
  color: var(--brand-700);
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

/* ============================================================
   PROGRESS (envoi en cours)
   ============================================================ */

.progress-card {
  background: white;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 18px;
}
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.progress-head .label { font-weight: 600; color: var(--ink-900); font-size: 14px; }
.progress-head .count { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink-700); font-weight: 600; }
.progress-bar {
  height: 8px;
  background: var(--ink-100);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-600));
  transition: width .3s ease;
}
.progress-stats {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: var(--ink-600);
}
.progress-stats .ok { color: var(--success); font-weight: 700; }
.progress-stats .ko { color: var(--danger); font-weight: 700; }

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-100);
}
.feed-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.feed-pulse {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
.live-feed {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  animation: feedIn .25s ease;
  background: var(--ink-50);
}
@keyframes feedIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }
.feed-row.ok { color: var(--ink-700); }
.feed-row.ok .feed-icon { color: var(--success); }
.feed-row.ko .feed-icon { color: var(--danger); }
.feed-icon svg { width: 14px; height: 14px; }
.feed-name { font-weight: 600; color: var(--ink-900); }
.feed-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-400); margin-left: auto; }

/* ============================================================
   TOAST
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink-900);
  color: white;
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn .25s ease;
  max-width: 360px;
}
.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: var(--warning); color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--ink-50);
}

.login-art {
  position: relative;
  background: var(--ink-950);
  color: white;
  padding: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,91,31,.28), transparent 50%),
    radial-gradient(circle at 30% 80%, rgba(255,91,31,.12), transparent 50%);
  pointer-events: none;
}
.login-art > * { position: relative; z-index: 1; }
.login-art .brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}
.login-art .brand-block .brand-logo { width: 46px; height: 46px; border-radius: 10px; }
.login-art .brand-block .brand-logo svg { width: 26px; height: 26px; }
.login-art .brand-block .brand-name { font-size: 20px; }
.login-art .brand-block .brand-sub { font-size: 11px; }

.login-art .quote {
  max-width: 460px;
}
.login-art .quote h2 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}
.login-art .quote h2 em {
  color: var(--brand);
  font-style: normal;
}
.login-art .quote p {
  font-size: 15px;
  color: var(--ink-400);
  line-height: 1.6;
  margin-bottom: 26px;
}
.login-art .stats {
  display: flex;
  gap: 32px;
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.login-art .stat { display: flex; flex-direction: column; }
.login-art .stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: white; letter-spacing: -0.02em; }
.login-art .stat .v .unit { font-size: 14px; color: var(--ink-400); font-weight: 600; margin-left: 4px; }
.login-art .stat .l { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-500); }

.login-art .foot { font-size: 12px; color: var(--ink-500); }

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px;
}
.login-form {
  width: 100%;
  max-width: 380px;
}
.login-form h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  margin-bottom: 6px;
}
.login-form .sub {
  font-size: 14px;
  color: var(--ink-500);
  margin-bottom: 30px;
}
.login-form .field { margin-bottom: 14px; }
.login-form .input { height: 44px; font-size: 14.5px; }
.login-form .submit { width: 100%; height: 46px; font-size: 14.5px; margin-top: 8px; }
.login-form .err {
  background: var(--danger-50);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
  display: flex; gap: 8px; align-items: center;
}
.login-form .help {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-500);
  margin-top: 22px;
}

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 30px; min-height: 320px; }
  .login-art .stats { gap: 20px; }
  .login-form-wrap { padding: 30px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .sidebar { width: 64px; }
  .nav-item span, .brand-text, .user-meta, .nav-section, .nav-pill { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item.active::before { left: 0; }
  .brand { justify-content: center; padding: 16px 0; }
  .user-card { justify-content: center; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.06); }
  .user-card .logout-btn { display: none; }
}

@media (max-width: 768px) {
  .content { padding: 18px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .topbar { padding: 0 18px; gap: 12px; }
  .topbar-search { max-width: none; }
  .topbar-time { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
