/* ==========================================================
   WeddingPart — Shell SaaS centralisé (App Outils)
   --------------------------------------------------------
   Calque visuel cohérent avec front-page :
     • Sidebar gauche rétractable (desktop)
     • Barre fixe bas (mobile)
     • Panneau full-screen "Tous les outils" (canva)
     • Workspace full-width pour le contenu de chaque outil
     • Boutons de fermeture présents partout
   Tokens : utilise les variables --wp-* de base.css (chargé en
   amont). Mobile first.
   ========================================================== */

/* ----------------------------------------------------------
   Alias internes — appui sur la palette globale WeddingPart
   ---------------------------------------------------------- */
:root {
  --app-bg:              var(--wp-bg);
  --app-surface:         var(--wp-surface);
  --app-surface-2:       var(--wp-surface-2);
  --app-surface-3:       var(--wp-surface-3);
  --app-line:            var(--wp-line);
  --app-line-strong:     var(--wp-line-strong);
  --app-ink:             var(--wp-ink);
  --app-soft:            var(--wp-soft);
  --app-muted:           var(--wp-muted);
  --app-brand:           var(--wp-brand);
  --app-brand-dark:      var(--wp-brand-dark);
  --app-brand-light:     var(--wp-brand-light);
  --app-brand-soft:      var(--wp-brand-soft);
  --app-brand-border:    var(--wp-brand-border);
  --app-gold:            var(--wp-gold);
  --app-gold-dark:       var(--wp-gold-dark);
  --app-gold-light:      var(--wp-gold-light);

  /* Dimensions shell */
  --app-header-h:        var(--header-h);
  --app-sidebar-w:       260px;
  --app-sidebar-w-mini:  74px;
  --app-bottom-h:        66px;
  --app-radius:          var(--radius-md);
  --app-radius-lg:       var(--radius-lg);
  --app-z-header:        var(--z-header);
  --app-z-sidebar:       var(--z-sticky);
  --app-z-bottom:        var(--z-sticky);
  --app-z-backdrop:      var(--z-overlay);
  --app-z-panel:         var(--z-modal);

  /* Compensation barre admin WP */
  --app-adminbar-h:      0px;
}
body.admin-bar { --app-adminbar-h: 32px; }
@media (max-width: 782px) {
  body.admin-bar { --app-adminbar-h: 46px; }
}

/* ----------------------------------------------------------
   Body app — fond, typo, polices
   ---------------------------------------------------------- */
body.idd-tools-body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--app-ink);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.idd-tools-body * { box-sizing: border-box; }

/* lock scroll when overlay open — desactive : le scroll-lock est maintenant
   centralise via header.js (window.__wpScrollLock + classes html.nav-lock /
   body.nav-lock) pour eviter les conflits entre plusieurs systemes ouverts
   simultanement (burger + panel + modale). Gardé en backup si JS désactivé. */
body.idd-tools-body.is-panel-open:not(.nav-lock),
body.idd-tools-body.is-drawer-open:not(.nav-lock) { overflow: hidden; }

/* La barre admin WP reste fixe par défaut */
#wpadminbar { position: fixed !important; top: 0 !important; }

/* ==========================================================
   APP FRAME — grid sidebar + main (desktop)
   ========================================================== */
.app-frame {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(800px 380px at 100% -10%, var(--app-brand-soft), transparent 60%),
    radial-gradient(680px 320px at -10% 110%, rgba(201,168,124,.10), transparent 60%),
    linear-gradient(180deg, var(--app-surface) 0%, var(--app-bg) 40%, var(--app-surface-2) 100%);
}

/* ==========================================================
   HEADER
   ========================================================== */
.app-header {
  position: sticky;
  top: var(--app-adminbar-h);
  z-index: var(--app-z-header);
  height: var(--app-header-h);
  display: flex;
  align-items: center;
  gap: 10px; /* TODO: tokenize — entre space-2 et space-3 */
  padding: 0 14px; /* TODO: tokenize — 14px hors scale */
  background: rgba(255,255,255,.85); /* TODO: tokenize — surface avec opacité */
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--app-line);
}

.app-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.app-header__logo {
  width: 38px; height: 38px;
  border-radius: 12px; /* TODO: tokenize — entre radius-sm et radius-md */
  background: var(--app-brand-soft);
  border: 1px solid var(--app-brand-border);
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8); /* TODO: tokenize — inset highlight */
}
.app-header__logo img { width: 100%; height: 100%; object-fit: contain; }
.app-header__logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}
.app-header__logo-mark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--app-brand-dark);
  letter-spacing: .04em;
}
.app-header__brand-text {
  display: flex; flex-direction: column;
  line-height: 1.1; min-width: 0;
}
.app-header__brand-name {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--app-ink);
  letter-spacing: -.01em;
}
.app-header__brand-tag {
  font-size: 11px; /* TODO: tokenize — sous text-xs */
  color: var(--app-muted);
  font-weight: 500;
}

