/* CRM d'OasisWeb : la base de l'interface, aux couleurs de la marque.
 * Fond sable, boutons turquoise, bandeau vert forêt. Titres en Sora, texte en
 * Plus Jakarta Sans (servies d'ici, aucune police externe). crm.css ajoute ce
 * qui est propre aux écrans du CRM, avec les mêmes variables.
 *
 * Turquoise : la marque est #0E8C7F; les boutons et les liens prennent #0B7C71,
 * un cran plus foncé, pour que le texte blanc et les liens passent le seuil de
 * lisibilité (4,5 pour 1). L'œil ne voit pas la différence, l'accessibilité oui.
 *
 * Rayons, par rôle : 6 px les contrôles, 8 px les cartes, 12 px la seule carte
 * de connexion. Aucune pilule. Le mouvement ne touche que transform et opacity
 * (plus les couleurs au survol), sous 300 ms, sur deux courbes de la marque. */

@font-face {
  font-family: "Sora";
  src: url("/crm/static/sora.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/crm/static/jakarta.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --page: #f8f3e9;
  --surface: #fffdf8;
  --surface-sunk: #f2ebdd;
  --ink: #11201d;
  --ink-2: #2d3e39;
  --muted: #55665e;
  --accent: #45c4b3;
  --accent-strong: #0b7c71;
  --accent-deep: #0a5c54;
  --accent-wash: #dff7ef;
  --on-accent: #ffffff;
  --forest: #0b3f39;
  --on-forest: #f8f3e9;
  --danger: #b23a2a;
  --danger-wash: #fbece8;
  --border: #e4d9c4;
  --border-strong: #d6c8ad;
  --grid: #efe7d7;
  --baseline: #c9b998;
  --radius: 6px;
  --radius-card: 8px;
  --radius-block: 12px;
  --shadow-card: 0 1px 2px rgba(11, 63, 57, 0.06), 0 10px 26px -18px rgba(184, 138, 53, 0.38);
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  /* Interactions (survol, ouverture) et ce qui arrive (pression relâchée). */
  --ease-fluid: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-arrive: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --base: 200ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(69, 196, 179, 0.35); color: #03201d; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Bandeau et menu --------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
  padding: 0 max(20px, calc((100vw - 1100px) / 2 + 20px));
  background: var(--forest);
  color: var(--on-forest);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--on-forest);
  font: 600 13px/1 var(--font-display);
}
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 20px; width: auto; }
.brand small {
  font-size: 13px;
  color: rgba(248, 243, 233, 0.68);
  padding-left: 10px;
  border-left: 1px solid rgba(248, 243, 233, 0.24);
}
.topbar .user { color: rgba(248, 243, 233, 0.82); font-size: 14px; }
.topbar .linklike, .topbar a.linklike { color: rgba(248, 243, 233, 0.82); font-size: 14px; }
.topbar .linklike:hover { color: var(--on-forest); }
.topbar .linklike[aria-current="page"] { color: var(--on-forest); }

.linklike {
  font: inherit;
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--accent-strong);
  cursor: pointer;
  transition: color var(--base) var(--ease-fluid);
}
.linklike:hover { text-decoration: underline; text-underline-offset: 3px; }

.subnav {
  display: flex;
  gap: 4px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  position: relative;
  flex: none;
  padding: 14px 12px 12px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--base) var(--ease-fluid);
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--accent-strong);
  transform: scaleX(0);
  transition: transform var(--base) var(--ease-fluid);
}
.subnav a.active { color: var(--ink); font-weight: 600; }
.subnav a.active::after { transform: scaleX(1); }

/* --- Page --------------------------------------------------------------------- */

.content { margin: 0 auto; padding: 24px 20px 64px; }
.page-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 4px 0 18px;
}
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.back { flex-basis: 100%; font-size: 13.5px; }

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin: 0 0 16px;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; }
.card-head h2 { margin: 0; font-size: 16.5px; line-height: 1.3; letter-spacing: -0.01em; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; margin: 0; }
.note { color: var(--muted); font-size: 12.5px; }

/* --- Champs ------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-grid label > span { color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.form-grid .wide { grid-column: 1 / -1; }
input[type="text"], input[type="search"], input[type="password"], input[type="email"],
input[type="tel"], input[type="url"], input[type="date"], input[type="number"],
select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color var(--base) var(--ease-fluid);
}
textarea { min-height: 88px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: #8a988f; }
input:hover, select:hover, textarea:hover { border-color: var(--baseline); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent-strong);
}
input[readonly] { background: var(--surface-sunk); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-strong); width: 16px; height: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.filter-row input, .filter-row select { width: auto; }
.field { min-width: 0; }

/* --- Boutons ------------------------------------------------------------------ */

