/* PROSPECTION — styles PROPRES AU MODULE.
 * La charte (tokens, base, fenêtre, primitives) vient de shared/charte.css,
 * chargée avant ce fichier. Ne pas y redéfinir les tokens.
 * Base reprise de pemkm.css (header, toolbar, KPI, table) pour rester homogène.
 */
@media (max-width: 900px) {
  .kb-window { margin: 0; border-radius: 0; min-height: 100vh; }
}

/* ═══ HEADER ═══ */
.kb-mega-header { background: white; border-bottom: 1px solid var(--kb-border); box-shadow: 0 1px 3px rgba(0,0,0,0.04); position: sticky; top: 0; z-index: 100; }
.mega-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; gap: 12px; flex-wrap: wrap; }
.mega-row-top { border-bottom: 1px solid var(--kb-border); }
.mega-left, .mega-right { display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo-img { width: 32px; height: 32px; background: linear-gradient(135deg, var(--kb-primary), var(--kb-primary-dark)); color: white; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
.logo-text { font-weight: 800; font-size: 14px; letter-spacing: 0.3px; }
.logo-text small { display: block; font-size: 9px; color: var(--kb-muted); font-weight: 600; letter-spacing: 0.5px; }
.section-divider { color: var(--kb-muted); font-weight: 300; }
.section-title { font-weight: 700; font-size: 15px; color: var(--kb-primary-dark); }
.vsep { width: 1px; height: 20px; background: var(--kb-border); }
.cross-nav a { color: var(--kb-muted); font-size: 12px; text-decoration: none; padding: 4px 10px; border-radius: 6px; }
.cross-nav a:hover { background: #f0f0f2; color: var(--kb-text); }
.user-info { font-size: 12px; color: var(--kb-muted); font-weight: 600; }
.logout-link { text-decoration: none; color: var(--kb-danger); font-size: 16px; padding: 4px 8px; border-radius: 6px; }
.logout-link:hover { background: #fdeceb; }
.mega-row-bottom { padding: 10px 24px; font-size: 12px; color: var(--kb-muted); background: var(--kb-toolbar); align-items: center; }
.pr-adv { border-top: 1px dashed var(--kb-border); background: #fbfbfc; }

/* Onglets Recherche / Historique (segmented control) */
.pr-tabs { display: inline-flex; background: var(--kb-control); border-radius: 8px; padding: 2px; }
.pr-tab { border: none; background: transparent; padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--kb-muted-strong); border-radius: 6px; cursor: pointer; font-family: inherit; }
.pr-tab.active { background: white; color: var(--kb-text); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }

/* ═══ TOOLBAR ═══ */
.kb-lm-toolbar { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.kb-lm-btn-primary { background: var(--kb-primary); color: white; border: none; border-radius: var(--kb-radius-sm); padding: 6px 13px; font-size: 12.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 1px 2px rgba(10,132,255,0.35); font-family: inherit; }
.kb-lm-btn-primary:hover { background: var(--kb-primary-dark); }
.kb-lm-btn-primary:disabled { opacity: 0.6; cursor: wait; }
.kb-lm-btn-ghost { background: white; color: #3a3a3c; border: 0.5px solid #d4d5da; border-radius: var(--kb-radius-sm); padding: 6px 13px; font-size: 12.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 0.5px 1.5px rgba(0,0,0,0.08); font-family: inherit; }
.kb-lm-btn-ghost:hover { background: #f0f0f2; }
.kb-lm-btn-ghost.pr-danger { color: var(--kb-danger); }
.kb-lm-search { border: none; border-radius: var(--kb-radius-sm); padding: 6px 10px; font-size: 12.5px; width: 260px; background: var(--kb-fill); color: var(--kb-text); font-family: inherit; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.05); }
.kb-lm-select { border: 1px solid var(--kb-border); border-radius: 6px; padding: 6px 8px; font-size: 12px; background: white; font-family: inherit; color: var(--kb-text); }
.kb-lm-select-label { font-size: 11px; color: var(--kb-muted); font-weight: 600; margin-right: 4px; }
.pr-hint { font-size: 11.5px; color: var(--kb-muted); }
.pr-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #3a3a3c; cursor: pointer; }
.pr-chk input { margin: 0; }

/* ═══ CONTENU ═══ */
main { padding: 14px 24px; }
.pr-status { background: var(--kb-st-info-bg); color: var(--kb-st-info); border-radius: var(--kb-radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.pr-status .pr-bar { flex: 1; height: 6px; background: rgba(10,132,255,0.15); border-radius: 3px; overflow: hidden; }
.pr-status .pr-bar > span { display: block; height: 100%; background: var(--kb-primary); width: 0; transition: width .3s; }
.pr-error { background: var(--kb-st-danger-bg); color: var(--kb-st-danger); border-radius: var(--kb-radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; white-space: pre-line; }

#kb-lm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kb-lm-kpi { background: var(--kb-surface); border: 0.5px solid var(--kb-border); border-radius: var(--kb-radius); padding: 13px 15px; box-shadow: var(--shadow-sm); }
.kb-lm-kpi.hl { border-color: var(--kb-ok); background: var(--kb-st-ok-bg); }
.kb-lm-kpi-title { font-size: 11.5px; color: #6a6a6e; font-weight: 600; margin-bottom: 2px; display: flex; align-items: center; gap: 7px; }
.kb-lm-kpi-title::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--kb-primary); flex: 0 0 8px; }
.kb-lm-kpi.hl .kb-lm-kpi-title::before { background: var(--kb-ok); }
.kb-lm-kpi-value { font-family: var(--kb-mono); font-variant-numeric: tabular-nums; font-size: 27px; font-weight: 600; margin-bottom: 1px; line-height: 1; }
.kb-lm-kpi-sub { font-size: 10.5px; color: var(--kb-muted); line-height: 1.2; }

.pr-results-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
#kb-lm-matrix { background: var(--kb-surface); border: 0.5px solid var(--kb-border); border-radius: var(--kb-radius); overflow: auto; box-shadow: var(--shadow-sm); }
.kb-lm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.25; }
.kb-lm-table thead th { background: #f7f7f9; text-align: left; padding: 8px 14px; font-size: 11px; color: var(--kb-muted); border-bottom: 0.5px solid var(--kb-border); font-weight: 600; white-space: nowrap; }
.kb-lm-table thead th[data-sort] { cursor: pointer; user-select: none; }
.kb-lm-table thead th[data-sort]:hover { background: #eef2ff; }
.kb-lm-table thead th .pr-arrow { color: var(--kb-faint); margin-left: 4px; font-size: 10px; }
.kb-lm-table thead th.sorted .pr-arrow { color: var(--kb-primary); }
.kb-lm-table tbody td { padding: 9px 14px; border-top: 0.5px solid #ededf0; vertical-align: top; }
.kb-lm-table tbody tr:hover { background: #f5f8ff; }
.kb-lm-name { font-weight: 600; line-height: 1.2; }
.kb-lm-sub { font-size: 10.5px; color: var(--kb-muted); line-height: 1.2; margin-top: 1px; }
.kb-lm-code { font-family: var(--kb-mono); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--kb-muted); font-weight: 500; white-space: nowrap; }
.pr-age { display: inline-block; min-width: 34px; text-align: center; padding: 2px 7px; border-radius: 4px; font-weight: 700; font-family: var(--kb-mono); font-size: 12px; }
.pr-age.old { background: var(--kb-st-ok-bg); color: var(--kb-st-ok); }
.pr-age.unknown { background: var(--kb-st-neutral-bg); color: var(--kb-st-neutral); }
.pr-pm { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 800; background: var(--kb-st-warn-bg); color: var(--kb-st-warn); margin-left: 4px; vertical-align: middle; }
/* BODACC : procédures collectives */
.pr-bod { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.pr-bod small { font-weight: 600; opacity: 0.8; }
.pr-bod.none { background: transparent; color: var(--kb-faint); font-weight: 500; }
.pr-bod.pending { color: var(--kb-faint); }
.pr-bod.lj { background: var(--kb-st-danger-bg); color: var(--kb-st-danger); }
.pr-bod.rj { background: var(--kb-st-warn-bg); color: var(--kb-st-warn); }
.pr-bod.other { background: var(--kb-st-info-bg); color: var(--kb-st-info); }
a.pr-bod:hover { filter: brightness(0.92); }
.pr-bodacc-info:not(:empty)::before { content: '⏳ '; }
.pr-links { display: flex; gap: 4px; white-space: nowrap; }
.pr-links a { display: inline-block; padding: 3px 8px; border: 1px solid var(--kb-border); border-radius: 5px; font-size: 11px; font-weight: 600; color: var(--kb-primary); background: white; }
.pr-links a:hover { background: var(--kb-primary-light); border-color: var(--kb-primary); }

.pr-pager { margin-top: 12px; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12.5px; color: var(--kb-muted); }
.pr-pager button:disabled { opacity: 0.5; cursor: default; }

.pr-empty { text-align: center; padding: 60px 20px; color: var(--kb-muted); }
.pr-empty-icon { font-size: 42px; margin-bottom: 10px; }
.pr-empty h3 { color: var(--kb-text); font-size: 17px; margin-bottom: 8px; }
.pr-empty p { font-size: 13px; line-height: 1.5; }

/* Carte */
#pr-map-wrap { margin-bottom: 12px; }
.pr-map-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
#pr-map { height: 460px; border-radius: 10px; border: 1px solid var(--kb-border); }
.pr-popup { font-size: 12px; min-width: 200px; }
.pr-popup strong { font-size: 13px; }
.pr-popup hr { border: none; border-top: 1px solid var(--kb-border); margin: 6px 0; }

/* Historique */
.pr-hist { background: var(--kb-surface); border: 0.5px solid var(--kb-border); border-radius: var(--kb-radius); padding: 12px 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 14px; cursor: pointer; box-shadow: var(--shadow-sm); }
.pr-hist:hover { border-color: var(--kb-primary); background: var(--kb-hover-row); }
.pr-hist-main { flex: 1; min-width: 0; }
.pr-hist-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 3px; }
.pr-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--kb-st-neutral-bg); color: var(--kb-st-neutral); }
.pr-badge.blue { background: var(--kb-st-info-bg); color: var(--kb-st-info); }
.pr-badge.green { background: var(--kb-st-ok-bg); color: var(--kb-st-ok); }
.pr-hist-nb { text-align: center; min-width: 70px; }
.pr-hist-nb .n { font-family: var(--kb-mono); font-size: 22px; font-weight: 700; color: var(--kb-primary); line-height: 1; }
.pr-hist-nb .l { font-size: 10.5px; color: var(--kb-muted); }
.pr-hist-del { background: transparent; border: 1px solid var(--kb-border); border-radius: 5px; color: var(--kb-muted); cursor: pointer; width: 28px; height: 28px; }
.pr-hist-del:hover { background: #fdeceb; color: var(--kb-danger); border-color: #f5c2be; }

@media (max-width: 640px) {
  .kb-lm-search { width: 100%; }
  #pr-map { height: 320px; }
}

.pr-ferme { color: var(--kb-danger); font-weight: 600; }

/* Score de cessibilité */
.pr-score { display: inline-block; min-width: 36px; text-align: center; padding: 3px 8px; border-radius: 999px; font-family: var(--kb-mono); font-weight: 800; font-size: 12px; cursor: help; }
.pr-score.hot { background: var(--kb-st-danger-bg); color: var(--kb-st-danger); }
.pr-score.warm { background: var(--kb-st-warn-bg); color: var(--kb-st-warn); }
.pr-score.cold { background: var(--kb-st-neutral-bg); color: var(--kb-st-neutral); }
.pr-score.na { color: var(--kb-faint); }

/* ═══ Suggestions ═══ */
.pr-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pr-tab-badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--kb-danger); color: white; font-size: 10.5px; font-weight: 800; margin-left: 4px; vertical-align: middle; }
.pr-new { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 800; background: var(--kb-st-ok-bg); color: var(--kb-st-ok); margin-left: 6px; vertical-align: middle; }
.pr-dep-tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; background: var(--kb-st-neutral-bg); color: var(--kb-st-neutral); margin-right: 4px; }
.pr-hide { width: 28px; height: 28px; border: 1px solid var(--kb-border); background: white; border-radius: 5px; cursor: pointer; color: var(--kb-muted); font-size: 13px; }
.pr-hide:hover { background: #fdeceb; color: var(--kb-danger); border-color: #f5c2be; }
.pr-hide.restore:hover { background: var(--kb-st-ok-bg); color: var(--kb-ok); border-color: #b7e4c7; }
#pr-sg-matrix { background: var(--kb-surface); border: 0.5px solid var(--kb-border); border-radius: var(--kb-radius); overflow: auto; box-shadow: var(--shadow-sm); }
/* Modal régions */
.pr-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.pr-modal-panel { background: var(--kb-surface); width: 100%; max-width: 860px; max-height: 92vh; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 50px rgba(0,0,0,0.3); }
.pr-modal-head { background: var(--kb-primary); color: white; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 700; }
.pr-modal-close { background: rgba(255,255,255,0.2); border: none; color: white; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 16px; }
.pr-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.pr-region { border: 1px solid var(--kb-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.pr-region.off { background: #fafafa; opacity: 0.75; }
.pr-region-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.pr-region-head input { margin: 0; }
.pr-region-head .pr-hint { font-weight: 500; margin-left: auto; }
.pr-deps { display: flex; flex-wrap: wrap; gap: 5px; }
.pr-dep { border: 1px solid var(--kb-border); background: white; border-radius: 5px; padding: 3px 8px; font-size: 11.5px; font-family: var(--kb-mono); cursor: pointer; color: var(--kb-text); }
.pr-dep:hover { border-color: var(--kb-primary); }
.pr-dep.off { background: var(--kb-st-neutral-bg); color: var(--kb-faint); text-decoration: line-through; }
.pr-dep .n { font-family: var(--kb-font); font-size: 10.5px; color: var(--kb-muted); margin-left: 4px; }
