*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #dc2626;
  --accent-h:     #b91c1c;
  --bg:           #0d1117;
  --bg-card:      #161b22;
  --bg-row-hover: #1c2230;
  --border:       rgba(255,255,255,.07);
  --ink:          #f0f4f8;
  --muted:        #8b949e;
  --radius:       12px;
}

html, body { min-height: 100vh; font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--ink); }

.card { min-width: 0; max-width: none; width: 100%; }

.page-body { padding: calc(var(--topbar-h, 70px) + 48px) 64px 64px; margin: 0 auto; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.badge-count {
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── ENTRY CARDS ── */
.entries-list { display: flex; flex-direction: column; }
.entry-card {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
}
.entry-card:last-child { border-bottom: none; }
.entry-card:hover { background: var(--bg-row-hover); border-left-color: var(--accent); }
.entry-row1 {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.entry-vehicle { font-size: 1.15rem; font-weight: 700; color: var(--ink); flex: 1; min-width: 0; }
.entry-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.entry-date { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.entry-meta {
  margin-top: 10px; display: flex; flex-wrap: wrap;
  gap: 6px 20px; color: var(--muted); font-size: .82rem; align-items: center;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-sold    { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.badge-active  { background: rgba(234,179,8,.15);  color: #fcd34d; border: 1px solid rgba(234,179,8,.25); }
.badge-returned{ background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.25); }

/* ── FILTER TABS ── */
.filter-tabs { display: flex; gap: 8px; }
.filter-tab {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: .8rem;
  padding: 4px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s;
}
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-tab:hover:not(.active) { border-color: rgba(255,255,255,.2); color: var(--ink); }
.entry-card[data-hidden] { display: none; }

.text-muted { color: var(--muted); }
.vehicle-name { font-weight: 600; }
.plate {
  display: inline-block;
  background: #1e293b;
  color: #94a3b8;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .78rem;
  font-family: monospace;
}

/* ── EMPTY / LOADING / ERROR ── */
.state-msg {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.state-msg .icon { font-size: 2.5rem; margin-bottom: 12px; }
.state-msg p { font-size: .9rem; }
.state-msg.error { color: #f87171; }

/* ── SPINNER ── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ENTRY FOOTER (loueur + bouton contrat) ── */
.entry-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.entry-loueur { font-size: .82rem; color: var(--muted); }
.entry-loueur strong { color: var(--ink); }

.btn-contract {
  appearance: none;
  background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(79,70,229,.12));
  border: 1px solid rgba(99,102,241,.35);
  color: #a5b4fc;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-contract:hover {
  background: linear-gradient(135deg, rgba(99,102,241,.28), rgba(79,70,229,.22));
  border-color: rgba(99,102,241,.55);
}

/* ── MODAL CONTRAT ── */
.contract-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.contract-modal-box {
  background: #fff;
  color: #111;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
}
.contract-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 700;
  font-size: 1rem;
  color: #111;
  background: #f9fafb;
  flex-shrink: 0;
}
.contract-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.contract-modal-close:hover { background: #f3f4f6; color: #111; }
.contract-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  background: #fff;
  color: #111;
}

/* ── MOBILE ── */
@media (max-width: 640px) {
  .page-body  { padding: calc(var(--topbar-h-mobile, 60px) + 20px) 16px 20px; }
  .entry-card { padding: 16px 16px; }
}
