/* ============================================================
   FC GRIMISUAT — LA UNE
   Design system — Bleu club #3963a5 + Or #e8b830
   Mobile-first, dark mode natif, vanilla CSS
   ============================================================ */


/* ── Design Tokens — Mode clair ─────────────────────────────
   ──────────────────────────────────────────────────────────── */
:root {
  /* ── Brand ── */
  --blue:           #3963a5;
  --blue-light:     #4a77c0;
  --blue-dark:      #2b4f8c;
  --blue-deeper:    #1e3a6e;
  --blue-subtle:    #eaf0fb;

  --gold:           #e8b830;
  --gold-light:     #f0c940;
  --gold-dark:      #c49a1a;
  --gold-subtle:    #fdf7e3;

  /* ── Surfaces (light) ── */
  --bg-page:        #f0f4fa;
  --bg-surface:     #ffffff;
  --bg-surface-2:   #f5f8fd;
  --bg-surface-3:   #eaeff7;
  --border:         #cdd8ed;
  --border-subtle:  #e4ebf5;

  /* ── Textes (light) ── */
  --text-primary:   #0f1929;
  --text-secondary: #3d5070;
  --text-muted:     #8096b4;
  --text-inverse:   #ffffff;

  /* ── Sémantique ── */
  --color-success:       #16a34a;
  --color-success-bg:    #dcfce7;
  --color-warning:       #d97706;
  --color-warning-bg:    #fef3c7;
  --color-danger:        #dc2626;
  --color-danger-bg:     #fee2e2;
  --color-info:          var(--blue);
  --color-info-bg:       var(--blue-subtle);
  --color-reduction:     #7c3aed;
  --color-reduction-bg:  #ede9fe;

  /* ── Shadows ── */
  --shadow-sm:  0 1px 3px rgba(15,25,41,.08), 0 1px 2px rgba(15,25,41,.04);
  --shadow-md:  0 4px 16px rgba(15,25,41,.10), 0 2px 6px rgba(15,25,41,.06);
  --shadow-lg:  0 12px 36px rgba(15,25,41,.13), 0 4px 12px rgba(15,25,41,.08);
  --shadow-xl:  0 24px 56px rgba(15,25,41,.16);
  --shadow-blue:0 4px 20px rgba(57,99,165,.25);

  /* ── Radius ── */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* ── Spacing (4pt grid) ── */
  --space-1:  4px;   --space-2:  8px;   --space-3:  12px;
  --space-4:  16px;  --space-5:  20px;  --space-6:  24px;
  --space-8:  32px;  --space-10: 40px;  --space-12: 48px;

  /* ── Typography ── */
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Barlow Condensed', system-ui, sans-serif;

  /* ── Motion ── */
  --ease-out:  cubic-bezier(.16,1,.3,1);
  --ease-in:   cubic-bezier(.4,0,1,1);
  --t-fast:    120ms;
  --t-normal:  200ms;
  --t-slow:    300ms;

  /* ── Layout ── */
  --sidebar-width: 264px;
  --header-height: 64px;

  /* ── Z-index ── */
  --z-raised:  10;
  --z-sticky:  100;
  --z-overlay: 200;
  --z-modal:   300;
  --z-toast:   400;
}