/* Titre outil courant — caché mobile, visible desktop */
.app-header__current {
  display: none;
  margin-left: 14px; /* TODO: tokenize — 14px hors scale */
  padding-left: 14px;
  border-left: 1px solid var(--app-line);
  min-width: 0;
  max-width: 320px; /* TODO: tokenize — max-width titre */
}
.app-header__current-eyebrow {
  display: block;
  font-size: 10px; /* TODO: tokenize — sous text-xs */
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--app-muted);
  line-height: 1;
}
.app-header__current-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 17px; /* TODO: tokenize — entre text-base et text-lg */
  font-weight: 700;
  color: var(--app-ink);
  line-height: 1.2;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right actions */
.app-header__spacer { flex: 1; }
.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Bouton générique icône (header / sidebar / overlay) */
.app-iconbtn {
  --size: 42px;
  width: var(--size); height: var(--size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--app-line);
  border-radius: 12px; /* TODO: tokenize — entre radius-sm et radius-md */
  background: var(--app-surface);
  color: var(--app-ink);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              color var(--duration) var(--ease);
  padding: 0;
  text-decoration: none;
}
.app-iconbtn:hover {
  background: var(--app-brand-soft);
  border-color: var(--app-brand-border);
  color: var(--app-brand-dark);
}
.app-iconbtn:active { transform: scale(.96); }
.app-iconbtn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.app-iconbtn--sm { --size: 36px; }
.app-iconbtn--sm svg { width: 18px; height: 18px; }
.app-iconbtn--ghost {
  background: transparent;
  border-color: transparent;
}
.app-iconbtn--ghost:hover {
  background: var(--app-brand-soft);
  border-color: var(--app-brand-border);
}

/* Tap target WCAG 2.5.5 sur mobile : 44x44 garanti.
   En desktop on garde la densité 42/36 pour la barre d'outils. */
@media (max-width: 768px) {
  .app-iconbtn { --size: var(--tap-target, 44px); }
  .app-iconbtn--sm { --size: var(--tap-target, 44px); }
  .app-header__tools-btn { height: var(--tap-target, 44px); }
  .app-header__account { height: var(--tap-target, 44px); }
}

/* Bouton "Tous les outils" du header */
.app-header__tools-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 42px;
  padding: 0 14px; /* TODO: tokenize — 14px hors scale */
  border: 1px solid var(--app-brand-border);
  background: var(--app-brand-soft);
  color: var(--app-brand-dark);
  border-radius: 12px; /* TODO: tokenize — entre radius-sm et radius-md */
  font-family: var(--font-sans);
  font-size: 13px; /* TODO: tokenize — entre text-xs et text-sm */
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}
.app-header__tools-btn:hover {
  background: var(--app-brand);
  color: var(--wp-surface);
  border-color: var(--app-brand);
  box-shadow: var(--shadow-brand);
}
.app-header__tools-btn svg { width: 18px; height: 18px; }
.app-header__tools-btn .app-header__tools-label { display: none; }
@media (min-width: 640px) {
  .app-header__tools-btn .app-header__tools-label { display: inline; }
}

/* Avatar / compte */
.app-header__account {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 42px;
  padding: 0 6px 0 14px; /* TODO: tokenize — padding asymétrique */
  border-radius: 12px; /* TODO: tokenize — entre radius-sm et radius-md */
  border: 1px solid var(--app-line);
  background: var(--app-surface);
  text-decoration: none;
  color: var(--app-ink);
  font-size: 13px; /* TODO: tokenize — entre text-xs et text-sm */
  font-weight: 600;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.app-header__account:hover {
  background: var(--app-brand-soft);
  border-color: var(--app-brand-border);
}
.app-header__account-avatar {
  width: 30px; height: 30px;
  border-radius: var(--radius-full);
  background: var(--app-brand);
  color: var(--wp-surface);
  display: grid; place-items: center;
  font-size: 13px; /* TODO: tokenize — entre text-xs et text-sm */
  font-weight: 700;
  font-family: var(--font-serif);
  flex-shrink: 0;
}
/* Photo de profil (au lieu de l'initiale) — même logique que le header du site. */
.app-header__account-avatar.has-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
}
.app-header__account-name {
  display: none;
  max-width: 130px; /* TODO: tokenize — max-width name */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 768px) {
  .app-header__account { padding-right: 14px; padding-left: 6px; }
  .app-header__account-name { display: inline; }
}

