/* ════════════════════════════════════════════════
   RESET & TOKENS
════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Couleurs */
  --c-bg: #f0f4f8;
  --c-white: #ffffff;
  --c-dark: #1a1a2e;
  --c-border: #dde3ec;
  --c-surface: #f8fafc;
  --c-muted: #aaa;
  --c-text: #333;
  --c-text-soft: #555;
  --c-text-muted: #666;

  --c-blue: #4361ee;
  --c-blue-light: #eef2ff;
  --c-blue-mid: #c5cff5;

  --c-green: #2dc653;
  --c-green-light: #e8f8f0;
  --c-green-dark: #1a7a3a;

  --c-red: #e63946;
  --c-red-light: #fde8ea;
  --c-red-dark: #a01020;

  --c-orange: #e67e00;
  --c-yellow: #ffc107;
  --c-yellow-light: #fff8e1;
  --c-yellow-dark: #8a6000;

  /* Rayons */
  --r-sm: 6px;
  --r-md: 7px;
  --r-lg: 9px;
  --r-xl: 12px;
  --r-pill: 20px;

  /* Typographie */
  --f-xs: 0.67rem;
  --f-sm: 0.72rem;
  --f-md: 0.79rem;
  --f-base: 0.82rem;
  --f-lg: 0.86rem;
  --f-xl: 0.88rem;
  --f-h1: 0.95rem;
  --f-h2: 1rem;
}

/* ════════════════════════════════════════════════
   BASE
════════════════════════════════════════════════ */
body {
  font-family: system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-dark);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════ */
header {
  background: var(--c-dark);
  color: var(--c-white);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 {
  font-size: var(--f-h2);
}

.compteur {
  background: var(--c-red);
  color: var(--c-white);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--f-base);
}

/* ════════════════════════════════════════════════
   TABS — mobile only
════════════════════════════════════════════════ */
.tabs {
  display: none;
  background: var(--c-white);
  border-bottom: 2px solid var(--c-bg);
  position: sticky;
  top: 44px;
  z-index: 99;
}
.tabs button {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tabs button.active {
  color: var(--c-blue);
  border-bottom-color: var(--c-blue);
}

/* ════════════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════════ */
.main {
  display: grid;
  grid-template-columns: 220px 1fr 180px 220px;
  gap: 10px;
  padding: 10px;
  align-items: start;
  flex: 1;
}

.col {
  background: var(--c-white);
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
}
.col h2 {
  font-size: var(--f-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--c-muted);
  margin-bottom: 12px;
}

.section-divider {
  border: none;
  border-top: 1.5px solid var(--c-bg);
  margin: 12px 0;
}

/* ════════════════════════════════════════════════
   MÉMO
════════════════════════════════════════════════ */
.memo-section {
  margin-bottom: 14px;
}

.memo-section h3 {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--c-red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.memo-item {
  font-size: var(--f-md);
  line-height: 1.6;
  color: var(--c-text);
  padding: 4px 8px;
  border-left: 3px solid var(--c-bg);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: 3px;
}
.memo-item strong {
  color: var(--c-dark);
}
.memo-item em {
  color: var(--c-text-muted);
}

.phrase-accroche {
  font-size: var(--f-base);
  font-style: italic;
  color: var(--c-dark);
  background: var(--c-yellow-light);
  border-left: 3px solid var(--c-yellow);
  padding: 6px 10px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin: 4px 0 6px;
}

/* ════════════════════════════════════════════════
   TAGS
════════════════════════════════════════════════ */
.tag {
  display: inline-block;
  background: var(--c-blue-light);
  color: var(--c-blue);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: var(--f-sm);
  margin: 1px;
}
.tag.red {
  background: var(--c-red-light);
  color: var(--c-red);
}
.tag.green {
  background: var(--c-green-light);
  color: var(--c-green);
}

/* ════════════════════════════════════════════════
   FORMULAIRE
════════════════════════════════════════════════ */
label {
  font-size: var(--f-md);
  font-weight: 600;
  display: block;
  margin: 9px 0 3px;
  color: var(--c-text);
}

input[type="text"],
input[type="time"],
input[type="date"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--f-base);
  background: var(--c-surface);
  color: var(--c-dark);
  outline: none;
  transition: border 0.2s;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--c-blue);
  background: var(--c-white);
}
textarea {
  resize: vertical;
  min-height: 54px;
}

