.sj-page [hidden] {
  display: none !important;
}

.sj-page .auth-top .mage-brand-wordmark {
  color: var(--mage-green-dark);
  font-size: 1.6rem;
}

.sj-page .auth-top .site-locale-select {
  appearance: none;
  min-height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--mage-border);
  border-radius: 999px;
  background: var(--mage-white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23366C5D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  color: #1a2e28;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.sj-page .auth-top .site-locale-select:hover {
  border-color: var(--mage-green);
}

.sj-page .auth-top .site-locale-select:focus-visible {
  outline: 2px solid var(--mage-green);
  outline-offset: 2px;
}

.sj-page ::selection {
  background: #cfe7dd;
  color: #12261f;
}

.sj-page .sj-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.sj-hero {
  padding: 20px 0 12px;
}

.sj-hero h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
  color: #1a2e28;
}

.sj-hero p {
  margin: 8px 0 0;
  color: var(--mage-muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.sj-card {
  background: var(--mage-white);
  border: 1px solid var(--mage-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 0 0 14px;
}

.sj-card h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #1a2e28;
}

.sj-card p {
  margin: 0 0 10px;
  line-height: 1.5;
  font-size: 0.92rem;
}

.sj-notice {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 0 0 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  background: var(--mage-mint-light);
  color: #1a2e28;
}

.sj-notice--warn {
  background: #fff6e0;
  color: #5c4300;
}

.sj-notice--err {
  background: #fdecea;
  color: #8a1f1a;
}

.sj-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
}

.sj-field > span {
  font-weight: 600;
  font-size: 0.9rem;
}

.sj-field small {
  color: var(--mage-muted);
  font-size: 0.8rem;
}

.sj-field select,
.sj-field input[type="date"],
.sj-field input[type="number"],
.sj-field input[type="text"],
.sj-field textarea,
.sj-input {
  font: inherit;
  font-size: 1rem;
  color: #1a2e28;
  padding: 11px 14px;
  border: 1px solid #cfd8d4;
  border-radius: 12px;
  background: #fff;
  min-height: 48px;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.sj-field select:focus,
.sj-field input:focus,
.sj-field textarea:focus,
.sj-input:focus {
  outline: none;
  border-color: var(--mage-green);
  box-shadow: 0 0 0 3px rgba(54, 108, 93, 0.18);
}

.sj-input[type="date"] {
  width: min(100%, 260px);
  accent-color: var(--mage-green);
}

/* Questionnaire */
.sj-form {
  padding: 22px 20px;
}

.sj-q {
  border: 0;
  margin: 0;
  padding: 20px 0;
  min-width: 0;
  background: linear-gradient(#e9eeec, #e9eeec) top / 100% 1px no-repeat;
}

.sj-q::after {
  content: "";
  display: table;
  clear: both;
}

.sj-form > .sj-q:first-child {
  background: none;
  padding-top: 0;
}

/* Légende flottante : sinon le navigateur la pose sur le bord du fieldset. */
.sj-q__label {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 4px;
  font-weight: 650;
  font-size: 0.98rem;
  line-height: 1.35;
  color: #1a2e28;
}

.sj-q__label--lg {
  font-size: 1.12rem;
  margin-bottom: 12px;
}

.sj-q__label + * {
  clear: both;
}

.sj-q__hint {
  margin: 0 0 10px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #5a6862;
}

.sj-q__label + .sj-pills,
.sj-q__label + .sj-tiles,
.sj-q__label + .sj-combo,
.sj-q__label + .sj-input {
  margin-top: 10px;
}

.sj-q__err {
  margin: 8px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #a12a22;
}

.sj-q.is-missing .sj-pill > span,
.sj-q.is-missing .sj-tile__body,
.sj-q.is-missing .sj-input,
.sj-q.is-missing .sj-combo__field {
  border-color: #e3a29c;
}

/* Tuiles (choix exclusif avec description) */
.sj-tiles {
  display: grid;
  gap: 8px;
}

.sj-tiles--2 {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.sj-tile {
  position: relative;
  display: block;
  cursor: pointer;
}

.sj-tile input,
.sj-pill input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.sj-tile__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100%;
  box-sizing: border-box;
  padding: 13px 44px 13px 15px;
  border: 1px solid #d6dfdb;
  border-radius: 14px;
  background: #fff;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #4d5c56;
  transition: border-color 0.15s ease-out, background-color 0.15s ease-out;
}

.sj-tile__body strong {
  font-size: 0.95rem;
  color: #1a2e28;
}

.sj-tile__body::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px solid #b9c6c0;
  background: #fff;
  transition: border-width 0.15s ease-out, border-color 0.15s ease-out;
}

.sj-tile:hover .sj-tile__body {
  border-color: #9fbcb1;
}

.sj-tile input:checked + .sj-tile__body {
  border-color: var(--mage-green);
  background: #f2f8f5;
  box-shadow: inset 0 0 0 1px var(--mage-green);
}

.sj-tile input:checked + .sj-tile__body::after {
  border: 5.5px solid var(--mage-green);
}

.sj-tile input:focus-visible + .sj-tile__body,
.sj-pill input:focus-visible + span {
  outline: 2px solid var(--mage-green);
  outline-offset: 2px;
}

/* Pastilles (choix court) */
.sj-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sj-pill {
  position: relative;
  cursor: pointer;
}

.sj-pill > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  box-sizing: border-box;
  padding: 9px 16px;
  border: 1px solid #d0dad6;
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 550;
  color: #26372f;
  transition: border-color 0.15s ease-out, background-color 0.15s ease-out, color 0.15s ease-out;
}

.sj-pill > span small {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6a7a73;
}

.sj-pill:hover > span {
  border-color: #9fbcb1;
}

.sj-pill input:checked + span {
  border-color: var(--mage-green);
  background: var(--mage-green);
  color: #fff;
}

.sj-pill input:checked + span small {
  color: #d7ebe3;
}

/* Recherche de métier */
.sj-combo {
  position: relative;
}

.sj-combo__field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd8d4;
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.sj-combo__field:focus-within {
  border-color: var(--mage-green);
  box-shadow: 0 0 0 3px rgba(54, 108, 93, 0.18);
}

.sj-combo__field svg {
  flex: none;
  color: #6a7a73;
}

.sj-combo__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 12px 0;
  font: inherit;
  font-size: 1rem;
  color: #1a2e28;
  background: transparent;
}

