/* ============================================================
   CONTRATS — grammaire « Rail » des fiches devis/facture (carte-titre
   noire, document à gauche, détails à droite), plus l'éditeur d'articles :
   une carte par article, glissable, que l'on retient ou non ; à droite les
   blancs à compléter et les données à insérer (25/10/2026).
   ============================================================ */

/* ── Registre ── */
.ct-reg .wd-reg-av .ms { font-size: 20px; }
.ct-reg .wd-reg-av.is-off { opacity: 0.45; }
.ct-num { font-variant-numeric: tabular-nums; }
.ct-head-acts { display: flex; align-items: center; gap: 10px; }

/* ── Choix du modèle ── */
.ct-pick-intro { margin: -6px 0 24px; color: var(--ep-text-secondary); font-size: 0.92rem; max-width: 62ch; }
.ct-pick-intro b { color: var(--wd-onyx); font-weight: 600; }
.ct-pick-h { margin: 28px 0 12px; font-family: var(--wd-font-sans); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ep-text-secondary); }
.ct-pick-h:first-of-type { margin-top: 0; }
.ct-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ct-pick-card {
    position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0;
    padding: 18px 20px; border-radius: var(--wd-r-card);
    background: var(--wd-card-bg); border: 1px solid var(--wd-card-border); box-shadow: var(--wd-card-shadow);
    transition: border-color 150ms var(--wd-ease), transform 150ms var(--wd-ease);
}
.ct-pick-card:hover { border-color: var(--wd-onyx); transform: translateY(-1px); }
.ct-pick-card.is-mine { border-color: var(--wd-jaune); }
.ct-pick-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--wd-papier); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.ct-pick-ic .ms { font-size: 20px; color: var(--wd-onyx); }
.ct-pick-card b { font-size: 0.98rem; font-weight: 600; color: var(--wd-onyx); }
.ct-pick-card p { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--ep-text-secondary); }
.ct-pick-tag { position: absolute; top: 16px; right: 16px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--wd-jaune-pale); color: #6B4F22; font-size: 0.72rem; font-weight: 600; display: inline-flex; align-items: center; }
.ct-pick-foot { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ct-pick-foot small { flex: 1 0 100%; color: var(--ep-text-muted); font-size: 0.78rem; }
.ct-pick-foot a { order: 2; font-size: 0.82rem; color: var(--ep-text-secondary); text-decoration: underline; text-underline-offset: 3px; }
.ct-pick-foot button { margin: 0; }
.ct-pick-go { order: 1; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--wd-onyx); color: #fff; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.ct-pick-go:hover { background: #000; }
.ct-legal { margin: 32px 0 0; max-width: 72ch; font-size: 0.8rem; line-height: 1.55; color: var(--ep-text-muted); }

/* ── Éditeur : articles ── */
.ct-arts { display: flex; flex-direction: column; gap: 12px; }
.ct-art {
    background: var(--wd-card-bg); border: 1px solid var(--wd-card-border);
    border-radius: var(--wd-r-card); box-shadow: var(--wd-card-shadow);
    padding: 14px 18px 16px 10px; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 0 6px;
    transition: border-color 150ms var(--wd-ease), opacity 150ms var(--wd-ease);
}
.ct-art:focus-within { border-color: var(--wd-onyx); }
.ct-art.is-off { background: transparent; box-shadow: none; border-style: dashed; }
.ct-art.is-off .ct-art-title, .ct-art.is-off .ct-art-body { color: var(--ep-text-muted); }
.ct-art-grip { grid-row: 1 / span 2; align-self: start; padding-top: 8px; color: var(--ep-text-muted); cursor: grab; text-align: center; opacity: 0.5; transition: opacity 150ms var(--wd-ease); }
.ct-art:hover .ct-art-grip { opacity: 1; }
.ct-art-grip .ms { font-size: 20px; }
.ct-art-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ct-art-n { flex: none; font-size: 0.76rem; font-weight: 600; color: var(--ep-text-secondary); font-variant-numeric: tabular-nums; min-width: 66px; }
.ct-art.is-off .ct-art-n { color: var(--ep-text-muted); font-weight: 500; }
.ct-art-title {
    flex: 1; min-width: 0; border: 0; background: transparent; padding: 6px 0;
    font-size: 1rem; font-weight: 600; color: var(--wd-onyx);
}
.ct-art-title:focus { outline: none; }
.ct-art-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.ct-switch { display: inline-flex; align-items: center; gap: 8px; margin: 0 6px 0 0; font-size: 0.78rem; color: var(--ep-text-secondary); cursor: pointer; user-select: none; }
.ct-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ct-switch i { width: 32px; height: 18px; border-radius: 999px; background: var(--wd-fumee); position: relative; transition: background 150ms var(--wd-ease); }
.ct-switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 150ms var(--wd-ease); }
.ct-switch input:checked + i { background: var(--wd-onyx); }
.ct-switch input:checked + i::after { transform: translateX(14px); }
.ct-switch input:focus-visible + i { outline: 2px solid var(--wd-jaune); outline-offset: 2px; }
.ct-icon-btn { width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--ep-text-secondary); display: inline-flex; align-items: center; justify-content: center; }
.ct-icon-btn:hover { background: var(--wd-papier); color: var(--wd-onyx); }
.ct-icon-btn .ms { font-size: 19px; }
.ct-art-body {
    grid-column: 2; width: 100%; min-height: 64px; margin-top: 4px; resize: none; overflow: hidden;
    border: 0; background: transparent; padding: 4px 0 0;
    font-size: 0.9rem; line-height: 1.6; color: var(--wd-onyx);
}
.ct-art-body:focus { outline: none; }
.ct-art.is-ghost { opacity: 0.4; }

