/* Responsive V2 — loaded last to normalize the client and admin interfaces. */
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  overflow-x: hidden;
}

img,
svg,
video,
iframe {
  max-width: 100%;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

/* ---------- Espace client : tablette ---------- */
@media (max-width: 1180px) {
  body > .client-header ~ main {
    width: 100%;
    max-width: 1040px;
    padding-inline: clamp(20px, 4vw, 42px);
  }

  .social-side-wall {
    display: none !important;
  }

  .client-header {
    height: 124px;
    padding: 0 clamp(20px, 4vw, 42px);
  }

  .client-header .brand {
    position: absolute;
    top: 12px;
    left: clamp(20px, 4vw, 42px);
  }

  .client-header .brand.client-brand-active {
    width: 160px;
    min-width: 0;
    height: 64px;
  }

  .client-header .brand.client-brand-active img {
    width: 150px;
    height: 60px;
  }

  .client-header .header-medal {
    display: block;
    top: 2px;
    width: 82px;
    height: 82px;
  }

  .client-header nav {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 0;
    height: 46px;
    margin: 0;
    transform: translateX(-50%);
  }

  .client-header nav > button {
    padding-inline: 11px;
    white-space: nowrap;
  }

  .client-header .notification-button {
    position: absolute;
    top: 22px;
    right: clamp(220px, 25vw, 285px);
    margin: 0;
  }

  .client-header .profile {
    position: absolute;
    top: 16px;
    right: clamp(70px, 9vw, 105px);
    max-width: 190px;
    margin: 0;
  }

  .client-header .profile > span:last-child {
    min-width: 0;
  }

  .client-header .profile b,
  .client-header .profile small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .client-header .signout-button {
    position: absolute;
    top: 22px;
    right: clamp(20px, 4vw, 42px);
  }

  .hero {
    align-items: stretch;
    padding: 32px;
  }

  .hero-copy {
    max-width: 45%;
  }

  .hero-partner-grid {
    width: 53%;
    grid-template-columns: minmax(150px, .85fr) minmax(210px, 1fr);
    gap: 14px;
  }

  .hero-jlcp-card img {
    width: 125px;
    height: 112px;
  }

  .profile-logo-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 34%);
  }

  .product-preview-dialog {
    width: min(960px, calc(100vw - 28px));
  }

  .preview-studio-layout {
    grid-template-columns: 112px minmax(350px, 1fr) 210px;
    gap: 14px;
  }

  /* Administration */
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .app-shell main {
    min-width: 0;
    padding-inline: 24px;
  }

  .topbar,
  .welcome-row,
  .section-head,
  .panel-head,
  .workspace-head {
    min-width: 0;
  }

  .demo-library,
  .communication-layout,
  .benefits-layout,
  .shop-layout,
  .reports-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Espace client : téléphone ---------- */
