/* wpc-app.css - Compléments du design system pour les pages PHP réelles (le design system est dessiné sur des artboards à positions absolues). */
html { height: 100%; }
.wpc { min-height: 100%; }
.app { min-height: 100vh; min-height: 100dvh; }
.wpc .sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
.wpc .side-spacer { min-height: 12px; }

/* Voile derrière le tiroir mobile */
.wpc .nav-scrim { position: fixed; inset: 0; z-index: 19; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
.wpc .nav-scrim.is-open { opacity: 1; pointer-events: auto; }
.wpc .menu-btn { display: none; }
@media (max-width: 1023px) {
  .wpc .menu-btn { display: inline-grid; }
  .wpc .app > .sidebar.is-open { height: 100dvh; overflow-y: auto; }
  .wpc .topbar { position: sticky; top: 0; z-index: 10; }
}

/* Sidebar repliée en icônes entre 1024 et 1279px (classe posée par ds.js) */
.wpc .app > .sidebar.is-collapsed .brand-name { display: none; }

/* Notifications */
.wpc .toasts { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); pointer-events: none; }
@media (max-width: 767px) { .wpc .toasts { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); } }

/* Pages */
.wpc .page-head h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.wpc .page-head .sub { margin-top: 4px; }
.wpc .content { max-width: 1400px; width: 100%; margin: 0 auto; }
.wpc .pill-link { text-decoration: none; }
.wpc a.btn:hover, .wpc a.pill:hover, .wpc a.tab:hover, .wpc a.side-item:hover { text-decoration: none; }
.wpc .banner { padding: 16px 18px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg-card); }
.wpc .banner--err { border-color: rgba(201, 58, 58, .45); background: var(--err-soft); }
.wpc .banner--warn { border-color: rgba(233, 154, 28, .5); background: var(--warn-soft); }
.wpc .tabs-scroll { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.wpc .tabs-scroll::-webkit-scrollbar { display: none; }
.wpc .list-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.wpc .list-row:last-child { border-bottom: 0; }
.wpc [hidden] { display: none !important; }
.wpc .table-stack td:last-child .row-actions { justify-content: flex-start; }
.wpc .task { text-decoration: none; color: inherit; }
.wpc a.task:hover { text-decoration: none; background: var(--bg-hover); }
.wpc .task-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--bg-sunken); color: var(--text-2); }
.wpc .task-ico--err { background: var(--err-soft); color: var(--err-text); }
.wpc .task-ico--warn { background: var(--warn-soft); color: var(--warn-text); }
.wpc .task-ico--info { background: var(--info-soft); color: var(--info-text); }
.wpc .task-ico--accent { background: var(--accent-soft); color: var(--accent-text); }

/* Maintenance : cases à cocher, barre d'action, modale */
.wpc .chk { width: 18px; height: 18px; flex: none; accent-color: var(--accent); cursor: pointer; }
.wpc .btn-block { width: 100%; }
.wpc .actionbar { position: fixed; z-index: 15; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; max-width: calc(100vw - 24px); background: var(--text-1); color: var(--bg-card); border-radius: var(--r-pill); box-shadow: var(--sh-pop); font-weight: 600; }
.wpc .actionbar .btn-ghost { color: var(--bg-card); }
.wpc .actionbar .btn-ghost:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 767px) { .wpc .actionbar { bottom: calc(12px + env(safe-area-inset-bottom)); border-radius: var(--r-xl); flex-wrap: wrap; justify-content: center; } }
.wpc .overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: var(--scrim); }
.wpc .overlay .modal { width: min(520px, 100%); border-radius: var(--r-2xl) var(--r-2xl) 0 0; }
@media (min-width: 640px) { .wpc .overlay { align-items: center; padding: 16px; } .wpc .overlay .modal { border-radius: var(--r-2xl); } }


