/* Menu DGI (danger grave et imminent) — page de travail compacte, pensée pour un écran d'ordinateur. */

.dgi-module {
  font-size: 0.9rem;
  color: var(--cgt-black, #1f1f1f);
}

.dgi-module .is-hidden,
.dgi-view.is-hidden {
  display: none !important;
}

.dgi-module mark {
  background: #fff1a8;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* Boutons du site plus discrets dans ce module */
.dgi-module .admin-submit {
  font-size: 0.85rem;
  padding: 0.38rem 0.85rem;
  min-height: 0;
  border-radius: 8px;
  box-shadow: none;
}

.dgi-module .admin-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Petit bouton générique */
.dgi-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid #cfd3d8;
  border-radius: 6px;
  background: #fff;
  color: #2b3036;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.dgi-mini:hover {
  border-color: var(--cgt-red, #e20714);
  color: var(--cgt-red, #e20714);
}

.dgi-mini:disabled {
  opacity: 0.5;
  cursor: default;
}

.dgi-ok-btn {
  border-color: #9fd0ad;
  color: #17672f;
}

.dgi-ok-btn:hover {
  background: #eaf7ee;
  border-color: #17672f;
  color: #17672f;
}

.dgi-ko-btn {
  border-color: #e3b5b5;
  color: #a00;
}

.dgi-ko-btn:hover {
  background: #fdeeee;
  border-color: #a00;
  color: #a00;
}

.dgi-back {
  margin-bottom: 0.4rem;
}

/* ── Onglets principaux ─────────────────────────────────── */
.dgi-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.6rem;
  border-bottom: 2px solid #e6e8eb;
}

.dgi-tab {
  padding: 0.35rem 0.8rem;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: #4a5056;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.dgi-tab:hover {
  color: var(--cgt-red, #e20714);
}

.dgi-tab.active {
  color: var(--cgt-red, #e20714);
  border-bottom-color: var(--cgt-red, #e20714);
}

/* ── Blocs ──────────────────────────────────────────────── */
.dgi-card {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin: 0 0 0.6rem;
}

.dgi-compact {
  padding: 0.55rem 0.75rem;
}

.dgi-card > summary {
  cursor: pointer;
  font-weight: 700;
}

.dgi-rappel {
  border-left: 4px solid var(--cgt-red, #e20714);
}

.dgi-rappel ul {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
}

.dgi-help {
  color: #6a7076;
  font-size: 0.8rem;
  font-weight: 400;
}

.dgi-tight {
  margin: 0.15rem 0 0.4rem;
}

.dgi-empty {
  color: #8a8f95;
  font-style: italic;
  margin: 0.2rem 0;
}

.dgi-msg {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.dgi-msg:empty {
  display: none;
}

.dgi-error {
  color: #b00010;
  font-weight: 600;
}

.dgi-ok {
  color: #17672f;
  font-weight: 600;
}

.dgi-red {
  color: var(--cgt-red, #e20714);
  text-decoration: underline;
}

.dgi-blue {
  color: #0070c0;
}

/* ── Champs ─────────────────────────────────────────────── */
.dgi-input {
  width: 100%;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  border: 1px solid #cfd3d8;
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
  color: inherit;
  box-sizing: border-box;
}

textarea.dgi-input {
  resize: vertical;
  line-height: 1.45;
}

.dgi-input:focus {
  outline: none;
  border-color: var(--cgt-red, #e20714);
  box-shadow: 0 0 0 2px rgba(226, 7, 20, 0.12);
}

.dgi-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.7rem;
}

.dgi-field-wide {
  grid-column: 1 / -1;
}

.dgi-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.dgi-field > span {
  color: #4a5056;
}

.dgi-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.45rem 0 0.1rem;
}

.dgi-side-actions .dgi-input {
  width: auto;
}

/* ── Mise en page de travail : document + panneau latéral ─ */
.dgi-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

@media (min-width: 1000px) {
  .dgi-work {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .dgi-work-side {
    position: sticky;
    top: 0.5rem;
    max-height: calc(100vh - 1rem);
    overflow: auto;
  }
}

@media (max-width: 700px) {
  .dgi-form {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dgi-side-box {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin: 0 0 0.55rem;
}

.dgi-side-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 800;
  font-size: 0.85rem;
  margin: 0 0 0.35rem;
}

summary.dgi-side-title {
  cursor: pointer;
  margin: 0;
}

details[open] > summary.dgi-side-title {
  margin-bottom: 0.35rem;
}

.dgi-side-title-act {
  margin-left: auto;
  display: inline-flex;
  gap: 0.25rem;
}

.dgi-locked {
  background: #f6f7f9;
}

.dgi-valider {
  width: 100%;
  justify-content: center;
  background: #17672f !important;
}

/* ── Liste et recherche ─────────────────────────────────── */
.dgi-searchbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  padding: 0.2rem 0 0.35rem;
}

.dgi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.dgi-filters .dgi-input {
  flex: 0 1 200px;
  width: auto;
}

.dgi-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  overflow: hidden;
}

.dgi-list:empty {
  display: none;
}

.dgi-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: start;
  width: 100%;
  text-align: left;
  background: #fff;
  color: inherit;
  border: none;
  border-bottom: 1px solid #eef0f2;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font: inherit;
}

.dgi-item:last-child {
  border-bottom: none;
}

.dgi-item:hover {
  background: #fbf4f4;
}

.dgi-item-date {
  font-weight: 700;
  font-size: 0.84rem;
  color: #3d4247;
  padding-top: 0.1rem;
}

.dgi-item-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.dgi-item-title {
  font-weight: 700;
}

.dgi-item-meta {
  color: #6a7076;
  font-size: 0.8rem;
}

.dgi-extrait {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: #50565c;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dgi-hits {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  font-size: 0.8rem;
}

.dgi-hits li {
  padding: 0.1rem 0;
}

.dgi-hit-src {
  font-weight: 700;
  color: var(--cgt-red, #e20714);
  margin-right: 0.25rem;
}

.dgi-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: #6a7076;
  white-space: nowrap;
}

.dgi-counts {
  display: inline-flex;
  gap: 0.25rem;
}

.dgi-count {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef0f2;
  border-radius: 999px;
  padding: 0 0.45rem;
  color: #3d4247;
}

.dgi-count-alert {
  background: #fff0d1;
  color: #8a5a00;
}

/* ── Badges de statut ───────────────────────────────────── */
.dgi-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.02rem 0.5rem;
  background: #eceef1;
  color: #3d4247;
  white-space: nowrap;
}

.dgi-st-brouillon { background: #fff0d1; color: #8a5a00; }
.dgi-st-depose { background: #fde2e3; color: #a3000b; }
.dgi-st-enquete { background: #e4f0fa; color: #00548f; }
.dgi-st-cse_extraordinaire { background: #ede4fa; color: #5a2a9a; }
.dgi-st-inspection { background: #e0f4f4; color: #0b6b6b; }
.dgi-st-clos { background: #e3f4e7; color: #17672f; }
.dgi-st-abandonne { background: #eceef1; color: #6b7076; }

/* ── En-tête de fiche ───────────────────────────────────── */
.dgi-detail-head {
  margin: 0 0 0.3rem;
}

.dgi-detail-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.dgi-detail-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.dgi-detail-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 0.3rem;
}

.dgi-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  border-bottom: 1px solid #e3e5e8;
  margin: 0.2rem 0 0.6rem;
}

.dgi-subtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: #50565c;
  cursor: pointer;
}

.dgi-subtab:hover {
  color: var(--cgt-red, #e20714);
}

.dgi-subtab.active {
  border-bottom-color: var(--cgt-red, #e20714);
  color: var(--cgt-red, #e20714);
}

/* ── Le document (rendu proche du formulaire officiel) ──── */
.dgi-doc {
  background: #fff;
  border: 1px solid #dcdfe3;
  border-radius: 6px;
  padding: 0.9rem 1.2rem;
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.45;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dgi-doc-top {
  border-bottom: 1px solid #eef0f2;
  padding-bottom: 0.4rem;
  margin-bottom: 0.3rem;
}

.dgi-doc-title {
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.dgi-doc-contacts {
  margin: 0.35rem 0 0 1.2rem;
  padding: 0;
  font-weight: 700;
  font-size: 0.88rem;
}

.dgi-doc-sec {
  padding: 0.3rem 0.4rem;
  margin: 0 -0.4rem;
  border-radius: 6px;
}

.dgi-doc-sec:hover {
  background: #fafbfc;
}

.dgi-doc-sec.is-editing {
  background: #fffdf3;
  outline: 1px solid #f0dfa0;
}

.dgi-doc-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.6rem;
}

.dgi-doc-head h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
}

.dgi-doc-head .dgi-mini {
  margin-left: auto;
  opacity: 0.55;
}

.dgi-doc-sec:hover .dgi-doc-head .dgi-mini {
  opacity: 1;
}

.dgi-doc-constats .dgi-doc-head h4 {
  font-style: italic;
}

.dgi-doc-constats .dgi-doc-text {
  text-align: justify;
}

.dgi-doc-text {
  white-space: normal;
  word-wrap: break-word;
  padding-left: 0.6rem;
}

.dgi-doc-constats .dgi-doc-text {
  padding-left: 0;
}

/* Suivi des modifications (comme Word) : couleur par auteur */
.dgi-tc {
  text-decoration-thickness: 1.5px;
}

ins.dgi-tc {
  color: var(--c, #1f6fd1);
  background: color-mix(in srgb, var(--c, #1f6fd1) 14%, transparent);
  text-decoration: underline;
  text-decoration-color: var(--c, #1f6fd1);
  border-radius: 2px;
}

del.dgi-tc {
  color: var(--c, #a00);
  text-decoration: line-through;
  text-decoration-color: var(--c, #a00);
  opacity: 0.85;
}

.dgi-chg {
  cursor: pointer;
}

.dgi-chg:hover {
  outline: 1px dashed #b9bec4;
  outline-offset: 1px;
}

/* Diff simple (aperçu, historique) */
.dgi-module del:not(.dgi-tc) {
  background: #fde2e3;
  color: #a3000b;
}

.dgi-module ins:not(.dgi-tc) {
  background: #dff3e4;
  color: #145c2b;
  text-decoration: none;
}

.dgi-editor-area {
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  font-size: 0.95rem;
}

.dgi-editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.3rem 0;
}

.dgi-editor-preview {
  border-left: 3px solid #f0dfa0;
  padding: 0.25rem 0.5rem;
  background: #fff;
  max-height: 240px;
  overflow: auto;
  font-size: 0.88rem;
}

/* Panneau des modifications */
.dgi-chglist {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 46vh;
  overflow: auto;
}

.dgi-chgcard {
  border: 1px solid #e3e5e8;
  border-left: 4px solid var(--c, #1f6fd1);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  font-size: 0.82rem;
  transition: background 0.3s ease;
}

.dgi-chgcard.is-flash {
  background: #fff6cc;
}

.dgi-chgcard-head {
  font-size: 0.78rem;
}

.dgi-chgcard-body {
  margin: 0.15rem 0;
  max-height: 6.5em;
  overflow: hidden;
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
}

.dgi-chgcard-act {
  display: flex;
  gap: 0.3rem;
}

.dgi-infos {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.1rem 0.5rem;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
}

.dgi-infos dt {
  color: #6a7076;
}

.dgi-infos dd {
  margin: 0;
  word-break: break-word;
}

.dgi-form-compact {
  gap: 0.35rem 0.55rem;
}

.dgi-work-side .dgi-form {
  grid-template-columns: minmax(0, 1fr);
}

/* Points de vigilance */
.dgi-vigilance {
  border: 1px solid #f2d48a;
  background: #fffaf0;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
}

.dgi-vigilance > summary {
  cursor: pointer;
  font-weight: 800;
}

.dgi-vigilance ul {
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
}

.dgi-vigilance li {
  margin: 0.15rem 0;
}

.dgi-vg-err { color: #a3000b; font-weight: 600; }
.dgi-vg-info { color: #4a5056; }

.dgi-import-text {
  font-size: 0.85rem;
  max-height: 420px;
  overflow: auto;
}

/* ── Enquête et annexes ─────────────────────────────────── */
.dgi-pgroup + .dgi-pgroup {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid #eef0f2;
}

.dgi-pieces {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dgi-pieces li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  padding: 0.18rem 0;
}

.dgi-pieces a {
  font-weight: 600;
  color: var(--cgt-red, #e20714);
}

.dgi-pieces .dgi-mini {
  margin-left: auto;
}

.dgi-timeline {
  list-style: none;
  margin: 0 0 0.45rem;
  padding: 0 0 0 0.7rem;
  border-left: 2px solid #e6e8eb;
  font-size: 0.8rem;
}

.dgi-timeline li {
  position: relative;
  padding: 0.15rem 0 0.15rem 0.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: baseline;
}

.dgi-timeline li::before {
  content: "";
  position: absolute;
  left: -1.05rem;
  top: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--cgt-red, #e20714);
}

.dgi-tl-date {
  font-weight: 700;
}

.dgi-tl-auteur {
  color: #8a8f95;
  font-size: 0.75rem;
}

.dgi-timeline .dgi-mini {
  padding: 0 0.3rem;
}

/* Glisser-déposer */
.dgi-drop {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 2px dashed #c4c7cc;
  border-radius: 8px;
  background: #fafbfc;
  text-align: center;
  font-weight: 400;
  font-size: 0.82rem;
  color: #4a5056;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dgi-drop:hover,
.dgi-drop:focus-within {
  border-color: var(--cgt-red, #e20714);
}

.dgi-drop.is-over {
  border-color: var(--cgt-red, #e20714);
  background: #fff1f1;
}

.dgi-drop.has-file {
  border-style: solid;
  border-color: #17672f;
  background: #f3fbf5;
}

.dgi-drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.dgi-drop-text strong {
  color: #1f1f1f;
}

.dgi-drop-file {
  font-weight: 700;
  color: #17672f;
}

.dgi-filelist {
  margin: 0.35rem 0;
  font-size: 0.8rem;
}

.dgi-filerow {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto 230px;
  gap: 0.4rem;
  align-items: center;
  padding: 0.12rem 0;
  border-bottom: 1px solid #f1f2f4;
}

#dgi-pc-list .dgi-filerow {
  grid-template-columns: minmax(0, 1fr) auto 230px;
}

.dgi-filerow.is-noise {
  opacity: 0.55;
}

.dgi-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dgi-filerow .dgi-input {
  padding: 0.12rem 0.3rem;
  font-size: 0.8rem;
}

/* ── Espace de travail CGT ──────────────────────────────── */
.dgi-contrib-new {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: start;
}

.dgi-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

@media (max-width: 800px) {
  .dgi-cols,
  .dgi-contrib-new {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dgi-col {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.dgi-contrib {
  border-top: 1px solid #eef0f2;
  padding: 0.35rem 0;
  font-size: 0.86rem;
}

.dgi-contrib.is-retenue {
  background: #f3fbf5;
  border-radius: 6px;
  padding: 0.35rem 0.4rem;
}

.dgi-contrib-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  font-size: 0.78rem;
  color: #6a7076;
}

.dgi-contrib-act {
  margin-left: auto;
  display: inline-flex;
  gap: 0.25rem;
}

.dgi-contrib-body p {
  margin: 0.15rem 0;
}

/* ── Historique ─────────────────────────────────────────── */
.dgi-hist {
  border-bottom: 1px solid #eef0f2;
  padding: 0.25rem 0;
  font-size: 0.84rem;
}

.dgi-hist > summary {
  cursor: pointer;
}

.dgi-hist-act {
  font-weight: 700;
}

.dgi-hist-diff {
  margin: 0.3rem 0 0.2rem;
  padding: 0.3rem 0.5rem;
  background: #fafbfc;
  border-radius: 6px;
  max-height: 300px;
  overflow: auto;
}

/* Liste classée par année : lignes pliables */
.dgi-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dgi-fold-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.dgi-year-group {
  border-bottom: 1px solid #e3e5e8;
}

.dgi-year-group:last-child {
  border-bottom: none;
}

.dgi-year {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  background: #f3f4f6;
  font-weight: 700;
  font-size: 0.9rem;
  color: #b3001b;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.dgi-year::-webkit-details-marker {
  display: none;
}

.dgi-year:hover {
  background: #eceef1;
}

.dgi-year-chev {
  display: inline-block;
  width: 0.8rem;
  transition: transform 0.15s;
  color: #6b7280;
}

.dgi-year-group[open] > .dgi-year .dgi-year-chev {
  transform: rotate(90deg);
}

.dgi-year-group[open] > .dgi-year {
  border-bottom: 1px solid #e3e5e8;
}

.dgi-year-n {
  font-weight: 400;
  font-size: 0.78rem;
  color: #6b7280;
}

.dgi-badge-fret {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.dgi-entreprise-sel {
  width: auto;
  padding: 0.1rem 0.3rem;
  font-size: 0.78rem;
}
