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

:root {
  --nuit: #171A32;
  --surface: #1C1F3A;
  --card: #232744;
  --card-hover: #2A2F52;
  --blanc: #F8F7F3;
  --lin: #D1B39B;
  --dragee: #CFDDEB;
  --horizon: #8092B6;
  --gold: #C4A35A;
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);
  --danger: #E06060;
  --success: #6DBE8A;
}

body {
  font-family: 'Hanken Grotesk', sans-serif;
  background: var(--nuit);
  color: var(--blanc);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Gotu', serif; font-weight: 400; }

/* ── Layout ── */
#app { height: 100vh; display: flex; flex-direction: column; }

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-brand {
  font-family: 'Gotu', serif;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.main-layout { flex: 1; display: flex; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 268px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-label {
  color: var(--horizon);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.client-list { flex: 1; overflow-y: auto; padding: 0.5rem; }

.client-item {
  padding: 0.7rem 0.75rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 1px;
  border: 1px solid transparent;
}

.client-item:hover { background: var(--card-hover); }
.client-item.active {
  background: var(--card);
  border-color: var(--border-strong);
}

.client-item-name {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--blanc);
  margin-bottom: 0.3rem;
}

.client-item-progress {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.actif { background: var(--gold); }
.status-dot.termine { background: var(--horizon); }
.status-dot.pause { background: var(--lin); }

.progress-bar {
  flex: 1;
  height: 2px;
  background: var(--border-strong);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
}

.progress-text {
  color: var(--horizon);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* ── Main content ── */
.main-content { flex: 1; overflow-y: auto; padding: 2rem 2.5rem; }

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.empty-state-title {
  font-family: 'Gotu', serif;
  font-size: 1.15rem;
  color: var(--horizon);
}

.empty-state-sub {
  color: var(--horizon);
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ── Client detail ── */
.client-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.client-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.client-name-row h2 {
  font-size: 1.6rem;
  color: var(--blanc);
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.18rem 0.6rem;
  border-radius: 20px;
  font-family: 'Hanken Grotesk', sans-serif;
}
.status-badge.actif { background: rgba(196,163,90,0.15); color: var(--gold); }
.status-badge.termine { background: rgba(128,146,182,0.15); color: var(--horizon); }
.status-badge.pause { background: rgba(209,179,155,0.15); color: var(--lin); }

.client-contact {
  color: var(--horizon);
  font-size: 0.83rem;
  display: flex;
  gap: 1.25rem;
}

/* ── Stats ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1rem;
  text-align: center;
}

.stat-number {
  font-family: 'Gotu', serif;
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 0.3rem;
}
.stat-number.gold { color: var(--gold); }
.stat-number.dim { color: var(--horizon); }
.stat-number.blue { color: var(--dragee); }

.stat-label {
  color: var(--horizon);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Objective ── */
.objective-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

.block-label {
  color: var(--horizon);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.objective-block p {
  color: var(--blanc);
  font-size: 0.9rem;
  line-height: 1.75;
}

/* ── Sessions ── */
.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.sessions-label {
  color: var(--horizon);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sessions-list { display: flex; flex-direction: column; gap: 0.6rem; }

.session-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.session-card-head {
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.session-card-head:hover { background: var(--card-hover); }

.session-meta { display: flex; align-items: center; gap: 0.65rem; }

.session-num {
  background: rgba(196,163,90,0.12);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
}

.session-date {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--blanc);
}

.session-dur {
  color: var(--horizon);
  font-size: 0.78rem;
}

.session-actions-row { display: flex; align-items: center; gap: 0.25rem; }

.chevron {
  color: var(--horizon);
  font-size: 0.65rem;
  transition: transform 0.2s;
  margin-left: 0.25rem;
}
.session-card.open .chevron { transform: rotate(180deg); }

.session-card-body {
  display: none;
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
}
.session-card.open .session-card-body { display: block; }

.session-field { margin-top: 0.9rem; }
.session-field-label {
  color: var(--horizon);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}
.session-field p {
  color: var(--blanc);
  font-size: 0.88rem;
  line-height: 1.75;
  white-space: pre-wrap;
}
.session-field a {
  color: var(--dragee);
  text-decoration: none;
  font-size: 0.88rem;
}
.session-field a:hover { text-decoration: underline; }

.no-sessions {
  color: var(--horizon);
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.9rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.12s;
  line-height: 1;
}

.btn-primary { background: var(--gold); color: var(--nuit); }
.btn-primary:hover { background: #d4b468; }

.btn-ghost {
  background: transparent;
  color: var(--horizon);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--card); color: var(--blanc); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(224,96,96,0.25);
}
.btn-danger:hover { background: rgba(224,96,96,0.08); }

.btn-icon {
  padding: 0.3rem 0.4rem;
  background: transparent;
  color: var(--horizon);
  border: none;
  font-size: 0.8rem;
  border-radius: 5px;
}
.btn-icon:hover { color: var(--blanc); background: var(--border-strong); }

.btn-sm { padding: 0.32rem 0.65rem; font-size: 0.78rem; }

.btn-row { display: flex; gap: 0.5rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.78rem;
  color: var(--horizon);
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--nuit);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--blanc);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.12s;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus { outline: none; border-color: var(--gold); }

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.65; }
.form-select option { background: var(--nuit); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23,26,50,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  width: 540px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.4rem 1.4rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.modal-header h3 { font-size: 1rem; color: var(--blanc); }

.modal-body { padding: 0 1.4rem; }

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Login ── */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem;
  width: 350px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-brand {
  text-align: center;
}
.login-brand h1 {
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.login-brand p {
  color: var(--horizon);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.login-error {
  color: var(--danger);
  font-size: 0.8rem;
  display: none;
  text-align: center;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  color: var(--blanc);
  font-size: 0.83rem;
  z-index: 300;
  animation: fadeUp 0.18s ease;
}
.toast.success { border-left: 3px solid var(--gold); }
.toast.error { border-left: 3px solid var(--danger); }

@keyframes fadeUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ── Confirm ── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23,26,50,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(3px);
}
.confirm-box {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 1.75rem;
  width: 340px;
  text-align: center;
}
.confirm-box p { color: var(--blanc); margin-bottom: 1.25rem; font-size: 0.9rem; line-height: 1.6; }
.confirm-box .btn-row { justify-content: center; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ── No-client state ── */
.sidebar-empty {
  padding: 1rem 0.75rem;
  color: var(--horizon);
  font-size: 0.82rem;
}

/* ── Factures / fichiers ─────────────────────────────────────────────────── */
.section-block {
  margin-bottom: 1.75rem;
}

.files-list { display: flex; flex-direction: column; gap: 0.5rem; }

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.file-item:hover { border-color: var(--border-strong); background: var(--card-hover); }

.file-icon { font-size: 1.1rem; flex-shrink: 0; }

.file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.file-name { color: var(--blanc); font-size: 0.88rem; font-weight: 500; }
.file-date { color: var(--horizon); font-size: 0.75rem; }
.file-arrow { color: var(--horizon); font-size: 0.85rem; flex-shrink: 0; }

/* Invoices in admin */
.invoices-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }

.invoice-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--nuit);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

.invoice-row a { color: var(--dragee); font-size: 0.85rem; text-decoration: none; flex: 1; }
.invoice-row a:hover { text-decoration: underline; }
.invoice-row span { color: var(--horizon); font-size: 0.78rem; }

/* ── Client meta (dates + contrat) ─────────────────────────────────────── */
.client-meta-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.client-meta-item {
  font-size: 0.8rem;
  color: var(--horizon);
}

a.client-meta-link {
  color: var(--dragee);
  text-decoration: none;
}
a.client-meta-link:hover { text-decoration: underline; }

/* ── Appointments ───────────────────────────────────────────────────────── */
.apt-date { color: var(--blanc); font-size: 0.85rem; flex: 1; }

.apt-past-toggle {
  font-size: 0.78rem;
  color: var(--horizon);
  cursor: pointer;
  padding: 0.3rem 0;
  margin-top: 0.25rem;
  user-select: none;
}
.apt-past-toggle:hover { color: var(--blanc); }

.apt-hint {
  font-size: 0.78rem;
  margin-top: -0.5rem;
  min-height: 1rem;
}

/* ── Packages ───────────────────────────────────────────────────────────── */
.pkg-info { display: flex; align-items: center; gap: 0.6rem; flex: 1; flex-wrap: wrap; }
.pkg-sessions { color: var(--gold); font-size: 0.85rem; font-weight: 600; }
.pkg-label { color: var(--blanc); font-size: 0.85rem; }
.pkg-date { color: var(--horizon); font-size: 0.78rem; }

/* ── Capacity gauge ─────────────────────────────────────────────────────── */
.capacity-panel {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem 1rem;
  flex-shrink: 0;
}

.cap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.cap-unit {
  font-size: 0.68rem;
  color: var(--horizon);
  opacity: 0.7;
}

.cap-rows { display: flex; flex-direction: column; gap: 0.45rem; }

.cap-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cap-week {
  font-size: 0.72rem;
  color: var(--horizon);
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
}

.cap-bar {
  flex: 1;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  overflow: hidden;
}

.cap-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.cap-fill.cap-low  { background: var(--success); }
.cap-fill.cap-mid  { background: var(--gold); }
.cap-fill.cap-high { background: var(--lin); }
.cap-fill.cap-full { background: var(--danger); }

.cap-count {
  font-size: 0.7rem;
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}
.cap-count.cap-low  { color: var(--success); }
.cap-count.cap-mid  { color: var(--gold); }
.cap-count.cap-high { color: var(--lin); }
.cap-count.cap-full { color: var(--danger); }

/* ── Sidebar next appointment ────────────────────────────────────────────── */
.client-item-next {
  font-size: 0.7rem;
  color: var(--dragee);
  margin-top: 0.2rem;
  opacity: 0.8;
}
