/* ==========================================================================
   GPF - Charte graphique
   Palette inspirée du site corporate GPF : bleu institutionnel + blanc,
   design clean et professionnel pour le secteur médical B2B.
   ========================================================================== */

:root {
    /* Couleurs principales - charte GPF */
    --gpf-teal: #2a6862;           /* vert sarcelle du logo GPF */
    --gpf-teal-dark: #1c4a46;      /* hover / états actifs */
    --gpf-teal-light: #4a8c85;     /* teal secondaire */
    --gpf-teal-soft: #e7f0ef;      /* arrière-plans subtils */
    --gpf-accent: #d42728;         /* rouge accent (logo + alertes) */
    --gpf-accent-dark: #a51d1e;
    --gpf-accent-soft: #fbe7e7;

    /* Alias de compatibilité (legacy) */
    --gpf-blue: var(--gpf-teal);
    --gpf-blue-dark: var(--gpf-teal-dark);
    --gpf-blue-light: var(--gpf-teal-light);
    --gpf-blue-soft: var(--gpf-teal-soft);

    /* Neutres */
    --white: #ffffff;
    --grey-50: #f7f9fc;
    --grey-100: #eef2f7;
    --grey-200: #e1e7ef;
    --grey-300: #cbd3df;
    --grey-400: #9aa5b4;
    --grey-500: #6b7687;
    --grey-600: #4a5464;
    --grey-700: #2f3847;
    --grey-900: #101827;

    /* Sémantique */
    --success: #1a8754;
    --success-soft: #e6f4ec;
    --warning: #c77700;
    --danger: #c92a2a;

    /* Typographie */
    --font-title: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    --font-body: 'Open Sans', 'Segoe UI', Arial, sans-serif;

    /* Mise en forme */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(28, 74, 70, 0.06);
    --shadow-md: 0 4px 12px rgba(28, 74, 70, 0.10);
    --shadow-lg: 0 10px 30px rgba(28, 74, 70, 0.15);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--grey-700);
    background: var(--grey-50);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-title);
    color: var(--gpf-blue);
    margin: 0 0 .5rem;
    line-height: 1.25;
}

a { color: var(--gpf-blue-light); text-decoration: none; }
a:hover { color: var(--gpf-blue-dark); text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
    background: var(--white);
    border-bottom: 3px solid var(--gpf-teal);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 20;
}

/* Bande fine rouge accent sous la bordure teal */
.site-header::after {
    content: "";
    display: block;
    height: 2px;
    background: var(--gpf-accent);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo {
    height: 52px;
    width: auto;
    display: block;
}
.brand-tagline {
    font-size: .78rem;
    color: var(--grey-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 2px solid var(--grey-200);
    padding-left: 14px;
    line-height: 1.3;
    max-width: 180px;
}
@media (max-width: 720px) {
    .brand-tagline { display: none; }
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    font-weight: 600;
    color: var(--grey-600);
    padding: 8px 4px;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.nav-link:hover { color: var(--gpf-blue); text-decoration: none; }
.nav-link.active {
    color: var(--gpf-blue);
    border-bottom-color: var(--gpf-blue);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--gpf-blue-soft);
    border-radius: 999px;
    font-size: .85rem;
}
.user-name { font-weight: 600; color: var(--gpf-blue); }
.user-badge {
    background: var(--gpf-blue);
    color: var(--white);
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ---------- Layout principal ---------- */
.site-main {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 28px 48px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}
.page-title {
    font-size: 1.9rem;
    margin: 0 0 4px;
}
.page-lead {
    color: var(--grey-500);
    margin: 0;
    font-size: .98rem;
}

/* ---------- Grid ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Card ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--grey-200);
    background: linear-gradient(180deg, var(--gpf-blue-soft) 0%, var(--white) 100%);
}
.card-title {
    font-size: 1.1rem;
    margin: 0;
}

/* ---------- Chips & badges ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    font-size: .8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}
.chip-info {
    background: var(--gpf-blue);
    color: var(--white);
}

.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 3px 9px;
    border-radius: 4px;
}
.badge-on { background: var(--success-soft); color: var(--success); }
.badge-off { background: var(--grey-100); color: var(--grey-500); }
.badge-platform {
    background: var(--gpf-teal-soft);
    color: var(--gpf-teal-dark);
    border: 1px solid var(--gpf-teal-light);
}

/* ---------- Listes ---------- */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--grey-100);
}
.list-item:last-child { border-bottom: none; }
.list-main { min-width: 0; }
.list-title {
    display: block;
    font-weight: 600;
    color: var(--gpf-blue);
    font-size: 1rem;
}
.list-desc {
    margin: 2px 0 0;
    color: var(--grey-500);
    font-size: .88rem;
}

.keyword-cloud {
    list-style: none;
    margin: 0;
    padding: 18px 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.keyword-pill {
    display: inline-block;
    background: var(--gpf-teal-soft);
    color: var(--gpf-teal-dark);
    border: 1px solid var(--gpf-teal-light);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 500;
}
.keyword-pill-sm {
    padding: 2px 8px;
    font-size: .75rem;
    margin: 2px 2px 0 0;
}

.empty-state {
    padding: 26px 22px;
    color: var(--grey-500);
    text-align: center;
    font-style: italic;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: .92rem;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
    text-decoration: none;
    line-height: 1;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--gpf-blue);
    color: var(--white);
}
.btn-primary:hover { background: var(--gpf-blue-dark); color: var(--white); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--gpf-blue);
    border-color: var(--grey-200);
}
.btn-ghost:hover {
    background: var(--gpf-blue-soft);
    border-color: var(--gpf-blue-light);
    text-decoration: none;
}

