* { box-sizing: border-box; margin: 0; padding: 0; }
  /* === PALETTE ISSUE DE LA PSYCHOLOGIE ENVIRONNEMENTALE DU TRAVAIL ===
     Études Kwallek & Lewis (1990, 2007), Mehrabian, et synthèses récentes sur
     l'impact des couleurs sur la concentration, le stress et la productivité.
     Choix :
     - Fond crème chaud (#FAF8F4) : réduit la fatigue visuelle vs. blanc pur,
       perçu comme accueillant.
     - Bleu doux pétrole (#5A7FA8) : favorise concentration sans surstimulation
       (vs. bleu vif qui peut être froid/clinique).
     - Vert sauge (#7BA48A) : couleur la plus reposante pour l'œil, associée
       à équilibre et bien-être.
     - Terra cotta atténuée (#C9866B) en lieu et place de rouge vif :
       signale sans agresser, garde un caractère chaleureux.
     - Ambre doux (#D9A86C) pour l'alerte modérée.
     - Texte ardoise bleutée (#2D3B4F) plus doux que le noir, conserve
       l'excellente lisibilité.
     - Bordures à très faible contraste (#EDE7DD) pour calmer le regard.
  */
  :root {
    --bg: #faf8f4;
    --bg-soft: #f3efe6;
    --surface: #ffffff;
    --border: #ede7dd;
    --border-soft: #f3efe6;
    --text: #2d3b4f;
    --text-soft: #7a8499;
    --primary: #1a5b47;       /* Vert émeraude profond — psychologie : prospérité, ambition, réussite, finance */
    --primary-dark: #0f3d2e;
    --primary-soft: #e6efea;
    --success: #7ba48a;
    --success-dark: #5e8b6f;
    --success-soft: #e8f0e9;
    --warning: #d9a86c;
    --warning-soft: #fbf2e2;
    --danger: #c9866b;
    --danger-soft: #f7e8e0;
    --info: #6b9bb5;
    --info-soft: #e6f0f5;
    --purple: #8a7ab2;
    --purple-soft: #efeaf5;
    --gold: #c9a96b;
    --gold-soft: #faf0d8;
    --shadow: 0 1px 3px rgba(45,59,79,.05), 0 1px 2px rgba(45,59,79,.03);
    --shadow-lg: 0 8px 24px rgba(45,59,79,.08);
  }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
  }
  /* === LAYOUT === */
  .app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
  .sidebar {
    background: linear-gradient(180deg, #3a4759 0%, #2d3b4f 100%);
    color: #cdd5e0;
    padding: 20px 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px 24px; border-bottom: 1px solid #485568;
  }
  .brand-logo {
    width: 36px; height: 36px; background: var(--primary);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 18px;
    box-shadow: 0 2px 8px rgba(26,91,71,.4);
  }
  .brand-name { color: #fff; font-weight: 700; font-size: 16px; }
  .brand-tag { color: #9aa6b8; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }
  .nav { padding: 16px 0; }
  .nav-section { padding: 8px 20px 4px; color: #8a96aa; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
  .nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; color: #cdd5e0; cursor: pointer;
    border-left: 3px solid transparent; transition: all .2s;
    font-size: 14px;
  }
  .nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
  .nav-item.active { background: rgba(26,91,71,.22); color: #fff; border-left-color: var(--primary); }
  .nav-icon { width: 20px; text-align: center; font-size: 16px; }
  .nav-badge {
    margin-left: auto; background: var(--warning); color: #fff;
    border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 600;
  }
  .sidebar-footer {
    margin-top: auto; padding: 16px 20px; border-top: 1px solid #485568;
    font-size: 12px; color: #9aa6b8;
  }
  /* === MAIN === */
  .main { display: flex; flex-direction: column; min-width: 0; }
  .topbar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 14px 24px; display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 10;
  }
  .page-title { font-size: 18px; font-weight: 700; }
  .search {
    flex: 1; max-width: 420px; position: relative;
  }
  .search input {
    width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; background: var(--bg);
    outline: none; transition: border-color .15s;
  }
  .search input:focus { border-color: var(--primary); background: #fff; }
  .search::before {
    content: "🔍"; position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%); opacity: .5; font-size: 13px;
  }
  .topbar-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
  .user-pill {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 12px 4px 4px; border-radius: 20px; background: var(--bg);
    cursor: pointer;
  }
  .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 600;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
  }
  .content { padding: 24px; flex: 1; overflow-x: auto; }
  /* === COMPONENTS === */
  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all .15s; background: var(--surface); color: var(--text);
    border: 1px solid var(--border);
  }
  .btn:hover { background: var(--bg); }
  .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
  .btn-primary:hover { background: var(--primary-dark); }
  .btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-icon { padding: 6px 8px; }
  .card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 16px;
  }
  .card-header {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .card-title { font-size: 15px; font-weight: 600; }
  .card-body { padding: 18px; }
  .card-body.p-0 { padding: 0; }
  /* === KPI === */
  .kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
  .kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 18px; box-shadow: var(--shadow);
  }
  .kpi-label { font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
  .kpi-value { font-size: 26px; font-weight: 700; }
  .kpi-delta { font-size: 12px; margin-top: 6px; }
  .kpi-delta.up { color: var(--success-dark); }
  .kpi-delta.down { color: var(--danger); }
  /* Petite bordure dorée pour célébrer un dépassement d'objectif */
  .kpi-celebrate {
    border-top: 3px solid var(--gold);
    position: relative;
  }
  .kpi-celebrate::before {
    content: '⭐'; position: absolute; top: -12px; right: 14px;
    background: var(--gold-soft); padding: 2px 8px; border-radius: 12px;
    font-size: 12px; color: var(--gold);
  }
  /* Animation subtile sur les jauges */
  .progress-bar { transition: width .8s ease-out; }
  .kpi-icon {
    float: right; width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
  }
  /* === TABLE === */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  th { font-size: 12px; text-transform: uppercase; color: var(--text-soft); font-weight: 600; letter-spacing: .3px; background: var(--bg); }
  tr:hover td { background: #fafbfd; }
  tr:last-child td { border-bottom: none; }
  /* === BADGE === */
  .badge {
    display: inline-block; padding: 3px 9px; border-radius: 12px;
    font-size: 11px; font-weight: 600; letter-spacing: .3px;
  }
  .badge.success { background: var(--success-soft); color: var(--success); }
  .badge.warning { background: var(--warning-soft); color: var(--warning); }
  .badge.danger { background: var(--danger-soft); color: var(--danger); }
  .badge.info { background: var(--info-soft); color: var(--info); }
  .badge.primary { background: var(--primary-soft); color: var(--primary); }
  .badge.purple { background: var(--purple-soft); color: var(--purple); }
  .badge.gray { background: #eef0f5; color: var(--text-soft); }
  /* === FORM === */
  .form-row { margin-bottom: 14px; }
  .form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .3px; }
  .form-control {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; font-family: inherit; outline: none;
    transition: border-color .15s; background: #fff;
  }
  .form-control:focus { border-color: var(--primary); }
  textarea.form-control { min-height: 80px; resize: vertical; }
  .form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  /* === MODAL === */
  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(14,26,53,.5);
    display: none; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
  }
  .modal-backdrop.show { display: flex; }
  .modal {
    background: #fff; border-radius: 12px; width: 100%; max-width: 600px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  }
  .modal-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .modal-title { font-size: 16px; font-weight: 600; }
  .modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-soft); }
  .modal-body { padding: 20px; }
  .modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
  /* === KANBAN === */
  .kanban { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
  .kanban-col { background: #eef1f7; border-radius: 10px; padding: 10px; }
  .kanban-col-header { display: flex; justify-content: space-between; padding: 4px 6px 10px; font-size: 13px; font-weight: 600; }
  .kanban-card {
    background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
    box-shadow: var(--shadow); cursor: pointer; border-left: 3px solid var(--primary);
  }
  .kanban-card:hover { box-shadow: var(--shadow-lg); }
  .kanban-card-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
  .kanban-card-meta { font-size: 11px; color: var(--text-soft); }
  .kanban-card-amount { font-weight: 600; color: var(--success); font-size: 13px; margin-top: 6px; }
  /* === FILTERS === */
  .filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
  .filters select, .filters input {
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px;
    font-size: 13px; background: #fff; font-family: inherit;
  }
  .empty-state { padding: 40px; text-align: center; color: var(--text-soft); }
  .empty-state-icon { font-size: 48px; opacity: .5; margin-bottom: 12px; }
  /* === DASHBOARD === */
  .dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
  .chart-wrap { position: relative; height: 280px; }
  .alert-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .alert-item:last-child { border-bottom: none; }
  .alert-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .alert-text { font-size: 13px; }
  .alert-time { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
  /* === DETAIL VIEW === */
  .detail-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
  .detail-section { margin-bottom: 18px; }
  .detail-section-title { font-size: 12px; text-transform: uppercase; color: var(--text-soft); font-weight: 600; margin-bottom: 8px; letter-spacing: .3px; }
  .detail-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed #eef0f5; }
  .detail-row:last-child { border-bottom: none; }
  .detail-label { color: var(--text-soft); }
  .detail-value { font-weight: 500; }
  .tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 14px; gap: 4px; flex-wrap: wrap; }
  .tab { padding: 10px 16px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-soft); border-bottom: 2px solid transparent; }
  .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
  /* === TIMELINE 360° === */
  .timeline-360 { position: relative; padding: 4px 0; }
  .tl-month {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-soft); padding: 14px 0 8px;
    border-bottom: 1px solid var(--border-soft); margin-bottom: 10px;
  }
  .tl-event {
    display: flex; gap: 14px; padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .tl-event:last-child { border-bottom: none; }
  .tl-event-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; box-shadow: var(--shadow);
  }
  .tl-event-body { flex: 1; min-width: 0; }
  .tl-event-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
  .tl-event-title { font-weight: 600; font-size: 14px; color: var(--text); }
  .tl-event-date { font-size: 12px; color: var(--text-soft); white-space: nowrap; }
  .tl-event-meta { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
  .tl-event-detail {
    font-size: 13px; color: var(--text); margin-top: 6px;
    background: var(--bg-soft); border-radius: 8px; padding: 8px 12px;
    border-left: 3px solid var(--border); white-space: pre-wrap;
  }
  .tl-filters {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
    padding: 10px; background: var(--bg-soft); border-radius: 10px;
  }
  .tl-filter {
    font-size: 12px; padding: 5px 12px; border-radius: 20px; cursor: pointer;
    background: #fff; border: 1px solid var(--border); transition: all .15s;
    display: inline-flex; align-items: center; gap: 5px; user-select: none;
  }
  .tl-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
  .tl-filter:hover:not(.active) { border-color: var(--primary); }
  .tl-empty { text-align: center; padding: 40px 20px; color: var(--text-soft); }
  /* === UTIL === */
  .flex { display: flex; }
  .flex-between { display: flex; justify-content: space-between; align-items: center; }
  .gap-2 { gap: 8px; }
  .gap-3 { gap: 12px; }
  .mt-2 { margin-top: 8px; }
  .mt-4 { margin-top: 16px; }
  .mb-2 { margin-bottom: 8px; }
  .text-soft { color: var(--text-soft); }
  .text-sm { font-size: 12px; }
  .text-success { color: var(--success-dark); }
  .text-danger { color: var(--danger); }
  .text-warning { color: var(--warning); }
  .text-primary { color: var(--primary); }
  .text-info { color: var(--info); }
  .text-gold { color: var(--gold); }
  .badge.gold { background: var(--gold-soft); color: var(--gold); }
  .text-right { text-align: right; }
  .truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
  .pointer { cursor: pointer; }
  .hidden { display: none !important; }
  @media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .kanban { grid-template-columns: 1fr; }
  }

  /* === MOBILE & TABLETTE — menu en tiroir (≤ 1024px : iPhone, iPad portrait, petites tablettes) === */
  @media (max-width: 1024px) {
    /* Layout général */
    body { font-size: 14px; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
    .app { display: block; }

    /* Sidebar transformée en drawer (par défaut caché) */
    .sidebar {
      position: fixed; top: 0; left: 0; width: 280px; height: 100vh;
      z-index: 1100; transform: translateX(-100%);
      transition: transform .25s ease;
      box-shadow: 4px 0 20px rgba(0,0,0,.25);
      overflow-y: auto;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle {
      display: flex !important; position: fixed; top: 12px; left: 12px; z-index: 1200;
      width: 44px; height: 44px; border-radius: 12px;
      background: var(--primary); color: #fff; border: none;
      align-items: center; justify-content: center; cursor: pointer;
      box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 20px;
    }
    .sidebar-backdrop {
      display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1099;
    }
    .sidebar.open ~ .sidebar-backdrop { display: block; }

    /* Header / topbar */
    .topbar {
      padding: 10px 14px 10px 60px !important;
      flex-wrap: wrap; gap: 8px;
    }
    .topbar h1, #page-title { font-size: 17px !important; }
    .user-pill { padding: 6px 10px !important; font-size: 12px; }
    .user-pill .avatar { width: 28px !important; height: 28px !important; font-size: 12px !important; }

    /* Main content padding */
    main, .main { padding: 12px !important; }
    .card { border-radius: 12px; margin-bottom: 12px; }
    .card-header { padding: 12px 14px !important; flex-wrap: wrap; gap: 8px; }
    .card-title { font-size: 15px !important; }
    .card-body { padding: 12px 14px !important; }

    /* KPIs adaptés */
    .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .kpi { padding: 12px !important; }
    .kpi-value { font-size: 20px !important; }
    .kpi-label { font-size: 11px !important; }
    .kpi-icon { width: 32px !important; height: 32px !important; font-size: 16px !important; }

    /* Boutons plus tactiles (44px Apple HIG) */
    .btn { min-height: 44px; padding: 10px 14px; font-size: 14px; }
    .btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
    .btn-lg { min-height: 52px; padding: 14px 20px; font-size: 16px; }

    /* Champs de formulaire — taille tactile */
    .form-control { min-height: 44px; padding: 10px 12px; font-size: 16px; /* 16px = pas de zoom iOS */ }
    select.form-control { padding-right: 32px; }
    textarea.form-control { min-height: 100px; }
    .form-label { font-size: 13px; margin-bottom: 6px; }
    .form-grid-2 { grid-template-columns: 1fr !important; gap: 10px !important; }
    .form-grid-3 { grid-template-columns: 1fr !important; }

    /* Modal en pleine page */
    .modal { padding: 0 !important; }
    .modal-body, #modal > div, #modal .modal-card {
      max-width: 100% !important; width: 100% !important;
      margin: 0 !important; border-radius: 0 !important;
      max-height: 100vh !important; min-height: 100vh;
      padding: 14px !important;
    }
    #modal-title { font-size: 17px !important; padding: 14px !important; }
    #modal-footer { padding: 12px 14px !important; flex-wrap: wrap; gap: 6px; position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--border); }

    /* Tableaux — scroll horizontal forcé */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { font-size: 13px; min-width: 100%; }
    th, td { padding: 10px 8px !important; }

    /* Filtres — empilés verticalement */
    .filters { flex-direction: column; gap: 8px; padding: 10px; }
    .filters > * { width: 100%; }

    /* Bandeau client / dashboard */
    .dashboard-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
    .detail-grid { grid-template-columns: 1fr !important; gap: 12px !important; }

    /* Portail client — tabs horizontal scroll */
    .client-portal-tabs {
      overflow-x: auto; flex-wrap: nowrap !important;
      padding: 8px 12px; -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .client-portal-tabs::-webkit-scrollbar { display: none; }
    .client-portal-tab { flex-shrink: 0; padding: 10px 14px; font-size: 13px; }
    .client-portal-header {
      flex-direction: column; align-items: stretch; gap: 10px;
      padding: 14px;
    }
    .client-portal-actions { flex-wrap: wrap; gap: 6px; }

    /* Hero / lifestyle cards portail */
    .wf-hero h1 { font-size: 24px !important; }
    .wf-hero .intro { font-size: 13px !important; }
    .wf-lifestyle-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
    .wf-card { padding: 16px !important; }
    .wf-card h3 { font-size: 17px !important; }
    .wf-emoji { font-size: 40px !important; }

    /* Nav items tactiles */
    .nav-item { padding: 14px 16px; font-size: 14px; }
    .nav-section { font-size: 11px; padding: 12px 16px 6px; }

    /* Login plus compact */
    .login-card { padding: 24px !important; max-width: 100% !important; margin: 14px !important; }
    .login-logo { width: 48px !important; height: 48px !important; }
  }

  /* Bouton hamburger (caché sur desktop) */
  .sidebar-toggle { display: none; }

  /* === Écrans tactiles : cibles d'au moins 40 px, champs lisibles sans zoom === */
  @media (hover: none) and (pointer: coarse) {
    .btn, button.btn, .tab, .nav-item { min-height: 40px; }
    .btn-sm, .btn.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 13px; }
    .form-control, input.form-control, select.form-control, textarea.form-control { min-height: 42px; font-size: 16px; }
    table td, table th { padding-top: 10px; padding-bottom: 10px; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .topbar .btn { min-height: 38px; }
  }
  /* Tablette en paysage et petit portable : barre latérale plus étroite */
  @media (min-width: 1025px) and (max-width: 1280px) {
    .app { grid-template-columns: 210px 1fr; }
    .nav-item { padding: 9px 14px; font-size: 13.5px; }
    .topbar { padding: 12px 16px; }
  }

  /* === BLOC ID CLIENT EN ÉVIDENCE (style TerminManager wefox) === */
  .client-id-chip {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; font-weight: 700; font-size: 12px;
    padding: 5px 11px; border-radius: 8px;
    letter-spacing: .5px; margin-right: 10px; min-width: 70px;
    text-align: center; box-shadow: 0 1px 3px rgba(26,91,71,.3);
    font-variant-numeric: tabular-nums;
  }
  .client-id-chip.prospect { background: linear-gradient(135deg, #d9a86c 0%, #c4925a 100%); box-shadow: 0 1px 3px rgba(217,168,108,.3); }
  .client-id-chip.vip { background: linear-gradient(135deg, #c9a96b 0%, #b3935a 100%); box-shadow: 0 1px 3px rgba(201,169,107,.3); }
  .client-id-chip.inactif { background: linear-gradient(135deg, #9aa6b8 0%, #7a8499 100%); }
  .client-name-block { display: flex; align-items: center; gap: 4px; }

  /* === ÉCRAN DE CONNEXION === */
  .login-overlay {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #0f3d2e 0%, #1a5b47 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
  }
  .login-card {
    background: #fff; border-radius: 16px; padding: 40px;
    width: 100%; max-width: 520px;
    box-shadow: 0 20px 60px rgba(45,59,79,.25);
    text-align: center;
  }
  .login-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 28px; font-weight: 700;
    box-shadow: 0 4px 12px rgba(26,91,71,.35);
    margin-bottom: 20px;
  }
  .login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
  .login-subtitle { color: var(--text-soft); font-size: 14px; margin-bottom: 28px; }
  .login-input {
    width: 100%; padding: 14px 18px;
    border: 2px solid var(--border); border-radius: 10px;
    font-size: 22px; text-align: center; letter-spacing: 8px;
    font-family: inherit; font-weight: 600;
    transition: border-color .15s;
  }
  .login-input:focus { outline: none; border-color: var(--primary); }
  .login-btn {
    width: 100%; padding: 14px;
    background: var(--primary); color: #fff;
    border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    margin-top: 14px; transition: background .15s;
  }
  .login-btn:hover { background: var(--primary-dark); }
  .login-hint {
    background: var(--bg-soft); border-radius: 8px;
    padding: 12px 16px; font-size: 12px; color: var(--text-soft);
    margin-top: 20px; text-align: left;
  }
  .login-hint code {
    background: #fff; padding: 1px 6px; border-radius: 4px;
    border: 1px solid var(--border); font-size: 11px;
  }
  .login-error {
    background: var(--danger-soft); color: var(--danger);
    padding: 10px; border-radius: 8px; font-size: 13px;
    margin-top: 12px;
  }
  .login-tabs {
    display: flex; gap: 4px; margin-bottom: 18px;
    background: var(--bg-soft); padding: 4px; border-radius: 10px;
  }
  .login-tab {
    flex: 1; padding: 10px; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 500; color: var(--text-soft);
    text-align: center; transition: all .15s;
  }
  .login-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
  /* === PORTAIL CLIENT === */
  .client-portal {
    min-height: 100vh; background: var(--bg);
    display: flex; flex-direction: column;
  }
  .client-portal[dir="rtl"] { direction: rtl; text-align: right; }
  .client-portal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; padding: 20px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    flex-wrap: wrap;
  }
  .client-portal-brand { display: flex; align-items: center; gap: 12px; }
  .client-portal-logo {
    width: 44px; height: 44px; background: rgba(255,255,255,.18);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; letter-spacing: .5px;
  }
  .client-portal-actions { display: flex; gap: 10px; align-items: center; }
  .client-portal-lang {
    background: rgba(255,255,255,.18); border: none; color: #fff;
    padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
  }
  .client-portal-lang option { color: var(--text); }
  .client-portal-tabs {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 0 28px; display: flex; gap: 4px; overflow-x: auto;
  }
  .client-portal-tab {
    padding: 14px 18px; cursor: pointer; font-size: 14px;
    color: var(--text-soft); border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  .client-portal-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
  .client-portal-content { flex: 1; padding: 28px; max-width: 1100px; width: 100%; margin: 0 auto; }
  .msg-thread { max-height: 480px; overflow-y: auto; padding: 8px; }
  .msg {
    margin-bottom: 12px; padding: 10px 14px; border-radius: 12px;
    max-width: 75%; word-wrap: break-word;
  }
  .msg.me { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
  .msg.other { background: var(--bg-soft); color: var(--text); margin-right: auto; border-bottom-left-radius: 4px; }
  .msg-meta { font-size: 11px; opacity: .75; margin-top: 4px; }
  /* RTL adjustments */
  [dir="rtl"] .msg.me { margin-left: 0; margin-right: auto; border-bottom-right-radius: 12px; border-bottom-left-radius: 4px; }
  [dir="rtl"] .msg.other { margin-right: 0; margin-left: auto; border-bottom-left-radius: 12px; border-bottom-right-radius: 4px; }

  /* === STYLE WEFOX-LIKE pour portail client === */
  .wf-hero {
    background: linear-gradient(135deg, #f0f7f4 0%, #ffffff 100%);
    border-radius: 24px;
    padding: 36px 32px;
    margin-bottom: 24px;
    border: 1px solid #e3ede8;
  }
  .wf-hero h1 {
    font-size: 36px;
    font-weight: 800;
    color: #1a5b47;
    line-height: 1.1;
    margin-bottom: 10px;
  }
  .wf-hero .greeting-time {
    color: #7a8499;
    font-size: 14px;
    margin-bottom: 8px;
  }
  .wf-hero p.intro {
    font-size: 18px;
    color: #2d3b4f;
    line-height: 1.5;
    max-width: 560px;
  }
  .wf-lifestyle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
  }
  .wf-card {
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: all .25s;
    position: relative;
    overflow: hidden;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 2px solid transparent;
  }
  .wf-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,.10);
  }
  .wf-card .wf-emoji {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 14px;
  }
  .wf-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a5b47;
    margin-bottom: 6px;
  }
  .wf-card p {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
  }
  .wf-card .wf-cta {
    margin-top: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #1a5b47;
  }
  .wf-card.pink { background: linear-gradient(135deg, #fdf2f4 0%, #ffd1dc 100%); }
  .wf-card.peach { background: linear-gradient(135deg, #fff5eb 0%, #ffd9b3 100%); }
  .wf-card.sky { background: linear-gradient(135deg, #e8f4fd 0%, #b3deff 100%); }
  .wf-card.mint { background: linear-gradient(135deg, #e6f7f0 0%, #b3e9d1 100%); }
  .wf-card.lavender { background: linear-gradient(135deg, #f0ecfa 0%, #cfc2eb 100%); }
  .wf-card.lemon { background: linear-gradient(135deg, #fdfbe8 0%, #faec9b 100%); }
  .wf-card.coral { background: linear-gradient(135deg, #ffe9e3 0%, #ffb8a1 100%); }
  .wf-card.aqua { background: linear-gradient(135deg, #e6f9f7 0%, #a8e8df 100%); }
  .wf-card.lilac { background: linear-gradient(135deg, #f7eef9 0%, #e0bce8 100%); }

  .wf-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a5b47;
    margin: 28px 0 14px;
  }
  .wf-section-subtitle {
    color: #7a8499;
    font-size: 14px;
    margin-bottom: 18px;
  }

  .wf-savings-banner {
    background: linear-gradient(135deg, #1a5b47 0%, #2d8c6d 100%);
    color: #fff;
    border-radius: 24px;
    padding: 28px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
  }
  .wf-savings-banner .savings-amount {
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
    margin: 8px 0;
  }
  .wf-savings-banner .savings-label {
    font-size: 13px;
    opacity: .9;
    text-transform: uppercase;
    letter-spacing: 1.5px;
  }
  /* Comparateur */
  .wf-comparator-row {
    display: grid;
    grid-template-columns: 200px repeat(5, 1fr);
    gap: 10px;
    padding: 14px 10px;
    border-bottom: 1px solid #ede7dd;
    align-items: center;
  }
  .wf-comparator-row.header {
    background: #faf8f4;
    font-weight: 700;
    border-radius: 12px 12px 0 0;
  }
  .wf-comparator-row.best {
    background: linear-gradient(90deg, rgba(123,164,138,.15), transparent);
    border-left: 4px solid #1a5b47;
  }
  .wf-insurer-name {
    font-weight: 600;
    color: #1a5b47;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  /* === Choix de l'espace à la connexion === */
  .space-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .space-tile { background: #fff; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 8px 10px; cursor: pointer; text-align: center; transition: all .15s; font-family: inherit; display: flex; flex-direction: column; align-items: center; gap: 3px; }
  .space-tile:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(26,91,71,.15); }
  .space-tile b { font-size: 12.5px; color: var(--text); }
  .space-tile small { font-size: 10.5px; color: var(--text-soft); line-height: 1.25; }
  .space-ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 4px; }
  .space-head { border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; color: #fff; text-align: left; font-size: 12.5px; line-height: 1.45; }
  .space-head b { display: block; font-size: 15px; margin-bottom: 2px; }
  .login-back { display: block; width: 100%; margin-top: 10px; background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 8px; color: var(--text-soft); cursor: pointer; font-size: 12.5px; font-family: inherit; }
  .login-back:hover { border-color: var(--primary); color: var(--primary); }
  @media (max-width: 520px) { .space-grid { grid-template-columns: repeat(2, 1fr); } }

  /* === Espace client — version application (téléphone) === */
  @media (max-width: 720px) {
    .client-portal-content { padding: 12px !important; }
    .client-portal-content div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .client-portal-content div[style*="display:flex"][style*="gap:18px"] { flex-direction: column; align-items: flex-start !important; }
    .client-portal-tabs, .cp-nav-l2 { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .client-portal-header { padding: 12px 14px !important; }
    .table-wrap { overflow-x: auto; }
  }
  /* Mode application (téléphone) : en-tête compact + barre d'onglets en bas */
  .cp-bottom-nav { display: none; }
  @media (max-width: 720px) {
    .client-portal-header .client-portal-logo { width: 36px !important; height: 36px !important; font-size: 13px !important; }
    .client-portal-header { gap: 8px !important; }
    .client-portal-actions { gap: 6px !important; }
    .client-portal-actions .client-portal-lang { padding: 6px 8px !important; font-size: 12px !important; }
    .client-portal > div[style*="border-bottom:1px solid var(--border)"] { padding: 8px 14px !important; gap: 8px !important; }
    .client-portal > div[style*="border-bottom:1px solid var(--border)"] .avatar { width: 36px !important; height: 36px !important; font-size: 13px !important; }
    .client-portal > div[style*="border-bottom:1px solid var(--border)"] div[style*="font-size:17px"] { font-size: 14px !important; }
    .client-portal > div[style*="border-bottom:1px solid var(--border)"] .btn { padding: 5px 9px !important; font-size: 11.5px !important; }
    .client-portal > div[style*="border-bottom:1px solid var(--warning)"] { padding: 6px 14px !important; font-size: 11.5px !important; }
    .client-portal-tabs.cp-nav-l1 { display: none !important; }
    .client-portal-content { padding-bottom: 84px !important; }
    .cp-bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    .cp-bottom-nav button { flex: 1; background: none; border: 0; font-family: inherit; font-size: 10.5px; color: #6b7280; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; cursor: pointer; position: relative; }
    .cp-bottom-nav button span.ico { font-size: 20px; line-height: 1; }
    .cp-bottom-nav button.active { color: var(--emerald-dark, #0f3d2e); font-weight: 700; }
    .cp-bottom-nav button .bd { position: absolute; top: 0; right: 12px; background: #dc2626; color: #fff; border-radius: 9px; font-size: 9px; padding: 1px 5px; }
  }
  @media (max-width: 720px) { .lyl-assist-wrap { bottom: 84px !important; right: 12px !important; } }
