:root {
  --bg: #EAF1FB; --card: #ffffff; --ink: #1C2530; --muted: #6B7686;
  --primary: #1E104C; --accent: #E30513;  /* marine et rouge du logo Leaseway */
  --up: #12915C; --down: #D6455D; --radius: 16px;
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--ink);
       font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 48px; }

header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.logo { height: 44px; }
header h1 { font-size: 20px; font-weight: 600; color: #1E104C; }
header .sub { color: var(--muted); font-size: 13px; margin-left: auto; text-align: right; }
nav { display: flex; gap: 4px; }

/* Menus deroulants (Performances / Automatisation), construits par menu.js */
.menu { position: relative; }
.menu-titre { font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  background: none; border: 0; border-radius: 999px; padding: 8px 14px;
  cursor: pointer; white-space: nowrap; }
.menu-titre.active { background: var(--primary); color: #fff; }
.menu-titre:not(.active):hover { background: #E3EAF7; }
.menu .fleche { font-size: 10px; opacity: .7; }
.menu-liste { display: none; position: absolute; top: calc(100% + 6px); left: 0;
  z-index: 30; min-width: 210px; padding: 6px; background: var(--card);
  border: 1px solid #E3E9F2; border-radius: 14px;
  box-shadow: 0 14px 40px rgba(28,37,48,.14); }
.menu.ouvert .menu-liste { display: block; }
.menu-liste a { display: block; font-size: 13px; color: var(--ink);
  text-decoration: none; padding: 9px 12px; border-radius: 9px; white-space: nowrap; }
.menu-liste a:hover { background: #EAF1FB; }
.menu-liste a.ici { color: var(--primary); font-weight: 600; }
.burger { display: none; font-size: 20px; background: none; border: 0;
          color: var(--ink); cursor: pointer; padding: 2px 6px; }
nav a { font-size: 13px; font-weight: 500; color: var(--ink); text-decoration: none;
        padding: 7px 13px; border-radius: 999px; }
nav a.active { background: var(--primary); color: #fff; }
nav a:not(.active):hover { background: radial-gradient(circle at var(--mx, 50%)
    var(--my, 50%), #9E0410 0%, var(--accent) 70%); color: #fff; }

.filters { background: var(--card); border-radius: var(--radius); padding: 14px 16px;
           display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
           box-shadow: 0 8px 24px rgba(28,37,48,.06); margin-bottom: 20px; }
.filters label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 3px; }
.filters select, .filters input { font: inherit; font-size: 13px; padding: 8px 10px;
    border: 1px solid #D7DFEC; border-radius: 10px; background: #fff; color: var(--ink);
    max-width: 190px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { font: inherit; font-size: 12.5px; font-weight: 500; padding: 8px 13px;
    border: 1px solid #D7DFEC; border-radius: 999px; background: #fff; color: var(--ink);
    cursor: pointer; }
.presets button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.spacer { flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
        gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 18px 20px;
       box-shadow: 0 8px 24px rgba(28,37,48,.06); }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 29px; font-weight: 700; margin: 4px 0 2px; }
.kpi .delta { font-size: 12.5px; font-weight: 600; min-height: 18px; }
.kpi .delta.up { color: var(--up); }
.kpi .delta.down { color: var(--down); }
.kpi .delta span { color: var(--muted); font-weight: 400; }
.kpi .note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px;
        box-shadow: 0 8px 24px rgba(28,37,48,.06); }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.chart-box { position: relative; height: 300px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
th { text-align: right; color: var(--muted); font-weight: 500; padding: 6px 8px;
     border-bottom: 1px solid #E5EBF5; }
th:first-child, td:first-child { text-align: left; }
td { padding: 7px 8px; text-align: right; border-bottom: 1px solid #F0F4FA; }
td:first-child { font-weight: 500; }

tr.cumul td { font-weight: 600; background: #F4F7FD; }
tr.premier td { background: #E7F6EE; font-weight: 600; }
tr.dernier td { background: #FDECEF; }
tr.apart td { color: var(--muted); font-style: italic; }
tr.total td { font-weight: 700; background: #E4EAFB; color: #1E104C; }
td.neg { color: var(--down); } td.pos { color: var(--up); }
td.att { color: #B45309; font-weight: 600; }  /* a surveiller (orange) */
th.tri { cursor: pointer; user-select: none; white-space: nowrap; }
th.tri:hover { color: var(--primary); }

/* Coche « traite » (relances) : le ✅ s'allume une fois la reponse traitee */
.coche { background: none; border: 0; font-size: 17px; line-height: 1;
         cursor: pointer; padding: 2px 4px; filter: grayscale(1); opacity: .3;
         transition: opacity .15s, filter .15s; }
.coche:hover { opacity: .7; }
.coche.fait { filter: none; opacity: 1; }

/* Boutons partages : exporter un tableau, lien vers la page d'import */
.exporter { font: inherit; font-size: 12.5px; font-weight: 500; padding: 9px 14px;
            border: 1px solid #D7DFEC; border-radius: 999px; background: #fff;
            color: var(--ink); cursor: pointer; }
.lien-import { font-size: 12px; color: var(--muted); border: 1px solid #D7DFEC;
               border-radius: 999px; padding: 6px 12px; text-decoration: none; }

/* Connexion / deconnexion */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--card); border-radius: var(--radius); padding: 36px 40px;
              box-shadow: 0 8px 24px rgba(28,37,48,.06); width: 360px; text-align: center; }
.login-card .logo { height: 52px; margin-bottom: 8px; }
.login-card h1 { font-size: 20px; font-weight: 600; color: #1E104C; margin-bottom: 4px; }
.login-intro { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-card form { text-align: left; }
.login-card label { font-size: 12px; color: var(--muted); display: block; margin: 12px 0 4px; }
.login-card input { width: 100%; font: inherit; font-size: 14px; padding: 10px 12px;
                    border: 1px solid #D7DFEC; border-radius: 10px; }
.login-card button { width: 100%; margin-top: 18px; font: inherit; font-weight: 600;
                     background: var(--primary); color: #fff; border: 0; border-radius: 10px;
                     padding: 11px; cursor: pointer; }
.logout button { font: inherit; font-size: 12px; color: var(--muted); background: none;
                 border: 1px solid #D7DFEC; border-radius: 999px; padding: 6px 12px;
                 cursor: pointer; }

/* Survol : rouge fonce sous la souris, degrade vers le rouge du logo
   (le point --mx/--my suit le curseur, cf. boutons.js) */
.presets button:hover, .logout button:hover, .login-card button:hover,
.exporter:hover, .lien-import:hover {
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
              #9E0410 0%, var(--accent) 70%);
  border-color: var(--accent); color: #fff; }

.foot { margin-top: 18px; color: var(--muted); font-size: 12px; }
.err { background: #FDECEF; color: var(--down); border-radius: var(--radius);
       padding: 14px 18px; margin-bottom: 16px; font-size: 13.5px; display: none; }
.warn { background: #FFF4E0; color: #92600A; border-radius: var(--radius);
        padding: 14px 18px; margin-bottom: 16px; font-size: 13.5px; display: none; }
.info { background: #FDECEF; color: #9E0410; border-radius: var(--radius);
        padding: 14px 18px; margin-bottom: 16px; font-size: 13.5px; }

/* Reporting actionnaires : trois ventilations cote a cote, empilees en mobile. */
.ventilations h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px;
                   color: var(--muted); }
@media (max-width: 900px) {
  .ventilations { grid-template-columns: 1fr !important; }
}

/* Bulle d'aide : le detail complet sans encombrer la page.
   Au survol ET au clavier (focus), pour rester atteignable sans souris. */
.aide { display: inline-flex; align-items: center; justify-content: center;
        width: 16px; height: 16px; margin-left: 6px; border-radius: 50%;
        background: #DCE6F8; color: var(--primary); font-size: 11px;
        font-weight: 700; cursor: help; position: relative;
        vertical-align: middle; font-style: normal; }
.aide .bulle { display: none; position: absolute; top: 22px; left: -4px;
               z-index: 30; width: min(360px, 70vw); padding: 10px 12px;
               border-radius: 10px; background: var(--ink); color: #fff;
               font-size: 12px; font-weight: 400; line-height: 1.55;
               text-align: left; box-shadow: 0 10px 28px rgba(28,37,48,.28); }
.aide:hover .bulle, .aide:focus .bulle, .aide:focus-within .bulle {
  display: block; }
/* Pres du bord droit, la bulle s'ancre a droite pour ne pas deborder. */
.aide.gauche .bulle { left: auto; right: -4px; }