.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-block { width: 100%; }

.btn-icon {
    background: transparent;
    border: 1px solid var(--grey-200);
    color: var(--grey-600);
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
    cursor: pointer;
    margin-left: 4px;
    transition: background .15s, color .15s, border-color .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    text-decoration: none;
}
.btn-icon:hover {
    background: var(--gpf-blue-soft);
    border-color: var(--gpf-blue-light);
    color: var(--gpf-blue);
    text-decoration: none;
}
.btn-icon.btn-delete:hover {
    background: var(--gpf-accent-soft);
    border-color: var(--gpf-accent);
    color: var(--gpf-accent);
}
/* Variantes colorées des boutons d'action */
.btn-icon-info { color: var(--gpf-teal-dark); }
.btn-icon-info:hover { background: var(--gpf-teal-soft); border-color: var(--gpf-teal-light); color: var(--gpf-teal); }
.btn-icon-validate { color: var(--success); }
.btn-icon-validate:hover { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.btn-icon-cancel { color: var(--gpf-accent); }
.btn-icon-cancel:hover { background: var(--gpf-accent-soft); border-color: var(--gpf-accent); color: var(--gpf-accent-dark); }
.btn-icon-workspace {
    background: var(--gpf-teal);
    color: var(--white);
    border-color: var(--gpf-teal);
}
.btn-icon-workspace:hover {
    background: var(--gpf-teal-dark);
    color: var(--white);
    border-color: var(--gpf-teal-dark);
}
.btn-icon-ask { color: #1f3a8a; font-weight: 700; }
.btn-icon-ask:hover {
    background: #e9eef9;
    border-color: #6b8edb;
    color: #1f3a8a;
}

/* Modal d'invitation aux chargés */
.invite-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.invite-group {
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}
.invite-group-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--gpf-teal-dark);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--grey-100);
}
.invite-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 4px; cursor: pointer;
    border-radius: 4px;
    font-size: .9rem;
}
.invite-row:hover { background: var(--gpf-teal-soft); }
.invite-row-disabled { opacity: .5; cursor: not-allowed; }
.invite-row-disabled:hover { background: transparent; }
.invite-name { font-weight: 600; min-width: 160px; }
.invite-row .badge { font-size: .7rem; }

/* ---------- Formulaires ---------- */
.field {
    display: block;
    margin-bottom: 14px;
}
.field-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--grey-600);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="url"],
.field input[type="email"],
.field textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: .95rem;
    color: var(--grey-700);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-md);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--gpf-blue-light);
    box-shadow: 0 0 0 3px rgba(42, 104, 98, 0.15);
}

.field-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 14px;
    font-size: .92rem;
    color: var(--grey-600);
    cursor: pointer;
}

