:root {
  --navy: #1B2A4A;
  --navy-light: #2E4270;
  --paper: #F7F8FA;
  --card: #FFFFFF;
  --border: #E1E4EA;
  --text: #1F2430;
  --muted: #6B7280;
  --accent: #E08D3C;
  --success: #2F9E6E;
  --danger: #C1443A;
  --radius: 10px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--text);
}

.screen { min-height: 100vh; }

/* Login */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-size: 1.4rem; color: var(--navy); }
.muted { color: var(--muted); font-size: 0.9rem; }
.login-list { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.login-list button {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--paper);
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
}
.login-list button:hover { border-color: var(--navy-light); background: #EEF1F7; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab-btn {
  background: transparent;
  border: none;
  color: #C7D0E0;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.tab-btn.active { background: var(--navy-light); color: white; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.current-user { font-size: 0.9rem; opacity: 0.9; }
.link-btn {
  background: none; border: none; color: #C7D0E0; text-decoration: underline;
  cursor: pointer; font-size: 0.85rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  flex-wrap: wrap;
}
.toolbar input[type="text"], .toolbar select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}
#search { flex: 1; min-width: 200px; }

.btn-primary {
  background: var(--navy);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-primary:hover { background: var(--navy-light); }

/* Cards list */
.cards-list { padding: 0 20px 32px; display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin: 0 auto; }
.pcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.pcard:hover { border-color: var(--navy-light); }
.pcard-main h3 { margin: 0 0 4px; font-size: 1.05rem; }
.pcard-meta { color: var(--muted); font-size: 0.85rem; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-actif { background: #E4F5EC; color: var(--success); }
.badge-a_rappeler { background: #FCEFDD; color: var(--accent); }
.badge-abandon { background: #F9E5E3; color: var(--danger); }
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }

/* Modals */
.modal {
  position: fixed; inset: 0; background: rgba(20,24,34,0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-box {
  background: white; border-radius: var(--radius); padding: 28px;
  width: 100%; max-width: 480px; position: relative; margin-top: 20px;
}
.modal-large { max-width: 640px; }
.modal-close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1;
}

/* Forms */
form label { display: block; margin-bottom: 12px; font-size: 0.9rem; color: var(--text); }
form label input, form label textarea, form label select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; font-family: inherit;
}
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 16px; padding: 12px 14px; }
legend { padding: 0 6px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
label.checkbox, label.radio { display: flex; align-items: center; gap: 8px; }
label.checkbox input, label.radio input { width: auto; margin: 0; }
.indent { margin: 8px 0 12px 26px; }
.sub { margin-left: 26px; }
.hint { color: var(--muted); font-size: 0.82rem; margin: -4px 0 12px; }
.form-error { background: #F9E5E3; color: var(--danger); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 0.88rem; }

/* Détail prospect */
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.detail-header h2 { margin: 0; }
.detail-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }
.detail-actions { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.btn-secondary { background: var(--paper); border: 1px solid var(--border); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; }
.btn-danger { background: #F9E5E3; color: var(--danger); border: 1px solid #F0C4BE; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; }

.history-item { border-top: 1px solid var(--border); padding: 12px 0; }
.history-item:first-child { border-top: none; }
.history-meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.history-body { font-size: 0.92rem; }
.history-suivi { margin-top: 4px; font-size: 0.85rem; font-weight: 600; }

@media (max-width: 560px) {
  .row { flex-direction: column; gap: 0; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