/* ── Design Tokens — Dark mode ──────────────────────────────
   Inspiration : navy profond comme un stade la nuit
   ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --blue:           #5b84c4;
  --blue-light:     #7299d4;
  --blue-dark:      #3963a5;
  --blue-deeper:    #2b4f8c;
  --blue-subtle:    #0d1a33;

  --gold:           #f0c940;
  --gold-light:     #f5d458;
  --gold-dark:      #d4a820;
  --gold-subtle:    #1e1500;

  --bg-page:        #080d18;
  --bg-surface:     #0f1828;
  --bg-surface-2:   #162034;
  --bg-surface-3:   #1c283f;
  --border:         #1f3050;
  --border-subtle:  #162034;

  --text-primary:   #e2eaf8;
  --text-secondary: #7a96c0;
  --text-muted:     #3d5478;
  --text-inverse:   #080d18;

  --color-success:       #4ade80;
  --color-success-bg:    #052414;
  --color-warning:       #fbbf24;
  --color-warning-bg:    #1c1200;
  --color-danger:        #f87171;
  --color-danger-bg:     #1f0505;
  --color-info:          var(--blue);
  --color-info-bg:       var(--blue-subtle);
  --color-reduction:     #c084fc;
  --color-reduction-bg:  #130828;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 12px 36px rgba(0,0,0,.6);
  --shadow-xl:  0 24px 56px rgba(0,0,0,.7);
  --shadow-blue:0 4px 20px rgba(57,99,165,.4);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  transition: background var(--t-slow), color var(--t-slow);
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
a   { color: var(--blue); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--blue-light); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-family: var(--font-display); font-size: 2rem;   font-weight: 700; line-height: 1.15; letter-spacing: .01em; }
h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
h3 { font-size: 1.2rem;  font-weight: 600; line-height: 1.35; }
h4 { font-size: 1rem;    font-weight: 600; }
h5 { font-size: .9375rem;font-weight: 600; }
h6 { font-size: .875rem; font-weight: 600; }

.font-display { font-family: var(--font-display); }
.text-xs   { font-size: .75rem; }
.text-sm   { font-size: .875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }
.text-danger   { color: var(--color-danger); }
.text-blue     { color: var(--blue); }
.text-gold     { color: var(--gold); }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  width: 100%; max-width: 1200px;
  margin: 0 auto; padding: 0 var(--space-4);
}
@media (min-width:768px)  { .container { padding: 0 var(--space-6); } }
@media (min-width:1024px) { .container { padding: 0 var(--space-8); } }

/* ── PUBLIC HEADER ───────────────────────────────────────────── */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
}

.site-header .header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height); gap: var(--space-4);
}

.site-logo {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 700; letter-spacing: .03em;
  color: var(--text-primary); text-decoration: none;
}

.site-logo img { width: 38px; height: 38px; border-radius: var(--radius-sm); }

.logo-badge {
  background: var(--gold); color: #0f1929;
  font-size: .6rem; font-weight: 700;
  padding: 2px 7px; border-radius: var(--radius-full);
  letter-spacing: .06em; text-transform: uppercase;
  margin-left: var(--space-1);
}

.header-actions { display: flex; align-items: center; gap: var(--space-3); }

/* ── Dark mode toggle ────────────────────────────────────────── */
.theme-toggle {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  background: var(--bg-surface-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), border-color var(--t-fast);
  color: var(--text-secondary);
}
.theme-toggle:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ── ADMIN LAYOUT ────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100dvh; }

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed; top:0; left:0; bottom:0;
  overflow-y: auto; overflow-x: hidden;
  z-index: var(--z-sticky);
  transition: transform var(--t-slow) var(--ease-out);
  display: flex; flex-direction: column;
}

.sidebar-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700; letter-spacing: .02em;
  color: var(--text-primary); text-decoration: none; line-height: 1.2;
}

.sidebar-logo img { width: 34px; height: 34px; border-radius: var(--radius-sm); flex-shrink: 0; }

/* Sidebar accent bar top */
.admin-sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--gold) 100%);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 1;
}

.sidebar-nav { padding: var(--space-3) 0; flex: 1; }

.sidebar-section-label {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding: var(--space-4) var(--space-5) var(--space-2);
}

.sidebar-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px var(--space-5);
  color: var(--text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
  font-size: .9375rem; font-weight: 500;
  text-decoration: none; position: relative;
}

.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-link:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.sidebar-link.active {
  color: var(--blue);
  background: var(--blue-subtle);
  font-weight: 600;
}

[data-theme="dark"] .sidebar-link.active { background: var(--blue-subtle); }

.sidebar-link.active::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--space-3);
  flex-shrink: 0;
}

.sidebar-footer .user-info { flex: 1; min-width: 0; }
.sidebar-footer .user-name { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .user-role { font-size: .75rem; color: var(--text-muted); }

.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--blue); color: #fff;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8125rem; flex-shrink: 0;
}

