/* PlanningTS — shell (D2) : sidebar fixe, barre du haut, fond lavande, panneau blanc, tiroir mobile. */

/* ---------- Composants de base du shell ---------- */
.icon { flex: none; width: 1.5rem; height: 1.5rem; }

.mascot { display: block; width: 100%; height: auto; }
.mascot__body { fill: var(--mascot, var(--mascot-orange)); }
.mascot--orange { --mascot: var(--mascot-orange); }
.mascot--green { --mascot: var(--mascot-green); }
.mascot--blue { --mascot: var(--mascot-blue); }
.mascot--pink { --mascot: var(--mascot-pink); }

.avatar { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--avatar-1); color: var(--color-ink); font-weight: 800; font-size: .8rem; letter-spacing: .02em; }
.avatar--lg { width: 46px; height: 46px; font-size: .95rem; }
.avatar--1 { background: var(--avatar-1); } .avatar--2 { background: var(--avatar-2); } .avatar--3 { background: var(--avatar-3); }
.avatar--4 { background: var(--avatar-4); } .avatar--5 { background: var(--avatar-5); } .avatar--6 { background: var(--avatar-6); }

.icon-btn { position: relative; display: inline-grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-soft); cursor: pointer; text-decoration: none; transition: transform var(--dur) var(--ease); }
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn__dot { position: absolute; top: 11px; right: 12px; width: 11px; height: 11px; border-radius: 50%; background: var(--color-badge); border: 2px solid var(--color-surface); }

/* ---------- Bandeau du mode démo ---------- */
:root { --demo-bar-height: 0px; }
.is-demo { --demo-bar-height: 46px; }
.demo-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: var(--demo-bar-height); display: flex; align-items: center; justify-content: center; gap: 18px; padding: 0 16px; background: var(--color-danger); color: #fff; font-size: .95rem; }
.demo-bar__text { margin: 0; line-height: 1.25; text-align: center; }
.demo-bar__text strong { font-weight: 800; letter-spacing: .04em; }
.demo-bar form { margin: 0; flex: none; }
.demo-bar__btn { min-height: 32px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: #fff; color: #b42318; font: inherit; font-weight: 800; cursor: pointer; transition: transform var(--dur) var(--ease); }
.demo-bar__btn:hover { transform: translateY(-1px); }
.demo-bar__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px #7a271a; }

/* ---------- Disposition ---------- */
.shell { padding-top: var(--demo-bar-height); min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.shell__body { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; height: var(--topbar-height); padding: 0 16px 0 8px; flex: none; }
.topbar__spacer { flex: 1; }
.topbar__menu { display: none; }
.org-pill { display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-soft); font-weight: 700; font-size: .95rem; }
.org-pill .icon { width: 1.3rem; height: 1.3rem; }
.page { flex: 1; min-width: 0; margin: 0 16px 16px 8px; padding: var(--page-pad) calc(var(--page-pad) + 4px) calc(var(--page-pad) + 4px); background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-soft); }
.page > .messages { margin-bottom: var(--space-4); }

/* ---------- Sidebar ---------- */
.sidebar { position: fixed; top: var(--demo-bar-height); bottom: 0; left: 0; z-index: 30; width: var(--sidebar-width); display: flex; flex-direction: column; padding-bottom: 58px; background: var(--color-sidebar); color: var(--color-sidebar-text); border-radius: 0 var(--radius-xl) var(--radius-xl) 0; overflow: hidden; }
.sidebar__scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 22px 14px 12px; overflow-y: auto; overscroll-behavior: contain; }   /* seule cette zone défile ; le nuage du bas reste libre */
.sidebar::after { content: ""; position: absolute; z-index: 0; left: 0; right: 0; bottom: 0; height: 58px; pointer-events: none;   /* nuage décoratif, sans texte dessus */
  background: radial-gradient(circle at 34px 62px, var(--color-lime) 0 40px, transparent 41px), radial-gradient(circle at 100px 74px, var(--color-lime) 0 46px, transparent 47px), radial-gradient(circle at 170px 66px, var(--color-lime) 0 38px, transparent 39px); }
.sidebar :focus-visible { outline-color: var(--color-lime); }
.brand { display: grid; justify-items: center; text-align: center; gap: 6px; margin-bottom: 22px; }
.brand .mascot { width: 84px; }
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: 1.75rem; letter-spacing: -.02em; color: #fff; line-height: 1.1; }
.brand__tag { font-size: .8rem; color: var(--color-sidebar-muted); line-height: 1.3; }
.brand--solo { margin: 1.5rem 0 1.25rem; }
.brand--solo .mascot { width: 72px; }
.brand--solo .brand__name { color: var(--color-ink); }
.brand--solo .brand__tag { color: var(--color-muted); }

