/* mySUZANNE.com 👓 — design system */
:root {
  --bg: #0e0f16;
  --bg2: #14161f;
  --card: #171923;
  --card2: #1f2230;
  --line: #2b2f42;
  --txt: #f2f3f8;
  --muted: #9aa2b8;
  --accent: #ff7d8f;
  --accent-dark: #e05a6e;
  --accent2: #8fd3ff;
  --ok: #41d98d;
  --warn: #ffb454;
  --danger: #ff6b5e;
  --radius: 14px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 480px at 85% -10%, #232030 0%, transparent 60%),
    radial-gradient(700px 420px at -10% 0%, #1b2233 0%, transparent 55%),
    var(--bg);
  color: var(--txt);
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; }
a { color: var(--accent2); }
.muted { color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 18, 26, .75);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--txt); }
.logo {
  font-size: 26px; width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), #b0567c);
  box-shadow: 0 4px 14px rgba(255, 125, 143, .35);
}
.brand h1 { font-size: 18.5px; letter-spacing: .2px; }
.brand h1 b { color: var(--accent); }
.brand p { margin: 1px 0 0; color: var(--muted); font-size: 11.5px; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.tab:hover { color: var(--txt); background: var(--card); }
.tab.active { color: var(--txt); background: var(--card); border-color: var(--line); }
.pill { background: var(--accent); color: #2a0d13; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; margin-left: 4px; font-weight: 800; }
.credits-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.credits-chip b { color: var(--warn); }
.credits-chip.low b { color: var(--danger); }
.userchip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
}
.userchip .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), #5f8ddb);
  color: #0d1b2b; font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center;
}
.userchip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12.5px; padding: 2px; }
.userchip button:hover { color: var(--danger); }