/* Admin main */
.admin-main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Admin topbar */
.admin-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  padding: 0 var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
}

.admin-topbar .page-title { font-size: 1rem; font-weight: 600; }
.admin-topbar .topbar-actions { display: flex; align-items: center; gap: var(--space-3); }

/* Admin content */
.admin-content { padding: var(--space-6); flex: 1; }
@media (min-width:1024px) { .admin-content { padding: var(--space-8); } }

/* Mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: calc(var(--z-sticky) - 1);
  backdrop-filter: blur(3px);
}
.menu-toggle {
  display: none; width: 40px; height: 40px;
  border-radius: var(--radius-md); background: var(--bg-surface-3);
  border: 1px solid var(--border); align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.menu-toggle svg { width: 20px; height: 20px; }

@media (max-width:1023px) {
  .admin-main    { margin-left: 0; }
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .menu-toggle  { display: flex; }
  .admin-content { padding: var(--space-4); }
  .admin-topbar  { padding: 0 var(--space-4); }
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap;
}
.page-header h1 { font-size: 1.75rem; }
.page-header p  { color: var(--text-secondary); margin-top: var(--space-1); font-size: .9375rem; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
}

.card-title {
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: var(--space-2);
}
.card-title svg { width: 17px; height: 17px; color: var(--blue); }

.card-body   { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width:480px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width:1024px) { .stats-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width:1024px) { .stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex; align-items: flex-start; gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
  transform: translateY(-1px);
}

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: var(--blue-subtle); color: var(--blue); }
.stat-icon.gold   { background: var(--gold-subtle); color: var(--gold-dark); }
.stat-icon.red    { background: var(--color-danger-bg); color: var(--color-danger); }
.stat-icon.green  { background: var(--color-success-bg); color: var(--color-success); }
.stat-icon.purple { background: var(--color-reduction-bg); color: var(--color-reduction); }

[data-theme="dark"] .stat-icon.gold { color: var(--gold); }

.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: .8125rem; font-weight: 500; color: var(--text-secondary); margin-bottom: var(--space-1); }
.stat-value { font-size: 1.75rem; font-weight: 700; font-family: var(--font-display); color: var(--text-primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub   { font-size: .8125rem; color: var(--text-muted); margin-top: var(--space-1); }

/* ── Player cards (public) ───────────────────────────────────── */
.players-grid {
  display: grid; gap: var(--space-4); grid-template-columns: 1fr;
}
@media (min-width:480px)  { .players-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width:768px)  { .players-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width:1200px) { .players-grid { grid-template-columns: repeat(4, 1fr); } }

.player-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex; align-items: center; gap: var(--space-4);
  cursor: pointer; text-decoration: none; color: var(--text-primary);
  transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  box-shadow: var(--shadow-sm);
}

.player-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.player-avatar {
  width: 52px; height: 52px;
  background: var(--blue-subtle);
  border: 2px solid var(--blue);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.05rem; color: var(--blue);
  flex-shrink: 0; position: relative;
}

[data-theme="dark"] .player-avatar { background: var(--blue-subtle); color: var(--blue-light); border-color: var(--blue); }

.player-number {
  position: absolute; bottom: -4px; right: -4px;
  background: var(--blue); color: #fff;
  font-size: .625rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-surface);
}

.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-position { font-size: .8125rem; color: var(--text-muted); }

.player-balance { text-align: right; flex-shrink: 0; }
.player-balance .amount { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.player-balance .label  { font-size: .75rem; color: var(--text-muted); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-full);
  white-space: nowrap; line-height: 1.4;
}

.badge-success   { background: var(--color-success-bg);   color: var(--color-success); }
.badge-warning   { background: var(--color-warning-bg);   color: var(--color-warning); }
.badge-danger    { background: var(--color-danger-bg);    color: var(--color-danger); }
.badge-info      { background: var(--color-info-bg);      color: var(--blue); }
.badge-neutral   { background: var(--bg-surface-3);       color: var(--text-secondary); }
.badge-blue      { background: var(--blue-subtle);        color: var(--blue); }
.badge-gold      { background: var(--gold-subtle);        color: var(--gold-dark); }
.badge-reduction { background: var(--color-reduction-bg); color: var(--color-reduction); }