/* Couleurs réaffirmées : .wpc button { color: inherit } et .wpc a { color } battent .btn-* et .card-hero en spécificité */
.wpc .btn.btn-primary { color: var(--on-accent); }
.wpc .btn.btn-secondary { color: var(--text-1); }
.wpc .btn.btn-secondary:hover { color: var(--accent-text); }
.wpc .btn.btn-soft { color: var(--accent-text); }
.wpc .btn.btn-ghost { color: var(--text-2); }
.wpc .btn.btn-ghost:hover { color: var(--text-1); }
.wpc .btn.btn-danger { color: #fff; }
.wpc .btn.btn-danger-soft { color: var(--err-text); }
.wpc .btn.btn-white { color: var(--green-700); }
.wpc .btn.btn-on-color { color: #fff; }
.wpc .icon-btn { color: var(--text-2); }
.wpc .icon-btn:hover { color: var(--text-1); }
.wpc a.card-hero, .wpc a.card-hero:hover { color: #fff; text-decoration: none; }
.wpc a.side-item { color: var(--text-2); }
.wpc a.side-item:hover { color: var(--text-1); }
.wpc a.side-item.is-active { color: var(--accent-text); }
.wpc .tab { color: var(--text-2); }
.wpc .tab:hover { color: var(--text-1); }
.wpc .tab.is-active { color: var(--accent-text); }
.wpc .pill { color: var(--text-2); }
.wpc .pill:hover { color: var(--text-1); }
.wpc .pill.is-active { color: #fff; }
.wpc .actionbar .btn.btn-ghost { color: var(--bg-card); }

/* Accordéons de la Maintenance */
.wpc .q-head { padding: 8px 18px; min-height: 60px; }
.wpc .q-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text-1); }
.wpc .q-toggle .q-chev { color: var(--text-2); transition: transform .15s; }
.wpc .q-toggle[aria-expanded="true"] .q-chev { transform: rotate(180deg); }
.wpc .q-body { border-top: 1px solid var(--line); }
.wpc .card > .q-toggle { width: 100%; }
@media (prefers-reduced-motion: reduce) { .wpc .q-toggle .q-chev { transition: none; } }

/* Visualisations de données (includes/ui.php) */
.wpc .daystrip { display: flex; gap: 3px; height: 30px; }
.wpc .daystrip > i { flex: 1 1 0; min-width: 0; border-radius: 4px; background: var(--bg-sunken); }
.wpc .daystrip > i.is-ok { background: var(--ok); }
.wpc .daystrip > i.is-warn { background: var(--warn); }
.wpc .daystrip > i.is-err { background: var(--err); }
.wpc .daystrip > i.is-none { background: var(--line-strong); opacity: .55; }
.wpc .bars > i { min-width: 3px; }
.wpc .bars { min-width: 0; overflow: hidden; }
.wpc .bars--dense { gap: 2px; }
.wpc .bars--dense > i { min-width: 1px; border-radius: 2px 2px 1px 1px; }
.wpc .bars--denser { gap: 1px; }
.wpc .bars--denser > i { min-width: 0; border-radius: 1px; }
.wpc .bars > i.is-fail { background: var(--err); }
.wpc .chart-area { fill: var(--accent); }
.wpc .chart-line { stroke: var(--accent); }
.wpc .viz-split { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
@media (max-width: 480px) { .wpc .viz-split { grid-template-columns: 1fr; justify-items: center; } }
.wpc .stat-note { font-size: 12.5px; color: var(--text-2); }
.wpc .row-meter { min-width: 100px; }

/* Support : boîte de réception */
.wpc .inbox { height: calc(100dvh - 120px); min-height: 600px; align-items: stretch; }
.wpc .inbox > .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wpc .inbox-scroll { overflow-y: auto; min-height: 0; flex: 1; }
.wpc .inbox-aside { overflow-y: auto; }
.wpc .inbox-main #thread-view { height: 100%; }
.wpc .ticket { align-items: start; }
.wpc .ticket.is-unread { box-shadow: inset 3px 0 0 var(--accent); }
.wpc .thread { padding-bottom: 6px; }
#t-back { display: none; }
@media (max-width: 1279px) {
  .wpc .inbox-aside.is-open { display: flex !important; flex-direction: column; position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); border-radius: var(--r-xl) 0 0 var(--r-xl); box-shadow: var(--sh-pop); padding: 20px; }
}
/* Écran pliable ouvert / tablette : la fiche client n'apparaît que dans son tiroir, jamais sous la liste */
@media (max-width: 1279px) { .wpc .inbox > .inbox-aside:not(.is-open) { display: none !important; } }
.aside-scrim { position: fixed; inset: 0; z-index: 29; background: var(--scrim, rgba(0,0,0,.45)); }
.aside-close[hidden] { display: none !important; }
.wpc .inbox > .inbox-aside.is-open { padding-top: 60px; height: 100dvh; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.wpc .inbox > .inbox-aside.is-open > * { flex-shrink: 0; }
.aside-close { position: fixed; z-index: 31; top: 12px; right: 12px; }
@media (min-width: 1280px) { .aside-scrim, .aside-close { display: none !important; } }
@media (min-width: 1280px) { #t-aside-btn { display: none; } }
@media (max-width: 1023px) {
  .wpc .inbox { height: auto; min-height: 0; display: block; }
  .wpc .inbox > .card { height: calc(100dvh - 96px); min-height: 480px; }
  /* Conversation ouverte : l'en-tête et le champ de réponse restent compacts pour laisser la place aux messages */
  .wpc #thread-view > header { padding: 10px 12px !important; }
  .wpc #thread-view > header .row.wrap:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .wpc #thread-view > header .row.wrap:last-child .select { width: 100% !important; min-width: 0; }
  .wpc #thread-view > header #t-aside-btn { grid-column: 1 / -1; }
  .wpc #thread-view .thread { padding: 12px !important; min-height: 200px; }
  .wpc #thread-view > footer { padding: 8px 10px !important; }
  .wpc #thread-view .quick { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 6px !important; }
  .wpc #thread-view .quick .chip { flex: none; }
  .wpc #thread-view .composer { padding: 8px; gap: 6px; }
  .wpc #thread-view .composer textarea { min-height: 44px; }
  .wpc #thread-view .composer .row .btn { padding-inline: 10px; }
  .wpc .inbox:not(.is-thread-open) .inbox-main { display: none; }
  .wpc .inbox.is-thread-open .inbox-list { display: none; }
  #t-back { display: inline-grid; }
  .wpc .msg { max-width: 94%; }
}

/* Support : filtres de la liste, tous visibles sur deux lignes si besoin */
.wpc .inbox-pills { flex-wrap: wrap; gap: 6px; }
.wpc .inbox-pills .pill { height: 30px; padding: 0 10px; font-size: 12px; gap: 5px; }
@media (pointer: coarse) { .wpc .inbox-pills .pill { height: 38px; } }

/* Maintenance : liste unique d'éléments à mettre à jour */
.wpc .m-row { border-bottom: 1px solid var(--line); }
.wpc .m-row:last-child { border-bottom: 0; }
.wpc .m-head { display: flex; align-items: center; gap: 12px; padding: 10px 18px; min-height: 64px; }
.wpc .m-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text-1); }
.wpc .m-toggle .q-chev { color: var(--text-2); transition: transform .15s; flex: none; }
.wpc .m-toggle[aria-expanded="true"] .q-chev { transform: rotate(180deg); }
.wpc .m-gauge { flex: none; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; width: 150px; justify-content: flex-end; }
.wpc .m-bar { flex-basis: 100%; margin-top: 5px; }
.wpc .m-sites { border-top: 1px dashed var(--line); background: var(--bg-sunken); }
@media (max-width: 767px) { .wpc .m-gauge { width: 84px; } .wpc .m-head { padding: 10px 14px; } .wpc .m-sites .list-row { padding-left: 24px !important; } }
@media (prefers-reduced-motion: reduce) { .wpc .m-toggle .q-chev { transition: none; } }

/* Espace client : sous 1024px, barre d'onglets fixe en bas (5 entrées) au lieu du tiroir ; cibles tactiles de 52px */
.wpc .tabbar { display: none; }
.wpc .tabbar-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 52px; border-radius: var(--r-sm); font-size: 11px; font-weight: 700; color: var(--text-2); text-decoration: none; }
.wpc .tabbar-item span:not(.badge-count) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpc a.tabbar-item:hover { text-decoration: none; color: var(--text-1); }
.wpc a.tabbar-item.is-active { color: var(--accent-text); background: var(--accent-soft); }
.wpc .tabbar-item .badge-count { top: 2px; right: calc(50% - 22px); }
@media (max-width: 1023px) {
  .wpc--client .menu-btn { display: none; }
  .wpc--client .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--bg-shell); border-top: 1px solid var(--line); }
  .wpc--client .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .wpc--client .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* Bandeau « Vous voyez le dashboard de… » (style en ligne de render.php) : au-dessus de la barre d'onglets */
  .wpc--client form[action="impersonate.php"] { bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

/* Cloche des notifications (admin) : panneau sous la barre du haut, toutes les non lues */
@media (min-width: 1024px) { .wpc .topbar { position: relative; } }   /* en dessous, la barre est déjà sticky (repère du panneau) */
.wpc .notif-panel { position: absolute; z-index: 30; top: calc(100% + 6px); right: 12px; width: min(440px, calc(100vw - 24px)); max-height: min(72vh, 640px); overflow-y: auto;
  background: var(--bg-shell); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-pop); }