.inline-form {
    display: flex;
    gap: 10px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--grey-100);
}
.inline-form input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-md);
    font-size: .95rem;
    font-family: inherit;
}
.inline-form input[type="text"]:focus {
    outline: none;
    border-color: var(--gpf-blue-light);
    box-shadow: 0 0 0 3px rgba(42, 104, 98, 0.15);
}

/* ---------- Login ---------- */
.login-page { background: linear-gradient(135deg, var(--gpf-teal-dark) 0%, var(--gpf-teal) 60%, var(--gpf-teal-light) 100%); }
.login-page .site-main { display: flex; align-items: center; justify-content: center; padding: 60px 20px; }

.login-wrapper { width: 100%; max-width: 420px; }
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--gpf-accent);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo {
    display: block;
    margin: 0 auto 14px;
    max-width: 200px;
    height: auto;
}
.login-title { font-size: 1.4rem; margin: 0 0 4px; }
.login-subtitle { color: var(--grey-500); font-size: .92rem; margin: 0; }
.login-form { margin-top: 8px; }
.login-hint {
    margin-top: 18px;
    text-align: center;
    font-size: .82rem;
    color: var(--grey-500);
}

/* ---------- Flash messages ---------- */
.flash-zone { margin-bottom: 18px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border-left: 4px solid;
    font-size: .92rem;
}
.flash-error {
    background: var(--gpf-accent-soft);
    border-color: var(--gpf-accent);
    color: var(--danger);
}
.flash-success {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success);
}

/* ---------- Sous-onglets (dashboard, gestion) ---------- */
.sub-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 18px;
    padding-bottom: 0;
    border-bottom: 2px solid var(--grey-200);
}
.sub-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: .9rem;
    color: var(--grey-500);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.sub-tab:hover {
    color: var(--gpf-teal);
    text-decoration: none;
}
.sub-tab.active {
    color: var(--gpf-teal-dark);
    border-bottom-color: var(--gpf-teal);
}
.sub-tab-count {
    display: inline-block;
    padding: 2px 8px;
    background: var(--grey-100);
    color: var(--grey-600);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}
.sub-tab.active .sub-tab-count {
    background: var(--gpf-teal);
    color: var(--white);
}

/* ---------- Onglets administration ---------- */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--grey-200);
}
.admin-tab {
    padding: 12px 20px;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: .95rem;
    color: var(--grey-500);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin-bottom: -1px;
}
.admin-tab:hover { color: var(--gpf-blue); text-decoration: none; background: var(--gpf-blue-soft); }
.admin-tab.active {
    color: var(--gpf-blue);
    background: var(--white);
    border-color: var(--grey-200);
    border-bottom-color: var(--white);
}

/* ---------- Tables ---------- */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
.data-table thead th {
    background: var(--grey-50);
    text-align: left;
    padding: 12px 16px;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--grey-600);
    border-bottom: 2px solid var(--grey-200);
}
.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--grey-100);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--gpf-blue-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .cell-name { font-weight: 600; color: var(--gpf-blue); }
.data-table .cell-url a { font-size: .88rem; word-break: break-all; }
.data-table .cell-desc { color: var(--grey-500); font-size: .88rem; max-width: 340px; }
.data-table .cell-term { font-weight: 500; color: var(--grey-700); }
.data-table .cell-buyer { font-weight: 500; color: var(--grey-700); max-width: 240px; }
.data-table .cell-dept {
    font-weight: 600;
    color: var(--gpf-teal-dark);
    font-size: .88rem;
    max-width: 180px;
    white-space: normal;
}
.data-table .cell-deadline { white-space: nowrap; }
.data-table .cell-lots { max-width: 360px; font-size: .88rem; line-height: 1.45; }
.data-table .cell-lots .lot-line { padding: 1px 0; }
.data-table .cell-lots .lot-line + .lot-line { border-top: 1px dashed var(--grey-100); margin-top: 2px; padding-top: 3px; }
.data-table .cell-lots small { display: inline-block; }