main { padding: 20px; max-width: 1280px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Formulaires ---------- */
select, input, textarea {
  background: var(--bg2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; font-size: 14px; outline: none; width: 100%;
  font-family: inherit;
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }

.btn {
  border: 1px solid var(--line); background: var(--card2); color: var(--txt);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; border: none; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 7px 12px; font-size: 12.5px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 34px 30px; text-align: center; }
.login-card .logo { width: 72px; height: 72px; font-size: 42px; margin: 0 auto 16px; border-radius: 22px; }
.login-card h1 { font-size: 26px; }
.login-card .tagline { color: var(--muted); font-size: 13.5px; margin: 8px 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- Recherche ---------- */
.searchbar { display: grid; grid-template-columns: 1.4fr auto; gap: 14px; padding: 16px; align-items: end; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chip { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); padding: 5px 10px; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600; }
.chip:hover { border-color: var(--accent); color: var(--txt); }

.mapcard { padding: 14px; }
.maptools { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.maptools-left strong { font-size: 14.5px; }
.maptools-left .muted { display: block; font-size: 11.5px; margin-top: 3px; max-width: 520px; }
.exhaustive-lbl { display: inline-flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 12px; color: var(--muted); cursor: pointer; }
.exhaustive-lbl input { width: 15px; height: 15px; accent-color: var(--warn); }
.maptools-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.maptools-right #map-search { width: 170px; }
.radius { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.radius label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.radius b { color: var(--accent); }
.radius input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

.canton-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.cc { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); padding: 4px 8px; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 600; }
.cc:hover { border-color: var(--accent); color: var(--txt); }
.cc.on { background: rgba(255, 125, 143, .16); border-color: var(--accent); color: #ffb3bd; }

.map-wrap { position: relative; width: 100%; background: #0b0d14; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
#ch-map { width: 100%; height: auto; display: block; }
#ch-map .commune { fill: #222839; stroke: #0b0d14; stroke-width: .4; cursor: pointer; }
#ch-map .commune:hover { fill: #3c4763; }
#ch-map .commune.sel { fill: var(--accent); }
#ch-map .commune.sel:hover { fill: #ff9dab; }
#ch-map .canton-outline { fill: none; stroke: #4a5578; stroke-width: 1; pointer-events: none; }
#ch-map .lake { fill: #14283e; pointer-events: none; }
.map-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #241019; color: #ffe9ec; border: 1px solid var(--accent);
  padding: 5px 9px; border-radius: 7px; font-size: 12px; font-weight: 600;
  transform: translate(-50%, -140%); white-space: nowrap; box-shadow: var(--shadow);
}
.map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13.5px; }
#ch-map { touch-action: none; }
.map-zoom-ctrl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 5px; z-index: 6; }
.map-zoom-ctrl button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(23, 25, 35, .9); color: var(--txt); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.map-zoom-ctrl button:hover { border-color: var(--accent); }

.status { margin: 14px 2px; color: var(--muted); font-size: 13.5px; min-height: 18px; }
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 6px 2px 12px; font-size: 13px; color: var(--muted); }
.results-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.results-actions .selall { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; color: var(--txt); font-size: 13px; }
.results-actions input[type="checkbox"], .rescard .res-check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 12px; }
.rescard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 7px; position: relative; }
.rescard.picked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rescard .pick { position: absolute; top: 12px; right: 12px; }
.rescard h4 { font-size: 14.5px; padding-right: 26px; line-height: 1.35; }
.rescard .meta { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.rescard .meta a { text-decoration: none; word-break: break-all; }
.rescard .row { display: flex; gap: 6px; align-items: baseline; }
.rescard .missing { color: #5d6478; font-style: italic; }
.rescard .contact { color: #ffb3bd; font-weight: 600; }
.rescard .contact em { color: var(--muted); font-weight: 400; font-style: normal; }
.rescard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; gap: 6px; flex-wrap: wrap; }

.src { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; font-weight: 700; background: rgba(255, 180, 84, .13); color: #ffcf8f; border: 1px solid rgba(255, 180, 84, .35); text-decoration: none; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 700; background: var(--card2); color: var(--muted); white-space: nowrap; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- Liste des leads ---------- */
.filterbar { display: flex; gap: 10px; padding: 12px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filterbar input { flex: 1; min-width: 160px; }
.filterbar select { width: auto; min-width: 120px; }

.leadlist { display: flex; flex-direction: column; gap: 8px; }
.leadrow {
  display: grid; grid-template-columns: 2fr 1fr 1.3fr 1fr 1fr auto;
  gap: 8px 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; cursor: pointer; text-decoration: none; color: var(--txt);
}
.leadrow:hover { border-color: var(--accent); }
.leadrow .lname { font-weight: 700; font-size: 14px; }
.leadrow .lname small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.leadrow .lcell { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leadrow .lstatus { justify-self: end; }
.badge-status { border: none; border-radius: 999px; padding: 5px 11px; font-size: 11.5px; font-weight: 800; }
.st-new { background: rgba(143, 211, 255, .15); color: #9cd7ff; }
.st-contacted { background: rgba(255, 180, 84, .15); color: #ffcf8f; }
.st-qualified { background: rgba(178, 142, 253, .16); color: #c9aefc; }
.st-won { background: rgba(65, 217, 141, .15); color: #7fe7b1; }
.st-lost { background: rgba(255, 107, 94, .14); color: #ff9d94; }
.empty { padding: 36px; text-align: center; color: var(--muted); font-size: 14px; }

/* Tableau des leads + colonnes */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.leads-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leads-table thead th {
  text-align: left; padding: 11px 14px; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px; background: var(--bg2); white-space: nowrap; position: sticky; top: 0;
}
.leads-table tbody td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.leads-table tbody tr { cursor: pointer; }
.leads-table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.leads-table .c-name { font-weight: 700; white-space: normal; min-width: 160px; }
.leads-table .c-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.leads-table a { color: var(--accent2); text-decoration: none; }
.leads-table .dash { color: #55607a; }
.cat-chip { display: inline-block; background: rgba(143, 211, 255, .14); color: #a9dcff; border: 1px solid rgba(143, 211, 255, .3); border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; }
.assignee { display: inline-flex; align-items: center; gap: 6px; }
.assignee .adot { width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), #5f8ddb); color: #0d1b2b; font-weight: 800; font-size: 10px; display: flex; align-items: center; justify-content: center; }

.cols-wrap { position: relative; }
.cols-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px; min-width: 210px; max-height: 320px; overflow-y: auto;
}
.cols-menu label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.cols-menu label:hover { background: var(--card2); }
.cols-menu input { width: 15px; height: 15px; accent-color: var(--accent); }

.cat-item { display: inline-flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; }
.cat-item button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 4px; }
.cat-item button:hover { color: var(--danger); }

.view-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.view-toggle .btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; border: none; }
.view-toggle #map-missing { margin-left: auto; font-size: 12px; }
#lead-map { height: 560px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#lead-map .leaflet-popup-content { font-size: 13px; }
#lead-map .leaflet-popup-content a { color: var(--accent-dark); font-weight: 700; }
.leaflet-container { background: #0b0d14; font: inherit; }

/* ---------- Fiche lead ---------- */
.lead-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.lead-head h2 { font-size: 22px; }
.lead-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lead-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
.lead-col { display: flex; flex-direction: column; gap: 14px; }
.section { padding: 16px; }
.section h3 { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields .full { grid-column: 1 / -1; }
.contact-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--bg2); }
.contact-card .c-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); font-weight: 700; }
.comment { padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); margin-bottom: 8px; }
.comment .c-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.comment .c-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; }

/* Timeline / historique */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; position: relative; padding-bottom: 14px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; border: 2px solid var(--bg2); }
.tl-dot.new { background: #9cd7ff; }
.tl-dot.contacted { background: var(--warn); }
.tl-dot.qualified { background: #c9aefc; }
.tl-dot.won { background: var(--ok); }
.tl-dot.lost { background: var(--danger); }
.tl-dot.note { background: var(--muted); }
.tl-body { min-width: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head .badge-status { font-size: 11px; padding: 3px 9px; }
.tl-head input[type="date"] { width: auto; padding: 5px 8px; font-size: 12.5px; }
.tl-label {
  width: auto; min-width: 90px; max-width: 190px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; border: 1px solid var(--line); cursor: text;
}
.tl-label:hover { border-color: var(--accent); }
.tl-label.st-new { background: rgba(143,211,255,.15); color: #9cd7ff; }
.tl-label.st-contacted { background: rgba(255,180,84,.15); color: #ffcf8f; }
.tl-label.st-qualified { background: rgba(178,142,253,.16); color: #c9aefc; }
.tl-label.st-won { background: rgba(65,217,141,.15); color: #7fe7b1; }
.tl-label.st-lost { background: rgba(255,107,94,.14); color: #ff9d94; }
.tl-label.st-note { background: var(--card2); color: var(--muted); }
.tl-note { margin-top: 5px; }
.tl-note input { padding: 6px 9px; font-size: 12.5px; }
.tl-meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.tl-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.tl-del:hover { color: var(--danger); }

/* ---------- Équipe / Admin ---------- */
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.table-like { width: 100%; }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; flex-wrap: wrap; }
.trow:last-child { border-bottom: none; }
.trow .t-main { font-weight: 600; }
.trow .t-sub { color: var(--muted); font-size: 12px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.formgrid .full { grid-column: 1 / -1; }

.packrow { display: flex; gap: 8px; flex-wrap: wrap; }
.archive-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr .9fr; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: center; }
.archive-row.head { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.archive-row:last-child { border-bottom: none; }

/* ---------- Modales & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 6, 12, .78); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 560px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-card h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card2); color: var(--txt); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .25s; font-size: 13.5px; z-index: 90; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .lead-grid, .twocol { grid-template-columns: 1fr; }
  .searchbar { grid-template-columns: 1fr; }
  .archive-row { grid-template-columns: 1.4fr 1fr .9fr; }
  .archive-row .hide-sm { display: none; }
}
@media (max-width: 680px) {
  main { padding: 14px 12px 60px; }
  .topbar { padding: 10px 12px; }
  .brand p { display: none; }
  .topnav { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .leadrow { grid-template-columns: 1fr auto; grid-template-areas: "name status" "cells cells"; }
  .leadrow .lname { grid-area: name; }
  .leadrow .lstatus { grid-area: status; }
  .leadrow .lcell { display: inline; white-space: normal; }
  .leadrow .lcells { grid-area: cells; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
  .fields, .formgrid { grid-template-columns: 1fr; }
  .maptools-right { width: 100%; }
  .filterbar select { flex: 1; }
}
