
  /* ============================================================
     NOUVEAUX CONTRATS · phase setup pré-production
     Tableau dynamique des fiches en stage='nouveau_contrat'.
     Design : meme layout que /projets/ (Demandes d estimation) mais
     les cartes utilisent la version mockup avec setup-badges.
     ============================================================ */

  /* Page bg legerement grise pour que les cartes blanches popent.
     Pattern partage avec les autres tableaux kanban (Demandes, Production, Termine). */
  .content { background: var(--surface-soft) !important; padding: 0 !important; }
  body.has-layout { background: var(--surface-soft); }
  .pipeline-wrap {
    padding: var(--space-lg) var(--space-xl) var(--space-xxl);
    background: var(--surface-soft);
    min-height: 100%;
  }
  /* S assurer que les cartes restent blanches meme si une cascade essaie l ecraser */
  .demande-card { background: var(--canvas) !important; }

  /* Stage nav · meme style que index.html (Demandes d estimation) */
  .stage-nav {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: var(--space-lg);
  }
  .stage-nav a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--r-pill);
    font-size: 13px; font-weight: 500; text-decoration: none;
    border: 1px solid var(--hairline);
    background: var(--canvas); color: var(--body);
    transition: all 0.15s;
  }
  .stage-nav a:hover { border-color: var(--primary); color: var(--primary); }
  .stage-nav a.active {
    background: var(--primary); border-color: var(--primary);
    color: #fff; font-weight: 600;
  }
  .stage-nav a .count {
    background: rgba(255,255,255,0.25); border-radius: var(--r-pill);
    padding: 1px 7px; font-size: 11px; font-family: var(--font-mono);
    min-width: 20px; text-align: center;
  }
  .stage-nav a:not(.active) .count {
    background: var(--surface-strong); color: var(--muted);
  }

  /* Filter bar (search + view toggle) · meme pattern que index.html */
  .filters-bar {
    display: flex; align-items: center; gap: var(--space-xs);
    flex-wrap: wrap; margin-bottom: var(--space-base);
  }
  /* Groupe recherche · input + bouton Filtre (pastille) dans un seul pill */
  .search-group {
    display: flex; align-items: center;
    flex: 1; max-width: 560px;
    height: 38px; padding-right: 5px;
    border: 1px solid var(--hairline); border-radius: var(--r-pill);
    background: var(--canvas);
    transition: border-color 0.15s;
  }
  .search-group:focus-within { border-color: var(--primary); }
  .search-group input[type="search"] {
    flex: 1; min-width: 0; height: 100%;
    border: none; background: transparent; outline: none;
    padding: 0 14px; font-size: 13px; font-family: inherit; color: var(--ink);
    border-radius: var(--r-pill);
  }

  .view-toggle {
    display: flex; gap: 2px; background: var(--canvas);
    border: 1px solid var(--hairline); border-radius: var(--r-pill);
    padding: 3px; margin-left: auto;
  }
  .view-btn {
    background: transparent; border: none; cursor: pointer;
    padding: 6px 12px; border-radius: var(--r-pill);
    color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.12s, color 0.12s;
  }
  .view-btn:hover { color: var(--ink); }
  .view-btn.active { background: var(--ink); color: #fff; }
  .view-btn svg { width: 14px; height: 14px; }

  /* Kanban · meme structure que index.html (colonnes flat sans fond/bordure) */
  .kanban-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: var(--space-base);
    margin: 0 calc(-1 * var(--space-xl));
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
    /* Drag-to-pan · scrollbar masquee, on saisit le tableau */
    cursor: grab;
    user-select: none;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge */
  }
  .kanban-scroll::-webkit-scrollbar { display: none; }   /* Chrome/Safari */
  .kanban-scroll.dragging { cursor: grabbing; scroll-behavior: auto; }
  .kanban-scroll.dragging .demande-card { pointer-events: none; }
  .kanban-board {
    display: flex; gap: 20px;
    min-width: max-content;
    align-items: flex-start;
  }
  .kanban-col {
    width: 280px; flex-shrink: 0;
    background: transparent;
    border: 0;
  }
  .col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 4px 10px;
  }
  .col-header-left { display: flex; align-items: center; gap: 8px; }
  .col-dot {
    width: 8px; height: 8px; border-radius: var(--r-full);
    flex-shrink: 0;
  }
  .col-label {
    font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.07em;
  }
  .col-count {
    font-size: 11px; font-family: var(--font-mono);
    color: var(--muted); background: var(--surface-soft);
    border-radius: var(--r-pill); padding: 1px 7px;
  }
  .col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
  .col-empty {
    padding: 16px 12px; text-align: center;
    font-size: 11px; color: var(--muted-soft);
  }

  /* ============================================================
     CARTE NOUVEAU CONTRAT · garde le design mockup avec setup-badges
     ============================================================ */
  .demande-card {
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    padding: var(--space-sm) var(--space-base);
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
  }
  .demande-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
    transform: translateY(-1px);
  }
  .card-name {
    font-size: 13px; font-weight: 600; color: var(--ink);
    margin-bottom: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .card-addr { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
  .card-types { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 8px; }
  .card-type {
    background: var(--surface-strong);
    color: var(--body);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--r-pill);
  }
  .card-action {
    border-top: 1px solid var(--hairline-soft);
    padding-top: 8px;
    font-size: 11px;
    color: var(--body);
  }
  .card-action .next {
    display: flex; align-items: center; gap: 5px;
    color: var(--ink); font-weight: 600; margin-bottom: 2px;
  }
  .card-action .note { color: var(--muted); }
  .card-foot {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 6px;
    font-size: 10px; color: var(--muted);
  }
  .card-foot .avatar {
    width: 18px; height: 18px;
    border-radius: var(--r-full);
    background: var(--primary);
    color: var(--on-primary);
    font-size: 9px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  /* Ligne contremaitre · entre les livrables et le card-foot. Avatar de
     couleur differente (orange) pour le distinguer du charge de projet. */
  .card-foreman-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 4px; margin-bottom: 2px;
    font-size: 10px; color: var(--muted);
  }
  .card-foreman {
    display: inline-flex; align-items: center; gap: 5px;
  }
  .card-foreman .avatar-cm {
    width: 18px; height: 18px;
    border-radius: var(--r-full);
    background: var(--accent-yellow, #f4b000);
    color: var(--canvas);
    font-size: 9px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  /* Livrables badges · 1 dot par livrable de la fiche. Gris par defaut,
     vert si signe. Compteur X/Y a droite pour vue d ensemble rapide. */
  .setup-badges {
    display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
    margin-bottom: 6px;
  }
  .setup-badge {
    width: 22px; height: 22px;
    border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-strong);
    color: var(--muted-soft);
    border: 1px solid var(--hairline-soft);
    flex-shrink: 0;
  }
  .setup-badge svg { width: 11px; height: 11px; }
  .setup-badge.done {
    background: rgba(5, 177, 105, 0.15);
    color: var(--semantic-up);
    border-color: var(--semantic-up);
  }
  .setup-count {
    font-size: 11px; font-family: var(--font-mono);
    color: var(--muted);
    margin-left: 4px;
    flex-shrink: 0;
  }

  /* Liste · groupes par statut (meme pattern que /projets/) */
  .list-group {
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    overflow: hidden;
    margin-bottom: var(--space-base);
    background: var(--canvas);
  }
  .list-group:last-child { margin-bottom: 0; }
  .list-group-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--hairline-soft);
    background: var(--surface-soft);
  }
  .list-group-dot { width: 7px; height: 7px; border-radius: var(--r-full); flex-shrink: 0; }
  .list-group-label { font-size: 11px; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: 0.07em; }
  /* Compteur · petite pastille juste a cote du titre (comme les pills du
     stage-nav en haut), pas pousse a droite. */
  .list-group-count {
    font-size: 11px; font-family: var(--font-mono); font-weight: 600;
    color: var(--muted);
    background: var(--surface-strong);
    border-radius: var(--r-pill);
    padding: 1px 8px;
    min-width: 20px; text-align: center;
  }

  .list-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .list-table-scroll::-webkit-scrollbar { display: none; }

  /* table-layout: fixed + colgroup partage · garantit que les colonnes
     s alignent IDENTIQUEMENT entre tous les groupes (sinon chaque table
     auto-dimensionne ses colonnes selon son propre contenu = decale). */
  .list-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
  .list-table th, .list-table td {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .list-table th {
    text-align: left;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--hairline-soft);
    background: var(--canvas);
  }
  .list-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--hairline-soft);
    color: var(--body);
    vertical-align: middle;
  }
  .list-table tr:last-child td { border-bottom: 0; }
  .list-table tbody tr { cursor: pointer; transition: background 0.12s; }
  .list-table tbody tr:hover td { background: var(--surface-soft); }
  .list-table .td-mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
  @media (max-width: 768px) {
    .list-table { min-width: 760px; }
  }

  /* Cellule Livrables · bouton compteur X/Y + chevron · ouvre un dropdown */
  .livr-cell-td { width: 1%; white-space: nowrap; }
  .livr-cell-btn {
    display: inline-flex; align-items: center; gap: 5px;
    height: 26px; padding: 0 8px 0 10px;
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
  }
  .livr-cell-btn:hover { border-color: var(--primary); background: var(--canvas); }
  .livr-cell-count {
    font-family: var(--font-mono); font-size: 12px; font-weight: 600;
    color: var(--ink);
  }
  .livr-cell-btn.all-done { background: rgba(5, 177, 105, 0.12); border-color: var(--semantic-up); }
  .livr-cell-btn.all-done .livr-cell-count { color: var(--semantic-up); }
  .livr-cell-btn svg { width: 12px; height: 12px; color: var(--muted); }

  /* Dropdown des livrables · popover fixed cree dynamiquement */
  #livr-dropdown {
    z-index: 1000;
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-hover);
    overflow: hidden;
    animation: livr-dd-in 0.12s ease;
  }
  @keyframes livr-dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  .livr-dropdown-head {
    padding: 9px 14px;
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    border-bottom: 1px solid var(--hairline-soft);
    background: var(--surface-soft);
  }
  .livr-dropdown-list { max-height: 320px; overflow-y: auto; padding: 4px; }
  .livr-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: var(--r-sm);
    font-size: 13px; color: var(--body);
  }
  .livr-dropdown-icon { display: inline-flex; flex-shrink: 0; color: var(--muted-soft); }
  .livr-dropdown-icon svg { width: 15px; height: 15px; }
  .livr-dropdown-item.done .livr-dropdown-icon { color: var(--semantic-up); }
  .livr-dropdown-label { flex: 1; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
  .livr-dropdown-label > :first-child, .livr-dropdown-item.done .livr-dropdown-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .livr-dropdown-item.done .livr-dropdown-label { color: var(--muted); }
  .livr-dropdown-date {
    font-size: 10px; color: var(--muted-soft); font-family: var(--font-mono);
    text-decoration: none;
  }
  .livr-dropdown-state {
    flex-shrink: 0; font-size: 11px; font-weight: 600;
    color: var(--muted-soft);
  }
  .livr-dropdown-item.done .livr-dropdown-state { color: var(--semantic-up); }

  .loading-state, .empty-state {
    text-align: center; padding: 80px 24px;
    color: var(--muted);
    font-size: 13px;
  }
  .empty-state { color: var(--muted-soft); font-style: italic; }

  @media (max-width: 768px) {
    .pipeline-wrap { padding: var(--space-base); }
    .kanban-scroll { margin: 0 calc(-1 * var(--space-base)); padding: 0 var(--space-base) var(--space-base); }
    .kanban-col { width: 250px; }
  }
