
:root{
  --bg:#0b1220;
  --card:#0f1b33;
  --card2:#101d38;
  --text:#e8eefc;
  --muted:#9fb0d6;
  --line:rgba(255,255,255,.10);
  --btn:#1b2f59;
  --danger:#7b2b2b;
}
*{box-sizing:border-box}
body{margin:0;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;background:linear-gradient(180deg,#0b1220,#071022);color:var(--text)}
a{color:#bcd0ff;text-decoration:none}
a:hover{text-decoration:underline}
.top{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:18px;border-bottom:1px solid var(--line);position:sticky;top:0;background:rgba(11,18,32,.92);backdrop-filter: blur(10px);z-index:10}
.brand{display:flex;gap:14px;align-items:center}
.avatar{width:64px;height:64px;border-radius:14px;object-fit:cover;border:1px solid var(--line)}
.h1{font-size:18px;font-weight:750}
.h2{font-size:13px;color:var(--muted);margin-top:2px}
.h3{font-size:12px;color:var(--muted);margin-top:4px}
.tagline{color:#d9e3ff}
.cta{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.small{font-size:12px;color:var(--muted)}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;padding:14px}
.card{background:linear-gradient(180deg,var(--card),var(--card2));border:1px solid var(--line);border-radius:16px;padding:14px;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.card.wide{grid-column:1/-1}
h2{margin:0 0 10px 0;font-size:16px}
h3{margin:12px 0 8px 0;font-size:14px}
p{margin:8px 0}
.muted{color:var(--muted);font-size:12px}
.label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.row{display:flex;gap:10px;align-items:center;margin:8px 0}
.row.wrap{flex-wrap:wrap}
.col{min-width:180px}
.col.grow{flex:1}
input[type="text"],input[type="url"],input[type="number"],input[type="month"],select{
  width:100%;padding:10px;border-radius:12px;border:1px solid var(--line);background:#0c1730;color:var(--text);
}
input[type="file"]{width:100%;padding:10px;border-radius:12px;border:1px dashed var(--line);background:#0c1730;color:var(--muted)}
.chk{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.btn{padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--btn);color:var(--text);cursor:pointer;font-weight:650}
.btn:hover{filter:brightness(1.08)}
.btn.primary{background:linear-gradient(180deg,#2f5fff,#2a4db4);border-color:rgba(255,255,255,.18)}
.btn.danger{background:linear-gradient(180deg,#7b2b2b,#5a1f1f)}
.sep{border:none;border-top:1px solid var(--line);margin:12px 0}
.datasets{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.dsItem{display:flex;justify-content:space-between;gap:10px;align-items:center;border:1px solid var(--line);border-radius:14px;padding:10px;background:rgba(255,255,255,.03)}
.dsMeta{display:flex;flex-direction:column;gap:2px}
.dsName{font-weight:750}
.dsSmall{font-size:12px;color:var(--muted)}
.kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.kpi{border:1px solid var(--line);border-radius:14px;padding:10px;background:rgba(255,255,255,.03)}
.k{font-size:11px;color:var(--muted)}
.v{font-size:16px;font-weight:800;margin-top:4px}
.pill{border:1px solid var(--line);border-radius:999px;padding:8px 12px;background:rgba(255,255,255,.03);font-size:12px;color:var(--muted)}
.pill b{color:var(--text)}
#map{height:420px;border-radius:14px;border:1px solid var(--line);overflow:hidden;margin-top:10px}
.tableWrap{overflow:auto;border-radius:14px;border:1px solid var(--line);margin-top:10px}
table{width:100%;border-collapse:collapse;min-width:980px}
th,td{padding:10px;border-bottom:1px solid var(--line);font-size:12px}
th{position:sticky;top:0;background:#0b1731;z-index:1;text-align:left}
td.muted{text-align:center}
.footnote{margin-top:10px}
.streetBox{border:1px solid var(--line);border-radius:14px;padding:10px;background:rgba(255,255,255,.02);margin-top:10px}
.streetBox summary{cursor:pointer;font-weight:750}
@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
  .cta{align-items:flex-start}
  .kpis{grid-template-columns:1fr 1fr}
}

/* --- Branding header (Pierre Peyrard) --- */
header.top{display:flex;gap:18px;align-items:center;justify-content:space-between;flex-wrap:wrap}
header.top .brand{display:flex;gap:14px;align-items:center}
header.top .avatar{width:64px;height:64px;border-radius:18px;object-fit:cover;border:1px solid rgba(255,255,255,.12)}
header.top .brandTitle{font-weight:900;font-size:18px;line-height:1.2}
header.top .brandSub{opacity:.85;margin-top:3px}
header.top .brandTag{opacity:.8;margin-top:6px}
header.top .cta{display:flex;flex-direction:column;gap:8px;align-items:flex-end}
header.top .contactLine{opacity:.9;font-size:13px;display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
header.top .contactLine a{color:inherit;text-decoration:none;border-bottom:1px solid rgba(255,255,255,.18)}
header.top .contactLine a:hover{border-bottom-color:rgba(255,255,255,.4)}
header.top .dot{opacity:.7}
header.top .amp{opacity:.75}
@media (max-width:820px){
  header.top .cta{align-items:flex-start}
}

/* --- Progress UI --- */
.progressWrap{margin-top:10px; display:flex; flex-direction:column; gap:8px}
.progressBar{height:10px; border-radius:999px; background:rgba(37,211,102,.22); overflow:hidden}
.progressFill{height:100%; width:0%; background:#25D366; transition:width .18s ease transition:width .18s ease}
.progressFill.indeterminate{width:35%; animation:progressIndet 1.1s infinite; transform:translateX(-100%)}
@keyframes progressIndet{
  0%{transform:translateX(-120%)}
  100%{transform:translateX(320%)}
}

.btn.whatsapp{background:#25D366;color:#072b12;border:1px solid rgba(0,0,0,.08);font-weight:800}

/* --- Diagnostics --- */
.diagBox{
  margin-top:10px;
  max-height:160px;
  overflow:auto;
  padding:10px;
  border-radius:14px;
  background:rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.10);
  font-size:12px;
  line-height:1.35;
  white-space:pre-wrap;
}

/* --- Reports (PDF/Word) --- */
.reportHost{
  position: fixed;
  left: -99999px;
  top: 0;
  width: 794px; /* ~A4 @96dpi */
  background:#fff;
  color:#111;
  padding: 26px;
  box-shadow:none;
  z-index:-1;
  font-family: Calibri, Arial, sans-serif;
}
.reportMeta{color:#333;font-size:13px;margin-bottom:12px}
.reportGrid{display:grid; grid-template-columns: 1fr; gap:14px}
.reportKpis{display:grid; grid-template-columns: repeat(3, 1fr); gap:10px}
.reportKpi{border:1px solid #e5e7eb; border-radius:10px; padding:10px}
.reportKpi .k{color:#555; font-size:12px}
.reportKpi .v{font-size:18px; font-weight:700}
.reportImg{width:100%; border:1px solid #e5e7eb; border-radius:12px; overflow:hidden}
.reportImg img{display:block; width:100%; height:auto}
.reportTable{width:100%; border-collapse:collapse; font-size:12px}
.reportTable th, .reportTable td{border:1px solid #e5e7eb; padding:4px; vertical-align:top}
.reportTable th{background:#f3f4f6; text-align:left}
.reportNote{font-size:11px; color:#444}

/* Force Calibri everywhere inside reports */
.reportHost, .reportHost *{
  font-family: Calibri, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
.reportPage{
  width: 794px; /* A4 @96dpi */
  min-height: 1123px;
  padding: 26px;
  box-sizing: border-box;
  background: #fff;
}
.reportPage + .reportPage{
  margin-top: 18px;
}
.reportHr{height:1px;background:#e5e7eb;margin:10px 0}
.reportMeta div{line-height:1.25}

.reportTable{table-layout:fixed}
.reportTable th, .reportTable td{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}
.reportTable th:nth-child(1){width:9%}
.reportTable th:nth-child(2){width:9%}
.reportTable th:nth-child(3){width:7%}
.reportTable th:nth-child(4){width:8%}
.reportTable th:nth-child(5){width:9%}
.reportTable th:nth-child(6){width:12%}
.reportTable th:nth-child(7){width:28%}
.reportTable th:nth-child(8){width:8%}

/* KPI + chart side-by-side */
.kpiRow{display:flex; gap:14px; align-items:stretch}
.kpiLeft{flex:1 1 58%}
.kpiRight{flex:1 1 42%; display:flex; flex-direction:column; justify-content:center}
.kpiRight h3{margin-top:0}
.kpiRight canvas{width:100% !important; max-width:100%}
@media (max-width: 980px){.kpiRow{flex-direction:column}}

/* Force chart BELOW KPIs (override previous side-by-side layout) */
.kpiRow{display:block !important}
.kpiLeft,.kpiRight{width:100% !important; max-width:100% !important}
.kpiRight{margin-top:12px !important}

/* Full-width sections */
.card.full{grid-column: 1 / -1;}
.card.full #chart{width:100% !important; height: 180px !important;}


/* ===============================
   Layout override (v14 ergonomics)
   Goal: use full screen width, keep left column for controls, right for results,
   and make KPI+chart full-width and readable.
   =============================== */
main.grid{
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 16px 24px !important;
  grid-template-columns: 420px minmax(0, 1fr) !important;
  align-items: start;
}

.card{width:100%}

.card.full{grid-column: 1 / -1 !important;}

.kpis{
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}

.card.full #chart{
  width: 100% !important;
  height: 220px !important;
}

/* Make long tables and lists breathe */
.tableWrap{overflow:auto; max-height: 240px;}
@media (max-width: 1100px){
  main.grid{
    grid-template-columns: 1fr !important;
    padding: 14px !important;
  }
  .tableWrap{max-height: 200px;}
}

/* Chart legibility */
.chartWrap canvas#chart{width:100% !important; height:320px !important; max-height:320px !important;}


/* ===============================
   Reports (PDF & Word) - Calibri + clean layout
   =============================== */
.reportHost{
  font-family: Calibri, Arial, sans-serif !important;
  color:#111827;
  background:#ffffff;
}
.reportPage{
  font-family: Calibri, Arial, sans-serif !important;
  padding: 28px 30px;
  line-height: 1.35;
}
.reportTitle{
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px 0;
}
.reportSubtitle{
  font-size: 12px;
  color:#374151;
  margin: 0 0 14px 0;
}
.reportSectionTitle{
  font-size: 15px;
  font-weight: 800;
  margin: 16px 0 8px 0;
}
.reportMeta{
  display:flex;
  flex-wrap:wrap;
  gap:10px 14px;
  font-size: 12px;
  color:#111827;
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px 12px;
}
.reportMeta b{font-weight:800}
.reportNote{
  font-size: 11px;
  color:#4b5563;
  margin: 6px 0 10px 0;
}
.reportGrid2{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.reportKpis{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.reportKpi{
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px 12px;
  background:#ffffff;
}
.reportKpi .k{font-size:11px;color:#6b7280;margin-bottom:6px}
.reportKpi .v{font-size:18px;font-weight:800;color:#111827}
@media print{
  .reportPage{box-shadow:none !important}
}

/* Report images blocks */
.reportImg{
  border:1px solid #e5e7eb;
  border-radius:14px;
  background:#fff;
  padding:10px;
}
.reportMap img{width:100%; height:360px; object-fit:contain}
.reportChart img{width:100%; height:240px; object-fit:contain}

/* Sales list refined */
.salesHeader{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.02em;
}
.saleRow{font-size:12px}
.saleRow div{min-height:18px}


/* MotorImmo table */
#motorSection .tbl th, #motorSection .tbl td{white-space:normal}
.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:800;border:1px solid #2b3750}
.badge.ok{background:rgba(16,185,129,.12)}
.badge.warn{background:rgba(245,158,11,.14)}
.badge.bad{background:rgba(239,68,68,.12)}
.aLink{color:#22c55e;text-decoration:none;font-weight:800}
.aLink:hover{text-decoration:underline}


.subhead{
  font-weight:700;
  margin:6px 0 6px;
  color:#e8eefc;
}
.lbl{
  display:flex;
  align-items:center;
  gap:8px;
}
