/* ============================================================
   Verticale Protocole — UI de l'espace connecté (client + admin)
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --navy: #1B2A4A; --ink: #070e1c; --ink-2: #0f1d36;
    --blue: #1a73e8; --blue-lt: #4d96f5; --blue-dark: #1562c8;
    --teal: #1abc9c; --grey: #f4f7fb; --line: #e6ebf3;
    --txt: #2b3445; --muted: #6b7689;
    --grad-blue: linear-gradient(135deg, #1a73e8, #4d96f5);
    --ok: #1e7d4f; --ok-bg: #e7f7ee; --err: #b3261e; --err-bg: #fdeceb;
    --radius: 14px;
    --font: 'Open Sans', system-ui, sans-serif;
    --head: 'Montserrat', sans-serif;
}
body { font-family: var(--font); color: var(--txt); background: var(--grey); line-height: 1.55; }
h1,h2,h3,h4 { font-family: var(--head); color: var(--navy); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---------- Topbar ---------- */
.topbar {
    background: #fff; border-bottom: 1px solid var(--line); height: 64px;
    display: flex; align-items: center; padding: 0 26px; position: sticky; top: 0; z-index: 50;
}
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; }
.topbar .brand img { height: 34px; width: auto; display: block; }
.topbar .brand.admin::after { content: 'ADMIN'; font-family: var(--head); font-size: 10px; font-weight: 700; letter-spacing: 1px; background: var(--navy); color:#fff; padding: 2px 7px; border-radius: 5px; margin-left: 10px; vertical-align: middle; }
.topbar .brand.part::after { content: 'PARTENAIRE'; font-family: var(--head); font-size: 10px; font-weight: 700; letter-spacing: 1px; background: var(--blue); color:#fff; padding: 2px 7px; border-radius: 5px; margin-left: 10px; vertical-align: middle; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar .who { font-size: 13.5px; color: var(--muted); }
.topbar .who strong { color: var(--navy); }

/* ---------- Layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 30px 22px 70px; }
.wrap-wide { max-width: 1240px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 14.5px; }
.back-link { font-size: 13.5px; color: var(--muted); }

/* ---------- Cards / sections ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px; }
.card > h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 9px; }
.card > .card-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.card .ti { color: var(--blue); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; font-family: var(--head); font-size: 12px; font-weight: 600; letter-spacing: .4px; color: var(--navy); margin-bottom: 6px; }
input, textarea, select {
    width: 100%; font-family: var(--font); font-size: 14.5px; color: var(--txt);
    padding: 11px 13px; border: 1.5px solid #dde3ec; border-radius: 10px; background: #fbfcfe;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,.15); background: #fff; }
textarea { resize: vertical; min-height: 90px; }
.seg { display: inline-flex; border: 1.5px solid #dde3ec; border-radius: 10px; overflow: hidden; }
.seg-btn { padding: 9px 20px; font-family: var(--head); font-size: 13px; font-weight: 700; color: var(--navy); background: #fbfcfe; }
.seg-btn + .seg-btn { border-left: 1.5px solid #dde3ec; }
.seg-btn.on { background: var(--blue); color: #fff; }
.chks { display: flex; gap: 16px; flex-wrap: wrap; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-family: var(--head); font-size: 13.5px; font-weight: 600; color: var(--navy); cursor: pointer; }
.chk input { width: auto; margin: 0; }
details > summary { cursor: pointer; font-family: var(--head); font-weight: 700; font-size: 13px; color: var(--blue); list-style: none; padding: 4px 0; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; }
.doc-check { margin: 4px 0 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dc-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; font-size: 14.5px; color: var(--navy); }
.dc-item + .dc-item { border-top: 1px solid var(--line); }
.dc-item i { font-size: 18px; flex-shrink: 0; }
.dc-item .st { margin-left: auto; }
.miss-box { background: #fff7e6; border: 1px solid #ffe2a8; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.miss-box .miss-title { font-family: var(--head); font-weight: 700; color: #8a6d3b; font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.miss-box ul { margin: 0; padding-left: 22px; color: #8a6d3b; font-size: 14px; line-height: 1.7; }
.doc-fold > summary { font-size: 15px; color: var(--navy); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.doc-fold[open] > summary { margin-bottom: 12px; }
.cat-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.cat-row:last-child { border-bottom: none; }
.cat-row .chk { min-width: 90px; }
.cat-row input[type=file] { width: auto; flex: 1; min-width: 180px; font-size: 12.5px; padding: 7px 10px; }
.cat-row .meta { color: var(--muted); font-size: 12px; }

/* ---------- Aide « ? » (où trouver le document) ---------- */
.tip { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
       width: 18px; height: 18px; border-radius: 50%; background: #e3edfb; color: var(--blue); vertical-align: middle;
       font: 700 11.5px/1 var(--head); cursor: help; letter-spacing: 0; text-transform: none; }
.tip:hover, .tip:focus { background: var(--blue); color: #fff; outline: none; }
.tip:hover::after, .tip:focus::after {
    content: attr(data-tip); position: absolute; z-index: 60; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
    width: max-content; max-width: min(280px, 78vw); white-space: normal; text-align: left;
    background: var(--navy); color: #fff; font: 400 12.5px/1.45 var(--font); letter-spacing: 0;
    padding: 9px 11px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.22); pointer-events: none;
}
.tip:hover::before, .tip:focus::before {
    content: ''; position: absolute; z-index: 60; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--navy); border-bottom: 0;
}

/* ---------- Envoi automatique d'un document ---------- */
.upl-wait { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--blue); }
.upl-wait i { animation: upl-spin 1s linear infinite; }
@keyframes upl-spin { to { transform: rotate(360deg); } }

