
/* Courtage Grand Ouest — feuille de style commune (suivi clients, analyse, portail). */
:root {
  /* Couleurs du logo Courtage Grand Ouest : bleu marine #0F1745 et vert #23BF98 (identiques à l'outil de suivi des leads) */
  --navy-900: #0f1745; --navy-800: #121a4d; --navy-700: #172159; --navy-600: #1f2b6e; --navy-500: #34438b; --navy-300: #8490c9; --navy-200: #b3bbe0; --navy-100: #d9ddf0; --navy-50: #eef0f9;
  --green-900: #0c4538; --green-700: #157e65; --green-600: #1b9f7f; --green-500: #23bf98; --green-400: #35c59f; --green-300: #5ccfae; --green-200: #95e2cb; --green-100: #c8f0e4; --green-50: #e9f9f4;
  --bg: #f3f5fa; --surface: #FFFFFF; --surface-2: #f7f8fc; --line: #e2e8f0; --line-strong: #cbd5e1;
  --ink: #1e293b; --muted: #64748b; --faint: #94a3b8;
  --accent: var(--navy-800); --accent-ink: #FFFFFF; --accent-soft: var(--navy-50);
  --green: var(--green-500); --green-ink: var(--green-700); --green-soft: var(--green-50);
  --brass: var(--green-700); --brass-soft: var(--green-50);
  --ok: #047857; --ok-soft: #ecfdf5; --warn: #b45309; --warn-soft: #fffbeb; --bad: #b91c1c; --bad-soft: #fef2f2;
  --shadow: 0 1px 2px rgba(15,23,69,.06), 0 6px 18px rgba(15,23,69,.07);
  --f-ui: "Segoe UI", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-head: var(--f-ui);
  --f-num: var(--f-ui);
  --r: 6px;
  --hdr: 0px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--f-head); text-wrap: balance; margin: 0; letter-spacing: -.005em; color: var(--navy-900); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-700); }
p { margin: 0; }
a { color: var(--navy-600); }
a:hover { color: var(--green-700); }
.num, .tnum, .n { font-variant-numeric: tabular-nums; }

