/* ============================================================
   Portail Adhérents — Running Montmeyran
   Design system : Bleu #2C6EA8 + Orange #FF5C1B — Montserrat
   Back-office moderne, accessible, responsive.
   ============================================================ */

:root {
  /* Marque */
  --blue:        #2C6EA8;
  --blue-dark:   #1d4f7a;
  --blue-light:  #4a8ec7;
  --blue-faint:  #e8f1f9;
  --orange:      #FF5C1B;
  --orange-dark: #d94a12;
  --orange-faint:#fff2ec;

  /* Neutres */
  --sidebar:     #0b1c30;
  --sidebar-2:   #0e2440;
  --bg:          #f4f6fa;
  --white:       #ffffff;
  --text:        #0b1c30;
  --text-light:  #64748b;
  --text-faint:  #94a3b8;
  --border:      #e2e8f0;
  --border-soft: #eef2f7;

  /* Sémantique */
  --green:       #16a34a;
  --green-faint: #f0fdf4;
  --red:         #dc2626;
  --red-faint:   #fef2f2;
  --amber:       #d97706;
  --amber-faint: #fffbeb;
  --violet:      #7c3aed;
  --violet-faint:#f5f3ff;
  --pink:        #db2777;
  --pink-faint:  #fdf2f8;

  --sidebar-w:   248px;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 2px rgba(11,28,48,.06);
  --shadow:      0 2px 10px rgba(11,28,48,.07);
  --shadow-md:   0 8px 28px rgba(11,28,48,.10);
  --shadow-lg:   0 20px 60px rgba(11,28,48,.18);
  --font:        'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
ul { list-style: none; }
:focus-visible { outline: 3px solid var(--blue-light); outline-offset: 2px; border-radius: 3px; }

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

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
  color: #fff;
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0;
  z-index: 50; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.15rem; color: #fff;
  box-shadow: 0 4px 14px rgba(255,92,27,.4);
}
.brand-logo-img { background: #fff; padding: 5px; overflow: hidden; box-shadow: 0 3px 12px rgba(0,0,0,.22); }
.brand-logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-txt b { display: block; font-size: .95rem; font-weight: 800; letter-spacing: -.01em; }
.brand-txt span { font-size: .62rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.45); }

.nav { flex: 1; padding: 14px 12px; }
.nav-section { font-size: .6rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 16px 12px 7px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-bottom: 2px; border-radius: 9px;
  color: rgba(255,255,255,.62); font-size: .84rem; font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(44,110,168,.35); }
