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

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 60%, #e0f2fe 100%);
  min-height: 100vh;
  padding: 0;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.18);
  padding: 0 28px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
.topbar-logo {
  height: 34px;
  background: white;
  border-radius: 6px;
  padding: 3px 8px;
}
.topbar-title {
  font-size: 16px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.2px;
}
.topbar-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.topbar-user {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}
.btn-topbar {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-topbar:hover { background: rgba(255,255,255,0.35); }

/* ── Main layout ──────────────────────────────────────────────────────────── */
.main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* ── Summary bar ──────────────────────────────────────────────────────────── */
.summary-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.summary-card {
  background: white;
  border-radius: 16px;
  padding: 18px 26px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(3,105,161,0.15);
}
.summary-card .num {
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  white-space: nowrap;
}
.summary-card .lbl {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-card.purple .num { color: #6d28d9; }
.summary-card.blue .num { color: #714B67; }
.summary-card.gold .num { color: #b45309; }
.summary-card.green .num { color: #15803d; }
.summary-card.teal .num { color: #0e7490; }
.summary-card.orange .num { color: #c2410c; }

/* ── Section panels ──────────────────────────────────────────────────────── */
.section-panel {
  background: white;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(3,105,161,0.12);
  margin-bottom: 28px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
}
.section-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  min-width: 30px;
}
.section-badge.purple { background: #ede9fe; color: #6d28d9; }
.section-badge.blue { background: #f3eaf1; color: #714B67; }
.section-badge.gold { background: #fef3c7; color: #b45309; }

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Filter toggle ────────────────────────────────────────────────────────── */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.filter-toggle input[type="checkbox"] {
  accent-color: #b45309;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
}
.dashboard-table th {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 20px;
  text-align: left;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.dashboard-table td {
  padding: 13px 20px;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.dashboard-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.dashboard-table tbody tr:hover { background: #f8fafc; }
.dashboard-table tbody tr:last-child td { border-bottom: none; }

.client-name {
  font-weight: 700;
  color: #0f172a;
}
.contrat-num {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 2px;
}

/* ── Status pills ──────────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-pill.en-cours { background: #dbeafe; color: #1d4ed8; }
.status-pill.archive { background: #f1f5f9; color: #94a3b8; }
.status-pill.signe { background: #dcfce7; color: #15803d; }
.status-pill.attente { background: #fef9c3; color: #a16207; }

/* ── Amount ──────────────────────────────────────────────────────────────── */
.amount {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.amount-na {
  color: #cbd5e1;
  font-size: 12px;
}

/* ── Date ────────────────────────────────────────────────────────────────── */
.date-cell {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

/* ── Open link ────────────────────────────────────────────────────────────── */
.open-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  color: #0369a1;
  text-decoration: none;
  background: #e0f2fe;
  border: none;
  outline: none;
  padding: 5px 12px;
  border-radius: 8px;
  transition: background 0.2s;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.open-link:hover { background: #bae6fd; }
.open-link.purple { color: #6d28d9; background: #ede9fe; }
.open-link.purple:hover { background: #ddd6fe; }
.open-link.gold { color: #b45309; background: #fef3c7; }
.open-link.gold:hover { background: #fde68a; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}
.empty-state .icon { font-size: 36px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; font-weight: 600; }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.loading-row td {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 32px 20px;
}

/* ── Archived row dimming ──────────────────────────────────────────────────── */
.row-archived td { opacity: 0.55; }

/* ── Refresh btn ────────────────────────────────────────────────────────────── */
.btn-refresh {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-refresh:hover { background: #e2e8f0; }

@media (max-width: 768px) {
  .topbar { padding: 0 14px; }
  .main { padding: 16px 12px 40px; }
  .summary-bar { gap: 10px; }
  .summary-card { min-width: 120px; padding: 14px 16px; }
  .dashboard-table th,
  .dashboard-table td { padding: 10px 12px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  td.hide-mobile { display: none; }
  th.hide-mobile { display: none; }
}