/* Barre haute : bandeau bleu marine comme l'outil de suivi des leads */
.topbar { position: sticky; top: 0; z-index: 30; color: #fff; background: linear-gradient(90deg, var(--navy-900), var(--navy-800) 55%, var(--navy-700)); box-shadow: 0 2px 6px rgba(15,23,69,.25); }
.topbar::after { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--green-500), var(--green-400), var(--navy-500)); }
.tb-row { display: flex; align-items: center; gap: 14px; padding: 10px 20px 0; }
.tb-row.nav-row { padding-top: 2px; padding-bottom: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; white-space: nowrap; cursor: pointer; background: none; border: 0; padding: 0; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { height: 40px; width: auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.brand .bt { display: flex; flex-direction: column; line-height: 1.15; }
.brand .bt small { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--green-300); }
.brand-mark { width: 26px; height: 26px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; letter-spacing: .02em; }
.crumb { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; color: var(--navy-100); }
.crumb strong { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { font-size: 12px; color: var(--navy-200); white-space: nowrap; }
.save-state.err { color: #fecaca; font-weight: 600; }

/* Structure */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - var(--hdr)); }
.nav { border-right: 1px solid var(--line); padding: 16px 10px; background: var(--surface); position: sticky; top: var(--hdr); align-self: start; height: calc(100vh - var(--hdr)); overflow-y: auto; }
.nav button { display: flex; width: 100%; gap: 10px; align-items: baseline; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: var(--r); cursor: pointer; color: var(--muted); }
.nav button .ix { font-family: var(--f-num); font-size: 11px; color: var(--faint); width: 18px; }
.nav button:hover { background: var(--green-50); color: var(--navy-800); }
.nav button.on { background: var(--navy-800); color: #fff; box-shadow: inset 3px 0 0 var(--green-500); }
.nav button.on .ix { color: var(--accent-ink); opacity: .75; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.nav .badge { margin-left: auto; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 999px; background: var(--green-500); color: #fff; line-height: 18px; }
main { min-width: 0; padding: 26px clamp(16px, 3vw, 36px) 64px; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { color: var(--muted); max-width: 70ch; margin-top: 4px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { position: static; }
  .tb-row { padding: 8px 12px 0; gap: 8px; flex-wrap: wrap; }
  .brand img { height: 32px; }
  .brand .bt small { display: none; }
  .nav { position: sticky; top: 0; z-index: 20; height: auto; display: flex; overflow-x: auto; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); gap: 4px; }
  .nav button { width: auto; white-space: nowrap; }
  .nav .sep { display: none; }
  .topbar .hide-sm { display: none; }
}

/* Cartes / sections */
.card { background: var(--surface); border: 1px solid rgba(226,232,240,.9); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,69,.05); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.card-head p { color: var(--muted); font-size: 13px; }
/* Titres de sections : capitales bleues soulignées d'une barre verte, comme l'outil des leads */
.card > h3, .card > .card-head > h3, .card > .card-head > div > h3, .card > .card-head > .row > h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-700); }
.card > h3::before, .card > .card-head > h3::before, .card > .card-head > div > h3::before, .card > .card-head > .row > h3::before { content: ''; width: 4px; height: 16px; border-radius: 4px; background: var(--green-500); flex: none; }
.card.empty > h3, .card.empty h3 { text-transform: none; letter-spacing: 0; font-size: 16px; justify-content: center; }
.card.empty > h3::before { display: none; }
.grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.g2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Champs */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12.5px; color: #334155; font-weight: 600; }
.field.wide { grid-column: 1 / -1; }
input[type=text], input[type=date], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 7px 10px; min-height: 36px; box-shadow: 0 1px 1px rgba(15,23,69,.03); }
input[type=password] { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 7px 10px; min-height: 36px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(35,191,152,.25); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }
input.n { text-align: right; font-variant-numeric: tabular-nums; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }

/* Boutons : actions principales en bleu marine, créations en vert */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--navy-200); background: var(--surface); color: var(--navy-800); padding: 7px 13px; border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; min-height: 34px; text-decoration: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { border-color: var(--green-400); background: var(--green-50); color: var(--navy-800); }
.btn.primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; box-shadow: 0 1px 2px rgba(15,23,69,.15); }
.btn.primary:hover { background: var(--navy-600); border-color: var(--navy-600); color: #fff; }
.btn.go { background: var(--green-700); border-color: var(--green-700); color: #fff; box-shadow: 0 1px 2px rgba(15,23,69,.15); }
.btn.go:hover { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--navy-800); background: #f1f5f9; }
.btn.danger { border-color: #fecaca; color: var(--bad); }
.btn.danger:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.btn.sm { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btn.ai { border-color: var(--green-300); color: var(--green-700); border-style: dashed; }
.btn.ai:hover { background: var(--green-50); border-style: solid; }
.btn[disabled] { opacity: .5; cursor: default; }
.topbar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: #fff; }
.topbar .btn:hover { background: rgba(255,255,255,.16); border-color: var(--green-400); color: #fff; }
.topbar .btn.go, .topbar .btn.primary { background: var(--green-700); border-color: var(--green-700); }
.topbar .btn.go:hover, .topbar .btn.primary:hover { background: var(--green-600); border-color: var(--green-600); }
.iconbtn { border: 0; background: none; cursor: pointer; color: var(--faint); padding: 4px 6px; border-radius: 4px; font-size: 16px; line-height: 1; }
.iconbtn:hover { color: var(--bad); background: var(--bad-soft); }

/* Tableaux */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid #eef2f6; text-align: left; vertical-align: middle; }
thead th { background: var(--navy-50); border-bottom: 1px solid var(--navy-100); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy-700); position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover td { background: rgba(233,249,244,.55); }
td.r, th.r { text-align: right; }
td.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--navy-50); color: var(--navy-900); }
tr.key td { font-weight: 600; }
tr.sub td:first-child { padding-left: 22px; color: var(--muted); }
tr.section td { background: var(--green-50); font-weight: 700; text-transform: uppercase; font-size: 11.5px; letter-spacing: .06em; color: var(--green-700); border-left: 3px solid var(--green-500); }
tbody tr:last-child td { border-bottom: 0; }
td input.n, td input[type=text], td select { min-height: 30px; padding: 4px 7px; }
.neg { color: var(--bad); }
.cell-in { min-width: 110px; }

/* Pastilles d'état */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.acc { background: var(--navy-50); color: var(--navy-700); border-color: var(--navy-100); }
.pill.brass { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Indicateurs : carte avec barre verte en haut, comme l'outil des leads */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.kpi { position: relative; overflow: hidden; border: 1px solid rgba(226,232,240,.9); border-radius: 12px; padding: 14px 14px 12px; background: linear-gradient(135deg, rgba(233,249,244,.75), #fff 70%); box-shadow: 0 1px 2px rgba(15,23,69,.05); display: flex; flex-direction: column; gap: 2px; }
.kpi::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--green-500); }
.kpi .l { font-size: 11px; color: rgba(31,43,110,.8); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kpi .v { font-size: 22px; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.ok { background: linear-gradient(135deg, #ecfdf5, #fff 70%); } .kpi.ok::before { background: #10b981; } .kpi.ok .v { color: var(--ok); }
.kpi.warn { background: linear-gradient(135deg, #fffbeb, #fff 70%); } .kpi.warn::before { background: #f59e0b; } .kpi.warn .v { color: var(--warn); }
.kpi.bad { background: linear-gradient(135deg, #fef2f2, #fff 70%); } .kpi.bad::before { background: #ef4444; } .kpi.bad .v { color: var(--bad); }

.note { border: 1px dashed var(--line-strong); border-radius: 6px; padding: 10px 12px; color: var(--muted); font-size: 13px; background: var(--surface-2); }
.note.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); border-style: solid; }
.note.bad { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); border-style: solid; }
.note.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); border-style: solid; }
.autotext { background: var(--navy-50); border-left: 3px solid var(--green-500); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.6; }
.autotext h4 { color: var(--navy-700); margin-bottom: 4px; }
.banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 8px; background: var(--green-50); border: 1px solid var(--green-200); color: var(--green-900); font-size: 13px; }

/* Entités */
.ent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ent { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,69,.04); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; text-align: left; }
.ent:hover { border-color: var(--green-400); }
.ent.on { border-color: var(--navy-800); box-shadow: 0 0 0 1px var(--navy-800), inset 0 3px 0 var(--green-500); }
.ent .t { font-weight: 600; font-size: 15px; }
.ent .m { color: var(--muted); font-size: 12.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Onglets internes */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button { border-bottom-width: 3px; }
.tabs button:hover { color: var(--navy-700); }
.tabs button.on { color: var(--navy-800); border-bottom-color: var(--green-500); font-weight: 600; }

/* Organigramme */
.org-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 20px; min-height: 240px; }
.org-wrap svg { display: block; margin: 0 auto; }
.org-node rect { fill: var(--surface); stroke: #a3aec4; }
.org-node.pp rect { fill: var(--green-50); stroke: var(--green-600); }
.org-node.main rect { stroke: var(--navy-800); stroke-width: 2.2; }
.org-node.crea rect { stroke-dasharray: 5 3; }
.org-node text { fill: var(--ink); font-family: var(--f-ui); }
.org-node text.sub { fill: var(--muted); font-size: 11px; }
.org-edge { stroke: var(--navy-700); fill: none; stroke-width: 1.4; }
.org-edge.dir { stroke: var(--warn); stroke-dasharray: 4 3; }
.org-edge.pp { stroke: var(--green-600); stroke-width: 1.6; stroke-dasharray: 2 3; }
.org-lbl { fill: var(--navy-700); font-size: 11.5px; font-weight: 700; }
.org-lbl.pp { fill: var(--green-700); font-size: 11px; }
.org-lbl-bg { fill: var(--surface); }

/* Graphiques */
.chart text { fill: var(--muted); font-size: 10.5px; }
.chart .grid-l { stroke: var(--line); }
.chart .s1 { fill: var(--navy-800); } .chart .s2 { fill: var(--green-500); } .chart .s3 { fill: var(--line-strong); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* Modale */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,69,.45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; border-top: 4px solid var(--green-500); box-shadow: var(--shadow); width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal.sm { width: min(520px, 100%); }

/* Accueil */
.dossiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.dos { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,69,.05); padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: left; }
.dos:hover { border-color: var(--green-400); box-shadow: var(--shadow); }
.dos .amt { font-size: 22px; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.dos .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }

.toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--navy-900); color: #fff; border-left: 4px solid var(--green-500); padding: 10px 16px; border-radius: 6px; z-index: 200; font-size: 13.5px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.drop { border: 2px dashed var(--line-strong); border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--green-500); background: var(--green-50); }
.steps-check { display: grid; gap: 6px; }
.steps-check div { display: flex; gap: 8px; align-items: center; font-size: 13px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
@media (max-width: 860px) { .shell { min-height: 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== Barre d'application commune ===== */
.modules { display: flex; gap: 2px; overflow-x: auto; margin-bottom: -1px; }
.modules a { text-decoration: none; color: rgba(217,221,240,.85); padding: 10px 13px 9px; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
.modules a:hover { color: #fff; }
.modules a.on { color: #fff; border-bottom-color: var(--green-400); }
#topSlot { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.usermenu { display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-left: auto; }
.usermenu .who { text-align: right; line-height: 1.2; color: var(--navy-100); text-decoration: none; }
.usermenu .who:hover { color: #fff; }
.usermenu .who strong { display: block; font-size: 13px; color: #fff; }
.usermenu .who span { font-size: 11.5px; color: var(--navy-200); }
.role-pill { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--green-50); color: var(--green-700); font-weight: 600; }
@media (max-width: 860px) { .usermenu .who { display: none; } #topSlot { order: 5; flex-basis: 100%; } }
.dem-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; }
.dem-bar > .small { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--navy-700); }
.dem-bar .tabs { border-bottom: 0; flex: 1; min-width: 0; }

/* ===== Suivi clients ===== */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { flex: 0 0 232px; background: #eef1f8; border: 1px solid var(--line); border-radius: 12px; border-top: 3px solid var(--navy-200); padding: 8px; min-height: 140px; }
.col.over { border-color: var(--green-500); background: var(--green-50); }
.col h3 { font-size: 13px; display: flex; justify-content: space-between; margin: 2px 4px 8px; }
.col h3 span { color: var(--muted); font-weight: 600; }
.lcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 2px rgba(15,23,69,.05); padding: 9px 10px; margin-bottom: 7px; cursor: grab; display: flex; flex-direction: column; gap: 2px; }
.lcard:hover { border-color: var(--green-400); }
.lcard b { font-size: 13.5px; }
.lcard small { color: var(--muted); font-size: 12px; }
.stagebar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.stagebar i { display: block; height: 100%; }
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl:last-child { border-bottom: 0; }
.tl .ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tl .ic.email_out, .tl .ic.email_in { background: var(--navy-50); color: var(--navy-700); border-color: transparent; }
.tl .ic.statut { background: var(--brass-soft); color: var(--brass); border-color: transparent; }
.tl .ic.appel, .tl .ic.rdv { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tl .meta { font-size: 12px; color: var(--muted); }
.tl .body { white-space: pre-wrap; font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr); } }
.side-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.side-card dt { color: var(--muted); }
.side-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.late { color: var(--bad); font-weight: 600; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--surface-2); }
.copybox { display: flex; gap: 6px; }
.copybox input { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
/* Pages de connexion : fond dégradé bleu → vert et grand logo, comme l'outil des leads */
body.gate-body { min-height: 100vh; background: radial-gradient(circle at 85% 10%, rgba(35,191,152,.28), transparent 40%), radial-gradient(circle at 10% 95%, rgba(52,67,139,.45), transparent 45%), linear-gradient(135deg, var(--navy-900), var(--navy-800) 50%, var(--green-900)); }
.gate { max-width: 460px; margin: 0 auto; padding: 9vh 16px 40px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; color: #fff; }
.gate .gate-logo { height: 112px; width: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,.3)); }
.gate h1 { color: #fff; font-size: 28px; }
.gate > p, .gate > .muted { color: var(--green-200); }
.gate > a { color: var(--navy-100); }
.gate > a:hover { color: #fff; }
.gate .card { color: var(--ink); border-top: 4px solid var(--green-500); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.gate .brand-mark { display: none; }
.mail-view { border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: #fff; color: #1a1a1a; max-height: 60vh; overflow: auto; }

/* ===== Photos et plans ===== */
.medias { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.media { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(15,23,69,.05); }
.media.off { opacity: .6; }
.media.off .media-img { filter: grayscale(.8); }
.media-img { aspect-ratio: 4 / 3; background: var(--surface-2); border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.media-img img { width: 100%; height: 100%; object-fit: contain; }
.bien { border: 1px solid var(--line); border-left: 3px solid var(--green-500); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
