/* ==========================================================================
   Pilote Base — compléments UX (CHAÎNE-BASE 2-4-5)
   Feuille globale chargée en dernier par templates/base.html. Les gabarits
   n'ajoutent aucune ligne <style> (cliquet design) : leurs compléments vivent
   ici. Aucun hex littéral : jetons --pds-* uniquement.
   ========================================================================== */

/* ── B-AGENDA-1 (b) — Date & heure de RDV : heure de début visible, requise ── */
.rdv-datetime-field { display: flex; flex-direction: column; gap: 4px; }
.rdv-datetime-label {
    font-size: var(--pds-text-sm);
    font-weight: 700;
    color: var(--pds-ink-soft);
}
.rdv-required { color: var(--pds-danger); text-decoration: none; }
.rdv-time-error {
    margin: 6px 0 0;
    font-size: var(--pds-text-sm);
    font-weight: 700;
    color: var(--pds-danger);
}

/* ── B-AGENDA-1 (c) — Fréquents : sous-titre forfaits ── */
.rdv-section-heading--sub { margin-top: 18px; }
.rdv-section-heading--sub h3 {
    margin: 0;
    color: var(--pds-ink);
    font-size: var(--pds-text-md);
}

/* ── B-AGENDA-1 (d) — Détail RDV : panier complet, actions rangées ── */
.aptd-cart-row { flex-direction: column; align-items: stretch; gap: 6px; }
.aptd-cart {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aptd-cart-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.9rem;
}
.aptd-cart-name {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-weight: 600;
    color: var(--pilot-text);
}
.aptd-cart-staff { font-weight: 500; color: var(--pilot-text-secondary); }
.aptd-cart-dur { white-space: nowrap; color: var(--pilot-text-secondary); font-size: 0.82rem; }
.aptd-cart-price { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.aptd-cart-total {
    grid-template-columns: minmax(0, 1fr) auto;
    border-top: 1px solid var(--pilot-border-light);
    margin-top: 2px;
    padding-top: 8px;
}
.aptd-cart-total .aptd-cart-name,
.aptd-cart-total .aptd-cart-price { font-weight: 800; }

.pilot-modal-footer.aptd-footer {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}
.aptd-footer > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.aptd-footer .pilot-modal-footer-right { order: 1; flex: 1 1 100%; justify-content: flex-end; }
.aptd-footer .pilot-modal-footer-center { order: 2; flex: 1 1 auto; }
.aptd-footer .pilot-modal-footer-left { order: 3; margin-left: auto; }
.aptd-footer .pilot-modal-footer-center:empty { display: none; }
@media (max-width: 560px) {
    .aptd-footer .pilot-modal-footer-right > * { flex: 1 1 auto; text-align: center; justify-content: center; }
}

/* ── B-AGENDA-1 (e) — Encaisser avec caisse fermée ── */
.cash-closed-gate {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(17, 24, 39, 0.45);
}
.cash-closed-gate__panel {
    width: min(480px, 100%);
    padding: 24px;
    border-radius: var(--pds-radius-md, 12px);
    background: var(--pds-surface);
    box-shadow: var(--pds-shadow-md);
    text-align: center;
}
.cash-closed-gate__title { margin: 0 0 8px; font-size: var(--pds-text-xl); color: var(--pds-ink); }
.cash-closed-gate__message { margin: 0 0 20px; color: var(--pds-ink-soft); }
.cash-closed-gate__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.aptd-cash-closed {
    flex: 1 1 100%;
    order: 0;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--pds-danger);
    border-radius: var(--pds-radius-sm);
    background: var(--pds-surface);
    color: var(--pds-ink);
    font-size: var(--pds-text-sm);
}
.aptd-cash-closed a { font-weight: 700; color: var(--pds-action); }

/* ── B-FINITION-1 — focus clavier visible partout ──
   Plusieurs composants historiques posent `outline: none` au focus : au
   clavier (:focus-visible), un anneau net et contrasté est toujours rendu.
   La souris (focus sans :focus-visible) garde le rendu actuel. */
html body :is(a, button, input, select, textarea, summary, [tabindex], [role="button"], [role="tab"]):focus-visible {
    outline: 3px solid var(--pds-action) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px var(--pds-action-soft) !important;
}

