  /* ============ TOKENS ============ */
  :root{
    --bg:#ffffff;
    --surface:#ffffff;
    --surface-2:#f5f6fa;
    --surface-hover:#eef0f6;
    --border:#e3e7f0;
    --border-strong:#c7cee3;
    --text-primary:#0f1830;
    --text-secondary:#565f7a;
    --text-muted:#8791ac;

    --navy:#0d1b3e;
    --navy-2:#122552;
    --sidebar-text:#c7d0ec;
    --sidebar-text-dim:#7c88ae;
    --sidebar-active:#16305f;

    --blue:#1a4ab8;
    --blue-tint:#e8edfb;
    --teal:#04998c;
    --teal-tint:#e0f4f2;
    --amber:#a8660a;
    --amber-tint:#f9eede;
    --violet:#7451c9;
    --violet-tint:#efe9fb;
    --coral:#c94a5f;
    --coral-tint:#fbe9ec;

    --good:#1f9d55;
    --good-tint:#e5f7ec;
    --warning:#c2620c;
    --warning-tint:#faeed9;
    --critical:#d13438;
    --critical-tint:#fbe6e6;

    --focus:#1a4ab8;
    --shadow:none;
    --shadow-lg:0 12px 32px -8px rgba(15,24,48,.16);
    --radius:10px;
    --radius-sm:8px;

    --grad-brand:var(--blue);
    --grad-brand-soft:transparent;
    --grad-sidebar:var(--navy);
    --grad-header:transparent;
    --glow-brand:none;
  }

  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --bg:#0a1122;
      --surface:#101a33;
      --surface-2:#152244;
      --surface-hover:#1a2a52;
      --border:#26355e;
      --border-strong:#324671;
      --text-primary:#eef1fb;
      --text-secondary:#aab4d4;
      --text-muted:#7b87ab;

      --navy:#070e20;
      --navy-2:#0c1830;
      --sidebar-text:#c7d0ec;
      --sidebar-text-dim:#6c78a0;
      --sidebar-active:#182c58;

      --blue:#5b86e6;
      --blue-tint:rgba(91,134,230,.14);
      --teal:#1fa79a;
      --teal-tint:rgba(31,167,154,.14);
      --amber:#bd7f28;
      --amber-tint:rgba(189,127,40,.16);
      --violet:#9270d6;
      --violet-tint:rgba(146,112,214,.16);
      --coral:#d66b7d;
      --coral-tint:rgba(214,107,125,.16);

      --good:#3ecf7c;
      --good-tint:rgba(62,207,124,.14);
      --warning:#e2a13d;
      --warning-tint:rgba(226,161,61,.14);
      --critical:#ec5f63;
      --critical-tint:rgba(236,95,99,.14);

      --focus:#5b86e6;
      --shadow:none;
      --shadow-lg:0 12px 32px -8px rgba(0,0,0,.4);
      --radius:10px;
      --radius-sm:8px;

      --grad-brand:var(--blue);
      --grad-brand-soft:transparent;
      --grad-sidebar:var(--navy);
      --grad-header:transparent;
      --glow-brand:none;
    }
  }
  :root[data-theme="dark"]{
    --bg:#0a1122;
    --surface:#101a33;
    --surface-2:#152244;
    --surface-hover:#1a2a52;
    --border:#26355e;
    --border-strong:#324671;
    --text-primary:#eef1fb;
    --text-secondary:#aab4d4;
    --text-muted:#7b87ab;

    --navy:#070e20;
    --navy-2:#0c1830;
    --sidebar-text:#c7d0ec;
    --sidebar-text-dim:#6c78a0;
    --sidebar-active:#182c58;

    --blue:#5b86e6;
    --blue-tint:rgba(91,134,230,.14);
    --teal:#1fa79a;
    --teal-tint:rgba(31,167,154,.14);
    --amber:#bd7f28;
    --amber-tint:rgba(189,127,40,.16);
    --violet:#9270d6;
    --violet-tint:rgba(146,112,214,.16);
    --coral:#d66b7d;
    --coral-tint:rgba(214,107,125,.16);

    --good:#3ecf7c;
    --good-tint:rgba(62,207,124,.14);
    --warning:#e2a13d;
    --warning-tint:rgba(226,161,61,.14);
    --critical:#ec5f63;
    --critical-tint:rgba(236,95,99,.14);

    --focus:#5b86e6;
    --shadow:none;
    --shadow-lg:0 12px 32px -8px rgba(0,0,0,.4);
    --radius:10px;
    --radius-sm:8px;

    --grad-brand:var(--blue);
    --grad-brand-soft:transparent;
    --grad-sidebar:var(--navy);
    --grad-header:transparent;
    --glow-brand:none;
  }

  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--bg);
    color:var(--text-primary);
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;
    font-size:14.5px;
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
  }
  h1,h2,h3,h4{
    font-family:"Archivo",-apple-system,sans-serif;
    font-weight:700;
    letter-spacing:-.015em;
    text-wrap:balance;
    margin:0;
    color:var(--text-primary);
  }
  .mono{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums;}
  a{color:inherit;}
  button{font-family:inherit;}
  input,select,textarea{font-family:inherit;}
  ::selection{background:var(--blue-tint);}
  ::-webkit-scrollbar{width:9px;height:9px;}
  ::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:99px;}
  ::-webkit-scrollbar-track{background:transparent;}
  :focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:4px;}
  @media (prefers-reduced-motion: reduce){ *{animation-duration:.01ms !important; transition-duration:.01ms !important;} }

  /* ============ SHELL ============ */
  .app{display:flex;min-height:100vh;}

  .sidebar{
    width:248px;flex:0 0 248px;
    background:var(--grad-sidebar);
    color:var(--sidebar-text);
    display:flex;flex-direction:column;
    padding:20px 12px;
    position:sticky;top:0;height:100vh;
    overflow-y:auto;overscroll-behavior:contain;
    scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent;
    box-shadow:1px 0 0 rgba(255,255,255,.04) inset;
  }
  .sidebar::-webkit-scrollbar{width:7px;}
  .sidebar::-webkit-scrollbar-thumb{background:rgba(255,255,255,.16);border-radius:99px;}
  .sidebar::-webkit-scrollbar-track{background:transparent;}
  .brand{display:flex;align-items:center;gap:10px;padding:4px 10px 18px;}
  .brand-mark{
    width:36px;height:36px;border-radius:11px;flex:none;
    background:var(--grad-brand);
    display:flex;align-items:center;justify-content:center;
    font-family:"Archivo";font-weight:800;font-size:15px;color:#fff;
    box-shadow:0 0 0 1px rgba(255,255,255,.1) inset, var(--glow-brand);
  }
  .brand-name{font-family:"Archivo";font-weight:700;font-size:14.5px;color:#fff;line-height:1.2;}
  .brand-sub{font-size:11px;color:var(--sidebar-text-dim);letter-spacing:.03em;}

  .nav-group-label{
    font-size:10.5px;text-transform:uppercase;letter-spacing:.09em;
    color:var(--sidebar-text-dim);padding:14px 12px 5px;font-weight:600;
  }
  .nav-item{
    display:flex;align-items:center;gap:11px;
    padding:8px 12px;border-radius:10px;cursor:pointer;
    font-size:13.4px;font-weight:500;color:var(--sidebar-text);
    border:none;background:none;width:100%;text-align:left;
    transition:background .14s,color .14s,transform .14s;
  }
  .nav-item svg{flex:none;width:17px;height:17px;opacity:.85;}
  .nav-item:hover{background:rgba(255,255,255,.07);transform:translateX(1px);}
  .nav-item.active{background:var(--grad-brand);color:#fff;box-shadow:var(--glow-brand);}
  .nav-item.active svg{opacity:1;}
  .nav-item .count{
    margin-left:auto;font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:10.5px;
    background:rgba(255,255,255,.09);color:var(--sidebar-text-dim);
    padding:1px 6px;border-radius:5px;
  }
  .nav-item.active .count{background:rgba(255,255,255,.22);color:#fff;}

  .role-switch{position:relative;margin-top:auto;padding-top:12px;border-top:1px solid rgba(255,255,255,.08);}
  .sidebar-foot{
    width:100%;padding:10px;border:none;background:none;border-radius:9px;
    display:flex;align-items:center;gap:9px;text-align:left;cursor:pointer;color:inherit;
  }
  .sidebar-foot:hover{background:rgba(255,255,255,.07);}
  .sidebar-foot .chev{margin-left:auto;width:14px;height:14px;flex:none;opacity:.55;}
  .role-menu{
    position:absolute;bottom:calc(100% + 6px);left:0;right:0;
    background:var(--surface);border:1px solid var(--border);border-radius:10px;
    box-shadow:var(--shadow-lg);padding:6px;display:none;z-index:30;
  }
  .role-switch.open .role-menu{display:block;}
  .role-menu-label{
    font-size:10px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);padding:7px 9px 5px;
  }
  .role-opt{
    display:flex;align-items:center;gap:9px;width:100%;text-align:left;
    border:none;background:none;padding:7px 9px;border-radius:8px;cursor:pointer;
  }
  .role-opt:hover{background:var(--surface-hover);}
  .role-opt-name{font-size:12.8px;font-weight:600;color:var(--text-primary);}
  .role-opt-role{font-size:11px;color:var(--text-muted);}
  .role-opt .check{margin-left:auto;flex:none;width:15px;height:15px;color:var(--blue);opacity:0;}
  .role-opt.on .check{opacity:1;}
  .role-opt .avatar{width:26px;height:26px;font-size:10.5px;}
  .admin-only-note{
    display:inline-flex;align-items:center;gap:6px;
    background:var(--violet-tint);color:var(--violet);
    border-radius:6px;padding:3px 10px;font-size:11px;font-weight:600;
  }
  .avatar{
    width:30px;height:30px;border-radius:8px;background:var(--grad-brand);
    display:flex;align-items:center;justify-content:center;
    font-family:"Archivo";font-weight:700;font-size:12px;color:#fff;flex:none;
    box-shadow:0 0 0 1px rgba(255,255,255,.1) inset;
  }
  .sidebar-foot-name{font-size:12.5px;font-weight:600;color:#fff;}
  .sidebar-foot-role{font-size:10.8px;color:var(--sidebar-text-dim);}

  .main{flex:1;min-width:0;display:flex;flex-direction:column;}

  .topbar{
    position:sticky;top:0;z-index:20;
    display:flex;align-items:center;gap:14px;
    padding:15px 32px;background:var(--surface);background:color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
    border-bottom:1px solid var(--border);
  }

  /* ---- recherche globale ---- */
  .search{position:relative;flex:0 1 470px;min-width:150px;}
  .search-field{
    display:flex;align-items:center;gap:9px;
    background:var(--surface-2);border:1px solid var(--border);
    border-radius:10px;padding:8px 13px;
    transition:border-color .12s,box-shadow .12s,background .12s;
  }
  .search-field:focus-within{
    border-color:var(--focus);background:var(--surface);
    box-shadow:0 0 0 3px var(--blue-tint);
  }
  .search-field > svg{width:16px;height:16px;color:var(--text-muted);flex:none;}
  .search-field input{
    flex:1;min-width:0;border:none;background:none;outline:none;
    font-family:inherit;font-size:13.4px;color:var(--text-primary);
  }
  .search-field input::placeholder{color:var(--text-muted);}
  .kbd{
    flex:none;font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:10.5px;font-weight:500;line-height:1.5;
    color:var(--text-muted);background:var(--surface);
    border:1px solid var(--border);border-radius:6px;padding:1px 6px;
  }
  .search-results{
    position:absolute;top:calc(100% + 7px);left:0;right:0;
    background:var(--surface);border:1px solid var(--border);border-radius:10px;
    box-shadow:var(--shadow-lg);padding:6px;display:none;
    max-height:calc(100vh - 120px);overflow:auto;z-index:40;
  }
  .search.open .search-results{display:block;}
  .sr-group{
    font-size:10px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);padding:9px 10px 4px;
  }
  .sr-item{
    display:flex;align-items:center;gap:10px;width:100%;text-align:left;
    border:none;background:none;padding:7px 10px;border-radius:8px;cursor:pointer;
  }
  .sr-item:hover,.sr-item.hl{background:var(--surface-hover);}
  .sr-ico{
    width:27px;height:27px;border-radius:8px;flex:none;
    display:flex;align-items:center;justify-content:center;
    font-family:"Archivo";font-weight:700;font-size:11px;
  }
  .sr-body{min-width:0;}
  .sr-title{font-size:13px;font-weight:600;color:var(--text-primary);}
  .sr-title mark{background:var(--blue-tint);color:var(--blue);border-radius:3px;padding:0 1px;}
  .sr-sub{font-size:11.4px;color:var(--text-muted);}
  .sr-meta{
    margin-left:auto;flex:none;padding-left:10px;
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:11px;color:var(--text-secondary);
  }
  .sr-empty{padding:18px 10px;text-align:center;font-size:12.6px;color:var(--text-muted);}
  .sr-hint{
    border-top:1px solid var(--border);margin-top:5px;padding:8px 10px 3px;
    font-size:11px;color:var(--text-muted);display:flex;gap:14px;
  }

  .create-wrap{position:relative;flex:none;}
  .create-menu{
    position:absolute;top:calc(100% + 8px);right:0;min-width:262px;
    background:var(--surface);border:1px solid var(--border);border-radius:10px;
    box-shadow:var(--shadow-lg);padding:6px;display:none;z-index:60;
  }
  .create-wrap.open .create-menu{display:block;}
  .cm-label{
    font-size:10px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);padding:8px 10px 4px;
  }
  .cm-item{
    display:flex;align-items:center;gap:10px;width:100%;text-align:left;
    border:none;background:none;padding:8px 10px;border-radius:8px;cursor:pointer;
  }
  .cm-item:hover{background:var(--surface-hover);}
  .cm-ico{
    width:27px;height:27px;border-radius:8px;flex:none;
    display:flex;align-items:center;justify-content:center;
  }
  .cm-ico svg{width:14px;height:14px;}
  .cm-nom{font-size:13px;font-weight:600;color:var(--text-primary);}
  .cm-sub{font-size:11.3px;color:var(--text-muted);}
  .cm-sep{height:1px;background:var(--border);margin:5px 8px;}
  .btn-primary .caret{width:13px;height:13px;opacity:.8;margin-left:1px;}

  .topbar-date{
    margin-left:auto;flex:none;white-space:nowrap;
    font-size:12.8px;font-weight:600;color:var(--text-secondary);
  }

  /* ---- en-tete de page ---- */
  .content{position:relative;}
  .content::before{
    content:"";position:absolute;top:0;left:0;right:0;height:220px;
    background:none;pointer-events:none;z-index:0;
  }
  .content > *{position:relative;z-index:1;}
  .page-head{display:flex;align-items:flex-start;gap:14px;flex-wrap:wrap;margin-bottom:22px;}
  .page-head h1{font-size:26px;letter-spacing:-.015em;line-height:1.22;}
  .page-head-sub{font-size:13.2px;color:var(--text-muted);margin-top:5px;}
  .page-head-actions{margin-left:auto;display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
  .demo-pill{
    background:var(--amber-tint);color:var(--amber);border-radius:6px;
    padding:3px 10px;font-size:10.5px;letter-spacing:.03em;font-weight:600;
  }

  /* ---- bandeau de section ---- */
  .day-label{
    display:flex;align-items:center;gap:11px;margin:0 0 13px;
    font-size:11px;text-transform:uppercase;letter-spacing:.1em;font-weight:700;
    color:var(--text-muted);
  }
  .day-label::after{content:"";flex:1;height:1px;background:var(--border);}
  .analyse-period{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:18px;}
  .analyse-period-txt{
    font-size:12.3px;color:var(--text-secondary);font-weight:600;
    background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:6px 11px;
  }
  .analyse-period-label{
    font-size:11px;text-transform:uppercase;letter-spacing:.1em;
    font-weight:700;color:var(--text-muted);
  }
  .day-count{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;letter-spacing:0;text-transform:none;font-size:10.5px;
    background:var(--surface-2);color:var(--text-secondary);
    border-radius:5px;padding:2px 9px;
  }

  .period-switch{display:flex;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:3px;gap:1px;}
  .period-switch button{
    display:inline-flex;align-items:center;
    border:none;background:none;padding:7px 14px;border-radius:8px;font-size:12.5px;
    font-weight:600;color:var(--text-secondary);cursor:pointer;transition:background .14s,color .14s,box-shadow .14s;
  }
  .period-switch button.active{background:var(--grad-brand);color:#fff;box-shadow:var(--glow-brand);}

  /* interrupteur inclure / exclure les brocantes */
  .broc-switch{
    display:inline-flex;align-items:center;gap:9px;cursor:pointer;
    background:var(--surface);border:1px solid var(--border);border-radius:10px;
    padding:5px 14px 5px 6px;font-family:inherit;font-size:12.5px;font-weight:600;
    color:var(--text-secondary);transition:border-color .14s,color .14s;
  }
  .broc-switch:hover{border-color:var(--border-strong);color:var(--text-primary);}
  .broc-track{
    position:relative;width:34px;height:19px;border-radius:99px;flex:none;
    background:var(--surface-2);border:1px solid var(--border);
    transition:background .16s,border-color .16s;
  }
  .broc-knob{
    position:absolute;top:1.5px;left:2px;width:14px;height:14px;border-radius:50%;
    background:var(--text-muted);transition:transform .16s,background .16s;
  }
  .broc-switch .broc-txt{white-space:nowrap;}
  .broc-switch.on{border-color:var(--coral);color:var(--coral);}
  .broc-switch.on .broc-track{background:var(--coral-tint);border-color:var(--coral);}
  .broc-switch.on .broc-knob{background:var(--coral);transform:translateX(15px);}

  .icon-btn{
    width:34px;height:34px;border-radius:10px;border:1px solid var(--border);
    background:var(--surface);display:flex;align-items:center;justify-content:center;
    cursor:pointer;color:var(--text-secondary);flex:none;
    transition:background .14s,color .14s,transform .14s,box-shadow .14s;
  }
  .icon-btn:hover{background:var(--surface-hover);color:var(--text-primary);transform:translateY(-1px);box-shadow:var(--shadow);}

  .icon-btn svg{width:16px;height:16px;}

  /* ---- menu réglages ("...") ---- */
  .settings-wrap{position:relative;flex:none;}
  .settings-menu{
    position:absolute;top:calc(100% + 8px);right:0;width:220px;
    background:var(--surface);border:1px solid var(--border);border-radius:10px;
    box-shadow:var(--shadow-lg);padding:6px;display:none;z-index:60;
  }
  .settings-wrap.open .settings-menu{display:block;}
  .settings-item{
    display:flex;align-items:center;gap:10px;width:100%;text-align:left;
    border:none;background:none;padding:9px 10px;border-radius:8px;cursor:pointer;
    font-family:inherit;font-size:13px;font-weight:500;color:var(--text-primary);
  }
  .settings-item:hover{background:var(--surface-hover);}
  .settings-item.fige{cursor:default;}
  .settings-item.fige:hover{background:none;}
  /* le HT annonce, le TTC conclut : c'est lui que le client paie */
  .ht{display:block;font-size:10.5px;font-weight:400;color:var(--text-muted);opacity:.9;margin-bottom:1px;letter-spacing:0;}
  .ttc{font-weight:700;color:var(--text-primary);}
  .ttc-lbl{font-weight:inherit;color:inherit;opacity:1;}
  .settings-item svg{width:16px;height:16px;flex:none;color:var(--text-muted);}
  .settings-item span:first-of-type{flex:1;}
  .settings-switch{
    flex:none;width:30px;height:18px;border-radius:99px;background:var(--border-strong);
    position:relative;transition:background .15s;
  }
  .settings-switch-knob{
    position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:99px;
    background:#fff;transition:transform .15s;box-shadow:0 1px 2px rgba(0,0,0,.25);
  }
  .settings-item.on .settings-switch{background:var(--good);}
  .settings-item.on .settings-switch-knob{transform:translateX(12px);}

  .btn-primary{
    display:inline-flex;align-items:center;gap:7px;
    background:var(--grad-brand);color:#fff;border:none;border-radius:10px;
    padding:9px 16px;font-size:13px;font-weight:600;cursor:pointer;
    box-shadow:var(--glow-brand);white-space:nowrap;
    transition:filter .14s,transform .14s,box-shadow .14s;
  }
  .btn-primary:hover{filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 14px 28px -10px rgba(41,84,214,.5);}
  .btn-primary:active{transform:translateY(0);}
  .btn-primary svg{width:15px;height:15px;}

  .content{padding:30px 32px 64px;}
  .view{display:none;}
  .view.active{display:block;animation:fade .25s ease;}
  @keyframes fade{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:none;}}

  .section-head{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin:34px 0 14px;}
  .section-head:first-child{margin-top:0;}
  .section-head h2{font-size:16.5px;}
  .section-head p{margin:2px 0 0;color:var(--text-muted);font-size:12.5px;}
  .section-head-actions{display:flex;gap:8px;flex:none;}

  /* ============ CARD / GRID PRIMITIVES ============ */
  .card{
    background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius);box-shadow:var(--shadow);
    transition:box-shadow .16s,border-color .16s;
  }
  .grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;}
  .grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;}
  .grid-2{display:grid;grid-template-columns:1.3fr 1fr;gap:14px;}
  .grid-2-even{display:grid;grid-template-columns:1fr 1fr;gap:14px;}
  @media (max-width:1080px){.grid-4{grid-template-columns:repeat(2,1fr);} .grid-2,.grid-2-even{grid-template-columns:1fr;}}

  /* stat tiles */
  .stat{
    padding:20px 20px 18px;display:flex;flex-direction:column;gap:10px;
    position:relative;overflow:hidden;
  }
  .stat::before{
    content:"";position:absolute;left:0;right:0;bottom:0;height:3px;
    background:var(--accent,var(--blue));pointer-events:none;
  }
  /* répartition de la fidélité, sous le total clients */
  .fid-bar{display:flex;height:7px;border-radius:99px;overflow:hidden;background:var(--surface-2);gap:2px;}
  .fid-bar span{display:block;height:100%;}
  .fid-leg{display:flex;flex-wrap:wrap;gap:4px 10px;font-size:11.2px;color:var(--text-secondary);}
  .fid-leg b{font-weight:700;color:var(--text-primary);}
  .fid-leg i{display:inline-block;width:7px;height:7px;border-radius:99px;margin-right:5px;vertical-align:middle;}
  .stat-top{display:flex;align-items:center;justify-content:space-between;}
  .stat-label{font-size:12px;color:var(--text-secondary);font-weight:600;}
  .stat-icon{width:30px;height:30px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex:none;box-shadow:0 0 0 1px rgba(255,255,255,.06) inset;}
  .stat-icon svg{width:15px;height:15px;}
  .stat-value{font-family:"Archivo";font-weight:800;font-size:26px;letter-spacing:-.015em;}
  .stat-delta{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;width:fit-content;padding:2px 7px 2px 6px;border-radius:6px;}
  .stat-delta svg{width:10px;height:10px;}
  .up{color:var(--good);background:var(--good-tint);}
  .down{color:var(--critical);background:var(--critical-tint);}
  .flat{color:var(--text-secondary);background:var(--surface-2);}

  /* pills / badges */
  .pill{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;padding:3px 9px;border-radius:6px;white-space:nowrap;}
  .pill svg{width:9px;height:9px;}
  .pill.dot::before{content:"";width:6px;height:6px;border-radius:99px;background:currentColor;}
  .pill-good{color:var(--good);background:var(--good-tint);}
  .pill-warning{color:var(--warning);background:var(--warning-tint);}
  .pill-critical{color:var(--critical);background:var(--critical-tint);}
  .pill-blue{color:var(--blue);background:var(--blue-tint);}
  .pill-teal{color:var(--teal);background:var(--teal-tint);}
  .pill-amber{color:var(--amber);background:var(--amber-tint);}
  .pill-violet{color:var(--violet);background:var(--violet-tint);}
  .pill-coral{color:var(--coral);background:var(--coral-tint);}
  .pill-muted{color:var(--text-secondary);background:var(--surface-2);}

  /* tables */
  .table-wrap{overflow-x:auto;border-radius:var(--radius);}
  table{width:100%;border-collapse:collapse;font-size:13.4px;min-width:640px;}
  thead th{
    text-align:left;font-size:10.8px;text-transform:uppercase;letter-spacing:.07em;
    color:var(--text-muted);font-weight:600;padding:14px 20px;
    background:var(--surface-2);
    border-bottom:1px solid var(--border);white-space:nowrap;
  }
  thead th:first-child{border-top-left-radius:var(--radius);}
  thead th:last-child{border-top-right-radius:var(--radius);}
  tbody td{padding:16px 20px;border-bottom:1px solid var(--border);vertical-align:middle;line-height:1.45;}
  td.date-longue{white-space:nowrap;}
  td.adresse{max-width:none;white-space:nowrap;}
  td.cell-types{white-space:nowrap;}
  .types-groupe{
    display:inline-flex;align-items:center;gap:6px;cursor:pointer;
    border-radius:6px;padding:3px 6px 3px 3px;margin:-3px -6px -3px -3px;
    transition:background .12s;
  }
  .types-groupe:hover{background:var(--surface-2);}
  .types-plus{
    font-size:11px;font-weight:700;color:var(--text-secondary);
    background:var(--surface-2);border:1px solid var(--border-strong);
    border-radius:5px;padding:1px 7px;white-space:nowrap;transition:all .12s;
  }
  .types-groupe:hover .types-plus{background:var(--blue-tint);border-color:var(--blue);color:var(--blue);}
  .types-chev{width:11px;height:11px;flex:none;color:var(--text-muted);opacity:0;transition:opacity .12s;}
  .types-groupe:hover .types-chev{opacity:.8;}
  .pm-sous{font-weight:600;text-transform:none;letter-spacing:0;opacity:.75;}
  .pm-tag{
    margin-left:auto;font-size:9.5px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;
    color:var(--blue);background:var(--blue-tint);border-radius:5px;padding:2px 7px;flex:none;
  }
  .mg-types{display:grid;grid-template-columns:repeat(auto-fit,minmax(148px,1fr));gap:8px;}
  @media (max-width:620px){ .mg-types{grid-template-columns:1fr 1fr;} }
  .mg-type{
    display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;min-width:0;
    border:1px solid var(--border-strong);background:var(--surface);
    border-radius:10px;height:38px;padding:0 12px;font-size:12.6px;color:var(--text-primary);
    transition:border-color .12s,background .12s,color .12s;
  }
  .mg-type span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .mg-type input{
    appearance:none;-webkit-appearance:none;margin:0;flex:none;
    width:15px;height:15px;border:1.6px solid var(--border-strong);border-radius:5px;
    background:var(--surface);cursor:pointer;position:relative;
  }
  .mg-type input:checked{background:var(--blue);border-color:var(--blue);}
  .mg-type input:checked::after{
    content:"";position:absolute;left:4.2px;top:1px;width:3.5px;height:8px;
    border:solid #fff;border-width:0 2px 2px 0;transform:rotate(42deg);
  }
  .mg-type:has(input:checked){border-color:var(--blue);background:var(--blue-tint);color:var(--blue);}
  tbody tr:last-child td{border-bottom:none;}
  tbody tr:hover td{background:var(--surface-hover);}
  td.num, th.num{text-align:right;font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap;}
  td.mono{white-space:nowrap;}
  td .pill{white-space:nowrap;}
  /* pastilles modifiables directement dans le tableau */
  .pill-modifiable{cursor:pointer;padding-right:19px;position:relative;transition:box-shadow .12s;}
  .pill-modifiable::after{
    content:"";position:absolute;right:7px;top:50%;margin-top:-1px;
    border-left:3.5px solid transparent;border-right:3.5px solid transparent;
    border-top:4px solid currentColor;opacity:.5;
  }
  .pill-modifiable:hover{box-shadow:0 0 0 2px var(--blue-tint);}
  .pill-modifiable:hover::after{opacity:1;}
  .pill-menu{
    position:fixed;z-index:80;display:none;min-width:200px;max-height:320px;overflow-y:auto;
    background:var(--surface);border:1px solid var(--border-strong);border-radius:10px;
    box-shadow:var(--shadow-lg);padding:5px;
  }
  .pill-menu.show{display:block;}
  .pill-menu .pm-titre{
    font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;
    color:var(--text-muted);padding:6px 9px 8px;
  }
  .pill-menu button{
    display:flex;align-items:center;gap:7px;width:100%;text-align:left;
    background:none;border:0;border-radius:8px;padding:6px 8px;cursor:pointer;font-family:inherit;
  }
  .pill-menu button:hover{background:var(--surface-hover);}
  .pill-menu button.actif{background:var(--surface-2);}
  .pill-menu button + .pm-titre{margin-top:4px;border-top:1px solid var(--border);padding-top:9px;}
  .pill-menu .pm-aucun + .pm-titre{margin-top:4px;border-top:1px solid var(--border);padding-top:9px;}
  .pill-menu .pm-ico{width:13px;height:13px;flex:none;opacity:.65;}
  .pill-menu button:hover .pm-ico{opacity:1;}
  .pill-menu .pm-coche{width:11px;flex:none;font-size:11px;color:var(--blue);opacity:0;}
  .pill-menu button.actif .pm-coche{opacity:1;}
  th.sortable-th{cursor:pointer;user-select:none;-webkit-user-select:none;}
  th.sortable-th:hover{color:var(--text-primary);background:var(--surface-hover);}
  th.sortable-th .th-inner{display:inline-flex;align-items:center;gap:5px;}
  th.num.sortable-th .th-inner{flex-direction:row-reverse;}
  .sort-arrow{display:inline-flex;flex-direction:column;gap:1px;flex:none;}
  .sort-arrow svg{width:8px;height:8px;display:block;color:var(--text-muted);opacity:.4;}
  th.sortable-th.sorted-asc .sort-arrow svg.chev-up,
  th.sortable-th.sorted-desc .sort-arrow svg.chev-down{opacity:1;color:var(--blue);}
  .cell-primary{font-weight:600;color:var(--text-primary);}
  .cell-sub{font-size:11.5px;color:var(--text-muted);margin-top:1px;}
  #devis-table .cell-sub, #fac-table .cell-sub, #cli-table .cell-sub{max-width:250px;line-height:1.4;}
  td.adresse{max-width:240px;line-height:1.4;color:var(--text-secondary);}
  /* Colonne Documents : le devis puis la facture, l'un sous l'autre. */
  .doc-cell{display:flex;flex-direction:column;align-items:flex-start;gap:5px;}
  .doc-cell-large{flex-direction:row;flex-wrap:wrap;gap:8px;}
  .doc-so{color:var(--text-muted);}
  td.doc-col{text-align:center;}
  /* Document manquant dans le suivi croisé : pas une alerte rouge, juste une
     invitation grise à l'ajouter. */
  .doc-ajout{
    display:inline-flex;align-items:center;gap:5px;border:1px dashed var(--border);
    background:none;color:var(--text-muted);font-family:inherit;font-size:11.5px;font-weight:600;
    padding:4px 9px;border-radius:7px;cursor:pointer;transition:color .12s,border-color .12s,background .12s;
  }
  .doc-ajout svg{width:11px;height:11px;flex:none;}
  .doc-ajout:hover{color:var(--text-primary);border-color:var(--text-muted);background:var(--surface-hover);}
  #doc-table tbody tr{cursor:pointer;}
  th.doc-col{text-align:center;}
  .table-comment{width:100%;min-width:120px;border:1px solid transparent;background:transparent;padding:6px 8px;border-radius:7px;font-size:12.5px;color:var(--text-primary);font-family:inherit;}
  .table-comment:hover{background:var(--surface-2);}
  .table-comment:focus{background:var(--surface);border-color:var(--border-strong);outline:none;}
  .table-comment::placeholder{color:var(--text-muted);}

  /* filter pills row */
  .filter-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px;}
  .filter-pill{
    display:inline-flex;align-items:center;gap:7px;
    border:1px solid var(--border);background:var(--surface);color:var(--text-secondary);
    font-size:12.5px;font-weight:600;padding:7px 13px;border-radius:8px;cursor:pointer;
    transition:background .14s,color .14s,border-color .14s,box-shadow .14s;
  }
  .filter-pill:hover{border-color:var(--border-strong);color:var(--text-primary);}
  .filter-pill .n{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:10.8px;font-weight:600;
    background:var(--surface-2);color:var(--text-secondary);
    border-radius:5px;padding:1px 7px;
  }
  .filter-pill.active .n{background:rgba(255,255,255,.24);color:#fff;}

  /* ---- journal d'activite ---- */
  .act-select{
    appearance:none;-webkit-appearance:none;-moz-appearance:none;
    border:1px solid var(--border);background:var(--surface);color:var(--text-secondary);
    font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;
    border-radius:8px;padding:8px 30px 8px 14px;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat:no-repeat;background-position:right 10px center;background-size:11px;
    transition:border-color .14s,color .14s;
  }
  .act-select:hover{border-color:var(--border-strong);color:var(--text-primary);}
  .act-day{
    border:1px solid var(--border);border-radius:10px;background:var(--surface);
    box-shadow:var(--shadow);margin-bottom:10px;overflow:hidden;
  }
  .act-day > summary{
    list-style:none;cursor:pointer;user-select:none;
    display:flex;align-items:center;gap:9px;padding:14px 18px;
    font-size:13.5px;font-weight:700;color:var(--text-primary);
  }
  .act-day > summary::-webkit-details-marker{display:none;}
  .act-day-chev{width:13px;height:13px;flex:none;color:var(--text-muted);transition:transform .15s;}
  .act-day[open] > summary .act-day-chev{transform:rotate(90deg);}
  .act-day-n{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:10.8px;font-weight:600;
    background:var(--surface-2);color:var(--text-secondary);
    border-radius:5px;padding:1px 8px;
  }
  .act-day-list{display:flex;flex-direction:column;}
  .act-row{
    display:flex;align-items:flex-start;gap:11px;
    padding:11px 18px 11px 41px;border-top:1px solid var(--border);
  }
  .act-dot{width:7px;height:7px;border-radius:50%;flex:none;margin-top:7px;}
  .act-row-main{flex:1;font-size:13px;color:var(--text-secondary);line-height:1.55;}
  .act-row-main b{font-weight:700;color:var(--text-primary);}
  .act-row-who{color:var(--text-muted);}
  .act-row-time{font-size:11.5px;color:var(--text-muted);flex:none;white-space:nowrap;padding-top:1px;}

  /* ---- export : cartes façon SMP Drive ---- */
  .exp-card{border-bottom:1px solid var(--border);padding:18px 0;}
  #exp-cases .exp-card:first-child{padding-top:2px;}
  .exp-card:last-child{border-bottom:none;padding-bottom:2px;}
  .exp-card-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:12px;}
  .exp-check{
    width:20px;height:20px;border-radius:6px;flex:none;margin-top:1px;
    border:1.5px solid var(--border-strong);background:var(--surface);
    display:flex;align-items:center;justify-content:center;cursor:pointer;
    transition:background .14s,border-color .14s;
  }
  .exp-check svg{width:12px;height:12px;color:#fff;opacity:0;transition:opacity .1s;}
  .exp-check.checked{background:var(--grad-brand);border-color:transparent;}
  .exp-check.checked svg{opacity:1;}
  .exp-card-title{font-size:13.5px;font-weight:700;color:var(--text-primary);cursor:pointer;user-select:none;display:flex;align-items:center;gap:8px;}
  .exp-fmt{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:9.5px;font-weight:600;letter-spacing:.03em;
    color:var(--text-secondary);background:var(--surface-2);border-radius:5px;padding:2px 6px;
  }
  .exp-fmt-pdf{color:var(--violet);background:var(--violet-tint);}
  .exp-card-sub{font-size:11.8px;color:var(--text-muted);margin-top:2px;}
  .exp-card-simple .exp-card-head{margin-bottom:0;}
  .exp-tabs{
    display:flex;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;
    padding:3px;gap:1px;width:100%;box-sizing:border-box;margin-left:32px;width:calc(100% - 32px);
  }
  .exp-tabs button{
    border:none;background:none;padding:7px 15px;border-radius:6px;font-size:12px;
    font-weight:600;color:var(--text-secondary);cursor:pointer;transition:background .14s,color .14s;
  }
  .exp-tabs button.active{background:var(--grad-brand);color:#fff;box-shadow:var(--glow-brand);}
  .exp-tab-panel{
    margin:10px 0 0 32px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;
    font-size:12px;color:var(--text-secondary);
  }
  .exp-foot{
    display:flex;align-items:center;justify-content:space-between;gap:14px;
    margin-top:16px;padding-top:16px;border-top:1px solid var(--border);
  }
  .exp-foot-txt{font-size:12.5px;color:var(--text-muted);}

  .filter-bar{
    display:flex;flex-wrap:wrap;gap:4px;align-items:center;
    background:var(--surface);border:1px solid var(--border);
    border-radius:10px;padding:6px;margin-bottom:14px;box-shadow:var(--shadow);
  }
  .filter-bar select,.filter-bar input{
    border:1px solid transparent;background:var(--surface-2);border-radius:8px;
    padding:9px 13px;font-family:inherit;font-size:12.8px;color:var(--text-primary);
    outline:none;transition:border-color .12s,box-shadow .12s,background .12s;
  }
  .filter-bar select:focus,.filter-bar input:focus{
    border-color:var(--focus);background:var(--surface);box-shadow:0 0 0 3px var(--blue-tint);
  }
  .filter-bar select,.filter-bar input{padding:8px 12px;font-size:12.6px;}
  .filter-bar .fb-search{flex:1 1 180px;min-width:150px;}
  .filter-bar .fb-date{width:132px;flex:none;}
  .filter-bar .fb-sep{width:1px;align-self:stretch;background:var(--border);margin:0 2px;}
  .filter-bar .fb-lbl{font-size:11.5px;font-weight:600;color:var(--text-muted);}
  .fb-reset{
    margin-left:auto;border:none;background:none;cursor:pointer;
    font-family:inherit;font-size:12.5px;font-weight:600;color:var(--text-muted);
    padding:8px 10px;border-radius:8px;
  }
  .fb-reset:hover{background:var(--surface-hover);color:var(--text-primary);}
  .source-strip{
    display:flex;align-items:flex-start;gap:11px;
    background:var(--surface);border:1px solid var(--border);border-left:3px solid var(--teal);
    border-radius:var(--radius);padding:13px 15px;margin-bottom:16px;
    font-size:12.8px;color:var(--text-secondary);line-height:1.55;
  }
  .source-strip > svg{width:17px;height:17px;flex:none;color:var(--teal);margin-top:1px;}
  .source-strip strong{color:var(--text-primary);}
  .source-sync{
    margin-left:auto;flex:none;white-space:nowrap;font-size:11.5px;
    color:var(--text-muted);font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;padding-left:14px;
  }
  .lien-pdf{
    border:none;background:none;padding:0;cursor:pointer;font:inherit;
    color:var(--blue);font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:12.6px;
    display:inline-flex;align-items:center;gap:5px;white-space:nowrap;
  }
  .lien-pdf:hover{text-decoration:underline;}
  .lien-pdf.vide{color:var(--text-muted);text-decoration:underline dotted;text-underline-offset:3px;}
  .lien-pdf.vide svg{opacity:.5;}
  .lien-pdf.joint{color:var(--blue);font-weight:600;}
  /* Le champ fichier natif aligne mal son bouton et son nom de fichier : on
     en fait une boîte flex à hauteur fixe, et on habille le bouton comme les
     autres boutons du logiciel. */
  .field input[type="file"]{
    display:flex;align-items:center;
    height:44px;min-height:44px;padding:0 10px;line-height:1;
    font-size:12.2px;background:var(--surface-2);
    border-style:dashed;cursor:pointer;
  }
  .field input[type="file"]::file-selector-button{
    height:30px;padding:0 13px;margin:0 11px 0 0;
    border:1px solid var(--border-strong);border-radius:8px;
    background:var(--surface);color:var(--text-primary);
    font-family:inherit;font-size:12.2px;font-weight:600;cursor:pointer;
  }
  .field input[type="file"]::file-selector-button:hover{background:var(--surface-hover);}
  .field .aide{font-size:11.3px;color:var(--text-muted);}
  .lu-pdf{
    display:none;gap:8px;align-items:flex-start;margin:-4px 0 12px;
    background:var(--good-tint);border-radius:12px;padding:9px 11px;
    font-size:11.8px;color:var(--good);line-height:1.5;
  }
  .lu-pdf.on{display:flex;}

  .modal.large{width:660px;}
  .dropzone{
    border:2px dashed var(--border-strong);border-radius:10px;
    padding:30px 20px;text-align:center;cursor:pointer;
    color:var(--text-secondary);background:var(--surface-2);
    transition:border-color .12s,background .12s;
  }
  .dropzone:hover,.dropzone.over{border-color:var(--focus);background:var(--blue-tint);color:var(--text-primary);}
  .dropzone svg{width:28px;height:28px;color:var(--text-muted);margin-bottom:8px;}
  .dropzone b{display:block;font-size:14px;color:var(--text-primary);margin-bottom:4px;}
  .dropzone span{font-size:12.3px;}
  .imp-liste{display:flex;flex-direction:column;gap:9px;margin-top:12px;max-height:46vh;overflow-y:auto;}
  .imp-item{border:1px solid var(--border);border-radius:11px;padding:11px 12px;background:var(--surface-2);}
  .imp-item.err{border-color:var(--warning);}
  .imp-tete{display:flex;align-items:center;gap:8px;margin-bottom:9px;}
  .imp-tete select{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:7px;padding:4px 8px;font-size:12px;font-family:inherit;font-weight:600;
  }
  .imp-nom{
    margin-left:auto;font-size:11.2px;color:var(--text-muted);
    max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }
  .imp-retirer{
    border:none;background:none;cursor:pointer;color:var(--text-muted);
    font-size:13px;padding:2px 5px;border-radius:6px;flex:none;
  }
  .imp-retirer:hover{background:var(--critical-tint);color:var(--critical);}
  .imp-grille{display:grid;grid-template-columns:1fr 1fr;gap:9px;}
  .imp-grille label{display:flex;flex-direction:column;gap:4px;font-size:10.6px;font-weight:600;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.04em;}
  .imp-grille input,.imp-grille select{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:7px;padding:7px 9px;font-size:12.6px;font-family:inherit;
  }
  #imp-valider:disabled{opacity:.45;cursor:not-allowed;}

  /* ---- aperçu PDF ---- */
  .pdf-overlay{align-items:stretch;justify-content:center;padding:22px;}
  .pdf-modal{
    background:var(--surface);border:1px solid var(--border);border-radius:10px;
    box-shadow:var(--shadow-lg);width:min(1000px,100%);max-height:100%;
    display:flex;flex-direction:column;overflow:hidden;
  }
  .pdf-tete{
    display:flex;align-items:center;gap:12px;flex-wrap:wrap;
    padding:11px 15px;border-bottom:1px solid var(--border);background:var(--surface);
  }
  .pdf-titre{min-width:0;flex:1 1 160px;}
  .pdf-titre strong{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:13.5px;color:var(--text-primary);}
  .pdf-titre span{
    display:block;font-size:11.4px;color:var(--text-muted);
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }
  .pdf-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;flex:none;}
  .pdf-actions .btn-ghost{padding:7px 12px;font-size:12.5px;text-decoration:none;}
  .pdf-zoom{
    display:inline-flex;align-items:center;
    border:1px solid var(--border);border-radius:9px;background:var(--surface-2);
  }
  .pdf-zoom button{
    border:none;background:none;cursor:pointer;padding:6px 11px;
    font-size:15px;line-height:1;color:var(--text-secondary);
  }
  .pdf-zoom button:hover{color:var(--text-primary);}
  .pdf-zoom span{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:11.3px;color:var(--text-secondary);
    min-width:46px;text-align:center;
  }
  .pdf-corps{
    flex:1;min-height:0;overflow:auto;background:var(--surface-2);
    padding:16px;display:flex;flex-direction:column;align-items:center;gap:14px;
  }
  .pdf-corps canvas{max-width:100%;background:#fff;border-radius:5px;box-shadow:var(--shadow);}
  .pdf-msg{padding:48px 22px;text-align:center;font-size:13px;color:var(--text-muted);line-height:1.7;}
  @media (max-width:820px){
    .pdf-overlay{padding:0;}
    .pdf-modal{border-radius:0;border:none;width:100%;height:100%;}
    .pdf-corps{padding:10px;}
    .pdf-actions .txt{display:none;}
    .pdf-actions .btn-ghost{padding:7px 10px;}
  }
  @media (max-width:520px){
    .pdf-tete{padding:9px 11px;gap:8px;}
    .pdf-titre{flex:1 1 100%;}
  }

  /* ---- fiche client ---- */
  .modal.fiche{width:760px;padding:0;}
  .fiche-tete{
    position:sticky;top:0;z-index:2;background:var(--surface);
    display:flex;align-items:center;gap:12px;
    padding:20px 22px 14px;border-bottom:1px solid var(--border);
    border-radius:10px 10px 0 0;
  }
  .fiche-tete h3{font-size:18px;display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
  .fiche-retour{
    flex:none;width:32px;height:32px;border-radius:8px;
    border:1px solid var(--border);background:var(--surface-2);cursor:pointer;
    color:var(--text-secondary);display:flex;align-items:center;justify-content:center;
  }
  .fiche-retour svg{width:16px;height:16px;}
  .fiche-retour:hover{background:var(--surface-hover);color:var(--text-primary);}
  .fiche-souspart{
    font-size:10.5px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);padding-bottom:7px;border-bottom:1px solid var(--border);margin:20px 0 11px;
  }
  .fiche-souspart:first-child{margin-top:2px;}
  .fiche-item-lien{cursor:pointer;transition:border-color .12s,background .12s;}
  .fiche-item-lien:hover{border-color:var(--blue);background:var(--surface-hover);}
  .fiche-lien-txt{color:var(--blue);cursor:pointer;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:2px;transition:text-decoration-color .12s;}
  .fiche-lien-txt:hover{text-decoration-color:var(--blue);}
  tr[data-fiche-row]{cursor:pointer;}
  .fiche-fermer{
    margin-left:auto;flex:none;width:32px;height:32px;border-radius:8px;
    border:1px solid var(--border);background:var(--surface-2);cursor:pointer;
    color:var(--text-secondary);font-size:15px;line-height:1;
  }
  .fiche-fermer:hover{background:var(--surface-hover);color:var(--text-primary);}
  #fiche-corps{padding:4px 22px 20px;}
  .fiche-sect{margin-top:20px;}
  .fiche-n{
    margin-left:auto;
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;letter-spacing:0;font-size:10px;
    background:var(--surface-2);color:var(--text-secondary);border-radius:5px;padding:1px 7px;
  }
  details.fiche-sect .fiche-n{margin-left:0;}
  .fiche-bloc{margin-top:18px;}
  .fiche-grille{display:grid;grid-template-columns:1fr 1fr;gap:13px 18px;}
  .fiche-grille > div, .fiche-grille > label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-primary);}
  .fiche-lbl{font-size:11.5px;font-weight:600;color:var(--text-secondary);}
  .fiche-champ{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:10px;padding:9px 11px;font-family:inherit;font-size:13px;outline:none;width:100%;
  }
  .fiche-champ:focus{border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);}
  select.fiche-champ{height:38px;padding:0 10px;}
  .fiche-edit-note{
    display:flex;align-items:center;gap:8px;margin:14px 0 2px;padding:9px 12px;
    background:var(--blue-tint);color:var(--blue);border-radius:9px;font-size:12px;font-weight:600;
  }
  .fiche-val{font-size:13.5px;color:var(--text-primary);padding:2px 0;}
  .fiche-val.fiche-lien-txt{color:var(--blue);cursor:pointer;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:2px;transition:text-decoration-color .12s;}
  .fiche-val.fiche-lien-txt:hover{text-decoration-color:var(--blue);}
  .fiche-adresse{display:flex;flex-direction:column;gap:4px;margin-top:12px;font-size:13px;}
  .fiche-tuiles{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-top:16px;}
  .fiche-tuile{
    display:flex;flex-direction:column;gap:3px;
    border:1px solid var(--border);border-radius:10px;padding:13px 15px;background:var(--surface-2);
  }
  .fiche-tuile strong{font-size:21px;color:var(--text-primary);}
  .fiche-val-fort{font-size:17px;font-weight:700;}
  .fiche-grille .pill{align-self:flex-start;margin-top:1px;}
  td.cli-fid{white-space:nowrap;}
  .fiche-sub{font-size:11.5px;color:var(--text-muted);}
  details.fiche-sect > summary{
    list-style:none;cursor:pointer;user-select:none;
    display:flex;align-items:center;gap:8px;
    font-size:10.5px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);padding-bottom:7px;border-bottom:1px solid var(--border);
  }
  details.fiche-sect > summary::-webkit-details-marker{display:none;}
  details.fiche-sect > summary:hover{color:var(--text-primary);}
  .fiche-chev{width:13px;height:13px;flex:none;transition:transform .15s;}
  details.fiche-sect[open] > .fiche-chev, details.fiche-sect[open] > summary .fiche-chev{transform:rotate(90deg);}
  details.fiche-sect > *:not(summary){margin-top:11px;}
  .fiche-liste{display:flex;flex-direction:column;gap:9px;}
  .fiche-item{
    border:1px solid var(--border);border-radius:10px;padding:10px 11px;background:var(--surface-2);
  }
  .fiche-item-h{display:flex;align-items:center;gap:8px;font-size:12.6px;}
  .fiche-montant{margin-left:auto;font-weight:600;color:var(--text-primary);white-space:nowrap;text-align:right;line-height:1.25;}
  .fiche-item-s{font-size:11.5px;color:var(--text-muted);margin:4px 0 7px;line-height:1.4;}
  .fiche-item-e .cell-sub{margin-top:3px;}
  .fiche-vide{font-size:12.5px;color:var(--text-muted);padding:4px 0 2px;}
  .fiche-notes{display:flex;flex-direction:column;gap:10px;margin-bottom:11px;}
  .fiche-note{
    padding:0 0 10px;font-size:12.8px;color:var(--text-primary);line-height:1.5;
    border-bottom:1px solid var(--border);
  }
  .fiche-note:last-child{border-bottom:none;padding-bottom:0;}
  .fiche-note-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;}
  .fiche-note-texte{flex:1;min-width:160px;}
  .fiche-note-meta{font-size:11px;color:var(--text-muted);white-space:nowrap;}
  .fiche-ajout{display:flex;gap:9px;align-items:flex-start;}
  .fiche-ajout textarea{
    flex:1;border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:10px;padding:9px 11px;font-family:inherit;font-size:12.8px;resize:vertical;outline:none;
  }
  .fiche-ajout textarea:focus{border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);}
  /* bloc d'envoi par mail depuis une fiche */
  .mail-bloc{
    border:1px solid var(--border);border-radius:var(--radius-sm);
    background:var(--surface-2);padding:13px 14px 12px;margin-top:12px;
  }
  .mail-bloc-vide{
    font-size:12.6px;color:var(--text-secondary);line-height:1.5;
    background:var(--surface);border-style:dashed;
  }
  /* bouton d'action en bout de ligne */
  th.th-action{width:1%;}
  td.td-action{text-align:right;width:1%;white-space:nowrap;}
  .btn-action{
    display:inline-flex;align-items:center;gap:5px;white-space:nowrap;cursor:pointer;
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-secondary);
    border-radius:8px;padding:5px 9px;font-family:inherit;font-size:11.5px;font-weight:600;
    transition:all .12s;
  }
  .btn-action:hover{border-color:var(--blue);color:var(--blue);background:var(--blue-tint);}
  .btn-action svg{width:10px;height:10px;flex:none;opacity:.7;}
  .pm-aucun{
    padding:10px 11px 12px;font-size:12px;color:var(--text-muted);line-height:1.5;max-width:250px;
  }
  .mail-lbl{
    font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;font-weight:700;
    color:var(--text-muted);width:46px;flex:none;padding-top:9px;
  }
  .mail-a{display:flex;align-items:flex-start;gap:10px;font-size:13px;color:var(--text-primary);margin-bottom:8px;}
  .mail-a > b{padding-top:7px;font-weight:600;}
  .mail-a .pill{margin-top:6px;}
  .mail-a-vide{color:var(--text-muted);font-style:italic;}
  .mail-a-vide .mail-lbl{font-style:normal;}
  .mail-objet{margin-bottom:0;}
  .mail-corps{margin-top:2px;}
  .mail-pied{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-top:2px;}
  .mail-note{font-size:11.4px;color:var(--text-muted);line-height:1.45;flex:1;min-width:180px;}
  .mail-choix{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:12px;}
  .mail-choix button{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-secondary);
    border-radius:8px;padding:6px 13px;font-family:inherit;font-size:12.4px;font-weight:600;cursor:pointer;
    transition:all .12s;
  }
  .mail-choix button:hover{border-color:var(--blue);color:var(--blue);}
  .mail-choix button.actif{background:var(--blue);border-color:var(--blue);color:#fff;}
  .mail-champ{
    width:100%;border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:10px;padding:9px 11px;font-size:13px;font-family:inherit;margin-bottom:9px;
  }
  textarea.mail-champ{resize:vertical;min-height:190px;line-height:1.55;}
  .mail-champ:focus{border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);outline:none;}
  .mail-actions{display:flex;flex-wrap:wrap;gap:9px;align-items:center;}
  .fiche-pied{
    position:sticky;bottom:0;background:var(--surface);border-top:1px solid var(--border);
    padding:13px 22px;display:flex;justify-content:flex-end;gap:9px;border-radius:0 0 10px 10px;
  }
  #cli-table .cell-primary, #enc-table .cell-primary{
    cursor:pointer;text-decoration:underline;text-decoration-color:transparent;
    text-underline-offset:3px;transition:text-decoration-color .12s;
  }
  #cli-table .cell-primary:hover, #enc-table .cell-primary:hover{
    color:var(--blue);text-decoration-color:var(--blue);
  }
  @media (max-width:760px){
    .fiche-grille,.fiche-tuiles{grid-template-columns:1fr;}
  }
  /* ---- photos d'intervention ---- */
  .photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;margin-top:2px;}
  .photo-card{
    border:1px solid var(--border);border-radius:11px;padding:7px;background:var(--surface-2);
    display:flex;flex-direction:column;gap:6px;
  }
  .photo-card img{width:100%;height:100px;object-fit:cover;border-radius:7px;cursor:zoom-in;background:var(--surface);}
  .photo-legende{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:7px;padding:5px 7px;font-size:11.5px;font-family:inherit;outline:none;width:100%;
  }
  .photo-legende:focus{border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);}
  .photo-suppr{
    align-self:flex-end;border:none;background:none;color:var(--text-muted);
    cursor:pointer;font-size:12px;padding:2px 4px;line-height:1;
  }
  .photo-suppr:hover{color:#d6293e;}
  /* Onglets Avant / Après des photos d'intervention. */
  .photo-onglets,.fiche-onglets{display:flex;gap:26px;border-bottom:1px solid var(--border);margin:26px 0 0;flex-wrap:wrap;}
  .photo-onglet,.fiche-onglet{
    display:inline-flex;align-items:center;gap:7px;border:none;background:none;cursor:pointer;
    font-family:inherit;font-size:13.5px;font-weight:700;color:var(--text-muted);
    padding:0 0 9px;border-bottom:2.5px solid transparent;margin-bottom:-1px;
    transition:color .12s,border-color .12s;
  }
  .photo-onglet:hover,.fiche-onglet:hover{color:var(--text-primary);}
  .photo-onglet.actif,.fiche-onglet.actif{color:var(--text-primary);border-bottom-color:var(--text-primary);}
  .photo-onglet-n,.fiche-onglet-n{
    background:var(--surface-hover);color:var(--text-muted);border-radius:20px;
    padding:1px 7px;font-size:10.5px;font-weight:700;
  }
  .photo-onglet.actif .photo-onglet-n,.fiche-onglet.actif .fiche-onglet-n{background:var(--blue-tint);color:var(--blue);}
  .fiche-volet{padding-top:16px;}
  /* Un commentaire remonté en haut de fiche : du texte, lisible d'un coup
     d'œil, sans avoir à ouvrir quoi que ce soit. */
  .fiche-texte{display:flex;flex-direction:column;gap:4px;margin-top:12px;font-size:13px;}
  .fiche-texte p{margin:0;color:var(--text-primary);line-height:1.55;}
  .fiche-texte .vide{color:var(--text-muted);}

  /* Intitulé du volet : le texte, puis un filet qui court jusqu'au bord. Deux
     traits pleins l'un sous l'autre (celui des onglets + celui du titre)
     alourdissaient inutilement le bloc. */
  .photo-souspart{
    display:flex;align-items:center;gap:14px;
    font-size:10.5px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);margin:18px 0 14px;
  }
  .photo-souspart::after{content:"";flex:1;height:1px;background:var(--border);}

  /* Ligne d'action : le bouton, puis ce qu'il faut photographier. */
  .photo-ajout{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin:0 0 12px;}
  .photo-ajout svg{width:14px;height:14px;}
  .photo-ajout-btn{
    display:inline-flex;align-items:center;gap:6px;flex:none;cursor:pointer;
    background:var(--surface-hover);border:none;border-radius:9px;
    font-family:inherit;font-size:13px;font-weight:700;color:var(--text-primary);
    padding:8px 14px;transition:filter .12s;
  }
  .photo-ajout-btn:hover{filter:brightness(.95);}
  .photo-ajout-aide{font-size:13px;color:var(--text-muted);flex:1 1 220px;min-width:0;}
  .photo-pdf-btn{
    display:inline-flex;align-items:center;gap:6px;flex:none;cursor:pointer;
    background:none;border:1px solid var(--border);border-radius:9px;
    font-family:inherit;font-size:12.5px;font-weight:600;color:var(--text-muted);
    padding:7px 12px;transition:color .12s,border-color .12s;
  }
  .photo-pdf-btn:hover{color:var(--text-primary);border-color:var(--text-muted);}

  /* ---- visionneuse plein écran ---- */
  .lightbox-overlay{
    position:fixed;inset:0;background:rgba(7,15,32,.92);display:none;
    align-items:center;justify-content:center;z-index:200;flex-direction:column;gap:14px;
  }
  .lightbox-overlay.show{display:flex;}
  #lightbox-img{max-width:min(92vw,900px);max-height:74vh;border-radius:10px;box-shadow:var(--shadow-lg);object-fit:contain;}
  .lightbox-legende{color:#fff;font-size:13px;opacity:.85;max-width:80vw;text-align:center;}
  .lightbox-fermer{
    position:absolute;top:18px;right:18px;width:38px;height:38px;border-radius:99px;
    border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.08);color:#fff;
    cursor:pointer;font-size:16px;
  }
  .lightbox-fermer:hover{background:rgba(255,255,255,.18);}
  .lightbox-nav{
    position:absolute;top:50%;transform:translateY(-50%);width:46px;height:46px;border-radius:99px;
    border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.08);color:#fff;
    cursor:pointer;font-size:24px;line-height:1;
  }
  .lightbox-nav:hover{background:rgba(255,255,255,.18);}
  .lightbox-prev{left:18px;}
  .lightbox-next{right:18px;}
  @media (max-width:600px){
    .lightbox-nav{width:38px;height:38px;font-size:20px;}
    .lightbox-prev{left:6px;}
    .lightbox-next{right:6px;}
  }

  .lien-pdf svg{width:12px;height:12px;flex:none;opacity:.75;}
  .btn-pl{
    display:inline-flex;align-items:center;gap:6px;white-space:nowrap;
    padding:6px 11px;font-size:12px;border-radius:8px;
  }
  .panneau-filtres{
    background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
    box-shadow:var(--shadow);padding:15px 16px;margin-bottom:16px;
  }
  .filters-panel{background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius);padding:14px;margin-bottom:16px;}
  .btn-ghost.actif{background:var(--blue-tint);border-color:var(--blue);color:var(--blue);}
  .cases{display:flex;flex-wrap:wrap;gap:10px;}
  .dd{position:relative;}
  .dd-btn{
    display:inline-flex;align-items:center;gap:9px;cursor:pointer;
    border:1px solid var(--border);background:var(--surface-2);border-radius:10px;
    padding:9px 12px;font-family:inherit;font-size:12.8px;font-weight:600;color:var(--text-secondary);
    transition:border-color .12s,background .12s,color .12s;
  }
  .dd-btn:hover{border-color:var(--border-strong);color:var(--text-primary);}
  .dd.actif > .dd-btn{background:var(--blue-tint);border-color:var(--blue);color:var(--blue);}
  .dd.open > .dd-btn{border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);background:var(--surface);}
  .dd-chev{width:13px;height:13px;flex:none;opacity:.7;transition:transform .15s;}
  .dd.open .dd-chev{transform:rotate(180deg);}
  .dd-panel{
    position:absolute;top:calc(100% + 6px);left:0;min-width:230px;z-index:30;display:none;
    background:var(--surface);border:1px solid var(--border);border-radius:12px;
    box-shadow:var(--shadow-lg);padding:6px;
  }
  .dd.open .dd-panel{display:block;}
  .dd-opt{
    display:flex;align-items:center;gap:11px;cursor:pointer;user-select:none;
    padding:9px 10px;border-radius:8px;font-size:13.2px;color:var(--text-primary);
  }
  .dd-opt:hover{background:var(--surface-hover);}
  .dd-opt input{
    appearance:none;-webkit-appearance:none;margin:0;flex:none;
    width:17px;height:17px;border:1.6px solid var(--border-strong);border-radius:5px;
    background:var(--surface);cursor:pointer;position:relative;
  }
  .dd-opt input:checked{background:var(--blue);border-color:var(--blue);}
  .dd-opt input:checked::after{
    content:"";position:absolute;left:5px;top:1.5px;width:4px;height:9px;
    border:solid #fff;border-width:0 2px 2px 0;transform:rotate(42deg);
  }
  .dd-txt{flex:1;}
  .case-n{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:10.5px;font-weight:600;
    background:var(--surface-2);color:var(--text-muted);border-radius:5px;padding:1px 7px;flex:none;
  }
  .dd-opt input:checked ~ .case-n{background:var(--blue-tint);color:var(--blue);}
  .dd-clear{
    display:block;width:100%;border:none;background:none;cursor:pointer;
    border-top:1px solid var(--border);margin-top:5px;padding:9px 10px 5px;
    font-family:inherit;font-size:12.5px;color:var(--text-muted);text-align:center;
  }
  .dd-clear:hover{color:var(--text-primary);}
  .panneau-bas{
    display:flex;align-items:center;gap:10px;flex-wrap:wrap;
    margin-top:15px;padding-top:14px;border-top:1px solid var(--border);
  }
  .panneau-bas select,.panneau-bas input{
    border:1px solid var(--border);background:var(--surface-2);border-radius:10px;
    padding:8px 10px;font-family:inherit;font-size:12.6px;color:var(--text-primary);outline:none;
  }
  .panneau-bas input:focus{border-color:var(--focus);background:var(--surface);box-shadow:0 0 0 3px var(--blue-tint);}
  .panneau-bas .fb-search{flex:1 1 200px;min-width:150px;}
  .panneau-bas .fb-date{width:132px;flex:none;}
  @media (max-width:700px){ .cases{gap:14px;} .grp{flex:1 1 100%;} }
  .table-empty{padding:38px 20px;text-align:center;color:var(--text-muted);font-size:13px;}
  .filter-pill.active{background:var(--grad-brand);border-color:transparent;color:#fff;box-shadow:var(--glow-brand);}

  /* list items (upcoming / alerts) */
  .list-card .list-item{display:flex;gap:12px;padding:13px 18px;border-bottom:1px solid var(--border);}
  .list-card .list-item:last-child{border-bottom:none;}
  /* Ligne qui ouvre une fiche au clic : le curseur et le survol le disent. */
  .list-card .list-item.cliquable{cursor:pointer;transition:background .13s ease;}
  .list-card .list-item.cliquable:hover{background:var(--surface-hover);}
  .list-stripe{width:3px;border-radius:99px;flex:none;align-self:stretch;}
  .list-item-body{flex:1;min-width:0;}
  .list-item-title{font-size:13.2px;font-weight:600;}
  .list-item-sub{font-size:12px;color:var(--text-muted);margin-top:2px;}
  .list-item-meta{flex:none;text-align:right;font-size:11.5px;color:var(--text-muted);display:flex;flex-direction:column;align-items:flex-end;gap:6px;}
  .list-item-action{
    display:inline-flex;align-items:center;gap:5px;white-space:nowrap;
    background:none;border:1px solid var(--border-strong);color:var(--text-secondary);
    border-radius:7px;padding:4px 9px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;
  }
  .list-item-action:hover{background:var(--surface-hover);color:var(--text-primary);}
  .list-item-action svg{width:10px;height:10px;flex:none;}
  .list-item-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end;}

  .avis-actions{display:flex;gap:7px;align-items:center;flex:none;}
  .avis-actions a.list-item-action{text-decoration:none;}
  a.avis-wa:hover{background:#25d36615;border-color:#25d366;color:#128c4a;}
  .card-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px 4px;}
  .card-head h3{font-size:14px;}
  .card-head .hint{font-size:11.5px;color:var(--text-muted);}

  /* tooltip */
  #tooltip{
    position:fixed;pointer-events:none;z-index:60;
    background:var(--navy);color:#fff;border-radius:8px;padding:8px 11px;
    font-size:12px;line-height:1.4;box-shadow:var(--shadow-lg);
    opacity:0;transform:translateY(3px);transition:opacity .12s ease, transform .12s ease;
    max-width:220px;
  }
  #tooltip.show{opacity:1;transform:none;}
  #tooltip .tt-title{font-weight:700;margin-bottom:2px;}
  #tooltip .tt-row{display:flex;justify-content:space-between;gap:14px;color:#c7d0ec;}

  /* calendar */
  .cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;background:var(--border);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;}
  .cal-dow{background:var(--surface-2);text-align:center;font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted);font-weight:600;padding:8px 0;}
  .cal-cell{background:var(--surface);min-height:112px;padding:7px;display:flex;flex-direction:column;gap:5px;}
  .cal-cell.empty{background:var(--surface-2);}
  .cal-cell.today{background:var(--blue-tint);}
  .cal-daynum{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:11.5px;color:var(--text-muted);}
  .cal-cell.today .cal-daynum{color:var(--blue);font-weight:700;}
  .cal-chip{display:flex;flex-direction:column;gap:1px;font-size:10.3px;font-weight:600;padding:4px 6px;border-radius:6px;line-height:1.3;cursor:pointer;}
  .cal-cell:not(.empty){cursor:pointer;transition:background .12s,box-shadow .12s;}
  .cal-cell:not(.empty):hover{background:var(--surface-hover);box-shadow:inset 0 0 0 2px var(--blue-tint);}
  .cal-cell.today:not(.empty):hover{background:var(--blue-tint);}
  .cal-plus{
    margin-top:auto;font-size:10px;font-weight:600;color:var(--text-muted);opacity:0;
    transition:opacity .12s;
  }
  .cal-cell:not(.empty):hover .cal-plus{opacity:1;}

  /* Ligne « déplacer » sous chaque rendez-vous de la fiche du jour :
     rattachée visuellement à sa carte, pour qu'on voie ce qu'on déplace. */
  .jour-dep{
    display:flex;align-items:center;gap:8px;flex-wrap:wrap;
    margin:-3px 0 0;padding:9px 12px;
    background:var(--surface-2);border:1px solid var(--border);border-radius:0 0 9px 9px;
  }
  .jour-dep .fb-lbl{flex:none;}
  .jour-dep .jour-dep-fin{margin-left:auto;}
  .jour-bloc{display:flex;flex-direction:column;margin-bottom:11px;}

  /* onglets d'une page */
  .onglets{display:flex;gap:8px;margin-bottom:18px;}
  .onglet{
    display:inline-flex;align-items:center;gap:7px;
    border:1px solid var(--border);background:var(--surface);color:var(--text-secondary);
    font-size:12.8px;font-weight:600;padding:8px 15px;border-radius:8px;cursor:pointer;
    font-family:inherit;transition:all .14s;
  }
  .onglet:hover{border-color:var(--border-strong);color:var(--text-primary);}
  .onglet.actif{background:var(--grad-brand);border-color:transparent;color:#fff;box-shadow:var(--glow-brand);}
  .onglet .n{
    font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-size:10.8px;font-weight:600;
    background:var(--surface-2);color:var(--text-muted);border-radius:5px;padding:1px 7px;
  }
  .onglet.actif .n{background:rgba(255,255,255,.22);color:#fff;}
  /* Les jours suivants d'un chantier qui dure : même couleur, mais en retrait,
     pour qu'on voie d'un coup d'œil où le chantier commence. */
  .cal-chip-suite{opacity:.72;}
  .cal-chip-row1{display:flex;align-items:baseline;gap:5px;overflow:hidden;}
  .cal-chip-time{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-weight:700;font-size:9.5px;flex:none;opacity:.85;}
  .cal-chip-name{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .cal-chip-sub{font-size:9px;font-weight:500;opacity:.78;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

  /* formula card */
  .formula{display:flex;flex-direction:column;gap:0;}
  .formula-row{display:flex;align-items:center;justify-content:space-between;padding:13px 20px;border-bottom:1px dashed var(--border);}
  .formula-row:last-child{border-bottom:none;}
  .formula-op{width:22px;text-align:center;color:var(--text-muted);font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;flex:none;}
  .formula-label{flex:1;font-size:13.3px;color:var(--text-secondary);}
  .formula-label strong{color:var(--text-primary);font-weight:600;}
  .formula-value{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-weight:600;font-size:14px;flex:none;min-width:110px;text-align:right;}
  .formula-row.total{background:var(--surface-2);border-radius:0 0 var(--radius) var(--radius);}
  .formula-row.total .formula-value{font-size:17px;font-weight:700;}

  .split-tile{padding:20px;display:flex;flex-direction:column;gap:12px;position:relative;overflow:hidden;}
  .split-tile::before{content:"";position:absolute;left:0;right:0;top:0;height:3px;background:var(--accent,var(--blue));}
  .split-head{display:flex;align-items:center;gap:10px;}
  .split-avatar{width:34px;height:34px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-family:"Archivo";font-weight:700;font-size:13px;color:#fff;flex:none;}
  .split-name{font-weight:700;font-size:14px;}
  .split-role{font-size:11px;color:var(--text-muted);}
  .split-amount{font-family:"Archivo";font-weight:800;font-size:26px;}
  .split-bar-track{height:9px;border-radius:99px;background:var(--surface-2);overflow:hidden;display:flex;}
  .split-bar-seg{height:100%;}
  .split-legend{display:flex;gap:14px;font-size:11.5px;color:var(--text-muted);}
  .split-legend span{display:inline-flex;align-items:center;gap:5px;}
  .split-legend i{width:8px;height:8px;border-radius:2px;}

  .mini-calc{display:flex;flex-direction:column;margin:2px 0 4px;}
  .mini-calc-row{display:flex;justify-content:space-between;align-items:center;padding:7px 0;font-size:12.8px;color:var(--text-secondary);border-bottom:1px dashed var(--border);}
  .mini-calc-row:last-child{border-bottom:none;}
  .mini-calc-row .v{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;}
  .mini-calc-row.total{padding-top:10px;margin-top:2px;border-top:1px solid var(--border-strong);border-bottom:none;}
  .mini-calc-row.total .label{font-weight:700;color:var(--text-primary);}
  .mini-calc-row.total .v{font-size:16px;}
  .target-row{display:flex;align-items:center;justify-content:space-between;padding:8px 2px;font-size:12.5px;color:var(--text-secondary);}
  .target-row .v{font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;font-weight:700;color:var(--text-primary);}
  .settle-banner{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:11px;border-radius:10px;font-size:13.5px;font-weight:700;margin-top:2px;}
  .settle-banner .settle-main{display:flex;align-items:center;gap:7px;}
  .settle-banner svg{width:15px;height:15px;}
  .settle-banner .settle-sub{font-size:11px;font-weight:500;opacity:.8;}

  .transfer-item{display:flex;align-items:center;gap:14px;padding:14px 18px;border-bottom:1px solid var(--border);}
  .transfer-item:last-child{border-bottom:none;}
  .transfer-people{display:flex;align-items:center;gap:6px;flex:none;}
  .transfer-arrow{width:16px;height:16px;color:var(--text-muted);flex:none;}
  .split-avatar.sm{width:26px;height:26px;font-size:10.5px;}
  .transfer-body{flex:1;min-width:0;}
  .transfer-title{font-size:13.2px;font-weight:600;}
  .transfer-sub{font-size:11.5px;color:var(--text-muted);margin-top:1px;}
  .transfer-amount{font-weight:700;font-size:15px;flex:none;font-family:"Public Sans",-apple-system,"Segoe UI",sans-serif;}

  .callout{
    display:flex;gap:13px;padding:16px 18px;border-radius:var(--radius);
    border:1px solid var(--border-strong);background:var(--surface-2);
  }
  .callout-icon{width:32px;height:32px;border-radius:9px;background:var(--blue-tint);color:var(--blue);display:flex;align-items:center;justify-content:center;flex:none;}
  .callout-icon svg{width:16px;height:16px;}
  .callout h4{font-size:13.5px;margin-bottom:4px;}
  .callout p{margin:0;font-size:12.8px;color:var(--text-secondary);line-height:1.55;}
  .callout code{background:var(--surface);border:1px solid var(--border);padding:1px 5px;border-radius:4px;font-size:11.5px;}

  .note-strip{display:flex;gap:10px;align-items:flex-start;padding:12px 16px;border-radius:var(--radius-sm);background:var(--teal-tint);border:1px solid var(--teal);border-opacity:.3;font-size:12.6px;color:var(--text-secondary);}
  .note-strip svg{width:15px;height:15px;color:var(--teal);flex:none;margin-top:1px;}
  .note-strip strong{color:var(--text-primary);}

  /* modal */
  .modal-overlay{position:fixed;inset:0;background:rgba(8,13,28,.55);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:none;align-items:center;justify-content:center;z-index:50;padding:20px;}
  .modal-overlay.show{display:flex;}
  .modal{
    background:var(--surface);border-radius:14px;box-shadow:var(--shadow-lg);
    width:560px;max-width:100%;padding:24px 26px;border:1px solid var(--border);
    max-height:calc(100vh - 40px);overflow-y:auto;
    animation:mg-apparition .18s ease-out;
  }
  @keyframes mg-apparition{
    from{opacity:0;transform:translateY(10px) scale(.985);}
    to{opacity:1;transform:none;}
  }
  /* écran large : le formulaire respire sur deux colonnes au lieu de s'allonger */
  @media (min-width:1000px){ .modal{width:660px;padding:26px 30px;} }
  @media (prefers-reduced-motion:reduce){ .modal{animation:none;} }
  .modal h3{position:sticky;top:-24px;background:var(--surface);padding-top:2px;z-index:1;}
  .mg-client-ligne{display:flex;gap:8px;align-items:stretch;margin-bottom:6px;position:relative;}
  .mg-client-ligne .mg-client-filtre,.mg-client-ligne .mg-lien-filtre,.mg-client-ligne .mg-adr-filtre{flex:1;margin-bottom:0;}
  .mg-client-ligne + select{display:none;}
  .client-ac-results{
    position:absolute;top:calc(100% + 4px);left:0;right:0;
    background:var(--surface);border:1px solid var(--border);border-radius:12px;
    box-shadow:var(--shadow-lg);padding:5px;display:none;
    max-height:260px;overflow-y:auto;z-index:70;
  }
  .client-ac-results.show{display:block;}
  .client-ac-item{
    display:block;width:100%;text-align:left;border:none;background:none;
    padding:8px 10px;border-radius:8px;cursor:pointer;font-family:inherit;
  }
  .client-ac-item:hover,.client-ac-item.hl{background:var(--surface-hover);}
  .client-ac-nom{display:block;font-size:13px;font-weight:600;color:var(--text-primary);}
  .client-ac-sub{display:block;font-size:11.4px;color:var(--text-muted);margin-top:1px;}
  .client-ac-creer{border-top:1px solid var(--border);margin-top:4px;padding-top:9px;}
  .client-ac-creer .client-ac-nom{color:var(--blue);}
  .client-ac-vide{padding:14px 10px;text-align:center;font-size:12.4px;color:var(--text-muted);}
  .mg-neuf-btn{
    flex:none;white-space:nowrap;height:40px;padding:0 14px;font-size:12.5px;font-weight:600;
    border:1px solid var(--border-strong);background:var(--surface-2);color:var(--text-primary);
    border-radius:10px;cursor:pointer;font-family:inherit;
  }
  .mg-neuf-btn:hover{background:var(--surface-hover);border-color:var(--blue);color:var(--blue);}
  .mg-neuf-btn.on{background:var(--blue-tint);border-color:var(--blue);color:var(--blue);}
  #mg-neuf{
    border:1px solid var(--border);background:var(--surface-2);
    border-radius:12px;padding:12px 13px 1px;margin-top:9px;
  }
  .mg-neuf-pied{
    display:flex;align-items:center;justify-content:space-between;gap:12px;
    padding:1px 0 12px;
  }
  .mg-neuf-pied span{font-size:11.3px;color:var(--text-muted);line-height:1.45;}
  .mg-neuf-pied button{flex:none;}
  .mg-neuf-t{
    font-size:10.5px;text-transform:uppercase;letter-spacing:.09em;font-weight:700;
    color:var(--text-muted);margin-bottom:10px;
  }
  .mg-neuf-grille{display:grid;grid-template-columns:1fr 1fr;gap:0 10px;}
  .mg-neuf-grille .field{grid-column:1 / -1;}
  .mg-neuf-grille .field-demi{grid-column:span 1;}
  #mg-neuf select{margin-top:0 !important;}
  .modal h3{font-size:16px;margin-bottom:3px;}
  .modal .hint{font-size:12px;color:var(--text-muted);margin-bottom:16px;}
  .field{display:flex;flex-direction:column;gap:5px;margin-bottom:12px;}
  .field label{font-size:12px;font-weight:600;color:var(--text-secondary);}
  .field input:not([type="checkbox"]):not([type="radio"]),.field select{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:10px;padding:0 12px;font-size:13px;font-family:inherit;line-height:normal;
    height:40px;min-height:40px;
    transition:border-color .14s, box-shadow .14s;
  }
  /* un champ date natif est plus haut que les autres : on le ramène à la même hauteur */
  .field input[type="date"]{padding-right:9px;}
  .field input[type="date"]::-webkit-datetime-edit{padding:0;}
  .field input:not([type="checkbox"]):not([type="radio"]):focus,.field select:focus,.field textarea:focus{
    border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);outline:none;
  }
  .mg-client-filtre{margin-bottom:6px;}
  .mg-client-filtre:focus{border-color:var(--focus);box-shadow:0 0 0 3px var(--blue-tint);outline:none;}
  .field-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
  .field textarea{
    border:1px solid var(--border-strong);background:var(--surface);color:var(--text-primary);
    border-radius:10px;padding:9px 11px;font-size:13px;font-family:inherit;resize:vertical;
  }
  .mg-groupe-titre{
    font-size:10.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
    color:var(--text-muted);margin:18px 0 9px;padding-bottom:6px;border-bottom:1px solid var(--border);
  }
  .mg-groupe:first-child .mg-groupe-titre{margin-top:0;}
  .mg-groupe-corps{display:grid;grid-template-columns:1fr 1fr;gap:0 14px;}
  @media (max-width:620px){
    .mg-groupe-corps,.mg-neuf-grille{grid-template-columns:1fr;}
  }
  .mg-groupe-corps .field{grid-column:1 / -1;}
  .mg-groupe-corps .field-demi{grid-column:span 1;}
  .modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px;padding-top:16px;border-top:1px solid var(--border);}
  .btn-ghost{
    display:inline-flex;align-items:center;gap:7px;white-space:nowrap;
    background:none;border:1px solid var(--border-strong);color:var(--text-secondary);
    border-radius:10px;padding:9px 15px;font-size:13px;font-weight:600;cursor:pointer;
    transition:background .14s,color .14s,border-color .14s,transform .14s;
  }
  .btn-ghost:hover{background:var(--surface-hover);color:var(--text-primary);border-color:var(--border-strong);transform:translateY(-1px);}
  .btn-ghost svg{width:14px;height:14px;flex:none;}

  /* toast */
  #toast{
    position:fixed;bottom:22px;left:50%;transform:translate(-50%,12px);
    background:var(--navy);color:#fff;padding:11px 18px;border-radius:10px;
    font-size:13px;font-weight:500;box-shadow:var(--shadow-lg);z-index:80;
    opacity:0;pointer-events:none;transition:opacity .2s ease, transform .2s ease;
    display:flex;align-items:center;gap:9px;
  }
  #toast.show{opacity:1;transform:translate(-50%,0);}
  #toast svg{width:15px;height:15px;color:var(--good);}

  .toggle-tabs{display:flex;gap:6px;background:var(--surface-2);padding:3px;border-radius:10px;width:fit-content;}
  .toggle-tabs button{border:none;background:none;padding:7px 14px;border-radius:7px;font-size:12.6px;font-weight:600;color:var(--text-secondary);cursor:pointer;}
  .toggle-tabs button.active{background:var(--surface);color:var(--text-primary);box-shadow:var(--shadow);}

  .chart-legend{display:flex;flex-wrap:wrap;gap:14px;padding:2px 18px 16px;font-size:11.8px;color:var(--text-secondary);}
  .chart-legend span{display:inline-flex;align-items:center;gap:6px;}
  .chart-legend i{width:9px;height:9px;border-radius:2.5px;flex:none;}

  .menu-btn{display:none;}
  .sidebar-backdrop{
    display:none;position:fixed;inset:0;background:rgba(8,13,28,.55);z-index:39;
  }
  @media (max-width:900px){
    .menu-btn{display:flex;}
    .sidebar{
      display:flex;position:fixed;top:0;left:0;height:100vh;z-index:40;
      transform:translateX(-100%);transition:transform .22s ease;box-shadow:var(--shadow-lg);
    }
    .sidebar.mobile-open{transform:translateX(0);}
    .sidebar-backdrop.show{display:block;}
    .content{padding:20px 16px 40px;}
    .topbar{padding:10px 16px;gap:10px;}
    .search{flex:1 1 auto;}
    .kbd,.topbar-date{display:none;}
    .page-head h1{font-size:21px;}
  }
