/*
 * Fondations du cockpit formateur.
 * Cette feuille ne cible que .app-shell afin de ne pas modifier l’espace stagiaire
 * ni les pages publiques. Les composants seront progressivement déplacés ici.
 */

.app-shell {
  --pro-bg: #f4f0e8;
  --pro-surface: #fffdf8;
  --pro-surface-soft: #eee8de;
  --pro-text: #2b2925;
  --pro-muted: #6b665e;
  --pro-line: #d8d0c3;
  --pro-accent: #2b2925;
  --pro-info: #40596b;
  --pro-radius: 14px;
  --pro-control-height: 40px;
}

.app-shell .content {
  min-width: 0;
}

.app-shell :where(.panel, .section, .toolbar, .kpi, .document-explorer-main, .document-explorer-sidebar) {
  border-color: var(--pro-line);
  border-radius: var(--pro-radius);
}

.app-shell :where(.button, .icon-button, .tab-link, .section-nav-link) {
  min-height: var(--pro-control-height);
}

.app-shell .button.primary,
.app-shell .icon-button.primary,
.app-shell .global-create-menu > summary.button.primary,
.app-shell .add-icon-button {
  background: var(--pro-accent);
  border-color: var(--pro-accent);
  color: #fffdf8;
}

.app-shell img {
  max-width: 100%;
}