.btn-sm, button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  font: 600 14px/1.2 var(--font-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition:
    color var(--base) var(--ease-fluid),
    background-color var(--base) var(--ease-fluid),
    border-color var(--base) var(--ease-fluid),
    transform var(--fast) var(--ease-arrive);
}
.btn-sm:active, button.primary:active { transform: scale(0.97); }
.btn-sm:disabled, button.primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-sm.primary, button.primary {
  color: var(--on-accent);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.btn-sm.btn-danger { color: var(--danger); border-color: #e7c3bb; }
@media (hover: hover) and (pointer: fine) {
  .btn-sm:hover { border-color: var(--accent-strong); color: var(--accent-strong); text-decoration: none; }
  .btn-sm.primary:hover, button.primary:hover {
    background: var(--accent-deep);
    border-color: var(--accent-deep);
    color: var(--on-accent);
  }
  .btn-sm.btn-danger:hover { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
}

/* Onglets d'une page (Un prospect / Importer une liste). */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-sunk);
  border-radius: var(--radius);
}
.seg button {
  font: 500 14px/1.2 var(--font-body);
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  transition: color var(--base) var(--ease-fluid), background-color var(--base) var(--ease-fluid);
}
.seg button.active, .seg button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(11, 63, 57, 0.12);
}

/* --- Tableaux ----------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .nw { white-space: nowrap; }
table.data tr.clickable { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  table.data tr.clickable:hover td { background: #fbf7ef; }
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sorted { color: var(--ink); }
.sort-arrow { color: var(--accent-strong); margin-left: 2px; }

/* --- Pastilles (chaleur, importation) ----------------------------------------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--ink-2);
  background: var(--surface-sunk);
  border: 1px solid transparent;
  border-radius: var(--radius);
}
.badge.st-issue { color: #8f3324; background: #fbe3de; }
.badge.st-pending { color: #74561a; background: #f6e8c9; }
.badge.st-inprod { color: var(--accent-deep); background: var(--accent-wash); }
.badge.st-done { color: #2c6a45; background: #e1f1e6; }

/* --- Indicateurs (Suivi) ------------------------------------------------------ */

.kpi-row { display: grid; gap: 12px; margin: 0 0 16px; }
.kpi {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
}
.kpi.selected { box-shadow: inset 0 0 0 2px var(--accent-strong), var(--shadow-card); }
.kpi .label { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.kpi .value { font: 600 30px/1.1 var(--font-display); letter-spacing: -0.02em; margin: 6px 0 2px; }
.kpi .note { color: var(--muted); font-size: 12.5px; }

/* --- Fiche ---------------------------------------------------------------------- */

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.detail-grid .k { color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.detail-grid .v { color: var(--ink); font-size: 14px; }

/* --- Connexion et lien d'accès --------------------------------------------------- */

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  width: 380px;
  background: var(--surface);
  border-radius: var(--radius-block);
  box-shadow: var(--shadow-card);
  padding: 32px 30px 28px;
}
.login-card h1 { margin: 0 0 4px; line-height: 1; }
.login-card h1 img { display: block; height: 26px; width: auto; }
.login-card .sub { color: var(--muted); font-size: 14.5px; margin: 10px 0 22px; }
.login-card label { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin: 14px 0 6px; }
.login-card button.primary { width: 100%; min-height: 44px; margin-top: 22px; font-size: 15px; }
.login-error { color: var(--danger); font-size: 13.5px; margin-top: 12px; min-height: 1em; }
.login-error:empty { display: none; }
.login-help { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.login-card .sub + .login-help { margin: -12px 0 4px; }

/* --- Téléphone ------------------------------------------------------------------ */

@media (max-width: 760px) {
  .topbar { gap: 14px; padding: 0 16px; }
  .topbar .user { display: none; }
  .brand small { display: none; }
  .subnav { padding: 0 8px; }
  .content { padding: 18px 16px 56px; }
  .page-head h1 { font-size: 23px; }
  .card { padding: 16px; }
  .form-grid, .grid-2, .detail-grid { grid-template-columns: 1fr; }
  input[type="text"], input[type="search"], input[type="password"], select, textarea { font-size: 16px; }
  .filter-row input, .filter-row select { width: 100%; }
  .login-card { padding: 28px 20px 24px; }
}
