:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #657085;
    --line: #e3e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --aec: #16a34a;
    --pixas: #7c3aed;
    --prospect: #ec4899;
    --danger: #b91c1c;
    --success: #047857;
}

.prospect-sheet { position: fixed; z-index: 1200; top: 64px; right: 0; bottom: 0; width: min(420px,100%); padding: 28px 24px; background: #fff; box-shadow: -12px 0 35px rgba(15,23,42,.18); transform: translateX(105%); transition: transform .22s ease; overflow-y: auto; }
.prospect-sheet.open { transform: none; }
.sheet-backdrop { position: fixed; z-index: 1150; inset: 0; background: rgba(15,23,42,.24); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; }
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet-close { position: absolute; top: 13px; right: 15px; width: 36px; height: 36px; border: 0; border-radius: 50%; font-size: 24px; background: #eef1f5; cursor: pointer; }
.prospect-sheet h2 { margin: 14px 42px 8px 0; }
.sheet-detail { display: block; margin-top: 22px; text-align: center; }
.sheet-preview-link { display:flex; align-items:center; justify-content:space-between; margin-top:14px; padding-top:12px; border-top:1px solid var(--line); color:var(--primary); font-size:14px; font-weight:800; text-decoration:none; }
.sheet-preview-link span { font-size:20px; line-height:1; }
.sheet-title-row { display:flex; align-items:center; gap:7px; padding-right:42px; }
.sheet-title-row h2 { flex:1; min-width:0; margin-right:4px; }
.sheet-icon { display:grid; place-items:center; flex:0 0 32px; width:32px; height:32px; padding:0; border:1px solid #e2e8f0; border-radius:9px; color:#475569; background:#fff; box-shadow:0 1px 2px rgba(15,23,42,.06); font-size:17px; font-weight:900; cursor:pointer; transition:background .15s ease, border-color .15s ease, transform .15s ease; }
.sheet-icon:hover { border-color:#cbd5e1; background:#f8fafc; transform:translateY(-1px); }
.sheet-icon.delete { position:relative; color:transparent; background:#fff; }
.sheet-icon.delete::before { content:""; position:absolute; left:10px; top:11px; width:10px; height:11px; border:2px solid #dc2626; border-top:0; border-radius:0 0 2px 2px; }
.sheet-icon.delete::after { content:""; position:absolute; left:9px; top:7px; width:14px; height:2px; border-radius:2px; background:#dc2626; box-shadow:3px -3px 0 -1px #dc2626; }
.sheet-icon.locate-client { color:#2563eb; border-color:#bfdbfe; background:#eff6ff; }
.sheet-icon.save { color:#047857; border-color:#a7f3d0; background:#ecfdf5; }
.map-relocating #map, .map-relocating #map * { cursor:crosshair !important; }
.sheet-name-form { display:grid; grid-template-columns:minmax(0,1fr) 36px 36px; align-items:center; gap:10px 8px; margin:12px 0; padding:14px; border:1px solid #dbe4ef; border-radius:13px; background:#f8fafc; box-shadow:0 5px 18px rgba(15,23,42,.05); }
.sheet-name-form[hidden], .sheet-title-row[hidden] { display:none; }
.sheet-name-form input, .sheet-name-form select { min-width:0; width:100%; height:42px; padding:9px 11px; border:1px solid #cbd5e1; border-radius:9px; color:var(--text); background:#fff; font-size:14px; font-weight:650; outline:none; }
.sheet-name-form input:focus { border-color:#60a5fa; box-shadow:0 0 0 3px rgba(37,99,235,.12); }
.sheet-name-form input, .sheet-name-form select { grid-column:1/-1; }
.sheet-name-form .sheet-icon.save { grid-column:2; grid-row:6; justify-self:end; }
.sheet-name-form .sheet-icon.cancel { grid-column:3; grid-row:6; justify-self:end; }
.sheet-create-head { display:flex; align-items:center; gap:11px; margin:4px 38px 16px 0; }
.sheet-create-head h2 { margin:0; }
.sheet-create-head p { margin:3px 0 0; color:var(--muted); font-size:12px; }
.sheet-create-pin { display:grid; place-items:center; flex:0 0 36px; width:36px; height:36px; border-radius:11px; color:#fff; background:var(--primary); font-size:22px; font-weight:800; }
.sheet-create-form { display:grid; gap:12px; }
.sheet-create-form label { display:grid; gap:5px; color:var(--muted); font-size:12px; font-weight:800; }
.sheet-create-form input, .sheet-create-form select { width:100%; height:42px; }
.sheet-create-row { display:grid; grid-template-columns:120px minmax(0,1fr); gap:10px; }
.sheet-create-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:3px; padding-top:12px; border-top:1px solid var(--line); }
.admin-nav { display:flex; gap:14px; margin-left:auto; margin-right:18px; font-size:13px; font-weight:700; }
.main-nav { margin-left:auto; margin-right:18px; font-size:13px; font-weight:800; }
.main-nav a,.admin-nav a { color:#566176; text-decoration:none; }
.main-nav a:hover,.admin-nav a:hover { color:#6d36ef; }
.main-nav + .admin-nav { margin-left:0; }
.prospect-card { max-width:820px; margin:0 auto; }
.prospect-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.prospect-card-head h1 { margin:0 0 7px; }
.prospect-category-form { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; margin:16px 0; padding:10px; border:1px solid var(--line); border-radius:12px; background:#f8fafc; }
.prospect-category-form .category-checks { display:flex; gap:6px; }
.prospect-category-form .category-check { flex:1 1 0; }
.prospect-category-form .category-check span { min-height:30px; padding:5px 8px; font-size:11px; }
.passage-form { padding:16px; border:1px solid var(--line); border-radius:14px; background:#f8fafc; }
.filter-toggle { border: 0; cursor: pointer; margin-left: auto; }
.admin-nav + .filter-toggle { margin-left: 0; }
.header-map-action { border: 0; cursor: pointer; margin-left: auto; }
.admin-nav + .header-map-action { margin-left: 0; }
.header-map-action + .filter-toggle { margin-left: 0; }
.header-map-action.locating svg { animation:location-pulse 1s ease-in-out infinite; }
@keyframes location-pulse { 50% { transform:scale(.78); opacity:.45; } }
.map-toast { position:fixed; z-index:1600; left:50%; bottom:calc(18px + env(safe-area-inset-bottom)); width:max-content; max-width:calc(100vw - 28px); padding:11px 15px; border-radius:12px; color:#fff; background:#1e293b; box-shadow:0 10px 30px rgba(15,23,42,.25); font-size:13px; font-weight:700; text-align:center; opacity:0; visibility:hidden; transform:translate(-50%,14px); transition:.2s ease; }
.map-toast.show { opacity:1; visibility:visible; transform:translate(-50%,0); }
.map-toast.error { background:#b42318; }
.filter-toggle svg { overflow: visible; }
.filter-toggle-arrow { transform-origin: 12px 12px; transition: transform .2s ease; }
.filter-toggle.active .filter-toggle-arrow { transform: rotate(180deg); }
.map-filters { transition: transform .22s ease, opacity .18s ease, max-height .22s ease, margin .22s ease, padding .22s ease; transform-origin: top; max-height: 500px; }
.map-filters.filters-hidden { transform: translateY(-18px); opacity: 0; max-height: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; pointer-events: none; overflow: hidden; }
@media (max-width: 900px) {
    html, body.map-view { width:100%; max-width:100%; overflow:hidden; }
    .sheet-backdrop { background:rgba(15,23,42,.12); }
    .prospect-sheet { position:fixed !important; inset:auto 10px calc(8px + env(safe-area-inset-bottom)) 10px !important; box-sizing:border-box; width:auto !important; max-width:none !important; height:auto !important; max-height:calc(100dvh - 82px) !important; min-height:0 !important; margin:0 !important; padding:30px 18px 16px; border:1px solid rgba(226,232,240,.95); border-radius:22px; background:#fff; box-shadow:0 18px 50px rgba(15,23,42,.25); transform:translate3d(0,calc(100% + 30px),0); overflow-y:auto !important; }
    .prospect-sheet::before { content:""; position:absolute; top:9px; left:50%; width:38px; height:4px; border-radius:999px; background:#d5dae3; transform:translateX(-50%); }
    .prospect-sheet .sheet-close { top:9px; right:10px; width:30px; height:30px; font-size:20px; }
    .prospect-sheet.open { transform: none; }
    #prospectSheetContent { position:relative; z-index:1; display:block !important; width:100%; height:auto; overflow:visible; color:var(--text); }
    .sheet-preview-badges { display:flex; align-items:center; gap:6px; padding-right:34px; overflow:hidden; }
    .prospect-sheet h2 { margin:10px 36px 5px 0; font-size:clamp(19px,5.5vw,24px); line-height:1.12; }
    .prospect-sheet .address-line { margin:0; color:var(--muted); line-height:1.35; font-size:13px; }
    .sheet-preview-link { display:flex; align-items:center; justify-content:space-between; margin-top:14px; padding-top:12px; border-top:1px solid var(--line); color:var(--primary); font-size:14px; font-weight:800; text-decoration:none; }
    .sheet-preview-link span { font-size:20px; line-height:1; }
    .sheet-title-row { align-items:flex-start; padding-right:32px; }
    .sheet-title-row h2 { margin-right:auto; }
    .sheet-icon { flex-basis:30px; width:30px; height:30px; border-radius:8px; }
    .sheet-name-form { grid-template-columns:minmax(0,1fr) 34px 34px; }
}
@media (max-width: 700px) { .admin-nav { display:none; } .main-nav { margin-left:auto; margin-right:8px; } }

/* Tournees */
.tours-page,.tour-detail { max-width:1050px; margin:0 auto; padding:34px 22px 70px; }
.page-heading,.tour-detail-head,.tour-builder-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.page-heading h1,.tour-detail h1,.tour-builder h1 { margin:4px 0 7px; font-size:clamp(26px,4vw,40px); color:#182033; }
.page-heading p,.tour-detail-head p { margin:0; color:#667085; }
.eyebrow { color:#7438ef; font-size:12px; font-weight:900; letter-spacing:.11em; text-transform:uppercase; }
.tour-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:16px; margin-top:28px; }
.tour-card,.empty-card { padding:22px; border:1px solid #e3e7ef; border-radius:18px; background:#fff; box-shadow:0 8px 25px rgba(35,43,65,.06); }
.tour-card { display:flex; justify-content:space-between; align-items:center; text-decoration:none; color:#182033; }
.tour-card h2 { margin:7px 0; font-size:19px; }.tour-card p { margin:0;color:#667085 }.tour-card-date{font-size:12px;color:#7b8497}.tour-card-arrow{font-size:25px;color:#7438ef}
.tour-builder { display:grid; grid-template-columns:360px 1fr; height:calc(100dvh - 73px); margin:-24px; }
.tour-builder-panel { padding:24px; background:#fff; overflow:auto; z-index:500; box-shadow:8px 0 28px rgba(22,29,48,.12); }
.tour-builder h1 { font-size:27px; }.icon-link { width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#f2f4f7;color:#344054;text-decoration:none;font-size:25px }
.field-label { display:block; margin:24px 0 8px; color:#344054; font-weight:800; font-size:13px; }
.tour-builder input { width:100%; box-sizing:border-box; border:1px solid #d7ddea; border-radius:12px; padding:13px 14px; font:inherit; }
.tour-start-actions { display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:12px }.tour-start-actions .button{padding:11px 8px}
.tour-muted,.tour-message { color:#687386;font-size:13px;min-height:20px }.tour-message.error{color:#c62828}
.tour-selection-head { display:flex;justify-content:space-between;align-items:center;margin:22px 0 10px }.text-button{border:0;background:none;color:#7438ef;cursor:pointer;font-weight:700}
.tour-selected-list { display:flex;flex-direction:column;gap:7px;margin:12px 0;max-height:34vh;overflow:auto }.tour-empty{color:#8a93a5;font-size:13px;line-height:1.5}
.tour-selected-item { display:flex;justify-content:space-between;align-items:center;text-align:left;border:1px solid #e4e7ec;background:#fafbfc;border-radius:11px;padding:10px 12px;cursor:pointer;color:#182033}.tour-selected-item span{min-width:0}.tour-selected-item strong,.tour-selected-item small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tour-selected-item small{color:#7b8497;margin-top:3px}.tour-selected-item b{font-size:18px;color:#8b95a7}
.tour-save { width:100%;margin-top:8px }.tour-map{height:100%;min-height:500px}.tour-map.placing-start{cursor:crosshair}
.tour-marker { display:grid;width:28px;height:28px;place-items:center;border:3px solid #fff;border-radius:50%;background:#788397;box-shadow:0 3px 10px #35405266;color:#fff;font-weight:900}.tour-marker.source-aec{background:#087e8b}.tour-marker.source-pixas{background:#7438ef}.tour-marker.selected{background:#16a36a;transform:scale(1.16)}
.tour-start-marker{display:grid;width:36px;height:36px;place-items:center;background:#fff;border-radius:50%;box-shadow:0 3px 12px #18203355;font-size:22px}
.back-link{color:#7438ef;text-decoration:none;font-weight:800}.icon-danger{border:0;background:#fff1f2;color:#c62828;border-radius:11px;padding:11px;cursor:pointer;font-size:17px}
.tour-view-map{height:330px;border-radius:18px;margin:24px 0;overflow:hidden;border:1px solid #e0e5ed}.tour-number-icon{display:grid!important;place-items:center;background:#7438ef;color:#fff;border:3px solid #fff;border-radius:50%;font-weight:900;box-shadow:0 2px 8px #2225}
.waze-main{display:flex!important;justify-content:center;margin:0 0 18px;background:#22a6e8!important;color:#fff!important;text-decoration:none}
.tour-stop-list{display:flex;flex-direction:column;gap:10px}.tour-stop{display:grid;grid-template-columns:42px 1fr;gap:13px;padding:17px;border:1px solid #e3e7ef;border-radius:15px;background:#fff}.tour-stop.done{background:#f4fbf7}.tour-stop.skipped{opacity:.55}.tour-stop-number{width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#ede7ff;color:#6930df;font-weight:900}.tour-stop h2{font-size:17px;margin:1px 0 5px}.tour-stop p{margin:0;color:#687386;font-size:14px}.tour-stop-actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-top:12px}.tour-stop-actions a{color:#138fcb;font-weight:800;text-decoration:none}.tour-stop-actions form{display:flex;gap:7px}.tour-stop-actions button{border:1px solid #d9deea;background:#fff;border-radius:8px;padding:6px 9px;cursor:pointer;color:#4c566b}
.tour-validated{color:#168458;font-size:13px;font-weight:850}.tour-note-form{margin-top:13px;border-top:1px solid #edf0f5;padding-top:11px}.tour-note-form summary{cursor:pointer;color:#6d36ef;font-weight:850;font-size:14px}.tour-note-form form{display:grid;gap:10px;margin-top:12px}.tour-note-form label{display:grid;gap:5px;color:#566176;font-size:12px;font-weight:800}.tour-note-form select,.tour-note-form textarea{width:100%;box-sizing:border-box;border:1px solid #d7ddea;border-radius:9px;padding:9px;font:inherit;background:#fff}.tour-note-form small{color:#7b8497}
@media(max-width:760px){.tour-builder{grid-template-columns:1fr;height:auto;margin:-16px}.tour-builder-panel{order:2;padding:20px;box-shadow:none}.tour-map{height:53dvh;min-height:360px;order:1}.tour-selected-list{max-height:240px}.page-heading{flex-direction:column}.tour-view-map{height:260px}.tours-page,.tour-detail{padding:24px 14px 55px}}
.tour-note-form small { display:none; }

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    touch-action: manipulation;
}

#map { touch-action:auto; }

a {
    color: inherit;
}

.topbar {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand {
    min-width: 0;
    color: #0f172a;
    font-weight: 900;
    text-decoration: none;
    font-size: 17px;
    line-height: 1.15;
    letter-spacing: 0;
}

.brand-logo {
    width:30px;
    height:30px;
    flex:0 0 30px;
    object-fit:contain;
}

.brand { display:flex; align-items:center; gap:7px; }

.brand-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-map-count {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.logout-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #334155;
    background: #f1f5f9;
    text-decoration: none;
}

.logout-icon:hover {
    color: #fff;
    background: var(--primary);
}

.page {
    padding: 12px;
}

body.map-view {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.map-view .topbar {
    flex: 0 0 auto;
}

body.map-view .page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    width: 100%;
}

html.prospect-view,
body.prospect-view {
    width:100%;
    height:auto !important;
    min-height:100%;
    overflow-x:hidden !important;
    overflow-y:visible !important;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-y;
}

body.prospect-view .page,
body.prospect-view .prospect-card {
    height:auto;
    max-height:none;
    overflow:visible;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 38px 18px;
    background: #f8fafc;
}

.panel,
.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.08);
    padding: 22px;
}

.login-card {
    width: min(460px, 100%);
    border-radius: 22px;
    border-color: #dbe3ef;
    padding: 32px 36px;
    text-align: center;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.09);
}

.login-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
    color: #fff;
    background: #3b82f6;
    border-radius: 17px;
}

.login-kicker {
    margin: 0 0 7px;
    color: #3b82f6;
    font-size: 16px;
    font-weight: 800;
}

.login-card h1 {
    margin-bottom: 34px;
    color: #0f172a;
    font-size: 30px;
    line-height: 1.05;
    font-weight: 900;
}

.login-subtitle {
    max-width: 360px;
    margin: 0 auto 26px;
    color: #64748b;
    font-size: 16px;
    line-height: 1.55;
}

.login-notice {
    margin: 0 0 24px;
    padding: 15px 18px;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #86efac;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 800;
    text-align: left;
}

.login-form {
    gap: 16px;
    text-align: left;
}

.login-form label {
    color: #233656;
    font-size: 16px;
}

.login-form input {
    min-height: 52px;
    border-radius: 13px;
    border-color: #d8e1ef;
    background: #eaf2ff;
    padding: 14px 18px;
    font-size: 16px;
}

.login-submit {
    min-height: 58px;
    margin-top: 10px;
    border-radius: 15px;
    font-size: 18px;
    box-shadow: 0 18px 36px rgba(59, 130, 246, 0.22);
}

.login-arrow {
    margin-right: 10px;
    font-size: 28px;
    line-height: 1;
}

h1,
h2 {
    margin: 0 0 18px;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 20px;
    margin-top: 24px;
}

.form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--primary-dark);
}

.button.secondary {
    background: #334155;
}

.button.ghost {
    background: #edf2f7;
    color: var(--text);
}

.button.small {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 14px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert.error {
    color: var(--danger);
    background: #fee2e2;
}

.alert.success {
    color: var(--success);
    background: #d1fae5;
}

.muted {
    color: var(--muted);
}

.map-shell {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.map-filters {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip,
.filter-all {
    display: block;
    flex: 0 0 auto;
    font-weight: 900;
}

.filter-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.filter-all input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.filter-chip span,
.filter-all span {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #334155;
    background: #fff;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    white-space: nowrap;
}

.filter-chip input:checked + span,
.filter-all input:checked + span {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.city-filter {
    display: grid;
    grid-template-columns: 180px auto 42px;
    gap: 8px;
    flex: 0 0 auto;
}

.city-filter input {
    min-height: 42px;
    border-radius: 999px;
    background: #fff;
}

.city-filter .button {
    min-height: 42px;
    border-radius: 999px;
    padding-inline: 14px;
}

.reset-button {
    padding-inline: 0;
    font-size: 20px;
}

.map-count {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 8px;
}

#map {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 28px rgba(23, 32, 51, 0.08);
}

.custom-marker {
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.custom-marker.marker-visited {
    display: grid;
    place-items: center;
    border-width: 4px;
    border-color: #f5c542;
    background: #fff;
    box-shadow: 0 0 0 2px #c89012, 0 0 12px rgba(245, 197, 66, 0.7), 0 5px 14px rgba(15, 23, 42, 0.3);
}

.marker-aec.marker-visited { color: var(--aec); }
.marker-pixas.marker-visited { color: var(--pixas); }
.marker-prospect.marker-visited { color: var(--prospect); }
.marker-check {
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #fff;
    background: currentColor;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}
.marker-aec.marker-visited .marker-check { background: var(--aec); }
.marker-pixas.marker-visited .marker-check { background: var(--pixas); }
.marker-prospect.marker-visited .marker-check { background: var(--prospect); }
.custom-marker.marker-attempted { display:grid; place-items:center; border:4px solid #fb923c; background:#fff; box-shadow:0 0 0 2px #c2410c,0 0 11px rgba(251,146,60,.55),0 5px 14px rgba(15,23,42,.28); }
.marker-attempted .marker-check { color:#fff; background:#f97316; }
.marker-aec.marker-visited,
.marker-aec.marker-attempted { background:var(--aec); }
.marker-pixas.marker-visited,
.marker-pixas.marker-attempted { background:var(--pixas); }
.marker-prospect.marker-visited,
.marker-prospect.marker-attempted { background:var(--prospect); }
.marker-visited .marker-check,
.marker-attempted .marker-check { color:#fff; background:transparent; }

.marker-aec {
    background: var(--aec);
}

.marker-pixas {
    background: var(--pixas);
}
.marker-prospect { background:var(--prospect); }

.prospect-cluster {
    display: grid;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: #2563eb;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
}

.prospect-cluster span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 900;
}

.popup-link {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff !important;
    text-decoration: none;
    font-weight: 800;
}

.popup-category {
    display: inline-block;
    margin-top: 6px;
    color: #475569;
    font-weight: 800;
}

.prospect-layout,
.users-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 18px;
    align-items: start;
}

.title-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.prospect-title {
    margin-top: 8px;
    margin-bottom: 18px;
}

.prospect-title h1 {
    margin-bottom: 8px;
}

.address-line {
    margin: 0;
    color: #475569;
    line-height: 1.45;
}

.back-link {
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.source-pill {
    border-radius: 999px;
    padding: 8px 12px;
    color: #fff;
    font-weight: 900;
}

.source-pill.aec {
    background: var(--aec);
}

.source-pill.pixas {
    background: var(--pixas);
}
.source-pill.prospect { background:var(--prospect); }

.badge-row {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #334155;
    background: #eef2f7;
    font-size: 12px;
    font-weight: 900;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.info-grid p {
    margin: 0;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.checkbox-group {
    display: grid;
    gap: 8px;
}

.field-title {
    color: #233656;
    font-weight: 700;
}

.category-checks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.category-check {
    min-width: 0;
    display: block;
}

.category-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.category-check span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #334155;
    background: #fff;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

.category-check input:checked + span {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.timeline {
    display: grid;
    gap: 10px;
}

.timeline-item {
    border-left: 4px solid var(--line);
    padding: 10px 0 10px 12px;
}

.client-timeline .timeline-item {
    border-left-color: #cbd5e1;
}

.timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.event-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    color: #fff;
    background: #64748b;
    font-size: 11px;
    font-weight: 900;
}

.event-rdv {
    background: #2563eb;
}

.event-refus {
    background: #dc2626;
}

.event-absent {
    background: #f59e0b;
}

.event-appel {
    background: #16a34a;
}

.event-modif {
    background: #7c3aed;
}

.timeline-item span {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.timeline-item p {
    margin: 8px 0 0;
}

.client-timeline { position:relative; display:grid; gap:14px; padding:4px 0 8px 34px; }
.client-timeline::before { content:""; position:absolute; top:8px; bottom:12px; left:13px; width:2px; border-radius:2px; background:#e2e8f0; }
.timeline-entry { position:relative; min-width:0; }
.timeline-node { position:absolute; z-index:1; top:15px; left:-34px; display:grid; place-items:center; width:28px; height:28px; border:4px solid #fff; border-radius:50%; color:#fff; background:#64748b; box-shadow:0 0 0 2px #cbd5e1; font-size:13px; font-weight:900; line-height:1; }
.timeline-visite .timeline-node { background:#16a34a; box-shadow:0 0 0 2px #86efac; }
.timeline-absent .timeline-node { background:#f59e0b; box-shadow:0 0 0 2px #fde68a; }
.timeline-info .timeline-node { background:#0284c7; box-shadow:0 0 0 2px #7dd3fc; }
.timeline-modif .timeline-node { background:#7c3aed; box-shadow:0 0 0 2px #c4b5fd; }
.timeline-card { padding:14px; border:1px solid #e5eaf1; border-radius:14px; background:#fff; box-shadow:0 5px 18px rgba(15,23,42,.055); }
.timeline-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.timeline-card-head strong { color:#1e293b; font-size:14px; }
.timeline-card-head time { flex:0 0 auto; color:#8490a3; font-size:11px; font-weight:700; }
.timeline-author { display:flex; align-items:center; gap:7px; margin-top:10px; color:#64748b; font-size:12px; font-weight:700; }
.timeline-avatar { display:grid !important; place-items:center; width:24px; height:24px; margin:0 !important; border-radius:50%; color:#475569 !important; background:#eef2f7; font-size:10px; font-weight:900; }
.timeline-avatar img { width:100%; height:100%; border-radius:50%; object-fit:cover; }
.user-admin-identity { display:flex; align-items:center; gap:8px; }
.user-admin-identity img,.user-admin-identity i { display:grid; place-items:center; width:32px; height:32px; flex:0 0 32px; border-radius:50%; object-fit:cover; color:#475569; background:#e8edf4; font-size:11px; font-style:normal; font-weight:900; }
.avatar-input { width:145px; max-width:100%; margin:0 6px 6px 0; padding:5px; font-size:11px; }
.timeline-note { margin-top:11px; padding:11px 12px; border-radius:10px; color:#334155; background:#f8fafc; font-size:13px; line-height:1.45; }
.timeline-edit { margin-top:10px; border-top:1px solid #edf0f4; padding-top:9px; }
.timeline-edit summary { width:max-content; color:var(--primary); font-size:12px; font-weight:800; cursor:pointer; list-style:none; }
.timeline-edit summary::-webkit-details-marker { display:none; }
.timeline-edit summary::before { content:"✎ "; }
.timeline-edit form { display:grid; gap:8px; margin-top:9px; }
.timeline-edit textarea { min-height:72px; resize:vertical; }
.timeline-edit .button { justify-self:start; }
.timeline-empty { padding:28px 16px; border:1px dashed #cbd5e1; border-radius:14px; text-align:center; color:#64748b; background:#fafbfc; }
.timeline-empty > span { display:block; margin-bottom:8px; font-size:28px; }
.timeline-empty strong { display:block; color:#334155; }
.timeline-empty p { margin:5px 0 0; font-size:13px; }
@media(max-width:520px){.prospect-category-form{grid-template-columns:minmax(0,1fr) auto}.prospect-category-form .field-title{grid-column:1/-1}.client-timeline{padding-left:29px}.client-timeline::before{left:11px}.timeline-node{left:-29px;width:24px;height:24px;top:14px;border-width:3px}.timeline-card{padding:12px}.timeline-card-head{display:grid;gap:3px}.timeline-card-head time{order:-1}.timeline-note{padding:10px}}

.narrow {
    width: min(700px, 100%);
    margin: 0 auto;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

@media (max-width: 900px) {
    .page {
        padding: 8px;
    }

    .map-filters {
        display: grid;
        gap: 6px;
    }

    .filter-chips {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        overflow: visible;
    }

    .filter-chip {
        min-width: 0;
    }

    .filter-chip span,
    .filter-all span {
        justify-content: center;
        width: 100%;
        min-height: 32px;
        padding: 6px 5px;
        font-size: 11px;
        overflow: hidden;
        text-align: center;
        white-space: nowrap;
    }

    .city-filter {
        grid-template-columns: 1fr auto 38px;
        gap: 6px;
    }

    .city-filter input {
        min-height: 38px;
        padding: 9px 12px;
        font-size: 14px;
    }

    .city-filter .button {
        min-height: 38px;
        padding-inline: 10px;
        font-size: 13px;
    }

    .prospect-layout,
    .users-layout {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .title-row {
        display: grid;
    }

    .badge-row {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .topbar {
        min-height: 52px;
        padding: 8px 10px 8px 12px;
    }

    .brand {
        font-size: 15px;
    }

    h1 {
        font-size: 24px;
    }

    .panel,
    .login-card {
        padding: 16px;
    }

    .city-filter {
        grid-template-columns: 1fr auto 38px;
    }

    .button {
        width: 100%;
        min-height: 48px;
    }

    .city-filter .button {
        width: auto;
        min-height: 38px;
        padding-inline: 10px;
    }

    .category-checks {
        grid-template-columns: 1fr;
    }

    .timeline-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}
.logout-form {
    margin: 0;
}

.inline-form {
    display: inline;
    margin: 0;
}

.button.danger {
    background: #b42318;
    border-color: #b42318;
    color: #fff;
}

.clients-admin { max-width:1180px; margin:0 auto; }
#sourceField[hidden], #sirenHelp[hidden] { display:none !important; }
.import-help { margin:0; padding:12px 14px; border:1px solid #f9a8d4; border-radius:10px; color:#9d174d; background:#fdf2f8; line-height:1.45; }
.import-templates { display:flex; align-items:center; gap:10px; margin:14px 0 20px; padding:12px; border:1px solid var(--line); border-radius:10px; background:#f8fafc; }
.import-templates > div { flex:1; display:flex; flex-direction:column; gap:3px; }
.import-templates span { color:var(--muted); font-size:12px; }

@media (max-width:600px) {
    .import-templates { align-items:stretch; flex-direction:column; }
    .import-templates .button { width:100%; }
}
.clients-admin-head { display:flex; align-items:end; justify-content:space-between; gap:20px; margin-bottom:20px; }
.clients-admin-head h1 { margin-bottom:4px; }
.clients-admin-head .muted { margin:0; color:var(--muted); }
.clients-search { width:min(460px,100%); }
.clients-search label { display:block; margin-bottom:6px; color:var(--muted); font-size:12px; font-weight:800; }
.clients-search > div { display:flex; gap:8px; }
.clients-search input { flex:1; min-width:0; }
.client-admin-list { display:grid; gap:12px; }
.client-create { margin:0 0 18px; border:1px solid #bfdbfe; border-radius:12px; background:#eff6ff; }
.client-create summary { padding:14px 16px; color:#1d4ed8; font-weight:900; cursor:pointer; }
.client-create[open] summary { border-bottom:1px solid #bfdbfe; }
.client-create-form { display:grid; grid-template-columns:2fr 1fr 2fr 110px 1.3fr; align-items:end; gap:12px; padding:16px 16px 8px; }
.client-create-form label { min-width:0; color:var(--muted); font-size:11px; font-weight:800; }
.client-create-form input, .client-create-form select { width:100%; margin-top:5px; }
.client-create-form small { font-weight:400; }
.client-create-form .create-categories { grid-column:1 / 4; display:flex; gap:14px; min-width:0; margin:0; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.client-create-form .create-categories legend { padding:0 4px; color:var(--muted); font-size:11px; font-weight:800; }
.client-create-form .create-categories label { display:flex; align-items:center; gap:5px; color:var(--text); }
.client-create-form .create-categories input { width:auto; margin:0; }
.client-create-form .button { grid-column:5; }
.client-create-hint { margin:4px 16px 14px; color:var(--muted); font-size:12px; }
.client-admin-card { padding:16px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.client-admin-card > header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:13px; }
.client-admin-card h2 { display:inline; margin:0 8px 0 0; font-size:17px; }
.client-id { color:var(--muted); font-size:12px; font-weight:700; }
.client-edit-form { display:grid; grid-template-columns:minmax(240px,2fr) 110px minmax(150px,1fr) 145px 145px auto; align-items:end; gap:10px; }
.client-edit-form label { min-width:0; color:var(--muted); font-size:11px; font-weight:800; }
.client-edit-form input { width:100%; margin-top:5px; }
.client-delete-form { display:flex; justify-content:flex-end; margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.pagination { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:20px; }
.pagination span { color:var(--muted); font-size:13px; font-weight:700; }

@media (max-width:1050px) {
    .client-create-form { grid-template-columns:1fr 1fr 1fr; }
    .client-create-form .create-company, .client-create-form .create-address { grid-column:span 2; }
    .client-create-form .create-categories { grid-column:1 / -1; }
    .client-create-form .button { grid-column:3; }
    .client-edit-form { grid-template-columns:2fr 1fr 1.5fr 1fr 1fr; }
    .client-edit-form .button { grid-column:1 / -1; justify-self:end; }
}

@media (max-width:700px) {
    .clients-admin-head { align-items:stretch; flex-direction:column; }
    .client-edit-form { grid-template-columns:1fr 1fr; }
    .client-edit-form .client-address, .client-edit-form .button { grid-column:1 / -1; }
    .client-edit-form .button, .client-delete-form .button { width:100%; }
    .client-create-form { grid-template-columns:1fr 1fr; }
    .client-create-form .create-company, .client-create-form .create-address, .client-create-form .create-categories, .client-create-form .button { grid-column:1 / -1; }
    .client-create-form .create-categories { flex-wrap:wrap; }
    .client-create-form .button { width:100%; }
}

.logout-form .logout-icon {
    cursor: pointer;
}