/* Checkboxes */
.checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 5px 0;
}
.checks label {
  font-weight: 400;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--c-text);
  margin: 0;
}
.checks input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--c-blue);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════
   ÉTAT / PRÉSENCE WEB
════════════════════════════════════════════════ */
.etat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 5px 0 8px;
}

.etat-btn {
  padding: 6px 4px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--c-text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.etat-btn:hover {
  border-color: var(--c-blue);
  color: var(--c-blue);
  background: var(--c-blue-light);
}
.etat-btn.full {
  grid-column: span 2;
}
.etat-btn.selected-ok {
  background: var(--c-green-light);
  border-color: var(--c-green);
  color: var(--c-green-dark);
  font-weight: 700;
}
.etat-btn.selected-warn {
  background: var(--c-yellow-light);
  border-color: var(--c-yellow);
  color: var(--c-yellow-dark);
  font-weight: 700;
}
.etat-btn.selected-bad {
  background: var(--c-red-light);
  border-color: var(--c-red);
  color: var(--c-red-dark);
  font-weight: 700;
}

/* ════════════════════════════════════════════════
   RDV
════════════════════════════════════════════════ */
.rdv-header {
  font-size: var(--f-base);
  font-weight: 700;
  color: var(--c-green);
  padding: 7px 10px;
  background: var(--c-green-light);
  border-radius: var(--r-md);
  margin: 4px 0 9px;
}

/* ════════════════════════════════════════════════
   BOUTONS
════════════════════════════════════════════════ */
.btn {
  display: block;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--r-lg);
  font-size: var(--f-lg);
  font-weight: 700;
  cursor: pointer;
  margin-top: 7px;
  transition:
    opacity 0.2s,
    transform 0.1s;
}
.btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--c-blue);
  color: var(--c-white);
}
.btn-success {
  background: var(--c-green);
  color: var(--c-white);
}
.btn-secondary {
  background: var(--c-bg);
  color: #444;
}
.btn-danger {
  background: var(--c-red);
  color: var(--c-white);
}

/* ════════════════════════════════════════════════
   RÉSUMÉ AUTO
════════════════════════════════════════════════ */
.resume-box {
  display: none;
  margin-top: 14px;
  background: #f7f9ff;
  border: 1.5px solid var(--c-blue-mid);
  border-radius: var(--r-lg);
  padding: 12px;
}
.resume-box.visible {
  display: block;
}