.wpc .notif-panel .row.between { position: sticky; top: 0; background: var(--bg-shell); z-index: 1; }
.wpc .notif-item.is-unread .task-title { color: var(--text-1); }
.wpc .notif-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.wpc .notif-site { font-weight: 800; color: var(--text-1); }
.wpc .notif-amount { margin-top: 2px; font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--ok-text); }
.wpc .notif-amount span { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--text-2); }
/* Logo d'un site (favicon) dans une pastille ronde, sur fond blanc pour les logos transparents */
.wpc .avatar.site-logo { position: relative; overflow: hidden; background: #fff; }
.wpc .avatar.site-logo img { width: 100%; height: 100%; object-fit: cover; }   /* le logo remplit tout le rond, quitte à être un peu coupé */
.wpc .avatar.site-logo::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.wpc .page-head .sub .avatar { display: inline-grid; vertical-align: middle; margin: -2px 8px 0 0; }   /* logo du site devant son adresse */

/* Pages publiques (connexion, mot de passe oublié) : une carte centrée */
.wpc .auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--bg-page); }
.wpc .auth-card { width: 100%; max-width: 400px; }
.wpc .auth-card .brand { padding: 0; margin-bottom: 18px; }
.wpc .auth-card .input { height: 46px; font-size: 16px; }   /* 16px : évite le zoom automatique d'iOS */
.wpc .auth-msg { padding: 10px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 600; }
.wpc .auth-msg--err { background: var(--err-soft); color: var(--err-text); }
.wpc .auth-msg--ok { background: var(--ok-soft); color: var(--ok-text); }