[data-theme="dark"] .badge-gold { color: var(--gold); }

.badge-dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; flex-shrink: 0; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
}

table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }

.data-table thead th {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-weight: 600; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .05em; padding: var(--space-3) var(--space-4);
  text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table thead th.sortable { cursor: pointer; user-select: none; transition: background var(--t-fast), color var(--t-fast); }
.data-table thead th.sortable:hover { background: var(--bg-surface-3); color: var(--text-primary); }

.data-table thead th .sort-icon {
  display: inline-flex; flex-direction: column; gap: 1px;
  margin-left: 6px; vertical-align: middle; opacity: .35;
}
.data-table thead th.sort-asc .sort-icon,
.data-table thead th.sort-desc .sort-icon { opacity: 1; color: var(--blue); }

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-fast);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-surface-2); }

.data-table tbody td { padding: var(--space-3) var(--space-4); vertical-align: middle; }

.data-table .amount-cell { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* Responsive table → cartes */
@media (max-width:767px) {
  .table-responsive thead { display: none; }
  .table-responsive tbody tr {
    display: block; border: 1px solid var(--border);
    border-radius: var(--radius-md); margin-bottom: var(--space-3);
    padding: var(--space-3); background: var(--bg-surface);
  }
  .table-responsive tbody td {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-2) 0; border: none;
  }
  .table-responsive tbody td::before {
    content: attr(data-label);
    font-weight: 600; font-size: .8125rem;
    color: var(--text-secondary); flex-shrink: 0; margin-right: var(--space-4);
  }
  .table-responsive tbody tr:hover { background: var(--bg-surface); }
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); padding: 9px var(--space-4);
  border-radius: var(--radius-md);
  font-size: .9rem; font-weight: 600; line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast);
  border: 1px solid transparent; text-decoration: none;
  white-space: nowrap; user-select: none; min-height: 40px;
}

.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.btn-primary:hover:not(:disabled) {
  background: var(--blue-light); border-color: var(--blue-light);
  box-shadow: var(--shadow-blue); color: #fff;
}

.btn-secondary {
  background: var(--bg-surface); color: var(--text-primary); border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-3); border-color: var(--blue);
}

.btn-danger {
  background: var(--color-danger); color: #fff; border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c; box-shadow: 0 4px 14px rgba(220,38,38,.3); color: #fff;
}

.btn-gold {
  background: var(--gold); color: #0f1929; border-color: var(--gold);
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-light); box-shadow: 0 4px 14px rgba(232,184,48,.35); color: #0f1929;
}

.btn-ghost {
  background: transparent; color: var(--text-secondary); border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-surface-3); color: var(--text-primary); }

.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); min-height: 36px; }
.btn-sm   { padding: 6px 12px; font-size: .8125rem; min-height: 32px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg   { padding: 12px 24px; font-size: 1rem; min-height: 48px; border-radius: var(--radius-lg); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block; font-weight: 600; font-size: .875rem;
  color: var(--text-primary); margin-bottom: var(--space-2);
}
.form-label .required { color: var(--color-danger); margin-left: 3px; }

.form-control {
  display: block; width: 100%;
  padding: 10px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: .9375rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 44px;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(57,99,165,.18);
}
.form-control:disabled {
  background: var(--bg-surface-3); color: var(--text-muted); cursor: not-allowed;
}
.form-control.is-error { border-color: var(--color-danger); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }

.form-error { font-size: .8125rem; color: var(--color-danger); margin-top: var(--space-1); display: flex; align-items: center; gap: var(--space-1); }
.form-hint  { font-size: .8125rem; color: var(--text-muted); margin-top: var(--space-1); }

.form-row { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width:600px) { .form-row.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width:600px) { .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); } }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%237a96c0' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.checkbox-group { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; user-select: none; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }

/* ── Player multi-selection ──────────────────────────────────── */
.players-selection-list {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; max-height: 320px; overflow-y: auto;
}

.player-select-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background var(--t-fast); user-select: none;
}
.player-select-item:last-child { border-bottom: none; }
.player-select-item:hover { background: var(--bg-surface-2); }
.player-select-item.selected { background: var(--blue-subtle); }
[data-theme="dark"] .player-select-item.selected { background: var(--blue-subtle); }

.player-select-item input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--blue);
  flex-shrink: 0; pointer-events: none;
}

.player-select-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--blue-subtle); color: var(--blue);
  font-family: var(--font-display); font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--blue); flex-shrink: 0;
}

.player-select-name { flex: 1; font-weight: 500; font-size: .9375rem; }
.player-select-num  { font-size: .8125rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.selection-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface-2);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  gap: var(--space-3); flex-wrap: wrap;
}

/* Recap box */
.recap-box {
  background: var(--blue-subtle);
  border: 1px solid rgba(57,99,165,.3);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-4);
}
[data-theme="dark"] .recap-box { border-color: rgba(91,132,196,.35); }

.recap-detail { color: var(--text-secondary); font-size: .9375rem; }
.recap-total  { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-normal);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 480px;
  max-height: calc(100dvh - 2 * var(--space-4));
  overflow-y: auto;
  transform: translateY(16px) scale(.98);
  transition: transform var(--t-normal) var(--ease-out);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.modal-title { font-size: 1.0625rem; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  background: var(--bg-surface-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: background var(--t-fast); flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body   { padding: var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }

/* ── Toasts ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--space-3);
  pointer-events: none; max-width: 380px;
  width: calc(100% - 2 * var(--space-6));
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: flex-start; gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transform: translateX(100%); opacity: 0;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t-slow);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; }

.toast.success { border-left-color: var(--color-success); }
.toast.error   { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.info    { border-left-color: var(--blue); }

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error   .toast-icon { color: var(--color-danger); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info    .toast-icon { color: var(--blue); }

.toast-message { flex: 1; font-size: .9rem; font-weight: 500; }
.toast-title   { font-weight: 700; margin-bottom: 2px; }
.toast-desc    { font-size: .8125rem; color: var(--text-secondary); }

/* ── Filters bar ─────────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap; margin-bottom: var(--space-5);
}
.filters-bar .form-control { max-width: 220px; min-height: 40px; padding: 8px var(--space-3); }

.search-input-wrapper {
  position: relative; flex: 1; min-width: 180px; max-width: 320px;
}
.search-input-wrapper svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.search-input-wrapper .form-control { padding-left: 34px; }

/* ── Actions cell ────────────────────────────────────────────── */
.actions-cell { display: flex; align-items: center; gap: var(--space-2); flex-wrap: nowrap; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto var(--space-4); opacity: .35; }
.empty-state h3  { font-size: 1.0625rem; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p   { font-size: .9rem; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  margin-bottom: var(--space-5); font-size: .9rem;
  display: flex; align-items: flex-start; gap: var(--space-2);
}
.alert-error   { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid rgba(220,38,38,.2); }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid rgba(22,163,74,.2); }
.alert-info    { background: var(--blue-subtle); color: var(--blue); border: 1px solid rgba(57,99,165,.25); }
.alert svg     { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); background: var(--bg-page);
  /* Subtle pitch pattern */
  background-image: radial-gradient(circle at 20% 80%, rgba(57,99,165,.06) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(232,184,48,.04) 0%, transparent 50%);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 400px;
  padding: var(--space-10) var(--space-8);
  position: relative; overflow: hidden;
}

/* Gold top accent */
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--gold) 100%);
}

.login-logo { text-align: center; margin-bottom: var(--space-8); }

.login-logo .logo-img {
  width: 72px; height: 72px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(57,99,165,.25);
}

.login-logo h1 { font-size: 1.75rem; letter-spacing: .02em; }
.login-logo p  { color: var(--text-secondary); font-size: .9rem; margin-top: var(--space-1); }