/* Raccourci wp-admin (admins uniquement) — bouton icône carré,
   même gabarit que les autres actions du header (42x42, radius 12). */
.app-header__wpadmin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--app-line);
  background: var(--app-surface);
  color: var(--app-ink);
  text-decoration: none;
  flex-shrink: 0;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              transform .15s ease;
}
.app-header__wpadmin svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}
.app-header__wpadmin:hover,
.app-header__wpadmin:focus-visible {
  background: var(--app-brand-soft);
  border-color: var(--app-brand-border);
  color: var(--app-brand-dark);
  outline: none;
}
.app-header__wpadmin:active { transform: scale(.96); }
@media (max-width: 768px) {
  .app-header__wpadmin { width: 44px; height: 44px; }
}

/* Burger de sidebar desktop */
.app-header__menu-toggle {
  display: none;
}
@media (min-width: 1024px) {
  .app-header__menu-toggle { display: inline-flex; }
}

/* Affichage du titre courant : desktop */
@media (min-width: 768px) {
  .app-header__current { display: block; }
}

/* ==========================================================
   SIDEBAR (desktop)
   ========================================================== */
.app-sidebar {
  display: none;
  position: fixed;
  top: calc(var(--app-adminbar-h) + var(--app-header-h));
  bottom: 0;
  left: 0;
  width: var(--app-sidebar-w);
  background: var(--app-surface);
  border-right: 1px solid var(--app-line);
  z-index: var(--app-z-sidebar);
  flex-direction: column;
  transition: width var(--duration-lg) var(--ease);
  overflow: hidden;
}

@media (min-width: 1024px) {
  .app-sidebar { display: flex; }
}

/* Mini mode (sidebar rétractée — icônes seules) */
body.is-sidebar-mini .app-sidebar { width: var(--app-sidebar-w-mini); }
body.is-sidebar-mini .app-sidebar__group-label { opacity: 0; pointer-events: none; }
body.is-sidebar-mini .app-sidebar__item-label,
body.is-sidebar-mini .app-sidebar__group-toggle { opacity: 0; pointer-events: none; visibility: hidden; }
body.is-sidebar-mini .app-sidebar__group { padding-block: 4px; }
body.is-sidebar-mini .app-sidebar__group-head { padding: 4px 12px; min-height: 22px; }
body.is-sidebar-mini .app-sidebar__item {
  justify-content: center;
  padding: 10px;
  gap: 0;
}
body.is-sidebar-mini .app-sidebar__item-gold { display: none; }
body.is-sidebar-mini .app-sidebar__footer-text { display: none; }

/* Sidebar inner scroll */
.app-sidebar__inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px; /* TODO: tokenize — padding inner */
  scrollbar-width: thin;
  scrollbar-color: var(--app-line-strong) transparent;
}
.app-sidebar__inner::-webkit-scrollbar { width: 6px; }
.app-sidebar__inner::-webkit-scrollbar-thumb { background: var(--app-line-strong); border-radius: 4px; }

/* Groupes */
.app-sidebar__group { padding: 6px 0 10px; }
.app-sidebar__group + .app-sidebar__group { border-top: 1px dashed var(--app-line); padding-top: 14px; margin-top: var(--space-2); }
.app-sidebar__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 8px; /* TODO: tokenize — padding head */
  min-height: 26px;
}
.app-sidebar__group-label {
  font-size: 10px; /* TODO: tokenize — sous text-xs */
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--app-muted);
  transition: opacity var(--duration) var(--ease);
  white-space: nowrap;
}

.app-sidebar__list { display: flex; flex-direction: column; gap: 2px; }

.app-sidebar__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px; /* TODO: tokenize — 10/12px hors scale */
  border-radius: 12px; /* TODO: tokenize — entre radius-sm et radius-md */
  text-decoration: none;
  color: var(--app-soft);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
  white-space: nowrap;
}
.app-sidebar__item:hover {
  background: var(--app-brand-soft);
  color: var(--app-brand-dark);
}
.app-sidebar__item-icon {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  color: var(--app-muted);
  flex-shrink: 0;
}
.app-sidebar__item-icon svg { width: 20px; height: 20px; stroke-width: 1.7; }
.app-sidebar__item:hover .app-sidebar__item-icon { color: var(--app-brand); }
.app-sidebar__item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--duration) var(--ease);
}
.app-sidebar__item-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  background: var(--app-gold-light);
  color: var(--app-gold-dark);
  border-radius: var(--radius-full);
  font-size: 9px; /* libellé court type "Gold" */
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Item actif */
.app-sidebar__item.is-active,
.app-sidebar__item[aria-current="page"] {
  background: var(--app-brand);
  color: var(--wp-surface);
  box-shadow: var(--shadow-brand);
}
.app-sidebar__item.is-active .app-sidebar__item-icon,
.app-sidebar__item[aria-current="page"] .app-sidebar__item-icon { color: var(--wp-surface); }
.app-sidebar__item.is-active .app-sidebar__item-gold,
.app-sidebar__item[aria-current="page"] .app-sidebar__item-gold {
  background: rgba(255,255,255,.22); /* TODO: tokenize — surface sur brand */
  color: var(--wp-surface);
}