/* Pastilles "date de rendu" avec niveau d'urgence */
.deadline-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}
.deadline-past   { background: var(--grey-100); color: var(--grey-500); text-decoration: line-through; }
.deadline-urgent { background: var(--gpf-accent-soft); color: var(--gpf-accent-dark); border: 1px solid var(--gpf-accent); }
.deadline-soon   { background: #fff4e0; color: #8a5a00; border: 1px solid #e0c060; }
.deadline-future { background: var(--gpf-teal-soft); color: var(--gpf-teal-dark); }

/* Pastille Type T / M */
.data-table .cell-type { text-align: center; }
.type-pill {
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 24px;
    border-radius: 50%;
    font-weight: 700;
    font-size: .85rem;
    text-align: center;
    border: 1.5px solid;
}
.type-t {
    background: #e9eef9;
    color: #1f3a8a;
    border-color: #6b8edb;
}
.type-m {
    background: #fff4e0;
    color: #8a5a00;
    border-color: #e0c060;
}
.data-table .cell-title { font-weight: 500; color: var(--grey-900); max-width: 560px; }
.data-table .cell-title a { color: var(--gpf-teal-dark); text-decoration: none; }
.data-table .cell-title a:hover { text-decoration: underline; color: var(--gpf-teal); }
.data-table .cell-date { white-space: nowrap; color: var(--grey-500); font-size: .88rem; }

.muted { display: block; color: var(--grey-500); font-size: .85rem; margin-top: 4px; }

.header-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- Modal info appel d'offres ---------- */
.modal-wide { max-width: 720px; }
.modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; padding: 22px 28px 12px;
}
.modal-header .modal-title { margin: 0; font-size: 1.15rem; line-height: 1.35; flex: 1; }
.modal-close {
    background: transparent; border: none; font-size: 1.6rem; line-height: 1;
    color: var(--grey-500); cursor: pointer; padding: 2px 8px; border-radius: 4px;
}
.modal-close:hover { background: var(--gpf-teal-soft); color: var(--gpf-teal); }
.modal-body { padding: 6px 28px 18px; max-height: 65vh; overflow-y: auto; }
.modal-footer {
    padding: 14px 28px; border-top: 1px solid var(--grey-200);
    display: flex; justify-content: flex-end; gap: 10px;
}

.info-grid {
    display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px;
    margin: 0 0 18px; padding: 14px 16px; background: var(--grey-50);
    border-radius: var(--radius-md);
}
.info-grid dt { color: var(--grey-500); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.info-grid dd { margin: 0; color: var(--grey-700); }

.info-section-title {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .5px;
    color: var(--grey-500); margin: 18px 0 8px;
}
.info-summary {
    background: var(--gpf-teal-soft); border-left: 3px solid var(--gpf-teal);
    padding: 14px 16px; border-radius: var(--radius-sm);
    color: var(--grey-700); line-height: 1.6;
}

/* Carte dans la fiche Info */
.info-map-wrap {
    margin: 16px 0 6px;
}
.info-map {
    height: 220px;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--grey-200);
    overflow: hidden;
}
.info-map-wrap small { display: block; text-align: right; margin-top: 4px; }
.leaflet-popup-content { font-family: inherit; font-size: .88rem; }

/* Cartes de credentials par plateforme */
.cred-card {
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 16px;
    background: var(--white);
    transition: border-color .15s;
}
.cred-card:hover { border-color: var(--gpf-teal-light); }
.cred-card-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 14px;
}
.cred-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    color: var(--gpf-teal-dark);
}
.cred-title .badge { font-size: .7rem; margin-left: 6px; vertical-align: middle; }
.cred-actions {
    display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px;
}
.cred-test-ok    { color: var(--success); }
.cred-test-error { color: var(--gpf-accent-dark); }

.files-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.files-list .btn { text-decoration: none; }

.loading-state { color: var(--grey-500); font-style: italic; }

/* Boutons d'action dans la table */
.btn-download {
    text-decoration: none;
    color: var(--gpf-teal-dark);
}
.btn-download:hover {
    background: var(--gpf-teal-soft);
    color: var(--gpf-teal);
    border-color: var(--gpf-teal-light);
    text-decoration: none;
}
.btn-info:hover {
    background: var(--gpf-teal-soft);
    color: var(--gpf-teal-dark);
    border-color: var(--gpf-teal);
}
.btn-edit-workspace {
    background: var(--gpf-teal);
    color: var(--white);
    border-color: var(--gpf-teal);
    text-decoration: none;
    font-weight: 600;
}
.btn-edit-workspace:hover {
    background: var(--gpf-teal-dark);
    color: var(--white);
    border-color: var(--gpf-teal-dark);
    text-decoration: none;
}
.btn-icon:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon.is-disabled { opacity: .4; pointer-events: none; }