.r-title {
  font-size: var(--f-sm);
  font-weight: 700;
  color: var(--c-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.resume-row {
  display: flex;
  gap: 7px;
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 3px 0;
  border-bottom: 1px solid #eaeef8;
}
.resume-row:last-child {
  border-bottom: none;
}
.resume-label {
  flex-shrink: 0;
  width: 120px;
  font-weight: 600;
  color: var(--c-text-soft);
}
.resume-val {
  color: var(--c-dark);
  flex: 1;
}

.rdv-badge {
  display: inline-block;
  background: var(--c-green);
  color: var(--c-white);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 700;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════
   NOTIFICATION
════════════════════════════════════════════════ */
.notif {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--c-green);
  color: var(--c-white);
  padding: 10px 18px;
  border-radius: var(--r-lg);
  font-weight: 700;
  font-size: 0.84rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(60px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 999;
  pointer-events: none;
}
.notif.show {
  transform: translateY(0);
  opacity: 1;
}

/* ════════════════════════════════════════════════
   LISTE LEADS
════════════════════════════════════════════════ */
#stats {
  font-size: var(--f-md);
  margin-bottom: 10px;
  color: var(--c-text-soft);
  line-height: 2;
  padding: 8px 10px;
  background: var(--c-surface);
  border-radius: var(--r-md);
}

.lead-item {
  padding: 7px 9px;
  border-radius: var(--r-md);
  margin-bottom: 4px;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}
.lead-item:hover {
  background: var(--c-bg);
}
.lead-item.active {
  border-color: var(--c-blue);
  background: var(--c-blue-light);
}

.lead-status {
  font-size: var(--f-xs);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.s-rdv {
  background: var(--c-green-light);
  color: var(--c-green);
}
.s-nok {
  background: var(--c-red-light);
  color: var(--c-red);
}
.s-en-cours {
  background: #fff3e0;
  color: var(--c-orange);
}
.s-vide {
  background: var(--c-bg);
  color: var(--c-muted);
}
.s-rappel {
  background: var(--c-blue-light);
  color: var(--c-blue);
}

/* ════════════════════════════════════════════════
   AGENCES
════════════════════════════════════════════════ */
.agence-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.agence-card-nom {
  font-size: var(--f-xl);
  font-weight: 700;
  color: var(--c-dark);
  margin-bottom: 3px;
}
.agence-card-detail {
  font-size: 0.76rem;
  color: var(--c-text-muted);
  line-height: 1.6;
}

.agence-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.agence-card-actions button {
  flex: 1;
  padding: 5px 8px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.agence-card-actions button:hover {
  opacity: 0.8;
}
.btn-edit-agence {
  background: var(--c-blue-light);
  color: var(--c-blue);
}
.btn-del-agence {
  background: var(--c-red-light);
  color: var(--c-red);
}

.agence-form-bloc {
  display: none;
  background: #f7f9ff;
  border: 1.5px solid var(--c-blue-mid);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 8px;
}
.agence-form-bloc.open {
  display: block;
}

.agence-empty {
  font-size: 0.8rem;
  color: var(--c-muted);
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}

/* ════════════════════════════════════════════════
   MODAL
════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 500;
}
.modal-overlay.open {
  display: block;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  background: var(--c-white);
  border-radius: var(--r-xl);
  padding: 20px;
  width: 300px;
  z-index: 501;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.modal.open {
  display: block;
  transform: translate(-50%, -50%);
}

.modal-title {
  font-size: var(--f-h1);
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--c-dark);
}
.modal-body {
  font-size: var(--f-base);
  color: var(--c-text-soft);
  margin-bottom: 16px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 8px;
}

/* ════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .main {
    grid-template-columns: 180px 1fr 150px 180px;
  }
}

@media (max-width: 850px) {
  .main {
    grid-template-columns: 1fr 1fr;
  }
  .col-agences {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .tabs {
    display: flex;
  }
  .main {
    grid-template-columns: 1fr;
    padding: 8px;
  }
  .col {
    display: none;
  }
  .col.visible {
    display: block;
  }
}

.tel-row {
  display: flex;
  gap: 10px;
}
.tel-row > div {
  flex: 1;
}

@media (max-width: 680px) {
  .tel-row {
    flex-direction: column;
  }
}

/* ════════════════════════════════════════════════
   LOGO HEADER
════════════════════════════════════════════════ */
header h1 img {
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.3s ease;
}

header h1 img:hover {
  transform: translateY(-3px) scale(1.12);
  filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.7));
}

/* ════════════════════════════════════════════════
   LOGO FOOTER
════════════════════════════════════════════════ */
footer img {
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.3s ease;
}

footer img:hover {
  transform: translateY(-3px) scale(1.12);
  filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.7));
}

/* ════════════════════════════════════════════════
  FOOTER
════════════════════════════════════════════════ */
footer {
  background: var(--c-dark);
  color: #aab4c8;
  text-align: center;
  padding: 10px 16px;
  font-size: var(--f-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

footer img {
  opacity: 0.75;
}

.footer-link {
  color: #aab4c8;
  text-decoration: none;
  font-weight: 600;
  transition:
    color 0.2s,
    letter-spacing 0.2s;
}

.footer-link:hover {
  color: var(--c-white);
  letter-spacing: 0.5px;
}

.footer-link:active {
  color: var(--c-blue);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-soft);
}
.pagination button {
  background: var(--c-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}