/* Tooltip sur item lorsque sidebar mini (desktop) */
body.is-sidebar-mini .app-sidebar__item { position: relative; }
body.is-sidebar-mini .app-sidebar__item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--app-ink);
  color: var(--wp-surface);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 6px 10px; /* TODO: tokenize — padding tooltip */
  border-radius: 8px; /* TODO: tokenize — entre radius-xs et radius-sm */
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
  z-index: var(--z-modal);
  box-shadow: var(--shadow-md);
}
body.is-sidebar-mini .app-sidebar__item:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Footer sidebar (Mon abonnement / mon compte / retour site) */
.app-sidebar__footer {
  padding: 12px 10px; /* TODO: tokenize — padding footer */
  border-top: 1px solid var(--app-line);
  display: flex;
  flex-direction: column;
  gap: 6px; /* TODO: tokenize — entre space-1 et space-2 */
  flex-shrink: 0;
}
.app-sidebar__footer-text {
  font-size: 11px; /* TODO: tokenize — sous text-xs */
  color: var(--app-muted);
  padding: 0 12px 4px;
  line-height: 1.4;
}

/* ==========================================================
   MAIN (workspace)
   ========================================================== */
.app-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--app-adminbar-h));
  min-height: calc(100dvh - var(--app-adminbar-h));
  padding-bottom: calc(var(--app-bottom-h) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 1024px) {
  .app-main {
    margin-left: var(--app-sidebar-w);
    transition: margin-left var(--duration-lg) var(--ease);
    /* La idd-shell-bar (~67px) reste visible en bas même sur desktop pour
       exposer les actions par outil. On garde le même offset bottom qu'en
       mobile pour que le contenu ne soit pas masqué. */
    padding-bottom: calc(var(--app-bottom-h) + env(safe-area-inset-bottom, 0px) + var(--space-4));
  }
}
body.is-sidebar-mini .app-main { margin-left: var(--app-sidebar-w-mini); }

/* Workspace : conteneur du contenu d'outil, full width
   (chaque outil garde la possibilité de se contraindre via son
   propre max-width interne) */
.app-workspace {
  flex: 1;
  padding: clamp(16px, 3vw, 28px) clamp(14px, 3vw, 32px);
  width: 100%;
  max-width: 100%;
}
.app-workspace__inner {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
}

/* ==========================================================
   BOTTOM NAV (mobile)
   ========================================================== */
.app-bottomnav {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: var(--app-z-bottom);
  background: rgba(255,255,255,.96); /* TODO: tokenize — surface avec opacité */
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--app-line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px; /* TODO: tokenize — entre space-1 et space-2 */
}
@media (min-width: 1024px) {
  .app-bottomnav { display: none; }
}
.app-bottomnav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px; /* TODO: tokenize — entre space-1 et space-2 */
  height: 54px; /* TODO: tokenize — height bottomnav item */
  border-radius: 12px; /* TODO: tokenize — entre radius-sm et radius-md */
  text-decoration: none;
  color: var(--app-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
  font-family: var(--font-sans);
  padding: 4px 2px; /* TODO: tokenize — padding compact */
}
.app-bottomnav__item:hover,
.app-bottomnav__item:focus-visible { background: var(--app-brand-soft); color: var(--app-brand-dark); outline: none; }
.app-bottomnav__item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.app-bottomnav__item-label {
  font-size: 10.5px; /* TODO: tokenize — sous text-xs */
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1;
}
.app-bottomnav__item.is-active {
  color: var(--app-brand-dark);
  background: var(--app-brand-soft);
}
.app-bottomnav__item.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 28px; height: 3px;
  background: var(--app-brand);
  border-radius: 0 0 4px 4px;
}
.app-bottomnav__item { position: relative; }

/* ==========================================================
   TOOLS PANEL (canva full écran)
   ========================================================== */