.sj-combo__field input::placeholder {
  color: #7b8a84;
}

.sj-combo__clear {
  flex: none;
  border: 0;
  background: none;
  padding: 6px;
  margin-right: -6px;
  border-radius: 8px;
  color: #5a6862;
  cursor: pointer;
  display: inline-flex;
}

.sj-combo__clear:hover {
  background: #eef3f1;
}

.sj-combo__list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid #d6dfdb;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(18, 38, 31, 0.12);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c3d1cb transparent;
}

.sj-combo__opt {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #1a2e28;
  cursor: pointer;
}

.sj-combo__opt mark {
  background: #dcefe7;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.sj-combo__opt.is-active {
  background: #eef5f2;
}

.sj-combo__opt[aria-selected="true"] {
  font-weight: 650;
  color: var(--mage-green-dark);
}

.sj-combo__opt--other {
  margin-top: 4px;
  border-top: 1px solid #edf1ef;
  border-radius: 0 0 10px 10px;
  color: #4d5c56;
}

.sj-combo__empty {
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #5a6862;
}

.sj-combo__picked {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #2d584b;
  font-weight: 600;
}

.sj-actions--submit {
  align-items: center;
  margin-top: 14px;
  padding-top: 18px;
  border-top: 1px solid #edf1ef;
}

.sj-actions__note {
  flex: 1 1 220px;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #5a6862;
}

/* Pré-diagnostic */
.sj-verdict {
  border-radius: var(--radius-md);
  border: 1px solid;
  padding: 18px;
  margin: 0 0 14px;
}

