/* Registre collectif des créances — Automata France SAS
   Palette : encre de greffe, papier froid, cachet bordeaux, laiton. */

@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@400;500;600;700&family=Source+Sans+3:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --encre: #14202a;
    --encre-2: #2b3a47;
    --papier: #eef0ed;
    --carte: #ffffff;
    --trait: #d6dad2;
    --gris: #5d6b74;
    --cachet: #7a2b36;
    --cachet-clair: #f3e7e8;
    --laiton: #9a7a33;
    --laiton-clair: #f6efdd;
    --vert: #2f6b4f;
    --r: 3px;
    --display: 'Zilla Slab', Georgia, serif;
    --corps: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--papier);
    color: var(--encre);
    font-family: var(--corps);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--cachet); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--encre); }
:focus-visible { outline: 2px solid var(--cachet); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.bandeau {
    background: var(--encre);
    color: #eef0ed;
    border-bottom: 3px solid var(--cachet);
}
.bandeau-int {
    max-width: 1280px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.marque { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: .2px; line-height: 1.15; }
.marque span { display: block; font-family: var(--corps); font-size: 11px; font-weight: 400;
    letter-spacing: .16em; text-transform: uppercase; color: #94a3ad; margin-top: 2px; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a {
    color: #cfd7dc; text-decoration: none; font-size: 13.5px; padding: 7px 12px;
    border-radius: var(--r); letter-spacing: .02em;
}
.nav a:hover { background: #223140; color: #fff; }
.nav a.actif { background: var(--cachet); color: #fff; }
.nav .qui { font-family: var(--mono); font-size: 12px; color: #8fa0ab; padding-right: 8px; }

/* ---------- Structure ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }
.etroit { max-width: 560px; }

h1 { font-family: var(--display); font-size: 30px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 14px; margin: 0 0 10px; }
.chapeau { color: var(--gris); margin: 0 0 26px; max-width: 70ch; }

.eyebrow {
    font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
    color: var(--gris); font-weight: 600; margin-bottom: 8px;
}

.carte {
    background: var(--carte); border: 1px solid var(--trait); border-radius: var(--r);
    padding: 22px; margin-bottom: 22px;
}
.carte > h2 { padding-bottom: 12px; border-bottom: 1px solid var(--trait); }

/* ---------- Cachet : bloc signature ---------- */
.cachet {
    border: 2px solid var(--cachet); color: var(--cachet); border-radius: var(--r);
    padding: 14px 20px; display: inline-block; transform: rotate(-1.2deg);
    background: var(--cachet-clair);
}
.cachet .lib { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; }
.cachet .val { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.cachet .sous { font-size: 11.5px; color: #8a5560; }

/* ---------- Chiffres ---------- */
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px;
    background: var(--trait); border: 1px solid var(--trait); border-radius: var(--r); overflow: hidden; }
.chiffre { background: var(--carte); padding: 16px 18px; }
.chiffre .lib { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gris); }
.chiffre .val { font-family: var(--mono); font-size: 19px; font-weight: 500; margin-top: 4px; }
.chiffre.fort .val { color: var(--cachet); font-weight: 600; }

/* ---------- Tableaux ---------- */
.tableau-enveloppe { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--r); background: var(--carte); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    background: var(--encre); color: #dfe5e9; text-align: left; padding: 9px 12px;
    font-weight: 500; font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
    white-space: nowrap; position: sticky; top: 0;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
tbody tr:hover { background: #f7f8f6; }
tr.allocation td { background: #fbfaf5; color: var(--encre-2); }
tr.allocation td:first-child { padding-left: 30px; border-left: 3px solid var(--laiton); }
tr.principal td { font-weight: 500; }
tfoot td { padding: 11px 12px; font-family: var(--mono); font-weight: 600; border-top: 2px solid var(--encre); }
.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.mini { font-size: 11.5px; color: var(--gris); }
.ref { font-family: var(--mono); font-size: 11.5px; color: var(--gris); }

/* ---------- Formulaires ---------- */
label { display: block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--gris); font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--trait); border-radius: var(--r);
    font-family: var(--corps); font-size: 14px; background: #fff; color: var(--encre);
}
input[type=number], .champ-num { font-family: var(--mono); text-align: right; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--encre); outline: none;
    box-shadow: 0 0 0 3px rgba(20,32,42,.08); }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.champ { margin-bottom: 14px; }

.btn {
    display: inline-flex; align-items: center; gap: 7px; background: var(--encre); color: #fff;
    border: 1px solid var(--encre); border-radius: var(--r); padding: 9px 16px; font-size: 13.5px;
    font-family: var(--corps); font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #24343f; color: #fff; }
.btn.cachet-btn { background: var(--cachet); border-color: var(--cachet); }
.btn.cachet-btn:hover { background: #63222b; }
.btn.creux { background: transparent; color: var(--encre); }
.btn.creux:hover { background: #e3e7e1; color: var(--encre); }
.btn.petit { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: transparent; color: var(--cachet); border-color: #e0c5c8; }
.btn.danger:hover { background: var(--cachet-clair); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Messages ---------- */
.message { padding: 11px 16px; border-radius: var(--r); margin-bottom: 12px; font-size: 14px;
    border-left: 4px solid; background: var(--carte); }
.message.succes { border-color: var(--vert); }
.message.erreur { border-color: var(--cachet); background: var(--cachet-clair); }
.message.info { border-color: var(--encre-2); }
.message.attention { border-color: var(--laiton); background: var(--laiton-clair); }

.note { background: var(--laiton-clair); border-left: 4px solid var(--laiton); padding: 12px 16px;
    border-radius: var(--r); font-size: 13.5px; color: #4a3d1c; }

/* ---------- Répartition ---------- */
.bande { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--trait); margin: 6px 0 4px; }
.bande i { display: block; height: 100%; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--gris); }
.legende span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px;
    margin-right: 5px; background: currentColor; }

/* ---------- Pièces ---------- */
.pieces { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; }
.pieces li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pieces a { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.depot { display: flex; gap: 6px; align-items: center; }
.depot input[type=file] { font-size: 11.5px; padding: 4px; max-width: 190px; }

details.ligne-edit summary { cursor: pointer; font-size: 12px; color: var(--gris); }
details.ligne-edit summary:hover { color: var(--encre); }
details.ligne-edit[open] { background: #f7f8f6; }

/* ---------- Connexion ---------- */
.ecran-connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: linear-gradient(160deg, #14202a 0%, #22323f 55%, #33232a 100%); }
.boite { background: var(--carte); border-radius: var(--r); padding: 34px; width: 100%; max-width: 420px;
    border-top: 4px solid var(--cachet); box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.boite h1 { font-size: 23px; }
.boite .chapeau { font-size: 13.5px; margin-bottom: 22px; }
.code-saisie { font-family: var(--mono); font-size: 30px; letter-spacing: .38em; text-align: center; padding: 12px; }

/* ---------- Impression ---------- */
.feuille { background: #fff; max-width: 900px; margin: 0 auto; padding: 46px 54px;
    border: 1px solid var(--trait); }
.feuille h1 { font-size: 24px; }
.feuille .entete-doc { display: flex; justify-content: space-between; gap: 30px;
    border-bottom: 2px solid var(--encre); padding-bottom: 16px; margin-bottom: 22px; }
.feuille table { font-size: 12px; }
.formule { font-size: 13.5px; line-height: 1.7; }
.signature { margin-top: 40px; display: flex; justify-content: space-between; gap: 40px; font-size: 13px; }

@media print {
    .bandeau, .nav, .sans-impression { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .page { padding: 0; max-width: none; }
    .feuille { border: none; padding: 0; max-width: none; }
    thead th { background: #14202a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .cachet { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 760px) {
    .bandeau-int { padding: 12px 16px; }
    .page { padding: 20px 14px 60px; }
    h1 { font-size: 24px; }
    .nav { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
