/* Juridixia – Dossier IA */
.jdx-app {
  --jdx-c: #71B5F9;
  --jdx-c-dark: #1F6FBF;
  --jdx-ink: #14213A;
  --jdx-muted: #5F6B7E;
  --jdx-line: #DCE5F0;
  --jdx-bg: #F5F9FE;
  --jdx-card: #FFFFFF;
  --jdx-ok: #1E8E5A;
  --jdx-warn: #B7791F;
  --jdx-err: #C0392B;
  --jdx-r: 14px;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 0 24px;
  color: var(--jdx-ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  container-type: inline-size;
}
.jdx-app *, .jdx-app *::before, .jdx-app *::after { box-sizing: inherit; }
.jdx-app h2 { font-size: 1.45rem; margin: 0 0 .35em; line-height: 1.25; color: var(--jdx-ink); }
.jdx-app h3 { font-size: 1.1rem; margin: 1em 0 .5em; color: var(--jdx-ink); }
.jdx-app h4 { font-size: 1rem; margin: 1.2em 0 .4em; color: var(--jdx-ink); }
.jdx-app p { margin: 0 0 .8em; }
.jdx-muted { color: var(--jdx-muted); font-size: .92em; }

.jdx-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.jdx-brand { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.jdx-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--jdx-c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--jdx-c) 25%, transparent); }

/* Boutons */
.jdx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 22px; background: var(--jdx-c); color: #0B2440; font-weight: 700; font-size: .98rem; cursor: pointer; text-decoration: none; transition: filter .15s, transform .05s; line-height: 1.2; }
.jdx-btn:hover { filter: brightness(.95); color: #0B2440; }
.jdx-btn:active { transform: translateY(1px); }
.jdx-btn:focus-visible, .jdx-link:focus-visible, .jdx-row:focus-visible, .jdx-steps li:focus-visible, .jdx-drop:focus-visible { outline: 3px solid var(--jdx-c-dark); outline-offset: 2px; }
.jdx-btn[disabled] { opacity: .55; cursor: not-allowed; }
.jdx-btn-ghost { background: transparent; color: var(--jdx-c-dark); box-shadow: inset 0 0 0 2px var(--jdx-c); }
.jdx-btn-ghost:hover { background: var(--jdx-bg); color: var(--jdx-c-dark); }
.jdx-btn-sm { padding: 7px 14px; font-size: .88rem; }
.jdx-link { background: none; border: 0; padding: 4px 0; color: var(--jdx-c-dark); font-weight: 600; cursor: pointer; text-decoration: none; font-size: .95rem; }
.jdx-link:hover { text-decoration: underline; }
.jdx-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }

/* Étapes */
.jdx-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; counter-reset: none; }
.jdx-steps li { display: flex; gap: 8px; align-items: flex-start; padding: 10px 8px; border-radius: 10px; background: var(--jdx-bg); border: 1px solid transparent; font-size: .8rem; line-height: 1.25; color: var(--jdx-muted); }
.jdx-steps li[data-a] { cursor: pointer; }
.jdx-steps li[data-a]:hover { border-color: var(--jdx-line); }
.jdx-steps .jdx-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--jdx-line); font-weight: 700; font-size: .78rem; }
.jdx-steps .jdx-st b { display: block; color: inherit; font-weight: 700; }
.jdx-steps .jdx-st small { display: block; font-size: .72rem; opacity: .85; margin-top: 2px; }
.jdx-steps li.is-cur { background: #fff; border-color: var(--jdx-c); color: var(--jdx-ink); box-shadow: 0 2px 10px rgba(31,111,191,.08); }
.jdx-steps li.is-cur .jdx-num { background: var(--jdx-c); border-color: var(--jdx-c); color: #0B2440; }
.jdx-steps li.is-done { color: var(--jdx-ink); }
.jdx-steps li.is-done .jdx-num { background: #E6F2FE; border-color: var(--jdx-c); color: var(--jdx-c-dark); }
@container (max-width: 860px) {
  .jdx-steps .jdx-st small { display: none; }
}
@container (max-width: 560px) {
  .jdx-steps .jdx-st { display: none; }
  .jdx-steps li { justify-content: center; padding: 8px 4px; }
}
@media (max-width: 760px) {
  .jdx-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .jdx-steps .jdx-st { display: none; }
  .jdx-steps li { justify-content: center; padding: 8px 4px; }
  .jdx-steps li.is-cur .jdx-st { display: none; }
}

/* Cartes */
.jdx-card { background: var(--jdx-card); border: 1px solid var(--jdx-line); border-radius: var(--jdx-r); padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(20,33,58,.04); }
@media (max-width: 600px) { .jdx-card { padding: 18px 16px; } }
.jdx-label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
.jdx-app textarea, .jdx-app input[type="text"] { width: 100%; border: 1.5px solid var(--jdx-line); border-radius: 12px; padding: 12px 14px; font: inherit; color: var(--jdx-ink); background: #fff; resize: vertical; }
.jdx-app textarea:focus, .jdx-app input[type="text"]:focus { outline: none; border-color: var(--jdx-c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--jdx-c) 22%, transparent); }
.jdx-create .jdx-btn { margin-top: 16px; }

/* Liste de dossiers */
.jdx-list { list-style: none; margin: 0; padding: 0; }
.jdx-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; background: none; border: 0; border-top: 1px solid var(--jdx-line); padding: 14px 4px; cursor: pointer; font: inherit; color: inherit; }
.jdx-list li:first-child .jdx-row { border-top: 0; }
.jdx-row:hover { background: var(--jdx-bg); }
.jdx-row small { display: block; color: var(--jdx-muted); font-size: .85rem; }
.jdx-badge { flex: none; font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--jdx-bg); color: var(--jdx-muted); white-space: nowrap; }
.jdx-b-valide { background: #E3F5EC; color: var(--jdx-ok); }
.jdx-b-rapport_pret, .jdx-b-attente_utilisateur { background: #FFF4E0; color: var(--jdx-warn); }
.jdx-b-analyse { background: #E6F2FE; color: var(--jdx-c-dark); }
.jdx-b-erreur { background: #FDECEA; color: var(--jdx-err); }

/* Conversation */
.jdx-thread { max-height: 460px; overflow-y: auto; padding: 6px 2px 10px; display: flex; flex-direction: column; gap: 12px; }
.jdx-msg { display: flex; gap: 10px; align-items: flex-end; }
.jdx-me { justify-content: flex-end; }
.jdx-av { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--jdx-c); color: #0B2440; font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.jdx-bubble { max-width: 78%; padding: 11px 15px; border-radius: 18px; background: var(--jdx-bg); border: 1px solid var(--jdx-line); }
.jdx-bubble p:last-child { margin: 0; }
.jdx-me .jdx-bubble { background: var(--jdx-c); border-color: var(--jdx-c); color: #0B2440; border-bottom-right-radius: 6px; }
.jdx-ai .jdx-bubble { border-bottom-left-radius: 6px; }
.jdx-typing { display: flex; gap: 4px; padding: 14px 16px; }
.jdx-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--jdx-muted); animation: jdx-b 1.2s infinite ease-in-out; }
.jdx-typing i:nth-child(2) { animation-delay: .15s; } .jdx-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes jdx-b { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.jdx-composer { display: flex; gap: 10px; align-items: flex-end; margin: 10px 0 8px; }
.jdx-composer textarea { flex: 1; }
.jdx-summary { background: var(--jdx-bg); border-left: 4px solid var(--jdx-c); border-radius: 10px; padding: 14px 18px; margin: 14px 0; }
.jdx-summary h3 { margin-top: 0; }

/* Import */
.jdx-sug { background: #F0F7FF; border: 1px dashed var(--jdx-c); border-radius: 12px; padding: 12px 16px; margin: 12px 0; font-size: .95rem; }
.jdx-sug ul { margin: 6px 0 4px 18px; padding: 0; }
.jdx-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border: 2px dashed var(--jdx-c); border-radius: 16px; padding: 30px 16px; cursor: pointer; background: #FBFDFF; transition: background .15s, transform .15s; margin: 14px 0; }
.jdx-drop:hover, .jdx-drop.is-over { background: #EAF4FF; }
.jdx-drop.is-over { transform: scale(1.01); }
.jdx-drop-ic { font-size: 1.8rem; color: var(--jdx-c-dark); line-height: 1; }
.jdx-files { list-style: none; margin: 8px 0; padding: 0; }
.jdx-files li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--jdx-line); }
.jdx-fmeta { flex: 1; min-width: 0; }
.jdx-fmeta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.jdx-fmeta small { color: var(--jdx-muted); font-size: .84rem; }
.jdx-ft { display: inline-grid; place-items: center; width: 40px; height: 46px; border-radius: 6px; font-size: .68rem; font-weight: 800; letter-spacing: .03em; color: #fff; background: #8796AA; }
.jdx-ft-pdf { background: #D9534F; } .jdx-ft-img { background: #3FA372; } .jdx-ft-doc { background: #2B6CB0; }
.jdx-x { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--jdx-bg); color: var(--jdx-muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.jdx-x:hover { background: #FDECEA; color: var(--jdx-err); }
.jdx-bar { display: block; height: 5px; border-radius: 9px; background: var(--jdx-line); margin-top: 6px; overflow: hidden; }
.jdx-bar span { display: block; height: 100%; background: var(--jdx-c); transition: width .25s; }
.jdx-err { color: var(--jdx-err); }

/* Agents */
.jdx-agents { list-style: none; margin: 16px 0; padding: 0; }
.jdx-agents li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--jdx-line); color: var(--jdx-muted); }
.jdx-agents li b { display: block; color: inherit; }
.jdx-agents li small { display: block; font-size: .87rem; }
.jdx-aic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--jdx-line); font-weight: 800; font-size: .85rem; background: #fff; }
.jdx-agents .is-fait { color: var(--jdx-ink); }
.jdx-agents .is-fait .jdx-aic { background: var(--jdx-ok); border-color: var(--jdx-ok); color: #fff; }
.jdx-agents .is-en_cours { color: var(--jdx-ink); }
.jdx-agents .is-en_cours .jdx-aic { border-color: var(--jdx-c); }
.jdx-agents .is-alerte .jdx-aic { background: var(--jdx-warn); border-color: var(--jdx-warn); color: #fff; }
.jdx-spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--jdx-c) 30%, transparent); border-top-color: var(--jdx-c-dark); animation: jdx-s .8s linear infinite; vertical-align: -3px; }
@keyframes jdx-s { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .jdx-spin, .jdx-typing i { animation-duration: 3s; } }

/* Résultats */
.jdx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.jdx-kpi { background: var(--jdx-bg); border-radius: 12px; padding: 10px 14px; }
.jdx-kpi small { display: block; color: var(--jdx-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.jdx-kpi b { font-size: 1.02rem; }
.jdx-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--jdx-line); margin: 18px 0 14px; overflow-x: auto; }
.jdx-tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--jdx-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.jdx-tabs button.is-on { color: var(--jdx-ink); border-bottom-color: var(--jdx-c); }
.jdx-piece { border: 1px solid var(--jdx-line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.jdx-piece header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.jdx-piece header div { flex: 1; }
.jdx-piece header small { display: block; color: var(--jdx-muted); font-size: .85rem; }
.jdx-pnum { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--jdx-c); color: #0B2440; font-weight: 800; display: grid; place-items: center; }
.jdx-piece ul { margin: 0 0 8px 18px; padding: 0; }
.jdx-timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.jdx-timeline li { position: relative; display: grid; grid-template-columns: 130px 1fr; gap: 14px; padding: 0 0 16px 18px; border-left: 2px solid var(--jdx-line); }
.jdx-timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--jdx-c); }
.jdx-timeline li.imp-haute::before { background: var(--jdx-c); }
.jdx-timeline time { font-weight: 700; font-size: .9rem; }
.jdx-timeline small { display: block; color: var(--jdx-muted); font-size: .82rem; }
@media (max-width: 600px) { .jdx-timeline li { grid-template-columns: 1fr; gap: 2px; } }
.jdx-args { list-style: none; margin: 0; padding: 0; }
.jdx-args li { padding: 8px 0; border-bottom: 1px solid var(--jdx-line); }
.jdx-force { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; margin-right: 8px; background: var(--jdx-bg); color: var(--jdx-muted); }
.jdx-f-forte { background: #E3F5EC; color: var(--jdx-ok); } .jdx-f-faible { background: #FDECEA; color: var(--jdx-err); }
.jdx-eval { border-radius: 12px; padding: 12px 16px; background: var(--jdx-bg); margin-bottom: 10px; }
.jdx-eval-favorable { background: #E3F5EC; } .jdx-eval-dfavorable { background: #FDECEA; } .jdx-eval-incertaine { background: #FFF4E0; }
.jdx-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.jdx-opt { border: 1px solid var(--jdx-line); border-radius: 12px; padding: 12px 14px; }
.jdx-opt small { display: block; color: var(--jdx-muted); margin-top: 4px; }
.jdx-sources { list-style: none; margin: 0; padding: 0; }
.jdx-sources li { padding: 10px 0; border-bottom: 1px solid var(--jdx-line); }
.jdx-sources p { margin: 4px 0 0; }
.jdx-tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; vertical-align: 1px; }
.jdx-tag-ok { background: #E3F5EC; color: var(--jdx-ok); } .jdx-tag-warn { background: #FFF4E0; color: var(--jdx-warn); }

/* Alertes */
.jdx-alert { background: #FFF8EB; border: 1px solid #F3D9A4; border-radius: 12px; padding: 12px 16px; margin: 12px 0; font-size: .95rem; }
.jdx-alert ul { margin: 6px 0 6px 18px; padding: 0; }
.jdx-alert-err { background: #FDECEA; border-color: #F2B8B0; color: #7B1D12; display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.jdx-alert-ok { background: #E3F5EC; border-color: #A9DCC1; color: #135C3A; }
.jdx-question { border-color: var(--jdx-warn); }
.jdx-question form { display: grid; gap: 10px; justify-items: start; }
.jdx-fb { display: grid; gap: 10px; justify-items: start; margin-top: 14px; }
.jdx-exports { display: flex; flex-wrap: wrap; gap: 10px; }

/* Rapport */
.jdx-report { background: #fff; border: 1px solid var(--jdx-line); border-radius: var(--jdx-r); padding: 40px 48px; font-size: 15px; line-height: 1.6; color: #1B2333; }
@media (max-width: 600px) { .jdx-report { padding: 22px 16px; } }
.jdx-report h2 { font-size: 1.6rem; border-bottom: 3px solid var(--jdx-c); padding-bottom: 10px; margin-bottom: 8px; }
.jdx-report h3 { font-size: 1.2rem; color: var(--jdx-c-dark); margin-top: 1.8em; }
.jdx-report h4 { font-size: 1.02rem; margin-top: 1.3em; }
.jdx-report blockquote { margin: 14px 0; padding: 10px 16px; border-left: 4px solid var(--jdx-c); background: #F0F7FF; border-radius: 0 10px 10px 0; font-size: .93em; }
.jdx-report ul, .jdx-report ol { padding-left: 22px; }
.jdx-report li { margin-bottom: 4px; }
.jdx-report a { color: var(--jdx-c-dark); }
.jdx-tablewrap { overflow-x: auto; margin: 10px 0 16px; }
.jdx-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.jdx-table th, .jdx-table td { border: 1px solid var(--jdx-line); padding: 7px 10px; text-align: left; vertical-align: top; }
.jdx-table tr:first-child th { background: var(--jdx-c); color: #0B2440; }
.jdx-table-fiche th { background: #EEF5FE !important; width: 32%; color: var(--jdx-ink) !important; }
.jdx-report.jdx-print { border: 0; border-radius: 0; padding: 0; }

.jdx-login { text-align: center; background: var(--jdx-bg); border-radius: var(--jdx-r); padding: 34px 20px; }
.jdx-disclaimer { margin-top: 18px; font-size: .8rem; color: var(--jdx-muted); text-align: center; }

@media print {
  .jdx-app > *:not(.jdx-report) { display: none !important; }
  .jdx-report { border: 0; padding: 0; }
}

/* --- Packs Pro / Expert ------------------------------------------------ */
.jdx-quota { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--jdx-card); border: 1px solid var(--jdx-line); border-radius: var(--jdx-r); padding: 12px 16px; margin-bottom: 16px; font-size: .93rem; }
.jdx-quota.is-full { background: #FFF8EB; border-color: #F3D9A4; }
.jdx-quota .jdx-btn { margin-left: auto; }
.jdx-pack { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; background: var(--jdx-bg); color: var(--jdx-muted); }
.jdx-pack-pro { background: #E6F2FE; color: var(--jdx-c-dark); }
.jdx-pack-expert { background: var(--jdx-c-dark); color: #fff; }
.jdx-meter { flex: 1 1 120px; max-width: 200px; height: 6px; border-radius: 3px; background: var(--jdx-line); overflow: hidden; }
.jdx-meter i { display: block; height: 100%; background: var(--jdx-c); border-radius: 3px; }
.jdx-quota.is-full .jdx-meter i { background: var(--jdx-warn); }
.jdx-create.is-locked textarea, .jdx-create.is-locked input { opacity: .6; }

/* --- Brouillon du rapport (avant validation du contrôle qualité) ------ */
.jdx-draftnote { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 12px 16px; border: 1px dashed var(--jdx-c); border-radius: 12px; background: var(--jdx-bg); }
.jdx-draftnote small { display: block; color: var(--jdx-muted); margin-top: 2px; }
.jdx-draft-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.jdx-report.jdx-draft { position: relative; border-style: dashed; background-image: repeating-linear-gradient(-45deg, transparent 0 46px, rgba(113,181,249,.05) 46px 92px); }
.jdx-report.jdx-draft::before { content: "BROUILLON"; position: absolute; top: 14px; right: 18px; font-size: .72rem; font-weight: 800; letter-spacing: .14em; color: var(--jdx-warn); border: 2px solid currentColor; border-radius: 6px; padding: 2px 8px; }
@media print { .jdx-report.jdx-draft::before { display: none; } }