.sj-verdict--ok { background: #f0f8f4; border-color: #bfe0d1; }
.sj-verdict--fragile { background: #fff8e8; border-color: #f0d79b; }
.sj-verdict--ineligible { background: #fdf1ef; border-color: #f0c2bc; }

.sj-verdict__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.sj-verdict__icon {
  flex: none;
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

.sj-verdict--ok .sj-verdict__icon { background: #d4ecdf; color: #1f6a47; }
.sj-verdict--fragile .sj-verdict__icon { background: #fbe7b7; color: #7a5200; }
.sj-verdict--ineligible .sj-verdict__icon { background: #f8d6d1; color: #9a2a20; }

.sj-verdict h2 {
  margin: 4px 0 4px;
  font-size: 1.08rem;
  line-height: 1.3;
  color: #1a2e28;
}

.sj-verdict__lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #3f4d47;
}

.sj-findings {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sj-finding {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(26, 46, 40, 0.08);
  font-size: 0.87rem;
  line-height: 1.5;
  color: #3f4d47;
}

.sj-finding strong {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  font-size: 0.92rem;
  color: #1a2e28;
}

.sj-finding__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sj-finding--block .sj-finding__dot { background: #c0392b; }
.sj-finding--warn .sj-finding__dot { background: #d18b00; }
.sj-finding--info .sj-finding__dot { background: var(--mage-green); }

.sj-finding__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sj-verdict__foot {
  margin: 14px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #5a6862;
}

.sj-verdict .sj-actions {
  margin-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .sj-tile__body,
  .sj-tile__body::after,
  .sj-pill > span,
  .sj-combo__field,
  .sj-input {
    transition: none;
  }
}

.sj-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.sj-choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--mage-border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.35;
  background: #fff;
}

.sj-choice:has(input:checked) {
  border-color: var(--mage-green);
  background: var(--mage-mint-light);
}

.sj-choice input {
  margin-top: 2px;
  accent-color: var(--mage-green);
}

.sj-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 12px;
}

.sj-check input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--mage-green);
}

.sj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.sj-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  border: 1px solid var(--mage-green);
  background: var(--mage-green);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
}

.sj-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.sj-btn--ghost {
  background: #fff;
  color: var(--mage-green);
}

.sj-btn--danger {
  background: #fff;
  color: #8a1f1a;
  border-color: #e9b8b4;
}

.sj-btn--sm {
  padding: 8px 14px;
  min-height: 38px;
  font-size: 0.85rem;
}

.sj-pieces {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sj-piece {
  border: 1px solid var(--mage-border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: #fff;
}

.sj-piece__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.sj-piece__title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
}

.sj-piece__desc {
  margin: 6px 0 0;
  color: var(--mage-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.sj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sj-tag {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f1f3f2;
  color: #3f4a46;
}

.sj-status {
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.sj-status--missing { background: #f1f3f2; color: #5c5c5c; }
.sj-status--processing { background: #e8f0fb; color: #1f4f8a; }
.sj-status--auto_ok,
.sj-status--validated { background: #e3f4ec; color: #1f6a47; }
.sj-status--auto_warning { background: #fff6e0; color: #5c4300; }
.sj-status--auto_redo,
.sj-status--rejected { background: #fdecea; color: #8a1f1a; }

.sj-files {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sj-file {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8faf9;
}

.sj-file__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sj-file__msg {
  display: block;
  color: var(--mage-muted);
  font-size: 0.8rem;
  white-space: normal;
  margin-top: 2px;
}

.sj-file__del {
  border: 0;
  background: none;
  color: #8a1f1a;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  flex: none;
}

.sj-upload {
  margin-top: 10px;
}

.sj-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sj-progress {
  height: 6px;
  border-radius: 999px;
  background: #eef2f0;
  overflow: hidden;
  margin-top: 8px;
}

.sj-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mage-green);
  transition: width 0.2s ease;
}

.sj-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.sj-steps li {
  flex: 1;
  min-width: 70px;
  font-size: 0.72rem;
  text-align: center;
  color: var(--mage-muted);
  padding-top: 8px;
  border-top: 4px solid #e2e8e4;
}

.sj-steps li.is-done {
  border-color: var(--mage-green);
  color: #1a2e28;
}

.sj-steps li.is-current {
  border-color: var(--mage-green);
  color: var(--mage-green);
  font-weight: 700;
}

.sj-deadlines,
.sj-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sj-deadline {
  border: 1px solid var(--mage-border);
  padding: 10px 12px;
  background: #f8faf9;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.sj-deadline--urgent,
.sj-deadline--overdue {
  border-color: #f3c9ae;
  background: #fff4ec;
}

.sj-deadline strong {
  display: block;
}

.sj-deadline time {
  font-weight: 600;
  color: #1a2e28;
}

.sj-timeline li {
  font-size: 0.85rem;
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}

.sj-timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mage-green);
}

.sj-timeline time {
  display: block;
  color: var(--mage-muted);
  font-size: 0.75rem;
}

.sj-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sj-list a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.sj-legal {
  font-size: 0.78rem;
  color: var(--mage-muted);
  line-height: 1.5;
  margin-top: 18px;
}

.sj-legal a {
  color: var(--mage-green);
}

.sj-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #1a2e28;
  color: #fff;
  font-size: 0.9rem;
  z-index: 50;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sj-toast.err {
  background: #8a1f1a;
}

/* Squelettes de chargement */
.sj-skel {
  border-radius: 10px;
  background: linear-gradient(90deg, #eef2f0 25%, #f7f9f8 50%, #eef2f0 75%);
  background-size: 200% 100%;
  animation: sj-shimmer 1.2s ease-in-out infinite;
}

.sj-skel--title { height: 28px; width: 60%; margin: 24px 0 10px; }
.sj-skel--line { height: 14px; width: 85%; margin: 0 0 18px; }
.sj-skel--steps { height: 30px; margin: 0 0 14px; }
.sj-skel--card { height: 110px; margin: 0 0 12px; }

@keyframes sj-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sj-skel { animation: none; }
}

dialog.sj-dialog {
  border: 0;
  border-radius: var(--radius-md);
  padding: 20px;
  width: min(92vw, 480px);
}

dialog.sj-dialog::backdrop {
  background: rgba(10, 20, 16, 0.45);
}