.app-shell .avatar img,
.app-shell .contact-avatar img {
  aspect-ratio: 1;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.app-shell :where(.module-list-image, .session-title-module-image) {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.app-shell :where(.offer-logo-figure img, .session-title-offer-logo, .invoice-asset-preview img) {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.app-shell :where(.article-preview-cover, [data-image-frame] img) {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Une synthèse horizontale remplace les grandes cartes KPI décoratives. */
.pro-summary-strip {
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid var(--pro-line);
  border-radius: var(--pro-radius);
  display: flex;
  margin: 0 0 18px;
  min-width: 0;
  overflow-x: auto;
  padding: 0;
  scrollbar-width: none;
}

.pro-summary-strip::-webkit-scrollbar {
  display: none;
}

.pro-summary-strip > div {
  align-content: center;
  display: grid;
  flex: 1 0 min(210px, 42vw);
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 11px 16px;
}

.pro-summary-strip > div + div {
  border-left: 1px solid var(--pro-line);
}

.pro-summary-strip dt {
  color: var(--pro-muted);
  font-size: 12px;
  font-weight: 700;
}

.pro-summary-strip dd {
  color: var(--pro-text);
  font-size: 21px;
  font-weight: 720;
  grid-column: 2;
  grid-row: 1 / span 2;
  letter-spacing: -0.035em;
  margin: 0 0 0 16px;
}

.pro-summary-strip small {
  color: var(--pro-muted);
  font-size: 11px;
  grid-column: 1;
}

/* Les KPI encore nécessaires restent compacts et informatifs. */
.app-shell .kpi-grid {
  gap: 10px;
  margin-bottom: 18px;
}

.app-shell .kpi-grid .kpi {
  min-height: 104px;
  padding: 14px 16px;
}

.app-shell .kpi-grid .kpi strong {
  font-size: clamp(22px, 2.4vw, 30px);
}

/* Le constructeur reste un outil de réglage, pas une page marketing. */
.app-shell .site-builder-intro {
  align-items: center;
  background: var(--pro-surface);
  border: 1px solid var(--pro-line);
  border-radius: var(--pro-radius);
  box-shadow: none;
  color: var(--pro-text);
  min-width: 0;
  padding: 18px 20px;
}

.app-shell .site-builder-intro::after {
  display: none;
}

.app-shell .site-builder-intro h2 {
  color: var(--pro-text);
  font-size: clamp(21px, 2.4vw, 28px);
  margin: 4px 0 2px;
}

.app-shell .site-builder-intro p,
.app-shell .site-builder-status > span:last-child {
  color: var(--pro-muted);
}

.app-shell .site-builder-status {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-items: auto;
  min-width: 0;
}

.app-shell .site-builder-status strong {
  font-size: 22px;
  margin: 0;
}

.app-shell :where(.site-builder-layout, .site-builder-editor, .site-settings-workbench, .site-settings-main) {
  max-width: 100%;
  min-width: 0;
}

.app-shell .site-settings-nav {
  background: #f3eee5;
}

.app-shell .site-settings-focus {
  background: #f3eee5;
  border-color: var(--pro-line);
}

.app-shell .site-settings-focus-metrics article,
.app-shell .site-publication-panel {
  background: var(--pro-surface);
  border-color: var(--pro-line);
}

.app-shell .site-publication-panel[data-state="published"] .site-publication-toggle > span {
  background: var(--pro-info);
}

.app-shell .site-settings-nav button.active {
  background: var(--pro-accent);
  border-color: var(--pro-accent);
  box-shadow: none;
  color: #fffdf8;
}

.app-shell .site-settings-nav button.active > small {
  color: #d9d1c6;
}

/* Les diagnostics restent disponibles sans prendre la priorité visuelle. */
.app-shell .pro-secondary-disclosure {
  background: var(--pro-surface);
  color: var(--pro-text);
  margin-top: 18px;
  padding: 0;
}

.app-shell .pro-secondary-disclosure > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  min-height: 58px;
  padding: 14px 18px;
}

.app-shell .pro-secondary-disclosure > summary::-webkit-details-marker {
  display: none;
}

.app-shell .pro-secondary-disclosure > summary::after {
  content: "+";
  font-size: 20px;
}

.app-shell .pro-secondary-disclosure[open] > summary::after {
  content: "−";
}

.app-shell .pro-secondary-disclosure > summary div {
  display: grid;
  gap: 2px;
}

.app-shell .pro-secondary-disclosure > summary span {
  color: var(--pro-muted);
  font-size: 12px;
}

.app-shell .email-delivery-journal {
  background: var(--pro-surface);
  border-color: var(--pro-line);
  color: var(--pro-text);
}

.app-shell .email-delivery-journal-body {
  border-top: 1px solid var(--pro-line);
  padding: 16px 18px 18px;
}

.app-shell .email-delivery-journal :where(p, small, .empty-message) {
  color: var(--pro-muted);
}

.app-shell .commercial-compose-panel {
  background: var(--pro-accent);
  border-color: var(--pro-accent);
  color: #fffdf8;
}

.app-shell .commercial-workbench.is-empty {
  grid-template-columns: 1fr;
}

.app-shell .commercial-compose-kicker {
  color: #cfc7bc;
}

.app-shell .commercial-compose-panel > p,
.app-shell .commercial-selection-count {
  color: #d7d0c6;
}

.app-shell .commercial-compose-panel :where(input, textarea) {
  background: rgba(255, 253, 248, 0.08);
  border-color: rgba(255, 253, 248, 0.25);
}

/* Structure sémantique et visuelle du formulaire d’inscription. */
.app-shell fieldset.registration-step {
  border: 0;
  border-top: 1px solid var(--pro-line);
  display: block;
  margin: 0;
  min-inline-size: 0;
  padding: 22px 0;
}

.app-shell fieldset.registration-step:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.app-shell .registration-step > legend {
  align-items: center;
  color: var(--pro-text);
  display: flex;
  float: none;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  width: 100%;
}

.app-shell .registration-step > legend > span {
  align-items: center;
  background: var(--pro-surface-soft);
  border: 1px solid var(--pro-line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.app-shell .registration-step > legend > strong {
  font-size: 17px;
}

.app-shell .registration-preview {
  background: var(--pro-surface);
  border-color: var(--pro-line);
  box-shadow: 0 12px 30px rgba(55, 47, 38, 0.07);
}

.app-shell .registration-preview > small {
  color: var(--pro-muted);
}

.app-shell .registration-preview dl > div {
  border-color: var(--pro-line);
}

@media (max-width: 760px) {
  .app-shell .section-command-bar,
  .app-shell .section-command-nav,
  .app-shell .section-command-actions {
    max-width: 100%;
    min-width: 0;
  }

  .app-shell .section-command-actions {
    overflow: visible;
  }

  .app-shell .section-command-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell .section-command-nav,
  .app-shell .section-command-actions {
    width: 100%;
  }

  .app-shell .section-command-actions {
    justify-content: flex-start;
  }

  .app-shell .site-settings-nav {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
    overflow: visible;
    width: 100%;
  }

  .app-shell .site-settings-nav-group {
    display: contents;
  }

  .app-shell .site-settings-nav button {
    min-width: 0;
    width: 100%;
  }

  .app-shell .site-settings-nav button {
    min-height: 40px;
  }

  .app-shell .site-settings-nav button.active {
    box-shadow: none;
  }

  .app-shell .site-builder-intro {
    align-items: flex-start;
    padding: 16px;
  }

  .app-shell .site-builder-status {
    flex-wrap: wrap;
  }

  .pro-summary-strip > div {
    flex-basis: 170px;
  }
}

@media (max-width: 520px) {
  .app-shell .section-command-actions > .button {
    max-width: calc(100vw - 110px);
  }

  .app-shell .site-builder-intro {
    gap: 12px;
  }

  .pro-summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
  }

  .pro-summary-strip > div {
    min-height: 64px;
    padding: 10px 12px;
  }

  .pro-summary-strip > div:nth-child(odd) {
    border-left: 0;
  }

  .pro-summary-strip > div:nth-child(n + 3) {
    border-top: 1px solid var(--pro-line);
  }

  .pro-summary-strip dd {
    font-size: 19px;
    margin-left: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell *,
  .app-shell *::before,
  .app-shell *::after {
    scroll-behavior: auto !important;
  }
}