.app-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29,24,25,.55); /* TODO: tokenize — ink overlay */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--app-z-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-lg) var(--ease), visibility var(--duration-lg) var(--ease);
}
body.is-panel-open .app-panel-backdrop {
  opacity: 1;
  visibility: visible;
}

.app-panel {
  position: fixed;
  inset: 0;
  top: var(--app-adminbar-h);
  background: var(--app-bg);
  z-index: var(--app-z-panel);
  display: flex;
  flex-direction: column;
  transform: translateY(40px) scale(.985);
  opacity: 0;
  visibility: hidden;
  transition: transform var(--duration-lg) var(--ease),
              opacity var(--duration-lg) var(--ease),
              visibility var(--duration-lg) var(--ease);
  overflow: hidden;
}
body.is-panel-open .app-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Panel header */
.app-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px; /* TODO: tokenize — padding header */
  border-bottom: 1px solid var(--app-line);
  background: var(--app-surface);
  flex-shrink: 0;
}
.app-panel__title-block {
  display: flex; flex-direction: column;
  gap: 4px; min-width: 0;
}
.app-panel__eyebrow {
  font-size: 10px; /* TODO: tokenize — sous text-xs */
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--app-brand);
  line-height: 1;
}
.app-panel__title {
  font-family: var(--font-serif);
  font-size: clamp(22px, 4vw, 30px); /* TODO: tokenize — clamp typo title */
  font-weight: 700;
  color: var(--app-ink);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -.01em;
}

/* Panel body — grid des outils */
.app-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: clamp(16px, 3vw, 28px);
  background:
    radial-gradient(900px 460px at 0% 0%, var(--app-brand-soft), transparent 65%),
    radial-gradient(700px 380px at 100% 100%, rgba(201,168,124,.10), transparent 60%),
    var(--app-bg);
}
.app-panel__group { margin-bottom: clamp(18px, 3vw, 30px); }
.app-panel__group-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--app-ink);
  margin: 0 0 var(--space-3);
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 10px; /* TODO: tokenize — entre space-2 et space-3 */
}
.app-panel__group-title::before {
  content: '';
  width: 22px; height: 2px;
  background: var(--app-brand);
  border-radius: 2px; /* TODO: tokenize — radius très fin */
}

.app-panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); /* TODO: tokenize — card min-width */
  gap: var(--space-3);
}
@media (min-width: 640px) {
  .app-panel__grid { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } /* TODO: tokenize — gap+min */
}

