/**
 * Bandeau de l'accord de transition.
 * Le défilement des pages se fait dans #module-content (espace CSE) ou .fil-panel (Le Fil),
 * sous ce bandeau. Il reste donc visible sans recouvrir le menu ni les titres.
 * Le header n'est pas fixe : le bandeau est le premier bloc du gabarit, collant si
 * un parent se met à défiler.
 */

.cd-countdown {
  position: sticky;
  top: 0;
  z-index: 180;
  flex-shrink: 0;
  width: 100%;
}

.app-shell > .cd-countdown {
  margin-bottom: -0.15rem;
}

.app-shell > .topbar,
#fil-app > .fil-topbar {
  position: relative;
  z-index: 40;
}

.cd-banner {
  display: flex;
  align-items: center;
  gap: 0.7rem 0.9rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.9rem;
  box-sizing: border-box;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: #FCEBEB;
  background: #A32D2D;
  appearance: none;
  -webkit-appearance: none;
}

.cd-banner[data-level="calm"],
.cd-banner[data-level="alert"] {
  background: #A32D2D;
}

.cd-banner[data-level="urgent"] {
  background: #791F1F;
}

.cd-banner[data-level="critical"] {
  background: #501313;
}

.cd-banner[data-level="expired"] {
  background: #444441;
}

.cd-banner:hover {
  filter: brightness(1.06);
}

.cd-banner:focus-visible {
  outline: 2px solid #FCEBEB;
  outline-offset: -3px;
}

.cd-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FCEBEB;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(252, 235, 235, 0.25);
}

.cd-banner[data-blink="1"] .cd-dot {
  animation: cd-dot-blink 1.15s ease-in-out infinite;
}

.cd-badge {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--rouge-1, #5a0000);
  background: #FCEBEB;
  border-radius: 6px;
  padding: 0.18rem 0.48rem;
}

.cd-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1 1 180px;
  gap: 0.05rem;
}

.cd-copy__line {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.cd-copy__sub {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  opacity: 0.92;
}

.cd-mobile-label {
  display: none;
}

.cd-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  flex: 0 0 auto;
}

.cd-bar,
.cd-modal-bar {
  display: block;
  width: 120px;
  height: 7px;
  border-radius: 999px;
  background: rgba(252, 235, 235, 0.28);
  overflow: hidden;
}

.cd-bar__fill,
.cd-modal-bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #FCEBEB;
}

.cd-progress__label {
  font-size: 11px;
  line-height: 1.15;
  font-weight: 600;
  white-space: nowrap;
}

.cd-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  margin-left: auto;
  font-weight: 700;
  font-size: 0.88rem;
}

.cd-more__icon {
  width: 18px;
  height: 18px;
  display: block;
}

@keyframes cd-dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
  .cd-banner[data-blink="1"] .cd-dot {
    animation: none;
  }
}

@media (max-width: 639px) {
  .cd-banner {
    flex-wrap: nowrap;
    gap: 0.45rem;
    padding: 0.48rem 0.7rem;
  }

  .cd-copy,
  .cd-progress,
  .cd-more__label {
    display: none;
  }

  .cd-mobile-label {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .cd-badge {
    font-size: 18px;
  }
}

.cd-modal[hidden] {
  display: none !important;
}

.cd-modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem 1rem;
  box-sizing: border-box;
  overflow: auto;
}

.cd-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-bg-popup, rgba(0, 0, 0, 0.45));
}

.cd-modal__panel {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  margin: auto 0;
  background: var(--color-bg-card, #fff);
  color: var(--color-text-main, #333);
  border-radius: 16px;
  padding: 1.25rem 1.3rem 1.15rem;
  box-shadow: var(--shadow-lg, 0 12px 24px rgba(0, 0, 0, 0.32));
  box-sizing: border-box;
}

.cd-modal__panel:focus {
  outline: none;
}

.cd-modal__panel:focus-visible {
  outline: 2px solid var(--cgt-red, #e20714);
  outline-offset: 2px;
}

.cd-modal__close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--gris-5, #e0e0e0);
  background: #fff;
  color: var(--color-text-main, #333);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.cd-modal__close:focus-visible,
.cd-btn:focus-visible,
.cd-neg:focus-visible {
  outline: 2px solid var(--cgt-red, #e20714);
  outline-offset: 2px;
}

#cd-modal-title {
  margin: 0 2rem 0.9rem 0;
  font-size: 1.2rem;
  line-height: 1.3;
  color: var(--carbone, #384f59);
}

.cd-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.cd-stat {
  background: var(--color-bg-module, #f5f5f5);
  border-radius: 10px;
  padding: 0.65rem 0.5rem;
  text-align: center;
}

.cd-stat__value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--carbone, #384f59);
  font-variant-numeric: tabular-nums;
}

.cd-stat__value--alert {
  color: var(--cgt-red, var(--rouge-3, #e20714));
}

.cd-stat__label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted, var(--carbone-70, #74848b));
}

.cd-modal-progress {
  margin-bottom: 0.95rem;
}

.cd-modal-bar {
  width: 100%;
  height: 10px;
  background: var(--gris-5, #e0e0e0);
}

.cd-modal-bar__fill {
  background: var(--cgt-red, #e20714);
}

.cd-modal-progress__dates {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--color-text-muted, #74848b);
}

.cd-text {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.cd-text strong {
  color: var(--carbone, #384f59);
}

.cd-list-title {
  margin: 0.2rem 0 0.45rem;
  font-size: 1rem;
  color: var(--carbone, #384f59);
}

.cd-neg-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.cd-neg-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted, #74848b);
}

.cd-neg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: var(--color-bg-module, #f5f5f5);
  color: inherit;
  text-decoration: none;
}

.cd-neg:hover {
  background: var(--carbone-10, #e6eaec);
}

.cd-neg__title {
  font-weight: 700;
  font-size: 0.92rem;
  min-width: 0;
}

.cd-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.cd-pill--cours {
  background: #fff1e6;
  color: #9a3412;
}

.cd-pill--avenir {
  background: var(--gris-5, #e0e0e0);
  color: var(--gris-2, #3c3c3c);
}

.cd-pill--conclu {
  background: var(--vert-5, #dcedc8);
  color: var(--vert-1, #003d00);
}

.cd-callout {
  margin: 0 0 0.95rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: var(--rouge-5, #ffd6d6);
  color: var(--rouge-1, #5a0000);
  font-weight: 700;
  line-height: 1.35;
}

.cd-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.45rem 0.85rem;
  border-radius: var(--app-radius, 10px);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}

.cd-btn--ghost {
  background: #fff;
  color: var(--carbone, #384f59);
  border-color: var(--gris-4, #b0b0b0);
}

.cd-btn--primary {
  background: var(--cgt-red, #e20714);
  color: #fff;
}

@media (max-width: 639px) {
  .cd-modal:not([hidden]) {
    padding: 0.6rem;
  }

  .cd-stats {
    grid-template-columns: 1fr;
  }

  .cd-modal__actions {
    flex-direction: column-reverse;
  }

  .cd-btn {
    width: 100%;
  }

  .cd-neg {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }
}
