
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

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

body {
  font-family: 'Inter', sans-serif !important;
  background: linear-gradient(135deg, #0f172a, #020617) !important;
  color: #e5e7eb !important;
  margin: 0;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────── */
.main-wrapper { padding: 20px; max-width: 1200px; margin: 0 auto; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid #1f2937;
  animation: fadeIn .35s ease;
}

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

/* ── KPI Grid ─────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: rgba(17, 24, 39, 0.85);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  text-align: center;
  border: 1px solid #1f2937;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #60a5fa;
  line-height: 1;
}

.kpi-label {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-success .kpi-value { color: #34d399; }
.kpi-warning .kpi-value { color: #f59e0b; }

/* ── Stats Banner (fiche client) ───────────────────────── */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}

.stats-banner-item {
  background: rgba(17, 24, 39, 0.7);
  border-radius: 12px;
  padding: .8rem 1rem;
  text-align: center;
  border: 1px solid #1f2937;
}

.stats-banner-item-warn { border-color: #f59e0b; }
.stats-banner-item-warn .stats-banner-value { color: #f59e0b; }

.stats-banner-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #60a5fa;
}

.stats-banner-label {
  font-size: 0.68rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: .25rem;
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active   { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-warning  { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-inactive { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.badge-relance  { background: rgba(239, 68, 68, 0.15);  color: #f87171; }

/* ── Prestation badge ─────────────────────────────────── */
.prestation-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  margin-left: .5rem;
}

/* ── Filter tabs ──────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-tab {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  text-decoration: none;
  color: #9ca3af;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid #374151;
  transition: all .2s;
}

.filter-tab:hover { border-color: #3b82f6; color: #93c5fd; }
.filter-tab.active { background: rgba(59, 130, 246, 0.2); border-color: #3b82f6; color: #93c5fd; }

/* ── Tables ───────────────────────────────────────────── */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #111827;
  border-radius: 12px;
  overflow: hidden;
}

th, td { padding: 11px 12px; border-bottom: 1px solid #1f2937; }

th {
  color: #9ca3af;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Buttons ──────────────────────────────────────────── */
button, .btn {
  background: #3b82f6 !important;
  color: white !important;
  border: none !important;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: .9rem;
  font-family: inherit;
  transition: .2s;
}

button:hover, .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.btn-success { background: #059669 !important; }
.btn-success:hover { box-shadow: 0 5px 15px rgba(5, 150, 105, 0.4) !important; }

/* ── Inputs ───────────────────────────────────────────── */
input, select, textarea {
  background: #1f2937 !important;
  border: 1px solid #374151 !important;
  color: white !important;
  padding: 9px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  width: 100%;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #3b82f6 !important;
}

/* ── Form helpers ─────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
  min-width: 160px;
}

.form-group label { font-size: .82rem; color: #9ca3af; }

/* ── Note display ─────────────────────────────────────── */
.note { padding: 16px; }

.note-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
  font-size: 1rem;
}

.note-content {
  color: #d1d5db;
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: .5rem;
}

.promo-info {
  font-size: .85rem;
  color: #f59e0b;
  margin: .4rem 0;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.note-balance {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  margin: .5rem 0;
  font-size: .85rem;
  color: #9ca3af;
  padding: .5rem .75rem;
  background: rgba(31, 41, 55, 0.5);
  border-radius: 8px;
}

.reglement-list {
  list-style: none;
  padding: 0;
  margin: .5rem 0;
  font-size: .85rem;
}

.reglement-list li {
  padding: .3rem 0;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.note-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-top: .75rem;
  font-size: .82rem;
  flex-wrap: wrap;
}

.note-action-link { color: #60a5fa; text-decoration: none; }
.note-action-link:hover { text-decoration: underline; }
.del-link { color: #f87171 !important; }
.add-link { color: #34d399 !important; }

/* ── Actions in table ─────────────────────────────────── */
.actions { display: flex; gap: .4rem; }

.actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  text-decoration: none;
  font-size: 14px;
  transition: transform .2s;
}

.actions a:hover { transform: scale(1.15); }
.actions a.view   { background: rgba(14, 165, 233, 0.15); }
.actions a.edit   { background: rgba(234, 179, 8, 0.15); }
.actions a.delete { background: rgba(239, 68, 68, 0.15); }

/* ── Dashboard specific ───────────────────────────────── */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dash-title { margin: 0; font-size: 1.4rem; }

.search-bar {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-bar input { flex: 1; min-width: 180px; }

.result-count { color: #9ca3af; font-size: .82rem; margin: .25rem 0 .75rem; }

/* ── Client info grid ─────────────────────────────────── */
.client-info-grid {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: .88rem;
  color: #d1d5db;
  margin: .5rem 0 1rem;
}

/* ── Links ────────────────────────────────────────────── */
.client-link { color: #93c5fd; text-decoration: none; font-weight: 600; }
.client-link:hover { text-decoration: underline; }
.tel-link { color: #e5e7eb; text-decoration: none; }
.tel-link:hover { color: #93c5fd; }
.nav-link { text-decoration: none; font-size: .88rem; }
.nav-link-warn   { color: #f59e0b; }
.nav-link-danger { color: #f87171; }
.muted { color: #4b5563; }

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-wrapper { padding: 12px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .kpi-value { font-size: 1.5rem; }

  .stats-banner { grid-template-columns: repeat(2, 1fr); gap: .5rem; }

  .hide-sm { display: none !important; }

  .filter-tab { font-size: .74rem; padding: 4px 10px; }

  .form-row { flex-direction: column; }
  .form-group { min-width: 100%; }

  .note-balance { flex-direction: column; align-items: flex-start; gap: .3rem; }

  .dash-title { font-size: 1.1rem; }
}
