/* CASTOR – cartographie des processus et cartes d'identité */

/* ---------- barre d'outils ---------- */
.cc-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px; position: sticky; top: 0; z-index: 5; }
.cc-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cc-seg button { border: 0; background: #fff; padding: 0 12px; min-height: 36px; font: inherit; font-size: 14px; cursor: pointer; color: var(--muted); }
.cc-seg button.on { background: var(--ink); color: #fff; }
.cc-bar input[type=search] { width: 250px; min-height: 36px; padding: 4px 10px; }
.cc-bar select { min-height: 36px; padding: 2px 8px; width: auto !important; min-width: 0; max-width: 200px; }
.cc-sp { flex: 1; }
.cc-cnt { font-size: 13px; color: var(--muted); min-width: 70px; }
.cc-sw { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; font-weight: 600; }
.cc-sw input { width: 18px; height: 18px; accent-color: var(--accent); }
.cc-status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cc-status.ok { color: var(--ok); } .cc-status.bad { color: var(--bad); font-weight: 600; }
.cc-banner { padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.cc-banner.warn { background: var(--warn-bg); border-color: #EFC9A5; }
#cc-stage { overflow: hidden; }
#cc-stage svg { width: 100%; height: auto; display: block; }
#cc-stage svg [data-id] { cursor: pointer; }
#cc-stage svg [data-id]:hover > rect:first-of-type { filter: brightness(.985); }

/* ---------- panneau d'édition (tiroir) : la page se décale pour ne rien masquer ---------- */
@media (min-width: 1100px) { body.cc-drawer #main { margin-right: min(430px, 100vw); } }
#cc-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); z-index: 40; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -16px 0 40px rgba(0, 0, 0, .12); overflow: auto; }
.cc-ph { position: relative; padding: 18px 56px 18px 20px; color: #fff; }
.cc-ph small { opacity: .85; font-size: 12px; display: block; margin-bottom: 4px; letter-spacing: .5px; }
.cc-ph h2 { margin: 0; font-size: 19px; line-height: 1.25; color: #fff; }
.cc-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .14); border: 0; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.cc-x:hover { background: rgba(255, 255, 255, .28); }
.cc-pb { padding: 14px 20px 40px; }
.cc-pb h4 { margin: 20px 0 8px; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.cc-pb .f { margin: 10px 0; font-size: 13px; }
.cc-pb .f input, .cc-pb .f select, .cc-pb .f textarea { width: 100%; font-weight: 400; }
.cc-pb textarea { min-height: 60px; }
.cc-row { display: flex; gap: 8px; align-items: flex-end; } .cc-row > * { flex: 1; min-width: 0; }
.cc-chk { display: grid; gap: 4px; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.cc-chk label { font-size: 13px; display: flex; gap: 6px; align-items: flex-start; cursor: pointer; font-weight: 400; }
.cc-chk .grp { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.cc-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; background: #FAF8F5; }
.cc-hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.cc-pend { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 13px; padding: 8px 10px; border: 1px dashed #D9A877; background: var(--warn-bg); border-radius: 8px; margin: 6px 0; }

/* ---------- matrice de couverture ---------- */
.cc-mx { overflow: auto; max-height: calc(100vh - 160px); }
.cc-mx table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.cc-mx th, .cc-mx td { padding: 7px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.cc-mx thead th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-size: 12px; cursor: pointer; text-align: center; border-top: 4px solid transparent; }
.cc-mx td.c { text-align: center; width: 46px; }
.cc-mx tr.l0 td { background: #F4F2EE; font-weight: 700; }
.cc-mx tr.l1 td { font-weight: 600; }
.cc-mx tr.l2 td:nth-child(2) { padding-left: 22px; color: #334155; }
.cc-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.cc-dot.lt { opacity: .3; }
.cc-sum { display: flex; flex-wrap: wrap; gap: 18px; padding: 16px 18px; font-size: 14px; border-bottom: 1px solid var(--line); }
.cc-sum b { font-size: 20px; display: block; }
.cc-ok { color: var(--ok); white-space: nowrap; } .cc-ko { color: var(--bad); font-weight: 700; white-space: nowrap; }

/* ---------- fenêtre de la carte d'identité ---------- */
#cc-fov { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); }
.cc-fwrap { height: 100%; overflow: auto; padding: 24px 20px 60px; }
.cc-ftool { position: sticky; top: 0; z-index: 2; max-width: 1100px; margin: 0 auto 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: rgba(255, 255, 255, .97); padding: 8px 10px; border-radius: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
.cc-ftt { font-size: 13px; color: var(--muted); min-width: 48px; text-align: center; }
.cc-fcard { max-width: 1100px; margin: 0 auto; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); background: #fff; animation: cc-pop .18s ease-out; }
@keyframes cc-pop { from { transform: translateY(10px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.fedit .ef { display: block; margin: 10px 0; flex: 1; font-weight: 400; }
.fedit .ef > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.fedit .ef small { font-weight: 400; }
.fedit .ef input, .fedit .ef textarea { width: 100%; }
.fedit .frow { display: flex; gap: 14px; }
.fedit .erow { display: flex; gap: 8px; align-items: center; margin: 6px 0; padding: 8px; border: 1px solid #E2E8F0; border-radius: 10px; background: #FAFBFD; }
.fedit .erow label { font-size: 12px; display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.fedit .erow select { width: auto; min-height: 34px; padding: 2px 6px; }
.fedit .erow textarea { min-height: 44px; }
.fedit .eh { margin: 22px 0 8px; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--c); }
.fedit .eh small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }

/* ---------- carte d'identité (aussi utilisée telle quelle pour l'export PNG) ---------- */
.fiche { --c: #312E81; --c2: #6366F1; font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #0F172A; background: #fff; width: 1100px; max-width: 100%; box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; line-height: 1.4; font-size: 14px; }
.fiche * { box-sizing: border-box; }
.fiche .fh { position: relative; overflow: hidden; padding: 28px 34px 26px; background: linear-gradient(120deg, var(--c), var(--c2)); color: #fff; }
.fiche .fh::before { content: ""; position: absolute; right: -60px; top: -90px; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.fiche .fh::after { content: ""; position: absolute; right: 140px; bottom: -120px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.fiche .fk { font-size: 12px; font-weight: 800; letter-spacing: 2.2px; opacity: .85; text-transform: uppercase; position: relative; z-index: 1; padding-right: 120px; }
.fiche .fh h1 { margin: 8px 0 0; font-size: 30px; line-height: 1.15; font-weight: 800; max-width: 760px; color: #fff; position: relative; z-index: 1; }
.fiche .fnum { position: absolute; right: 34px; top: 24px; text-align: right; z-index: 1; }
.fiche .fnum b { display: block; font-size: 54px; line-height: 1; font-weight: 800; }
.fiche .fnum span { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .18); padding: 4px 10px; border-radius: 20px; }
.fiche .fpil { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; position: relative; z-index: 1; }
.fiche .fpil > div { display: flex; align-items: center; gap: 9px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); padding: 6px 14px 6px 6px; border-radius: 30px; }
.fiche .fpil > div.pend { border-style: dashed; }
.fiche .fpil i { font-style: normal; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--c); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.fiche .fpil b { font-size: 13.5px; display: block; } .fiche .fpil small { font-size: 11.5px; opacity: .85; }
.fiche .fbody { padding: 24px 30px 10px; }
.fiche .fsec { border: 1px solid #E2E8F0; border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; background: #fff; }
.fiche .fsec h3, .fiche .fcol h3 { margin: 0 0 12px; font-size: 11.5px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--c); display: flex; align-items: center; gap: 8px; }
.fiche h3 em { font-style: normal; background: color-mix(in srgb, var(--c2) 16%, #fff); color: var(--c); padding: 1px 8px; border-radius: 10px; font-size: 11px; letter-spacing: 0; }
.fiche h3 em.alert { background: #FEE2E2; color: #B91C1C; }
.fiche .ffin { background: color-mix(in srgb, var(--c2) 9%, #fff); border-color: color-mix(in srgb, var(--c2) 25%, #fff); border-left: 5px solid var(--c2); }
.fiche .ffin p { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 500; }
.fiche .g2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.fiche .fact { margin: 0; padding: 0; list-style: none; counter-reset: a; }
.fiche .fact li { counter-increment: a; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; padding: 5px 0; }
.fiche .fact li::before { content: counter(a); flex: none; width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; margin-top: -1px; }
.fiche .fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fiche .fchip { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.fiche .fchip.critere { background: var(--c); color: #fff; }
.fiche .fchip.indicateur { background: color-mix(in srgb, var(--c2) 18%, #fff); color: var(--c); }
.fiche .fchip.section { background: #F1F5F9; color: #475569; }
.fiche .fchip.inconnu { background: #FEE2E2; color: #991B1B; }
.fiche .inter { font-size: 13px; margin: 4px 0; color: #334155; } .fiche .inter b { color: var(--c); }
.fiche .flow { display: grid; grid-template-columns: 1fr 150px 1fr; margin-bottom: 16px; }
.fiche .fcol { border: 1px solid #E2E8F0; border-radius: 16px; padding: 16px 18px; }
.fiche .fcol.in { background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--c2) 6%, #fff)); }
.fiche .fcol.out { background: linear-gradient(270deg, #fff, color-mix(in srgb, var(--c2) 6%, #fff)); }
.fiche .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fiche .tags li { font-size: 12.5px; line-height: 1.3; padding: 5px 10px; border-radius: 9px; background: #F8FAFC; border: 1px solid #E2E8F0; }
.fiche .mod { background: #FFF7ED !important; border-color: #FDBA74 !important; color: #9A3412; }
.fiche .fcore { display: flex; align-items: center; justify-content: center; position: relative; }
.fiche .fcore::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; background: linear-gradient(90deg, #CBD5E1, var(--c2), #CBD5E1); }
.fiche .ring { position: relative; width: 112px; height: 112px; border-radius: 50%; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; display: grid; place-items: center; text-align: center; box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 35%, transparent), 0 0 0 8px #fff, 0 0 0 10px color-mix(in srgb, var(--c2) 30%, #fff); }
.fiche .ring small { display: block; font-size: 9.5px; letter-spacing: 2px; font-weight: 800; opacity: .9; } .fiche .ring b { font-size: 34px; line-height: 1; }
.fiche .rtab { width: 100%; border-collapse: collapse; font-size: 13px; }
.fiche .rtab th { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: #64748B; text-align: center; padding: 4px 6px; font-weight: 700; }
.fiche .rtab th:nth-child(2) { text-align: left; }
.fiche .rtab td { padding: 8px 6px; border-top: 1px solid #F1F5F9; vertical-align: middle; }
.fiche .rtab td.n { text-align: center; font-weight: 700; width: 34px; } .fiche .rtab td.r { text-align: right; }
.fiche .rid { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #0F172A; color: #fff; font-size: 10.5px; font-weight: 800; }
.fiche .crit { display: inline-block; min-width: 74px; text-align: center; font-size: 11.5px; font-weight: 800; padding: 4px 8px; border-radius: 20px; color: #fff; }
.fiche .crit.faible { background: #10B981; } .fiche .crit.modere { background: #F59E0B; } .fiche .crit.eleve { background: #EF4444; }
.fiche .heat { display: grid; gap: 4px; margin-top: 14px; max-width: 340px; }
.fiche .heat .ax { font-size: 10px; color: #64748B; display: grid; place-items: center; font-weight: 700; }
.fiche .heat .cl { border-radius: 10px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 3px; padding: 3px; }
.fiche .heat .cl.faible { background: #10B98133; } .fiche .heat .cl.modere { background: #F59E0B33; } .fiche .heat .cl.eleve { background: #EF444433; }
.fiche .heat .cl.on.faible { background: #10B981; } .fiche .heat .cl.on.modere { background: #F59E0B; } .fiche .heat .cl.on.eleve { background: #EF4444; }
.fiche .heat .cl .rid { width: 20px; height: 20px; font-size: 9.5px; background: #fff; color: #0F172A; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.fiche .heatl { display: flex; justify-content: space-between; max-width: 340px; font-size: 10px; color: #64748B; margin-top: 2px; padding-left: 26px; }
.fiche .ind { list-style: none; margin: 0; padding: 0; }
.fiche .ind li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.4; padding: 7px 0; border-top: 1px solid #F1F5F9; }
.fiche .ind li:first-child { border-top: 0; }
.fiche .ind li::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 3px; margin-top: 5px; background: linear-gradient(135deg, var(--c), var(--c2)); }
.fiche .ind li.ret { color: #94A3B8; text-decoration: line-through; } .fiche .ind li.ret::before { background: #CBD5E1; }
.fiche .ind li > span:first-child { flex: 1; }
.fiche .fbadge { flex: none; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 10px; background: #FFEDD5; color: #C2410C; display: inline-block; }
.fiche .fbadge.gray { background: #F1F5F9; color: #64748B; }
.fiche .fpac { list-style: none; margin: 0; padding: 0; }
.fiche .fpac li { display: flex; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; border-top: 1px solid #F1F5F9; }
.fiche .fpac li:first-child { border-top: 0; }
.fiche .fpac a { color: var(--c); font-weight: 700; text-decoration: none; }
.fiche .fpac .st { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #F1F5F9; color: #475569; white-space: nowrap; }
.fiche .fpac .st.actif { background: #FEF3C7; color: #92400E; } .fiche .fpac .st.cloture { background: #DCFCE7; color: #166534; }
.fiche .ffoot { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 14px 30px 24px; font-size: 11.5px; color: #64748B; border-top: 1px solid #F1F5F9; }
.fiche .ffoot .lg { display: inline-flex; align-items: center; gap: 6px; } .fiche .ffoot .lg i { width: 14px; height: 10px; border-radius: 3px; background: #FFF7ED; border: 1px solid #FDBA74; }
.fiche .ffoot .r { text-align: right; white-space: nowrap; }
.fiche .fempty { font-size: 12.5px; color: #94A3B8; font-style: italic; }
@media screen and (max-width: 860px) { .fiche .g2, .fiche .flow { grid-template-columns: 1fr; } .fiche .fcore { padding: 14px 0; } .fiche .fcore::before { display: none; } }

/* ---------- impression : la carte en A3 paysage, les fiches en A4 portrait ---------- */
#cc-printzone { display: none; }
@page cc-carte { size: A3 landscape; margin: 8mm; }
@page cc-fiche { size: A4 portrait; margin: 8mm; }
@page cc-matrice { size: A4 landscape; margin: 8mm; }
@media print {
  body.cc-printing > *:not(#cc-printzone) { display: none !important; }
  body.cc-printing { background: #fff; }
  body.cc-printing #cc-printzone { display: block; }
  #cc-printzone.carte svg { page: cc-carte; width: 100%; height: 279mm; display: block; }
  #cc-printzone.matrice { page: cc-matrice; }
  #cc-printzone.matrice .cc-mx { max-height: none; overflow: visible; }
  #cc-printzone .fiche { page: cc-fiche; width: 1100px; max-width: none; break-after: page; }
  #cc-printzone .fiche:last-child { break-after: auto; }
  #cc-printzone .fsec, #cc-printzone .fcol, #cc-printzone .rtab tr, #cc-printzone .ind li { break-inside: avoid; }
}