/* ---------- Lot A.1 : triage des AO ---------- */
.btn-triage {
    margin-left: 6px;
    font-weight: 600;
}
.btn-triage-study {
    background: var(--success-soft);
    color: var(--success);
    border-color: var(--success);
}
.btn-triage-study:hover {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}
.btn-triage-ignore {
    color: var(--grey-500);
    border-color: var(--grey-200);
}
.btn-triage-ignore:hover {
    background: var(--gpf-accent-soft);
    color: var(--gpf-accent-dark);
    border-color: var(--gpf-accent);
}

/* Animation de disparition d'une ligne après triage */
tr.row-fading {
    animation: rowFadeOut 0.28s ease-out forwards;
}
@keyframes rowFadeOut {
    0%   { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(40px); }
}

/* Badges de comptage dans la navigation */
.nav-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--white);
    background: var(--gpf-accent);
    border-radius: 999px;
    vertical-align: middle;
}
.nav-badge-active {
    background: var(--gpf-teal);
}

/* Chip "muted" pour le compteur d'historique ignorés */
.chip-muted {
    background: var(--grey-300);
    color: var(--grey-700);
    margin-left: 6px;
}

/* Section repliable "Historique AO ignorés" */
.archive-section {
    border: 1px dashed var(--grey-300);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    background: var(--grey-50);
}
.archive-section[open] {
    background: var(--white);
}
.archive-summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: var(--grey-700);
    font-weight: 600;
    outline: none;
}
.archive-summary::-webkit-details-marker { display: none; }
.archive-summary-text {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--grey-600);
}
.archive-summary-text::before {
    content: "▶ ";
    display: inline-block;
    transition: transform 0.15s ease;
    color: var(--grey-500);
}
.archive-section[open] .archive-summary-text::before {
    content: "▼ ";
    color: var(--gpf-teal);
}
.archive-section[open] .archive-summary-text {
    color: var(--gpf-teal);
}

/* Styling visuel des lignes archivées */
tr.row-archived td {
    color: var(--grey-500);
}
tr.row-archived .cell-title a {
    color: var(--grey-600);
}