/* Carte outil dans le panel */
.app-toolcard {
  position: relative;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 18px; /* TODO: tokenize — entre radius-md et radius-lg */
  padding: var(--space-4);
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  transition: transform var(--duration-lg) var(--ease),
              box-shadow var(--duration-lg) var(--ease),
              border-color var(--duration) var(--ease);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.app-toolcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--app-brand-soft) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-lg) var(--ease);
}
.app-toolcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--app-brand-border);
}
.app-toolcard:hover::before { opacity: 1; }
.app-toolcard.is-active {
  border-color: var(--app-brand);
  box-shadow: var(--shadow-brand);
}
.app-toolcard__icon {
  width: 46px; height: 46px;
  border-radius: 14px; /* TODO: tokenize — entre radius-sm et radius-md */
  background: var(--app-brand-soft);
  border: 1px solid var(--app-brand-border);
  color: var(--app-brand-dark);
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.app-toolcard__icon svg { width: 22px; height: 22px; stroke-width: 1.8; }
.app-toolcard__body {
  flex: 1; min-width: 0;
  position: relative;
  z-index: 1;
}
.app-toolcard__title {
  font-family: var(--font-serif);
  font-size: 17px; /* TODO: tokenize — entre text-base et text-lg */
  font-weight: 700;
  color: var(--app-ink);
  margin: 0 0 4px;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.app-toolcard__desc {
  font-size: 12.5px; /* TODO: tokenize — sous text-sm */
  color: var(--app-soft);
  line-height: 1.5;
  margin: 0;
}
.app-toolcard__badge {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 9px; /* TODO: tokenize — très petit */
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  background: var(--app-gold-light);
  color: var(--app-gold-dark);
  z-index: 2;
}
.app-toolcard__badge--free {
  background: #E8F5E9; /* TODO: tokenize — success-light */
  color: #2E7D32; /* TODO: tokenize — success-dark */
}

/* Footer du panel (CTA / retour) */
.app-panel__footer {
  padding: 14px 16px; /* TODO: tokenize — padding footer */
  border-top: 1px solid var(--app-line);
  background: var(--app-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px; /* TODO: tokenize — entre space-2 et space-3 */
  flex-wrap: wrap;
  flex-shrink: 0;
}
.app-panel__footer-info {
  font-size: 12.5px; /* TODO: tokenize — sous text-sm */
  color: var(--app-soft);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.app-panel__footer-info svg { width: 16px; height: 16px; color: var(--app-brand); }

/* ==========================================================
   FORME 100% native pour le contenu intérieur d'un outil :
   on s'assure que .idd-tools-workspace (qu'on garde pour compat)
   et le contenu pris en charge (.entry-content, le.post-x, etc.)
   prennent toute la largeur.
   ========================================================== */
.app-workspace .idd-tools-workspace { width: 100%; }
.app-workspace .idd-tools-workspace__inner {
  max-width: var(--container-wide);
  margin-inline: auto;
}

/* ==========================================================
   BURGER (animation 3 lignes -> croix)
   ========================================================== */
.app-burger {
  position: relative;
  width: 22px; height: 22px;
}
.app-burger span {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px; /* TODO: tokenize — radius très fin */
  transition: transform var(--duration-lg) var(--ease),
              opacity var(--duration) var(--ease),
              top var(--duration-lg) var(--ease);
}
.app-burger span:nth-child(1) { top: 4px; }
.app-burger span:nth-child(2) { top: 10px; }
.app-burger span:nth-child(3) { top: 16px; }

.app-iconbtn[aria-expanded="true"] .app-burger span:nth-child(1) { top: 10px; transform: rotate(45deg); }
.app-iconbtn[aria-expanded="true"] .app-burger span:nth-child(2) { opacity: 0; }
.app-iconbtn[aria-expanded="true"] .app-burger span:nth-child(3) { top: 10px; transform: rotate(-45deg); }

/* ==========================================================
   GATE & messages connexion (placeholder pour outils non connectés)
   ========================================================== */
.idd-tdb-login-required,
.idd-abo-gate-message {
  max-width: 540px; /* TODO: tokenize — max-width message */
  margin: var(--space-10) auto;
  padding: 28px; /* TODO: tokenize — entre space-6 et space-8 */
  text-align: center;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--shadow-sm);
  font-size: 15px; /* TODO: tokenize — entre text-sm et text-base */
  color: var(--app-soft);
}

/* ==========================================================
   PETITS UTILITAIRES (réutilisables outils)
   ========================================================== */
.app-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.app-row   { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

.app-section-title {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3.5vw, 30px); /* TODO: tokenize — clamp typo title */
  font-weight: 700;
  color: var(--app-ink);
  letter-spacing: -.01em;
  margin: 0 0 var(--space-4);
}
.app-section-lead {
  color: var(--app-soft);
  font-size: 15px; /* TODO: tokenize — entre text-sm et text-base */
  line-height: 1.65;
  max-width: 64ch;
}

/* ==========================================================
   COMPAT — Anciennes classes idd-tools-* utilisées par PHP/CSS
   On les masque/neutralise pour qu'elles n'apparaissent plus
   ========================================================== */
.idd-tools-topbar,
.idd-tools-drawer,
.idd-tools-drawer-backdrop,
.idd-tools-burger,
.idd-tools-current { display: none !important; }

/* L'ancien wrapper .idd-tools-app et son padding global sont gérés
   par le nouveau shell : on l'utilise désormais comme alias de
   .app-frame mais on le neutralise visuellement. */
.idd-tools-app { all: unset; display: block; min-height: 100vh; }
.idd-tools-main { display: block; width: 100%; }

/* ==========================================================
   HARMONISATION OUTILS — affine les hero internes des plugins
   pour qu'ils s'intègrent dans le workspace sans concurrencer
   le header SaaS qui affiche déjà le titre de l'outil.
   ========================================================== */

/* Tous les outils placés dans le workspace : suppression du
   margin-top excessif et limites de largeur pour profiter de
   la zone de travail full-width. */
.app-workspace__inner > .idd-tdb,
.app-workspace__inner > .idd-budget,
.app-workspace__inner > [id^="idd-"],
.app-workspace__inner > .wpz-tool,
.app-workspace__inner > .idd-presta {
  max-width: 1200px; /* TODO: tokenize — entre container et container-wide */
  margin-inline: auto;
  margin-top: 0;
}

/* Hero / header interne d'outil : réduit le poids pour que le
   bandeau supérieur du shell reste la référence visuelle. */
.app-workspace__inner .idd-tdb__hero,
.app-workspace__inner .idd-budget__header,
.app-workspace__inner .idd-presta__hero,
.app-workspace__inner .idd-mb__hero,
.app-workspace__inner .idd-rp__hero,
.app-workspace__inner .idd-li__hero,
.app-workspace__inner .idd-mt__hero,
.app-workspace__inner .idd-pdt__hero,
.app-workspace__inner .idd-pi__hero,
.app-workspace__inner .idd-lieu__hero,
.app-workspace__inner .idd-pl__hero,
.app-workspace__inner .idd-sm__hero {
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-line);
  box-shadow: var(--shadow-sm);
}

/* Boutons internes : préservent leur style, mais ajoutent une
   transition et un focus ring cohérent avec la home. */
.app-workspace__inner button:focus-visible,
.app-workspace__inner a:focus-visible {
  outline: 3px solid rgba(181,99,122,.30); /* TODO: tokenize — focus ring brand */
  outline-offset: 2px;
}

/* Les modals/drawers internes d'outils doivent passer SOUS le
   shell panel (z-index < 100) sauf cas spécifique. */
.app-workspace__inner [class*="modal"]:not(.app-panel),
.app-workspace__inner [class*="drawer"]:not(.app-panel) {
  z-index: 80; /* TODO: tokenize — sous app-z-panel */
}

/* Tables / grilles internes des outils : full width au sein du
   workspace, scroll horizontal si débordement. */
.app-workspace__inner table,
.app-workspace__inner .idd-budget__table,
.app-workspace__inner .idd-li__table,
.app-workspace__inner .idd-presta__table {
  width: 100%;
}
.app-workspace__inner .idd-table-wrap,
.app-workspace__inner .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================
   GATE — harmonisation visuelle complète
   ========================================================== */
.app-workspace__inner .idd-abo-gate {
  max-width: var(--container-narrow);
  margin: var(--space-8) auto 56px; /* TODO: tokenize — 56px hors scale (entre space-12 et space-16) */
}

/* ==========================================================
   PRINT — sortir la sidebar / barre bas / header pour le PDF
   ========================================================== */
@media print {
  .app-header, .app-sidebar, .app-bottomnav, .app-panel,
  .app-panel-backdrop, #wpadminbar { display: none !important; }
  .app-main { margin-left: 0 !important; padding-bottom: 0 !important; }
  .app-workspace { padding: 0 !important; }
  body.idd-tools-body { background: var(--wp-surface) !important; }
}

/* ==========================================================
   FOCUS RING accessibilité
   ========================================================== */
.app-iconbtn:focus-visible,
.app-header__account:focus-visible,
.app-header__tools-btn:focus-visible,
.app-sidebar__item:focus-visible,
.app-bottomnav__item:focus-visible,
.app-toolcard:focus-visible {
  outline: 3px solid rgba(181,99,122,.35); /* TODO: tokenize — focus ring brand */
  outline-offset: 2px;
}

/* ==========================================================
   ANIMATIONS — entrée discrète des cartes du panel
   ========================================================== */
@keyframes app-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.is-panel-open .app-toolcard {
  animation: app-fade-up .35s var(--ease) both;
}
body.is-panel-open .app-toolcard:nth-child(2) { animation-delay: .04s; }
body.is-panel-open .app-toolcard:nth-child(3) { animation-delay: .08s; }
body.is-panel-open .app-toolcard:nth-child(4) { animation-delay: .12s; }
body.is-panel-open .app-toolcard:nth-child(5) { animation-delay: .16s; }
body.is-panel-open .app-toolcard:nth-child(6) { animation-delay: .20s; }
body.is-panel-open .app-toolcard:nth-child(n+7) { animation-delay: .24s; }

/* ==========================================================
   Réduction de mouvement
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ==========================================================
   EN-TÊTE DES OUTILS — octobre 2026
   Le menu des outils tout à gauche (tiroir qui glisse depuis la gauche, liste verticale),
   le logo seul mis en valeur (bague qui se dessine, étoiles qui scintillent),
   à droite : notifications et compte (tiroir depuis la droite).
   ========================================================== */
.app-header__drawer-toggle { display: none; }
.app-header__brand-text { display: none; }
.app-header__logo {
  width: 46px; height: 46px;
  background: none; border: 0; box-shadow: none; overflow: visible;
  position: relative;
}
.app-header__logo::before {
  content: ''; position: absolute; inset: 2px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,183,196,.45) 0%, rgba(232,183,196,0) 70%);
  animation: app-logo-halo 5s ease-in-out 1.6s infinite;
}
.app-header__logo-img { position: relative; padding: 0; filter: drop-shadow(0 2px 5px rgba(158,77,100,.22)); }
.app-header__brand:hover .app-header__logo-img { transform: rotate(-6deg) scale(1.05); transition: transform .35s var(--ease, ease); }
@keyframes app-logo-halo { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .app-header__logo::before { animation: none; } }