@media (max-width: 800px) {
  body::before,
  body::after {
    display: none !important;
  }

  body > .client-header ~ main {
    max-width: none;
    padding: 0 16px 42px;
  }

  .client-header {
    height: 76px;
    padding: 0 12px;
    gap: 8px;
  }

  .client-header::before,
  .client-header::after {
    height: 10px;
    width: 28vw;
  }

  .client-header .brand,
  .client-header .brand.client-brand-active {
    position: static;
    width: 108px;
    min-width: 96px;
    height: 54px;
  }

  .client-header .brand img,
  .client-header .brand.client-brand-active img {
    width: 104px;
    max-width: 104px;
    height: 50px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
  }

  .client-header .header-medal {
    display: block;
    top: 7px;
    width: 62px;
    height: 62px;
  }

  .client-header .header-socials,
  .client-header .signout-button,
  .client-header .profile > span:last-child {
    display: none;
  }

  .client-header .profile {
    position: static;
    width: 42px;
    height: 42px;
    margin: 0 0 0 auto;
    padding: 2px;
    border: 0;
    justify-content: center;
  }

  .client-header .profile .avatar {
    width: 36px;
    height: 36px;
  }

  .client-header .notification-button {
    position: static;
    width: 42px;
    height: 42px;
    margin: 0;
  }

  .client-header .mobile-menu {
    display: block;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #343434;
    border-radius: 10px;
    background: #171717;
    font-size: 22px;
  }

  .client-header nav {
    position: fixed;
    z-index: 30;
    top: 76px;
    left: 0;
    right: 0;
    bottom: auto;
    display: none;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 76px);
    margin: 0;
    padding: 10px 12px 18px;
    overflow-y: auto;
    transform: none;
    border-top: 1px solid #3b3017;
    background: #0d0d0d;
    box-shadow: 0 18px 38px #0008;
  }

  .client-header nav.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .client-header nav > button {
    min-height: 46px;
    padding: 12px 14px;
    text-align: left;
    border-radius: 8px;
    box-shadow: none;
  }

  .client-header nav > button.active {
    background: #211a0c;
    box-shadow: inset 3px 0 var(--gold);
  }

  .mobile-socials {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    display: block;
    min-height: 0;
    margin-top: 16px;
    padding: 25px 20px;
    border-radius: 16px;
  }

  .hero-copy {
    max-width: none;
  }

  .hero h1 {
    font-size: clamp(29px, 9vw, 38px);
    line-height: 1.03;
  }

  .hero-copy > p:not(.eyebrow) {
    margin-bottom: 19px;
  }

  .hero-copy .gold-button {
    width: 100%;
    min-height: 46px;
  }

  .hero-partner-grid {
    width: 100%;
    margin-top: 20px;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 10px;
  }

  .hero-partner-grid .contract-medallion {
    min-height: 0;
    margin: 0;
    padding: 15px;
  }

  .hero-jlcp-card {
    padding: 10px 6px;
  }

  .hero-jlcp-card img {
    width: 104px;
    height: 94px;
  }

  .hero-jlcp-card span {
    font-size: 11px;
  }

  .hero-jlcp-card b {
    font-size: 10px;
  }

  .contract-medallion > b {
    margin: 9px 0 2px;
    font-size: 32px;
  }

  .contract-medallion > b i {
    font-size: 16px;
  }

  .contract-medallion em,
  .contract-medallion small {
    font-size: 10px;
  }

  .mini-progress {
    margin: 12px 0 8px;
  }

  .client-actions,
  .panel,
  .profile-card {
    padding: 18px 16px;
    border-radius: 13px;
  }

  .actions-heading,
  .panel-heading,
  .section-title,
  .page-head,
  .document-page-head,
  .shop-page-head,
  .shop-carousel-heading,
  .shop-orders-heading,
  .profile-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .action-list,
  .quick-grid,
  .content-grid,
  .benefit-cards,
  .benefits-list,
  .profile-layout,
  .profile-form-grid,
  .profile-logo-layout,
  .event-edit-grid,
  .order-form-grid,
  .delivery-grid {
    grid-template-columns: 1fr;
  }

  .action-list button {
    min-height: 0;
    padding: 13px;
  }

  .quick-grid article {
    padding: 14px;
  }

  .content-grid {
    gap: 14px;
  }

  .event-body {
    align-items: flex-start;
  }

  .event-info dl {
    grid-template-columns: 1fr 1fr;
  }

  .timeline {
    padding-inline: 16px;
  }

  .timeline article {
    position: relative;
    display: grid;
    grid-template-columns: 12px 70px minmax(0, 1fr);
    gap: 10px;
    padding: 17px 0;
  }

  .timeline article::before {
    margin-top: 4px;
  }

  .timeline time {
    width: auto;
  }

  .timeline article > div {
    min-width: 0;
  }

  .timeline article > button,
  .timeline article > .gold-button,
  .timeline article > .outline {
    grid-column: 2 / -1;
    width: 100%;
  }

  .document-list {
    padding-inline: 14px;
  }

  .document-list > button {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .document-list > button > div {
    min-width: calc(100% - 60px);
  }

  .document-list em {
    width: 100%;
    margin: 0 0 0 57px;
  }

  .profile-logo-card,
  .profile-delivery-card {
    grid-column: auto;
  }

  .profile-save-bar {
    bottom: 8px;
    align-items: stretch;
    flex-direction: column;
  }

  .profile-save-bar button,
  .upload-document-button,
  #showOrdersButton,
  #hideOrdersButton {
    width: 100%;
  }

  .shop-carousel {
    margin-inline: -8px;
    padding-inline: 34px;
  }

  .shop-carousel-arrow {
    width: 38px;
    height: 58px;
  }

  .real-shop-grid article {
    flex-basis: min(82vw, 330px);
  }

  .shop-service-note {
    grid-template-columns: 1fr;
  }

  .shop-order-list article {
    grid-template-columns: 1fr auto;
  }

  .shop-order-list article div {
    grid-column: 1 / -1;
  }

  /* Toutes les fenêtres restent entièrement accessibles sur petit écran. */
  dialog,
  .product-preview-dialog,
  .document-viewer-dialog,
  .event-details-dialog,
  .gift-delivery-dialog,
  .product-order-dialog,
  .shop-order-confirmation-dialog,
  .social-post-dialog {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    max-height: calc(100dvh - 18px) !important;
    margin: auto;
    border-radius: 14px;
  }

  dialog form,
  .product-preview-shell,
  .document-viewer-shell,
  .shop-confirmation-shell,
  .social-post-shell {
    max-height: calc(100dvh - 18px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  dialog form,
  .product-preview-shell,
  .shop-confirmation-shell {
    padding: 22px 16px;
  }

  dialog .close {
    z-index: 12;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1eee7;
  }

  .event-dialog-heading,
  .event-files > div:first-child,
  .order-product-head,
  .preview-studio-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-progress ul {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions > button,
  .dialog-actions > a {
    width: 100%;
    min-height: 46px;
  }

  .preview-studio-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .preview-stage-column {
    order: 1;
    min-width: 0;
  }

  .preview-thumbnail-rail {
    order: 2;
    min-width: 0;
  }

  .preview-studio-summary {
    order: 3;
    padding: 18px;
  }

  .preview-thumb-gallery {
    display: flex;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .preview-thumb {
    flex: 0 0 104px;
    min-width: 104px;
    scroll-snap-align: start;
  }

  .preview-stage-column .live-product-preview {
    width: 100%;
    height: min(54dvh, 430px);
    min-height: 300px;
  }

  .product-preview-shell > .preview-disclaimer {
    margin: 14px 0 0;
  }

  .document-viewer-dialog {
    height: calc(100dvh - 18px) !important;
  }

  .document-viewer-shell > header,
  .document-viewer-shell > footer {
    padding: 12px;
  }

  .document-preview {
    padding: 8px;
  }

  .document-preview iframe {
    min-height: 0;
  }

  .notifications-drawer {
    width: 100%;
    height: 100dvh;
    padding: 20px 16px;
  }

  /* Administration mobile */
  .app-shell {
    display: block;
  }

  .app-shell main {
    width: 100%;
    padding: 0 14px 36px;
  }

  .sidebar {
    width: min(300px, 88vw);
    height: 100dvh;
    padding-top: 18px;
    overflow-y: auto;
    box-shadow: 18px 0 55px #0008;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 9;
    min-height: 72px;
    margin-inline: -14px;
    padding-inline: 14px;
    background: rgba(246, 244, 239, .96);
    backdrop-filter: blur(12px);
  }

  .menu-toggle {
    width: 44px;
    height: 44px;
    flex: none;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .topbar h1 {
    font-size: 20px;
    line-height: 1.1;
  }

  .top-actions {
    flex: none;
  }

  .top-actions .client-preview-link {
    display: none !important;
  }

  .welcome-row,
  .section-head,
  .workspace-head,
  .demo-library-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .kpi-grid,
  .dashboard-grid,
  .action-list,
  .detail-grid,
  .benefit-grid,
  .mini-kpi-grid,
  .demo-kpi-grid,
  .demo-library,
  .gift-grid,
  .support-grid,
  .catalogue-grid,
  .shop-summary {
    grid-template-columns: 1fr;
  }

  .panel,
  .kpi,
  .demo-card-body {
    padding: 17px;
  }

  .panel-head {
    flex-direction: column;
    gap: 10px;
  }

  .panel-head > button,
  .panel-head .primary,
  .head-actions,
  .head-actions > button {
    width: 100%;
  }

  .head-actions {
    flex-direction: column;
  }

  .filters,
  .detail-tabs,
  .settings-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .table-row,
  .contract-row,
  .benefit-row,
  .order-row,
  .result-row,
  .coupon-row {
    min-width: 0;
  }

  .demo-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .demo-card-meta,
  .demo-module-grid,
  .dialog-grid,
  .access-check-grid,
  .price-edit-grid,
  .product-admin-layout,
  .pack-detail-grid,
  .price-breakdown {
    grid-template-columns: 1fr;
  }

  .demo-dialog,
  .workspace-dialog,
  .wide-dialog {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    max-height: calc(100dvh - 18px) !important;
  }

  .demo-dialog form,
  .workspace-dialog form,
  .wide-dialog form {
    max-height: calc(100dvh - 18px);
    padding: 20px 15px;
    overflow-y: auto;
  }

  .demo-dialog-title,
  .demo-ai-heading {
    display: block;
  }

  .demo-step,
  .demo-ai-heading > span {
    display: inline-block;
    margin-top: 10px;
  }

  .demo-ai-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .demo-ai-actions > button {
    width: 100%;
    min-height: 44px;
  }

  .demo-dialog-actions {
    bottom: -20px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Connexion : le branding reste présent sans repousser le formulaire. */
  .login-shell {
    min-height: 100dvh;
  }

  .login-brand {
    min-height: 220px;
    padding: 18px 20px;
  }

  .brand-link {
    min-height: 88px;
    gap: 14px;
  }

  .brand-link img {
    width: 82px;
    height: 82px;
    border-radius: 16px;
  }

  .brand-link strong {
    font-size: 17px;
  }

  .brand-link b {
    font-size: 21px;
  }

  .brand-copy {
    margin: 16px 0 0;
  }

  .brand-copy h1 {
    margin: 9px 0 0;
    font-size: clamp(25px, 7vw, 32px);
  }

  .login-panel {
    min-height: calc(100dvh - 220px);
    padding: 116px 14px 34px;
    align-content: start;
  }

  .partner-slogan {
    top: 20px;
    padding: 12px 38px;
    font-size: clamp(18px, 5vw, 23px);
  }

  .login-card {
    width: 100%;
    max-width: 480px;
    padding: 24px 20px;
    border-radius: 18px;
  }

  .login-card input,
  .primary-login {
    min-height: 48px;
  }

  .login-footer {
    position: static;
    display: grid;
    gap: 8px;
    margin-top: 24px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .client-header .brand,
  .client-header .brand.client-brand-active {
    width: 88px;
    min-width: 82px;
  }

  .client-header .brand img,
  .client-header .brand.client-brand-active img {
    width: 86px;
  }

  .client-header .header-medal {
    width: 54px;
    height: 54px;
    top: 10px;
  }

  .client-header .profile {
    display: none;
  }

  .hero-partner-grid {
    grid-template-columns: 1fr;
  }

  .hero-jlcp-card {
    display: grid;
    grid-template-columns: 92px 1fr;
    text-align: left;
  }

  .hero-jlcp-card img {
    width: 92px;
    height: 82px;
  }

  .hero-jlcp-card span {
    font-size: 13px;
  }

  .hero-jlcp-card b {
    font-size: 11px;
  }

  .event-body {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
  }

  .calendar {
    float: none;
    width: 64px;
    height: 72px;
    margin: 0;
  }

  .event-info dl {
    grid-template-columns: 1fr;
    padding-top: 12px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }

  .event-progress ul {
    grid-template-columns: 1fr;
  }

  .mobile-socials {
    grid-template-columns: 1fr;
  }

  .real-shop-grid article {
    flex-basis: calc(100vw - 84px);
  }

  .preview-stage-column .live-product-preview {
    min-height: 250px;
    height: 42dvh;
  }

  .preview-ready-badge {
    display: none;
  }

  .preview-thumb {
    flex-basis: 92px;
    min-width: 92px;
  }

  .shop-order-list article {
    grid-template-columns: 1fr;
  }

  .shop-order-list article > * {
    grid-column: 1 !important;
  }

  .demo-card-actions > button {
    flex: 1 1 calc(50% - 8px);
  }

  .demo-card-actions .demo-delete {
    margin-left: 0;
  }

  .login-brand {
    min-height: 190px;
    padding: 14px 16px;
  }

  .brand-link {
    min-height: 74px;
    gap: 10px;
  }

  .brand-link img {
    width: 70px;
    height: 70px;
  }

  .brand-link strong {
    font-size: 14px;
  }

  .brand-link b {
    font-size: 17px;
  }

  .brand-copy h1 {
    font-size: 24px;
  }

  .login-panel {
    min-height: calc(100dvh - 190px);
    padding-top: 108px;
  }

  .login-card h2 {
    font-size: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Mobile header V3: identity left, medal centered, utilities on the right. */
@media (max-width: 800px) {
  .client-header {
    height: 118px;
    padding: 0;
  }

  .client-header .brand,
  .client-header .brand.client-brand-active {
    position: absolute;
    top: 11px;
    left: 12px;
    width: 112px;
    min-width: 0;
    height: 52px;
    margin: 0;
  }

  .client-header .brand img,
  .client-header .brand.client-brand-active img,
  body.airfrance-demo .client-header .brand.client-brand-active img {
    width: 110px;
    max-width: 110px;
    height: 50px;
  }

  .client-header .header-medal {
    top: 5px;
    left: 50%;
    width: 66px;
    height: 66px;
  }

  .client-header .profile,
  .client-header .signout-button {
    display: none !important;
  }

  .client-header .notification-button,
  .client-header .mobile-menu {
    position: absolute;
    top: 14px;
    width: 42px;
    height: 42px;
    margin: 0;
  }

  .client-header .notification-button {
    right: 58px;
  }

  .client-header .mobile-menu {
    right: 10px;
  }

  .client-header .header-socials {
    position: absolute;
    bottom: 8px;
    display: flex;
    gap: 5px;
    margin: 0;
  }

  .client-header .header-socials-left {
    right: 113px;
  }

  .client-header .header-socials-right {
    right: 10px;
  }

  .client-header .header-socials a {
    width: 29px;
    height: 29px;
    border-radius: 8px;
  }

  .client-header .header-socials svg {
    width: 15px;
    height: 15px;
  }

  .client-header nav {
    top: 118px;
    max-height: calc(100dvh - 118px);
  }
}

@media (max-width: 390px) {
  .client-header .brand,
  .client-header .brand.client-brand-active {
    width: 96px;
  }

  .client-header .brand img,
  .client-header .brand.client-brand-active img,
  body.airfrance-demo .client-header .brand.client-brand-active img {
    width: 94px;
    max-width: 94px;
  }

  .client-header .header-medal {
    width: 58px;
    height: 58px;
    top: 8px;
  }
}

/* Notification centre V2: explicit content, actions and reliable mobile drawer. */
html.notifications-open,
html.notifications-open body { overflow: hidden; }

.notifications-drawer {
  color: #181818;
  visibility: visible;
}

.drawer-head > div > span {
  display: block;
  margin-top: 5px;
  color: #74777d;
  font-size: 13px;
}

.notification-list {
  display: grid;
  padding-top: 8px;
}

.notification-list article {
  grid-template-columns: 44px 1fr;
  padding: 16px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.notification-list article:hover,
.notification-list article:focus-visible {
  background: #f7f4ed;
  outline: 2px solid #d6a832;
  outline-offset: -2px;
  transform: translateX(-2px);
}

.notification-list article.unread {
  background: #fffbef;
}

.notification-list .notification-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #e7dfca;
  border-radius: 11px;
  background: #fff;
  font-size: 18px;
}

.notification-list article > div { min-width: 0; }
.notification-list article > i { display: none; }
.notification-list em {
  display: inline-block;
  margin-top: 8px;
  color: #8c6814;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

@media (max-width: 800px) {
  .notifications-drawer {
    width: min(100%, 430px);
    padding: max(18px, env(safe-area-inset-top)) 16px 24px;
  }

  .notification-list article {
    min-height: 116px;
  }
}