/* ---------- Lot A.2 : selects workflow + assignation ---------- */
.select-workflow,
.select-assign {
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23666' stroke-width='2' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.select-workflow:focus,
.select-assign:focus {
    outline: none;
    border-color: var(--gpf-teal-light);
    box-shadow: 0 0 0 3px rgba(42, 104, 98, 0.15);
}

/* Couleurs par statut workflow */
.workflow-a_etudier { background-color: var(--grey-50); color: var(--grey-700); }
.workflow-assigne   { background-color: var(--gpf-teal-soft); color: var(--gpf-teal-dark); border-color: var(--gpf-teal-light); }
.workflow-en_cours  { background-color: #fff7e0; color: #8a5a00; border-color: #e0c060; }
.workflow-depose    { background-color: #e9eef9; color: #1f3a8a; border-color: #6b8edb; }
.workflow-gagne     { background-color: var(--success-soft); color: var(--success); border-color: var(--success); }
.workflow-perdu     { background-color: var(--gpf-accent-soft); color: var(--gpf-accent-dark); border-color: var(--gpf-accent); }

/* Détails JSON dans le journal d'activité */
.details-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .8rem;
    color: var(--grey-600);
    background: var(--grey-50);
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid var(--grey-200);
    word-break: break-all;
}
.muted-strong {
    color: var(--gpf-teal-dark);
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Mise en évidence des lignes avec DCE téléchargé ---------- */
tr.row-has-dce td {
    background: linear-gradient(90deg, rgba(26, 135, 84, 0.08) 0%, transparent 60%);
}
tr.row-has-dce td:first-child {
    box-shadow: inset 3px 0 0 var(--success);
    position: relative;
}
tr.row-has-dce:hover td {
    background: linear-gradient(90deg, rgba(26, 135, 84, 0.14) 0%, var(--gpf-teal-soft) 100%);
}

/* Badge "DCE" inline dans le titre */
.dce-flag {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--white);
    background: var(--success);
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Variante pour les lignes archivées : badge grisé */
tr.row-archived .dce-flag {
    background: var(--grey-400);
}
tr.row-archived.row-has-dce td {
    background: linear-gradient(90deg, rgba(74, 84, 100, 0.06) 0%, transparent 60%);
}
tr.row-archived.row-has-dce td:first-child {
    box-shadow: inset 3px 0 0 var(--grey-400);
}

/* ---------- Analyse du DCE (modal Info) ---------- */
.dce-analysis {
    background: var(--white);
    border: 1px solid var(--gpf-teal-light);
    border-left: 4px solid var(--gpf-teal);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--grey-700);
    line-height: 1.55;
}
.dce-analysis p {
    margin: 0 0 8px;
}
.dce-analysis .dce-section-title {
    font-family: var(--font-title);
    color: var(--gpf-teal-dark);
    font-size: .95rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 14px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gpf-teal-soft);
}
.dce-analysis .dce-section-title:first-child {
    margin-top: 0;
}
.dce-analysis .dce-list {
    margin: 0 0 8px;
    padding-left: 18px;
}
.dce-analysis .dce-list li {
    margin: 2px 0;
}
.dce-pending {
    background: #fff7e0;
    border-left: 3px solid #c77700;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #8a5a00;
    font-style: normal;
}

/* ============================================================
   Table tools : filtres, tri, export
   ============================================================ */

/* Bouton d'export dans le card-header */
.table-tools-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* En-têtes : tout sur une seule ligne (titre + flèche de tri) */
.data-table thead th {
    white-space: nowrap;
}
.th-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
}
.th-sortable:hover {
    background: var(--gpf-teal-soft);
}
.sort-arrow {
    color: var(--grey-400);
    font-size: .85em;
    margin-left: 4px;
    display: inline-block;
    vertical-align: middle;
    transition: color 0.1s;
}
.th-sortable[data-sort-dir] .sort-arrow {
    color: var(--gpf-teal);
    font-weight: 700;
}

/* Titre des AO : autorise le wrap pour éviter une ligne trop large */
.data-table tbody .cell-title {
    white-space: normal;
    line-height: 1.4;
}

/* ---------- Table : scroll vertical + en-tête figé ---------- */
.table-wrapper {
    max-height: 65vh;
    overflow: auto;
    border-radius: var(--radius-md);
}
.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--grey-50);
    z-index: 5;
    box-shadow: inset 0 -2px 0 var(--grey-200);
}

/* ---------- Bouton filtre dans le th (entonnoir) ---------- */
.th-label {
    display: inline-block;
    vertical-align: middle;
}
.th-filter-btn {
    margin-left: 6px;
    padding: 2px 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--grey-400);
    border-radius: 3px;
    vertical-align: middle;
    line-height: 0;
    transition: color .12s, background .12s;
}
.th-filter-btn:hover {
    color: var(--gpf-teal);
    background: var(--gpf-teal-soft);
}
.th-filter-btn.th-filter-active {
    color: var(--gpf-accent);
    background: var(--gpf-accent-soft);
}
.th-filter-btn svg { display: inline-block; vertical-align: middle; }