.nav-link.active svg { opacity: 1; }
.nav-footer { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-footer .nav-link { color: rgba(255,255,255,.5); }
.nav-footer .nav-link:hover { color: #fff; }

/* ── Main ───────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  height: 62px; padding: 0 28px;
  display: flex; align-items: center; gap: 14px;
}
.topbar h1 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: .8rem; color: var(--text-light); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue-faint); color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .78rem;
}
.burger { display: none; width: 42px; height: 42px; border-radius: 9px; align-items: center; justify-content: center; color: var(--text); }
.burger:hover { background: var(--bg); }
.burger svg { width: 22px; height: 22px; }
.content { padding: 28px; flex: 1; }
.content-narrow { max-width: 1180px; margin-inline: auto; }

/* ── Page head ──────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .subtitle { color: var(--text-light); font-size: .9rem; margin-top: 3px; }
.page-head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }

/* ── KPI cards ──────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-ico { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.kpi-ico svg { width: 21px; height: 21px; }
.kpi-ico.blue   { background: var(--blue-faint);   color: var(--blue); }
.kpi-ico.orange { background: var(--orange-faint); color: var(--orange); }
.kpi-ico.green  { background: var(--green-faint);  color: var(--green); }
.kpi-ico.violet { background: var(--violet-faint); color: var(--violet); }
.kpi-ico.pink   { background: var(--pink-faint);   color: var(--pink); }
.kpi-ico.amber  { background: var(--amber-faint);  color: var(--amber); }
.kpi-value { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.kpi-label { font-size: .78rem; color: var(--text-light); margin-top: 6px; font-weight: 600; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 20px; }
.trend.up { background: var(--green-faint); color: var(--green); }
.trend.down { background: var(--red-faint); color: var(--red); }
.trend.flat { background: var(--bg); color: var(--text-light); }
.trend svg { width: 12px; height: 12px; }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.card-head h3 { font-size: .95rem; font-weight: 800; }
.card-head .hint { font-size: .78rem; color: var(--text-light); font-weight: 500; }
.card-body { padding: 20px; }
.card-body.tight { padding: 8px 8px 4px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-12 { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1024px) { .grid-2, .grid-3, .grid-12 { grid-template-columns: 1fr; } }

/* ── Charts ─────────────────────────────────────────────── */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 240px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; }
.data th { text-align: left; padding: 11px 18px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light); background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data td { padding: 13px 18px; border-bottom: 1px solid var(--border-soft); font-size: .85rem; vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: none; }
.data tbody tr { transition: background .12s; }
.data tbody tr:hover td { background: #fafcff; }
.data a.link { color: var(--blue); font-weight: 700; }
.data a.link:hover { text-decoration: underline; }
.cell-strong { font-weight: 700; }
.cell-muted { color: var(--text-light); }
.avatar-mini { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; font-size: .72rem; font-weight: 800; margin-right: 9px; vertical-align: middle; }
.avatar-mini.f { background: var(--pink-faint); color: var(--pink); }
.avatar-mini.m { background: var(--blue-faint); color: var(--blue); }
.avatar-mini.x { background: var(--bg); color: var(--text-light); }
.name-cell { display: flex; align-items: center; }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.badge-green  { background: var(--green-faint);  color: var(--green); }
.badge-orange { background: var(--orange-faint); color: var(--orange-dark); }
.badge-amber  { background: var(--amber-faint);  color: var(--amber); }
.badge-red    { background: var(--red-faint);    color: var(--red); }
.badge-blue   { background: var(--blue-faint);   color: var(--blue); }
.badge-violet { background: var(--violet-faint); color: var(--violet); }
.badge-gray   { background: var(--bg);           color: var(--text-light); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm); font-size: .82rem; font-weight: 700; letter-spacing: .01em; transition: background .15s, transform .1s, box-shadow .15s; white-space: nowrap; min-height: 40px; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(44,110,168,.28); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-orange { background: var(--orange); color: #fff; box-shadow: 0 4px 14px rgba(255,92,27,.28); }
.btn-orange:hover { background: var(--orange-dark); }
.btn-ghost { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); border-color: var(--text-faint); }
.btn-danger { background: var(--red-faint); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .78rem; }
.btn-icon { padding: 8px; min-height: 36px; width: 36px; }

/* ── Filters bar ────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters .search { position: relative; flex: 1 1 260px; min-width: 200px; }
.filters .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-faint); }
.filters .search input { padding-left: 38px; }

/* ── Forms ──────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-light); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: .88rem; color: var(--text); background: var(--white); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(44,110,168,.12); }
textarea.input { resize: vertical; min-height: 90px; }
select.input { cursor: pointer; }
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 680px) { .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; } }
.hint { font-size: .74rem; color: var(--text-light); }

/* ── Dropzone (glisser-déposer) ──────────────────── */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: var(--blue-faint); }
.dropzone .dz-inner { pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dropzone svg { width: 26px; height: 26px; color: var(--blue); }
.dropzone p { font-size: .85rem; color: var(--text-light); }
.dropzone .dz-name { font-size: .82rem; font-weight: 700; color: var(--blue-dark); }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; margin-bottom: 18px; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { background: var(--green-faint); color: var(--green); border: 1px solid #bbf7d0; }
.alert-error { background: var(--red-faint); color: var(--red); border: 1px solid #fecaca; }
.alert-info { background: var(--blue-faint); color: var(--blue-dark); border: 1px solid #c7dcef; }
.alert-warn { background: var(--amber-faint); color: var(--amber); border: 1px solid #fde68a; }

/* ── Empty state ────────────────────────────────────────── */
.empty { text-align: center; padding: 54px 24px; color: var(--text-light); }
.empty svg { width: 46px; height: 46px; margin: 0 auto 14px; opacity: .35; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; gap: 5px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; border: 1px solid var(--border); background: var(--white); color: var(--text-light); }
.pagination a:hover { background: var(--bg); }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }
.pagination .muted { border: none; background: none; }

/* ── Member profile ─────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-avatar { width: 66px; height: 66px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; flex-shrink: 0; }
.profile-avatar.f { background: var(--pink-faint); color: var(--pink); }
.profile-avatar.m { background: var(--blue-faint); color: var(--blue); }
.profile-avatar.x { background: var(--bg); color: var(--text-light); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 6px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text-light); }
.profile-meta svg { width: 15px; height: 15px; color: var(--text-faint); }
.def-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
@media (max-width: 560px) { .def-list { grid-template-columns: 1fr; } }
.def-list dt { font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.def-list dd { font-size: .9rem; font-weight: 600; margin-top: 2px; }

/* ── Timeline (historique) ──────────────────────────────── */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); border: 3px solid var(--blue); }
.tl-item.orange .tl-dot { border-color: var(--orange); }
.tl-season { font-weight: 800; font-size: .95rem; }
.tl-detail { font-size: .82rem; color: var(--text-light); margin-top: 2px; }

/* ── Progress bar ───────────────────────────────────────── */
.progress { height: 9px; border-radius: 20px; background: var(--bg); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 20px; background: var(--green); }
.progress > span.warn { background: var(--amber); }
.progress > span.bad { background: var(--red); }

/* ── Login ──────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, var(--sidebar-2), var(--sidebar)); }
.login-card { background: var(--white); border-radius: 20px; padding: 42px 38px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 26px; }
.login-brand .brand-logo { width: 46px; height: 46px; font-size: 1.3rem; }
.login-logo { width: 230px; max-width: 80%; height: auto; margin-inline: auto; }
.login-brand b { font-size: 1.05rem; font-weight: 800; }
.login-card h1 { font-size: 1.15rem; font-weight: 800; text-align: center; }
.login-card .sub { font-size: .85rem; color: var(--text-light); text-align: center; margin: 4px 0 26px; }

/* ── Utils ──────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-light); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-light); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1); width: min(84vw, 290px); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .burger { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .content { padding: 18px 14px; }
  .overlay { position: fixed; inset: 0; background: rgba(11,28,48,.5); z-index: 45; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .overlay.show { opacity: 1; pointer-events: auto; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.5rem; }
  .input, select.input { font-size: 16px; }
  .user-chip .user-name { display: none; }
}