.ct-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.ct-add .dropdown-menu { max-height: 360px; overflow-y: auto; min-width: 300px; }
.ct-add .dropdown-item small { display: block; color: var(--ep-text-muted); font-size: 0.74rem; white-space: normal; }
.ct-add-btn { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px dashed var(--wd-card-border); background: transparent; color: var(--wd-onyx); font-size: 0.86rem; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.ct-add-btn:hover { border-color: var(--wd-onyx); }
.ct-add-btn .ms { font-size: 18px; }

/* ── Éditeur : panneau latéral ── */
.ct-blanks-empty { margin: 0; font-size: 0.86rem; color: var(--ep-text-secondary); }
.ct-blank-f { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; }
.ct-blank-f label { font-size: 0.78rem; font-weight: 500; color: var(--ep-text-secondary); margin: 0; }
.ct-blank-f .form-control { height: 40px; font-size: 0.88rem; }
.ct-blank-f.is-empty .form-control { background: #FFFBF3; border-color: var(--wd-jaune); }
.ct-count { margin-left: 6px; height: 20px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--wd-jaune-pale); color: #6B4F22; font-size: 0.72rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.ct-count.is-done { background: var(--wd-st-ok-bg); color: var(--wd-st-ok); }
.ct-tokens { display: flex; flex-direction: column; gap: 12px; }
.ct-tokens p { margin: 0 0 6px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ep-text-muted); }
.ct-tokens div { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-chip { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--wd-card-border); background: #fff; color: var(--wd-onyx); font-size: 0.78rem; display: inline-flex; align-items: center; }
.ct-chip:hover { border-color: var(--wd-onyx); }
.ct-chip--blank { border-style: dashed; }
.ct-help { margin: 12px 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--ep-text-muted); }
.ct-help code { font-size: 0.76rem; color: var(--wd-onyx); background: var(--wd-papier); padding: 1px 5px; border-radius: 5px; }
.ct-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ct-issues li { display: flex; gap: 8px; font-size: 0.86rem; line-height: 1.45; color: var(--wd-onyx); }
.ct-issues li .ms { font-size: 18px; color: var(--wd-jaune); flex: none; }
.ct-ready { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 0.86rem; color: var(--wd-st-ok); }
.ct-ready .ms { font-size: 18px; }

/* ── Fiche : le document ── */
.ct-sheet { padding: 0; overflow: hidden; }
.ct-sheet iframe { display: block; width: 100%; min-height: 70vh; border: 0; background: #fff; }
.ct-sheet-h { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--wd-hairline); }
.ct-sheet-h h2 { font-family: var(--wd-font-sans); font-size: 0.98rem; font-weight: 600; margin: 0; }
.ct-sheet-h > :last-child { margin-left: auto; }
.ct-sheet-h a { font-size: 0.82rem; color: var(--ep-text-secondary); }
.ct-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ct-steps li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; font-size: 0.86rem; color: var(--ep-text-muted); }
.ct-steps li i { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--wd-fumee); }
.ct-steps li.is-done { color: var(--wd-onyx); }
.ct-steps li.is-done i { border-color: var(--wd-onyx); background: var(--wd-onyx); }
.ct-steps li small { display: block; color: var(--ep-text-muted); font-size: 0.78rem; }
.ct-sign-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--wd-hairline); display: flex; flex-direction: column; gap: 10px; }
.ct-sign-form .wd-doc-f { margin: 0; }
.ct-sign-form .form-control { height: 40px; font-size: 0.88rem; }
.ct-secondary { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--wd-card-border); background: #fff; color: var(--wd-onyx); font-size: 0.86rem; font-weight: 600; }
.ct-secondary:hover { border-color: var(--wd-onyx); }

/* ── Dossier : panneau Contrats ── */
.ct-ev-list { list-style: none; margin: 0; padding: 0; }
.ct-ev-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 8px; margin: 0 -8px; border-radius: 10px; text-decoration: none; color: var(--wd-onyx); }
.ct-ev-list li + li a { border-top: 1px solid var(--wd-hairline); border-radius: 0; }
.ct-ev-list a:hover { background: #FBFAF7; }
.ct-ev-list b { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-ev-list small { grid-column: 1; color: var(--ep-text-muted); font-size: 0.78rem; }
.ct-ev-list .wd-st { grid-row: 1 / span 2; grid-column: 2; }

@media (max-width: 991.98px) {
    .ct-art { padding-left: 6px; }
}
@media (max-width: 767.98px) {
    .ct-art-h { flex-wrap: wrap; }
    .ct-art-n { min-width: 0; }
    .ct-art-title { order: 3; flex-basis: 100%; }
    .ct-art-tools { margin-left: auto; }
    .ct-sheet iframe { min-height: 60vh; }
}

/* ── Signature Wedoria dans les fiches (contrat, devis, cession) ── */
.wd-sig-steps li.is-late i { border-color: var(--wd-st-danger, #B0392E); background: var(--wd-st-danger, #B0392E); }
.wd-sig-warn { font-weight: 600; color: var(--wd-st-danger, #B0392E); }
.wd-sig-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--wd-hairline); }
.wd-sig-actions form { margin: 0; }
.wd-sig-actions .ct-secondary { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.wd-sig-actions .ct-secondary .ms { font-size: 18px; }
.wd-sig-actions .wd-sig-danger { color: var(--wd-st-danger, #B0392E); }
.wd-sig-actions .ct-secondary.is-copied { border-color: var(--wd-st-ok); color: var(--wd-st-ok); }