/* ---------- Popover de filtre ---------- */
.th-filter-popover {
    background: var(--white);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    min-width: 240px;
    max-width: 320px;
    z-index: 1000;
}
.th-filter-popover .popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--grey-100);
}
.th-filter-popover .popover-head > span {
    font-family: var(--font-title);
    font-size: .8rem;
    font-weight: 700;
    color: var(--gpf-teal-dark);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.popover-clear {
    background: transparent;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    color: var(--grey-600);
    cursor: pointer;
    font-size: .75rem;
    padding: 3px 8px;
}
.popover-clear:hover {
    background: var(--gpf-accent-soft);
    border-color: var(--gpf-accent);
    color: var(--gpf-accent-dark);
}
.filter-input {
    width: 100%;
    padding: 7px 10px;
    font-family: inherit;
    font-size: .88rem;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    box-sizing: border-box;
}
.filter-input:focus {
    outline: none;
    border-color: var(--gpf-teal-light);
    box-shadow: 0 0 0 2px rgba(42, 104, 98, 0.12);
}
.filter-date-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.filter-multiselect-inline { display: block; }

/* Multiselect personnalisé */
.filter-multiselect {
    position: relative;
    display: inline-block;
    width: 100%;
}
.filter-multiselect-btn {
    width: 100%;
    text-align: left;
    padding: 6px 28px 6px 10px;
    font-family: inherit;
    font-size: .85rem;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    color: var(--grey-700);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23666' stroke-width='2' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.filter-multiselect-btn:hover {
    border-color: var(--gpf-teal-light);
}
.filter-multiselect-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 220px;
    max-width: 320px;
    background: var(--white);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 30;
    display: none;
    padding: 8px;
}
.filter-multiselect.open .filter-multiselect-panel {
    display: block;
}
.filter-multiselect-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .82rem;
    margin-bottom: 6px;
    box-sizing: border-box;
}
.filter-multiselect-list {
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid var(--grey-100);
    padding-top: 4px;
}
.filter-multiselect-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: .85rem;
    border-radius: 3px;
}
.filter-multiselect-item:hover {
    background: var(--gpf-teal-soft);
}
.filter-multiselect-actions {
    border-top: 1px solid var(--grey-100);
    margin-top: 6px;
    padding-top: 6px;
    text-align: right;
}
.filter-multiselect-clear {
    background: transparent;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: .8rem;
    color: var(--grey-600);
    cursor: pointer;
}
.filter-multiselect-clear:hover {
    background: var(--gpf-accent-soft);
    border-color: var(--gpf-accent);
    color: var(--gpf-accent-dark);
}

/* "Aucun résultat" */
tr.no-filter-result td {
    text-align: center;
    padding: 22px 16px;
    color: var(--grey-500);
    font-style: italic;
    background: var(--grey-50);
}

/* ============================================================
   Bibliothèque de documents
   ============================================================ */
.library-upload-form .field select,
.library-upload-form .field input[type=text],
.library-upload-form .field textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: .95rem;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-md);
    background: var(--white);
    box-sizing: border-box;
}

/* Dropzone */
.library-dropzone {
    display: block;
    margin-top: 14px;
    padding: 28px 24px;
    border: 2px dashed var(--grey-300);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--grey-600);
    background: var(--grey-50);
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
}
.library-dropzone:hover {
    border-color: var(--gpf-teal-light);
    background: var(--gpf-teal-soft);
}
.library-dropzone.dragging {
    border-color: var(--gpf-teal);
    background: var(--gpf-teal-soft);
    transform: scale(1.01);
}
.library-dropzone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--grey-700);
}
.dropzone-prompt { font-size: .95rem; line-height: 1.5; }
.library-dropzone.has-file .dropzone-prompt { display: none; }
.dropzone-selected {
    color: var(--success);
    font-size: 1rem;
}

/* Cellule nom de document */
.cell-doc-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 220px;
    max-width: 360px;
}
.cell-doc-name .doc-display-name {
    font-weight: 600;
    color: var(--gpf-teal-dark);
}
.cell-doc-name .doc-original {
    font-size: .76rem;
    color: var(--grey-500);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-icon {
    margin-right: 6px;
    color: var(--gpf-teal);
}

/* ============================================================
   Workspace d'un AO : layout 2 colonnes + analyse + timeline + todo
   ============================================================ */
.workspace-title {
    font-size: 1.5rem;
    line-height: 1.3;
    margin: 0 0 6px;
}
.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1100px) {
    .workspace-grid { grid-template-columns: 1fr; }
}
.workspace-main { display: flex; flex-direction: column; gap: 24px; }
.workspace-side { display: flex; flex-direction: column; gap: 24px; }

/* Analyse markdown rendue */
.workspace-analysis {
    padding: 22px 26px;
    line-height: 1.6;
    color: var(--grey-700);
}
.workspace-analysis .ws-section-title {
    font-family: var(--font-title);
    color: var(--gpf-teal-dark);
    font-size: .95rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 18px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gpf-teal-soft);
}
.workspace-analysis .ws-section-title:first-child { margin-top: 0; }
.workspace-analysis ul { margin: 0 0 8px; padding-left: 22px; }
.workspace-analysis p { margin: 0 0 8px; }