/* ── Dashboard top players ───────────────────────────────────── */
.top-players-list { display: flex; flex-direction: column; gap: var(--space-3); }

.top-player-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface-2); border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--t-fast);
}
.top-player-item:hover { border-color: var(--blue); }

.top-player-rank {
  width: 26px; height: 26px; border-radius: var(--radius-full);
  font-family: var(--font-display); font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.top-player-rank.gold   { background: var(--gold-subtle); color: var(--gold-dark); border: 1px solid var(--gold); }
.top-player-rank.silver { background: var(--bg-surface-3); color: var(--text-secondary); border: 1px solid var(--border); }
.top-player-rank.bronze { background: #fde8d8; color: #c05621; border: 1px solid #f5c0a0; }
[data-theme="dark"] .top-player-rank.gold { color: var(--gold); }

.top-player-info { flex: 1; min-width: 0; }
.top-player-name { font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-player-amount { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--color-danger); font-variant-numeric: tabular-nums; }

/* ── Collective grid ─────────────────────────────────────────── */
.collective-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width:768px) { .collective-grid { grid-template-columns: repeat(2, 1fr); } }

.collective-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-3);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.collective-item:hover { box-shadow: var(--shadow-md); border-color: var(--blue); }
.collective-item.reduction:hover { border-color: var(--color-reduction); }

.collective-item-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.collective-item-name   { font-weight: 600; font-size: .9375rem; flex: 1; }
.collective-item-amount { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.collective-item:not(.reduction) .collective-item-amount { color: var(--color-danger); }
.collective-item.reduction .collective-item-amount { color: var(--color-reduction); }

/* ── Player balance summary ──────────────────────────────────── */
.player-balance-summary {
  background: var(--bg-surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-4) var(--space-5);
  display: flex; align-items: center; gap: var(--space-5);
  flex-wrap: wrap; margin-bottom: var(--space-5);
}

.balance-item { text-align: center; }
.balance-item .label { font-size: .8125rem; color: var(--text-muted); }
.balance-item .value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Player detail hero ──────────────────────────────────────── */
.joueur-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  display: flex; align-items: center; gap: var(--space-6);
  flex-wrap: wrap; box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  position: relative; overflow: hidden;
}

/* Accent décoration top-left */
.joueur-hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--gold) 60%, transparent 100%);
}

.joueur-hero-avatar {
  width: 84px; height: 84px; border-radius: var(--radius-full);
  background: var(--blue-subtle);
  border: 3px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.8rem; font-weight: 700;
  color: var(--blue); flex-shrink: 0;
}
[data-theme="dark"] .joueur-hero-avatar { color: var(--blue-light); }

.joueur-hero-info h1 { font-size: 2rem; }
.joueur-hero-info p  { color: var(--text-secondary); }

.joueur-hero-stats { margin-left: auto; display: flex; gap: var(--space-6); flex-wrap: wrap; }

/* ── Grids ───────────────────────────────────────────────────── */
.grid-2 { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
@media (min-width:1024px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }

.grid-3 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width:768px)  { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width:1200px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ── Utility classes ─────────────────────────────────────────── */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.flex-wrap      { flex-wrap: wrap; }
.flex-1         { flex: 1; }
.min-w-0        { min-width: 0; }
.w-full         { width: 100%; }
.section        { margin-bottom: var(--space-8); }
.divider        { height: 1px; background: var(--border); margin: var(--space-5) 0; }
.mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); } .mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); }
.p-4  { padding: var(--space-4); } .p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.block       { display: block; }
.hidden      { display: none !important; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .admin-sidebar, .admin-topbar, .btn, .filters-bar { display: none !important; }
  .admin-main { margin-left: 0; }
}

/* ── Responsive adjustments ─────────────────────────────────── */
@media (max-width:767px) {
  h1 { font-size: 1.6rem; }
  .joueur-hero { flex-direction: column; text-align: center; }
  .joueur-hero-stats { margin-left: 0; justify-content: center; }
  .login-card { padding: var(--space-8) var(--space-6); }
}