/* ── BASE-CORRECTIFS-RECETTE-2810 — déconnexion dans le menu du téléphone ──
   Même formulaire POST que le menu avatar du bureau. Classe propre (pas
   `phone-sheet-item` : la déconnexion n'est pas une entrée de module, et un
   utilisateur sans rôle la garde) ; mêmes mesures que les entrées de la feuille. */
.phone-sheet-form { margin: 0; }
.phone-sheet-logout {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px;
    margin-top: 8px; padding: 10px 12px; border: 0; border-radius: 12px; background: none;
    font-family: inherit; font-size: 15px; font-weight: 600; text-align: left;
    cursor: pointer; color: var(--pds-ref-danger, var(--pds-danger));
}
.phone-sheet-logout:active { background: var(--ph-bg); }

/* ── BASE-CORRECTIFS-RECETTE-2810 — tri du stock au téléphone ──
   Les en-têtes (porteurs du tri) sont masqués par `.phone-cards` sous 768 px :
   un sélecteur + un bouton de sens les remplacent, branchés sur stkSort(). */
.stk-sort-mobile { display: none; }
@media (max-width: 767.98px) {
    .stk-sort-mobile { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
    .stk-sort-mobile label { flex: 0 0 auto; font-size: 0.85rem; font-weight: 600; color: var(--pds-ref-muted); }
    .stk-sort-mobile select { flex: 1 1 auto; min-width: 0; }
    .stk-sort-mobile button { flex: 0 0 auto; white-space: nowrap; }
}

/* B-MOBILE (31/10) : « Retour au planning » des rubriques, téléphone seulement (phone.css). */
@media (min-width: 768px) { .ph-back-planning { display: none; } }
/* B-MOBILE (01/11) — ticket (pos/sale_detail.html) : au bureau, le groupe des
   actions sensibles ne change rien à la rangée d'actions. */
.tk-secondary { display: contents; }
.tk-secondary-title { display: none; }
@media (max-width: 767.98px) {
  body.pds-admin .tk-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 0; border: 0; background: transparent; box-shadow: none; }
  body.pds-admin .tk-head .pds-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
  body.pds-admin .tk-head .pds-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.pds-admin .tk-head .pds-actions > :is(a, button) { width: 100%; min-height: 44px; height: auto; font-size: 14px; }
  body.pds-admin .tk-secondary { display: grid; grid-column: 1 / -1; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--ph-line); }
  body.pds-admin .tk-secondary:not(:has(a, button)) { display: none; }
  body.pds-admin .tk-secondary-title { display: block; margin: 0; color: var(--ph-muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  body.pds-admin .tk-secondary :is(a, button) { width: 100%; min-height: 44px; height: auto; font-size: 14px; }
  body.pds-admin .tk-meta { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  /* Une ligne de ticket devient une carte : les six colonnes restent toutes
     lisibles, sans réduire les mots ou couper les montants. Composant existant
     phone-cards ; aucun changement des valeurs ni du document fiscal. */
  body.pds-admin :is(.tk-lines, .tk-payments) {
    border: 0; background: transparent; box-shadow: none; overflow: visible;
  }
  body.pds-admin :is(.tk-lines, .tk-payments) table {
    width: 100%; min-width: 0; border: 0; box-shadow: none;
  }
  body.pds-admin :is(.tk-lines, .tk-payments) tbody td {
    padding: 4px 0; font-size: 14px; overflow-wrap: break-word; word-break: normal;
  }
  body.pds-admin :is(.tk-lines, .tk-payments) td[data-phone-primary] {
    font-size: 16px; font-weight: 600;
  }
  body.pds-admin :is(.tk-lines, .tk-payments) td[data-label]::before {
    text-transform: none; letter-spacing: normal; font-size: 13px; font-weight: 400;
  }
  body.pds-admin :is(.tk-lines, .tk-payments) tbody td[colspan] { display: block; }
  body.pds-admin :is(.tk-lines, .tk-payments) td.text-right { white-space: nowrap; }
  body.pds-admin .tk-lines tfoot { display: block; padding: 8px 12px; background: var(--pds-surface); border-radius: 12px; }
  body.pds-admin .tk-lines tfoot tr {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 8px 0; margin: 0; border: 0; border-radius: 0;
  }
  body.pds-admin .tk-lines tfoot td { display: block; width: auto; min-height: 0; padding: 0; }
  body.pds-admin .tk-lines tfoot td:first-child { flex: 1; text-align: left; white-space: normal; }

}

/* ── Planning — panneau d'actions du collaborateur (clic sur le nom) ──
   Portée stricte : .staff-actions-panel. Annule le double rembourrage
   .modal-panel + .pilot-modal ; lignes d'action sobres, rouge réservé à Off. */
body.pds-admin .modal-panel.staff-actions-panel {
    width: min(420px, calc(100vw - 32px));
    max-width: none;
    padding: 0;
    border-radius: var(--pds-radius-lg);
    background: var(--pds-surface);
    overflow-x: hidden;
}
.staff-actions-panel .staff-actions-head {
    align-items: flex-start;
    gap: var(--pds-space-3);
    padding: var(--pds-space-4) var(--pds-space-4) var(--pds-space-3) var(--pds-space-5);
    border-bottom: 1px solid var(--pds-divider);
}
.staff-actions-panel .staff-actions-heading { min-width: 0; padding-top: 2px; }
.staff-actions-panel .staff-actions-head h2 {
    margin: 0;
    font-size: var(--pds-text-lg);
    font-weight: 700;
    line-height: 1.25;
    color: var(--pds-ink);
    overflow-wrap: anywhere;
}
.staff-actions-panel .staff-actions-sub {
    margin: 2px 0 0;
    font-size: var(--pds-text-sm);
    color: var(--pds-slate);
}
.staff-actions-panel .staff-actions-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--pds-tap-min);
    height: var(--pds-tap-min);
    padding: 0;
    border: 0;
    border-radius: var(--pds-radius-full);
    background: transparent;
    color: var(--pds-slate);
    cursor: pointer;
    transition: background var(--pds-transition), color var(--pds-transition);
}
.staff-actions-panel .staff-actions-close:hover {
    background: var(--pds-action-soft);
    color: var(--pds-ink);
}
.staff-actions-panel .staff-actions-list,
.staff-actions-panel .staff-actions-foot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--pds-space-2);
}
.staff-actions-panel .staff-actions-foot {
    border-top: 1px solid var(--pds-divider);
    background: var(--pds-page);
}
.staff-actions-panel .staff-action {
    display: flex;
    align-items: center;
    gap: var(--pds-space-3);
    width: 100%;
    min-height: var(--pds-tap-min);
    margin: 0;
    padding: var(--pds-space-2) var(--pds-space-3);
    border: 0;
    border-radius: var(--pds-radius-md);
    background: transparent;
    color: var(--pds-ink);
    font-family: inherit;
    font-size: var(--pds-text-base);
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--pds-transition), color var(--pds-transition);
}
.staff-actions-panel .staff-action:hover { background: var(--pds-action-soft); }
.staff-actions-panel :is(.staff-action, .staff-actions-close):focus-visible {
    outline: 2px solid var(--pds-action);
    outline-offset: 2px;
}
.staff-actions-panel .staff-action-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--pds-radius-sm);
    background: var(--pds-action-soft);
    color: var(--pds-action);
}
.staff-actions-panel .staff-action-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.staff-actions-panel .staff-action-chevron { flex: none; color: var(--pds-muted); }
.staff-actions-panel .staff-action--danger { color: var(--pds-danger); }
.staff-actions-panel .staff-action--danger .staff-action-icon {
    background: var(--pds-danger-soft);
    color: var(--pds-danger);
}
.staff-actions-panel .staff-action--danger:hover { background: var(--pds-danger-soft); }
.staff-actions-panel .staff-action--link {
    color: var(--pds-ink-soft);
    font-weight: 500;
}
.staff-actions-panel .staff-action--link .staff-action-icon {
    background: var(--pds-surface);
    color: var(--pds-slate);
}
.staff-actions-panel .staff-action--link:hover { background: var(--pds-surface); }
@media (max-width: 767.98px) {
    body.pds-admin .modal-panel.staff-actions-panel { width: calc(100% - 16px); }
}

/* P8 — Liste des prestations en offre Base (`.svc-table--base`, posé par
   services/service_list.html seulement) : sans les colonnes Premium Promo et
   Rentabilité, « Carte client » est la 5e colonne. Les paliers d'origine du
   gabarit visent `.svc-table--premium` ; ici le palier 1024 px de la Base.
   Aucune autre `.svc-table` (démo, etc.) n'est visée. Au téléphone
   (< 768 px), le format cartes du gabarit et de phone.css reste seul maître. */
@media (min-width: 768px) and (max-width: 1024px) {
    .svc-table--base th:nth-child(5),
    .svc-table--base td:nth-child(5) { display: none; }
}