/* Documents requis */
.reqdoc-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.reqdoc-item {
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
.reqdoc-item:hover {
    border-color: var(--gpf-teal-light);
    box-shadow: var(--shadow-sm);
}
.reqdoc-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.reqdoc-label {
    font-weight: 600;
    color: var(--grey-900);
}
.match-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 500;
}
.match-found {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid var(--success);
}
.match-specific {
    background: var(--gpf-teal-soft);
    color: var(--gpf-teal-dark);
    border: 1px solid var(--gpf-teal-light);
}
.match-missing {
    background: #fff4e0;
    color: #8a5a00;
    border: 1px solid #e0c060;
}
.match-manual {
    background: #e9eef9;
    color: #1f3a8a;
    border: 1px solid #6b8edb;
}
.reqdoc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.reqdoc-select {
    flex: 1;
    min-width: 220px;
    max-width: 460px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: .85rem;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    background: var(--white);
}
/* Bouton "Téléverser un fichier spécifique" : texte + icône, width auto */
.reqdoc-upload-btn {
    cursor: pointer;
    user-select: none;
    width: auto !important;
    padding: 6px 12px !important;
    gap: 4px;
    font-size: .82rem;
    font-weight: 600;
}

/* Timeline des dates */
.timeline {
    list-style: none;
    padding: 14px 12px 4px 14px;
    margin: 0;
    position: relative;
}
.timeline::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 22px;
    width: 2px;
    background: var(--grey-200);
}
.timeline-item {
    position: relative;
    padding: 6px 0 12px 30px;
}
.timeline-dot {
    position: absolute;
    left: 16px;
    top: 10px;
    width: 14px;
    height: 14px;
    background: var(--grey-300);
    border: 2px solid var(--white);
    border-radius: 50%;
    z-index: 1;
}
.timeline-past .timeline-dot { background: var(--grey-400); }
.timeline-future .timeline-dot { background: var(--gpf-teal); }
.timeline-next .timeline-dot {
    background: var(--gpf-accent);
    box-shadow: 0 0 0 4px rgba(212, 39, 40, 0.18);
}
.timeline-label {
    font-weight: 600;
    color: var(--gpf-teal-dark);
    font-size: .88rem;
}
.timeline-past .timeline-label { color: var(--grey-500); text-decoration: line-through; }
.timeline-next .timeline-label { color: var(--gpf-accent-dark); }
.timeline-value {
    color: var(--grey-700);
    font-size: .85rem;
}

/* TO DO list */
.todo-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.todo-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background .1s;
}
.todo-item:hover {
    background: var(--gpf-teal-soft);
}
.todo-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    flex: 1;
    line-height: 1.4;
}
.todo-check input[type=checkbox] {
    margin-top: 3px;
    accent-color: var(--gpf-teal);
}
.todo-label { color: var(--grey-700); font-size: .92rem; }
.todo-item.done .todo-label {
    text-decoration: line-through;
    color: var(--grey-400);
}
.todo-del {
    opacity: 0;
    transition: opacity .15s;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--grey-400);
    padding: 2px 6px;
}
.todo-item:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--gpf-accent); }
.col-actions { text-align: right; white-space: nowrap; }

/* ---------- Switch (toggle) ---------- */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    inset: 0;
    background: var(--grey-300);
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s;
}
.slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    top: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--gpf-blue); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(42, 104, 98, 0.25); }

/* ---------- Modal / dialog ---------- */
.modal {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 520px;
    width: 92%;
    box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(10, 20, 40, 0.5); }
.modal-form { padding: 28px 30px; }
.modal-title {
    margin: 0 0 20px;
    font-size: 1.2rem;
    color: var(--gpf-blue);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--gpf-teal-dark);
    color: var(--grey-200);
    padding: 18px 28px;
    font-size: .82rem;
    border-top: 3px solid var(--gpf-accent);
}
.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.footer-sep { color: var(--gpf-teal-light); }

/* ---------- Erreur ---------- */
.error-state {
    text-align: center;
    padding: 80px 20px;
}
.error-code {
    font-size: 5rem;
    color: var(--gpf-blue);
    margin: 0;
    letter-spacing: 4px;
}
.error-message {
    font-size: 1.1rem;
    color: var(--grey-500);
    margin: 0 0 24px;
}