@media (max-width: 1023px) {
  .app-header { gap: 6px; padding: 0 10px; }
  .app-header__drawer-toggle { display: inline-flex; margin-left: -4px; }
  .app-header__tools-btn, .app-header__wpadmin { display: none !important; }
  .app-header__account-name { display: none; }

  /* Tiroir des outils : glisse depuis la gauche, liste verticale qui défile */
  .app-panel {
    inset: 0 auto 0 0;
    top: var(--app-adminbar-h);
    width: min(86vw, 380px);
    border-radius: 0 22px 22px 0;
    box-shadow: 12px 0 40px rgba(29,24,25,.22);
    transform: translateX(-104%);
    opacity: 1;
  }
  body.is-panel-open .app-panel { transform: translateX(0); }
  .app-panel__header { padding: 14px 14px 12px 18px; }
  .app-panel__title { font-size: 22px; }
  .app-panel__body { padding: 12px 12px 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .app-panel__group { margin-bottom: 14px; }
  .app-panel__group-title { font-size: 15px; margin: 0 0 8px 4px; }
  .app-panel__grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .app-toolcard { align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; box-shadow: none; }
  .app-toolcard:hover { transform: none; box-shadow: none; }
  .app-toolcard.is-active { box-shadow: none; background: var(--app-brand-soft); }
  .app-toolcard__icon { width: 40px; height: 40px; border-radius: 12px; }
  .app-toolcard__icon svg { width: 20px; height: 20px; }
  .app-toolcard__title { font-size: 15.5px; margin: 0; }
  .app-toolcard__desc { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.35; margin-top: 2px; }
  .app-toolcard__badge { position: static; flex-shrink: 0; align-self: center; }
  .app-panel__footer { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .app-panel__footer-info { display: none; }
}

/* Logo jamais plus haut que l'en-tête ; photo du compte centrée dans son cadre (octobre 2026) */
.app-header__logo { width: 30px !important; height: 42px !important; max-height: calc(var(--app-header-h, 64px) - 20px); align-self: center; }
@media (max-width: 1023px) { .app-header__logo { width: 27px !important; height: 38px !important; } }
.app-header .app-header__logo .app-header__logo-img { width: 100% !important; height: 100% !important; max-width: none; object-fit: contain; }
@media (max-width: 767px) {
  .app-header__account { width: 46px; padding: 0; gap: 0; justify-content: center; }
  .app-header__account-avatar { width: 34px; height: 34px; }
}

/* Message « Téléchargement lancé » : vert clair, texte blanc, coche — en bas à droite (au-dessus de la barre des outils sur téléphone) */
.wp-dl-toast {
  position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 100200;
  display: flex; align-items: center; gap: 10px; max-width: min(360px, calc(100vw - 32px));
  padding: 11px 16px 11px 12px; border-radius: 14px;
  background: #5BBE83; color: #fff; box-shadow: 0 10px 28px rgba(30,90,55,.32);
  font-size: 14px; line-height: 1.3;
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.wp-dl-toast.is-on { opacity: 1; transform: translateY(0); }
.wp-dl-toast__check { flex: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.wp-dl-toast__check svg { width: 16px; height: 16px; }
.wp-dl-toast__text { display: flex; flex-direction: column; min-width: 0; }
.wp-dl-toast__text strong { font-weight: 700; }
.wp-dl-toast__name { font-size: 12.5px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-dl-toast__name:empty { display: none; }
@media (max-width: 1023px) { .wp-dl-toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { .wp-dl-toast { transition: none; } }

/* ==========================================================
   EN-TÊTE DES OUTILS — ordre des boutons (7 octobre 2026)
   Ordinateur : recherche, compte (photo puis nom), notifications, roue crantée (admins seulement).
   Téléphone et tablette : le nom « weddingpart » animé à droite de la bague ;
   à droite : recherche, notifications, compte.
   ========================================================== */
.app-header__wordmark { display: none; }

/* Loupe : bouton icône du thème (.app-iconbtn), même gabarit que la cloche et la roue crantée */
.app-header__search { flex-shrink: 0; }

@media (max-width: 1023px) {
  .app-header__brand { gap: 7px; }
  .app-header__wordmark {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    width: auto;
    height: 22px;
    object-fit: contain;
    object-position: left center;
  }
  .app-header__actions { gap: 6px; }
  .app-header__search { order: 1; }
  .app-header__actions .idd-bell { order: 2; }
  .app-header__account { order: 3; width: 46px; padding: 0; gap: 0; justify-content: center; }
}