.sidebar__nav { flex: 1 0 auto; }   /* ne se compresse jamais : la zone défile si l'écran est trop court */
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px; border: 0; border-radius: 18px; background: transparent; color: var(--color-sidebar-text); font: inherit; font-weight: 650; font-size: .97rem; line-height: 1.2; text-align: left; text-decoration: none; cursor: pointer; transition: background var(--dur) var(--ease), transform var(--dur) var(--ease); }
a.nav-item:hover, .nav-item--button:hover { background: var(--color-sidebar-hover); }
.nav-item[aria-current="page"] { background: var(--color-lime); color: var(--color-ink); font-weight: 800; }
.nav-item--soon { opacity: .62; cursor: default; }
.nav-item__soon { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-item__badge { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: var(--radius-pill); background: var(--color-badge); color: #fff; font-size: .78rem; font-weight: 800; }

.sidebar__footer { display: grid; gap: 8px; margin-top: auto; padding-top: 14px; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 6px 8px; }
.user-card__text { display: grid; line-height: 1.25; min-width: 0; }
.user-card__text strong { color: #fff; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card__text span { color: var(--color-sidebar-muted); font-size: .82rem; }
.org-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .1); font-weight: 650; font-size: .88rem; line-height: 1.25; }
.org-card .icon { width: 1.35rem; height: 1.35rem; }

/* Écrans peu hauts : on resserre pour que tout reste visible sans défiler */
@media (max-height: 860px) {
  .brand { margin-bottom: 12px; gap: 2px; }
  .brand .mascot { width: 62px; }
  .brand__name { font-size: 1.5rem; }
  .brand__tag { display: none; }
  .nav { gap: 2px; }
  .nav-item { padding-block: 9px; }
  .sidebar__footer { gap: 6px; padding-top: 10px; }
  .org-card { padding: 9px 12px; }
}

/* ---------- Pages sans menu (connexion, mot de passe) ---------- */
.solo { max-width: 28rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
.solo .card { margin-top: 1rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }

/* ---------- Page Paramètres ---------- */
.settings-links { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--space-4); }
.settings-link { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: var(--radius-lg); background: var(--kpi-blue); color: var(--color-ink); text-decoration: none; transition: transform var(--dur) var(--ease); }
.settings-link:hover { transform: translateY(-1px); }
.settings-link--off { opacity: .6; cursor: default; }
.settings-link--off:hover { transform: none; }
.settings-link--demo { align-items: flex-start; background: var(--kpi-yellow); }
.settings-link--demo:hover { transform: none; }
.settings-link__body p { margin: .35rem 0 .9rem; }
.settings-link__body form { margin: 0; }
.settings-link__icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .7); }

/* ---------- Tablette (768–1099 px) : rail d'icônes ---------- */
@media (min-width: 768px) and (max-width: 1099px) {
  :root { --sidebar-width: 84px; }
  .sidebar__scroll { padding-inline: 10px; }
  .brand__name, .brand__tag, .user-card__text, .org-card, .nav-item__soon { display: none; }
  .brand .mascot { width: 54px; }
  .nav-item { justify-content: center; padding: 12px 0; position: relative; }
  .nav-item__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-item__badge { position: absolute; top: 3px; right: 10px; min-width: 20px; height: 20px; font-size: .7rem; margin: 0; }
  .user-card { justify-content: center; padding: 0; }
  .org-pill span { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { padding: 22px; }
}

/* ---------- Mobile (< 768 px) : menu en tiroir ---------- */
@media (max-width: 767px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell__body { grid-column: 1; }
  .sidebar { width: min(84vw, 300px); transform: translateX(-105%); visibility: hidden; transition: transform 220ms var(--ease), visibility 0s linear 220ms; box-shadow: var(--shadow-pop); }
  .sidebar.is-open { transform: none; visibility: visible; transition-delay: 0s; }
  .shell__backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(17, 19, 24, .45); }
  .shell__backdrop[hidden] { display: none; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-height) + env(safe-area-inset-top)); }
  .is-demo { --demo-bar-height: 52px; }
  .is-demo .topbar { padding-top: 0; height: var(--topbar-height); }
  .demo-bar { gap: 10px; padding: 0 10px; font-size: .85rem; }
  .demo-bar__sub { display: none; }
  .demo-bar__btn { padding: 0 12px; font-size: .85rem; }
  .topbar__menu { display: inline-grid; }
  .org-pill { display: none; }
  .page { margin: 0 8px 8px; padding: 18px 16px 24px; border-radius: var(--radius-lg); }
}