/* ---------- Afficher / masquer le mot de passe ---------- */
.mdp-wrap { position: relative; display: block; }
.mdp-wrap input { padding-right: 46px; }
.mdp-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
           width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.mdp-eye:hover, .mdp-eye:focus { color: var(--blue); background: #eef4fd; outline: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--head); font-weight: 700; font-size: 13px; letter-spacing: .4px;
    padding: 11px 20px; border-radius: 10px; cursor: pointer; border: 1.5px solid transparent;
    transition: transform .2s, box-shadow .2s, background .2s, color .2s; background: var(--grad-blue); color: #fff;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(26,115,232,.35); text-decoration: none; }
.btn.full { width: 100%; }
.btn.ghost { background: #fff; color: var(--navy); border-color: #d6deea; }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); box-shadow: none; }
.btn.danger { background: #fff; color: var(--err); border-color: #f0c4c0; }
.btn.sm { padding: 7px 13px; font-size: 12px; border-radius: 8px; }

/* ---------- Flash ---------- */
.flash { border-radius: 10px; padding: 13px 16px; margin-bottom: 20px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b6e6c9; }
.flash.err { background: var(--err-bg); color: var(--err); border: 1px solid #f5c6c2; }

/* ---------- Badges code couleur ---------- */
.badge { display: inline-flex; align-items: center; gap: 7px; font-family: var(--head); font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 50px; }
.badge .dot { width: 9px; height: 9px; border-radius: 50%; }
.tag { display: inline-block; font-family: var(--head); font-size: 11.5px; font-weight: 700; letter-spacing: .4px; padding: 3px 10px; border-radius: 50px; background: #eef2f8; color: var(--navy); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: #fff4e3; color: #b06a00; }
.tag.err { background: var(--err-bg); color: var(--err); }

/* ---------- Tables / lists ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-family: var(--head); font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
tr:hover td { background: #fafcff; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.doc-row:last-child { border-bottom: none; }
.doc-row .ti { font-size: 20px; color: var(--blue); }
.doc-row .meta { color: var(--muted); font-size: 12.5px; }
.doc-row .spacer { margin-left: auto; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0; font-style: italic; }
td .meta, .meta { color: var(--muted); font-size: 12.5px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%); }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 18px; padding: 38px 34px; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.auth-card .brand { text-align: center; margin-bottom: 10px; }
.auth-card .brand img { height: 50px; width: auto; display: inline-block; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth-card .foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 20px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 460px; }
.chat-stream { flex: 1; overflow-y: auto; padding: 14px 4px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.msg .t { display: block; font-size: 11px; opacity: .7; margin-top: 5px; }
.msg.them { align-self: flex-start; background: #eef2f8; color: var(--txt); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--grad-blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-form { display: flex; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tabs a { font-family: var(--head); font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--navy); text-decoration: none; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }

@media (max-width: 820px) {
    .grid-2 { grid-template-columns: 1fr; }
    .row2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .topbar .who { display: none; }
}

/* ---------- Pastille « nouveautés » (non lu) ---------- */
.nv-badge { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:20px; padding:0 6px; margin-left:6px;
            border-radius:50px; background:#e53935; color:#fff; font-family:var(--head); font-weight:800; font-size:11px; line-height:1; vertical-align:middle; }
tr.has-new td:first-child { box-shadow: inset 4px 0 0 #e53935; }
