/* Mini CRM Beyond — interface sobre, mobile d'abord. --accent = couleur du projet (posée par le script). */
:root {
  --accent: #1d2329;
  --ink: #1d2329;
  --muted: #5f6b76;
  --line: #dfe3e7;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok-bg: #e8f3ee;
  --ok: #1f6b45;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 16px; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* Barre de marque : logo du client et logo Beyond, en blanc sur la couleur du projet */
.brand-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; background: var(--accent); color: #fff; }
.brand-bar img { display: block; height: 32px; width: auto; }
.brand-bar .client-logo { height: 40px; }
.brand-bar .beyond-logo { height: 28px; opacity: .9; }
.brand-bar .client-name { font-weight: 700; letter-spacing: .04em; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.checks { display: grid; gap: 8px; margin-top: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.checks input { width: auto; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; font: inherit; font-weight: 600; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: var(--surface); color: var(--accent); }
button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
button.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }
.form-error { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--danger-bg); color: var(--danger); font-size: 14px; }
.notice { margin: 0 0 16px; padding: 12px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok); }
.notice strong { font-size: 20px; letter-spacing: .1em; word-break: break-all; }

/* Connexion */
.login-page { min-height: 100vh; display: flex; flex-direction: column; }
.login-card { width: calc(100% - 32px); max-width: 400px; margin: 32px auto; padding: 24px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.login-card button[type=submit] { width: 100%; margin-top: 24px; }
.login-page .signature { margin-top: auto; }
.signature { padding: 16px; text-align: center; font-size: 14px; color: var(--muted); }

/* Application */
.top { position: sticky; top: 0; z-index: 10; }
.userline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 14px; }
.userline .who { font-weight: 600; margin-right: auto; }
.userline select { width: auto; padding: 6px 8px; }
.tabs { display: flex; overflow-x: auto; gap: 4px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs a { flex: none; padding: 12px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; }
.tabs a[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }
main.view { padding: 16px; max-width: 960px; margin: 0 auto; }
.card { padding: 16px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card .meta { color: var(--muted); font-size: 14px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; margin-right: 6px; border: 1px solid var(--line); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.log { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.log th, .log td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
details.form { margin-bottom: 16px; }
details.form summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 8px 0; }
.form-grid { display: grid; gap: 0 16px; }

/* Leads */
.tabs .count { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.tools { display: grid; gap: 8px; margin-bottom: 16px; }
.segmented { display: flex; gap: 4px; }
.segmented button { background: var(--surface); color: var(--accent); }
.segmented button[aria-pressed=true] { background: var(--accent); color: #fff; }
.lead-card { cursor: pointer; }
.lead-card h2, .lead-head h1 { margin: 0; font-size: 18px; }
.lead-head h1 { font-size: 24px; }
.lead-card .typo { margin: 4px 0 0; font-size: 14px; }
.lead-card .meta { margin: 4px 0 0; }
.lead-card:hover { border-color: var(--accent); }
.badge.new { background: var(--accent); color: #fff; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.muted { background: var(--line); color: var(--muted); }
.due { color: var(--danger); font-weight: 600; }
.later { color: var(--muted); }
.call-links { display: inline-flex; gap: 8px; }
a.button { text-decoration: none; }
a.button.secondary { background: var(--surface); color: var(--accent); }
.back { display: inline-block; margin-bottom: 12px; font-weight: 600; text-decoration: none; }
.label { color: var(--muted); }
.contacts, .timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.contacts li { padding: 8px 0; border-top: 1px solid var(--line); }
.timeline li { padding: 12px 0; border-top: 1px solid var(--line); }
.timeline p { margin: 0; }
.timeline .body { white-space: pre-wrap; margin-top: 4px; }
.follow-up h2 { margin-bottom: 0; }

/* Tableau de bord */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat { padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat p { margin: 0; }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--muted); }
.chart { position: relative; height: 240px; }
.log.numbers td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tools.dates { grid-template-columns: 1fr 1fr; }
.tools.dates select { grid-column: 1 / -1; }

@media (min-width: 760px) {
  .tools { grid-template-columns: 2fr repeat(3, 1fr); }
  .tools .segmented { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tools.dates { grid-template-columns: 2fr 1fr 1fr; }
  .tools.dates select { grid-column: auto; }
  .chart { height: 280px; }
  .brand-bar { padding: 12px 24px; }
  .login-card { padding: 32px; margin-top: 64px; }
  main.view { padding: 24px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
