/* Page « Paramètres » (onglet data-tab="parametres") — uniquement des variables CSS existantes. */
#page-parametres .pp-group-grid { grid-auto-rows: auto; align-items: start; }
#page-parametres .pp-card { min-height: 0; }
#page-parametres .ps-card-wide { grid-column: 1 / -1; }
#page-parametres .params-grid { scroll-behavior: smooth; }
#page-parametres .pp-group { scroll-margin-top: 4px; }

.ps-nav { display: flex; gap: 6px; padding: 6px 2px 10px; overflow-x: auto; flex: none; -webkit-overflow-scrolling: touch; }
.ps-nav a { flex: none; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--text); font-size: .8em; font-weight: 600; text-decoration: none; white-space: nowrap; min-height: 32px; display: inline-flex; align-items: center; }
.ps-nav a:hover, .ps-nav a:focus-visible { border-color: var(--accent); color: var(--accent); }

.ps-banner { padding: 9px 12px; border-radius: 8px; font-size: .82em; line-height: 1.45; }
.ps-banner[hidden] { display: none; }
.ps-banner-warn { background: var(--warnBg); color: var(--warnFg); }
.ps-banner ul { margin: 6px 0 0 18px; }
.ps-banner li { margin-bottom: 3px; }
#ps-readonly { margin: 0 0 10px; flex: none; font-weight: 600; }

.ps-hint { font-size: .74em; color: var(--muted); font-weight: 500; line-height: 1.4; }
.ps-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ps-msg { min-height: 1.2em; margin-top: 6px; font-size: .8em; font-weight: 600; }
.ps-msg.ok { color: var(--successFg); }
.ps-msg.err { color: var(--danger); }
.ps-msg.warn { color: var(--warnFg); }
.ps-msg:empty { min-height: 0; margin: 0; }

.ps-linkbox { margin: 8px 0; padding: 10px 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; word-break: break-all; font-weight: 700; font-size: .95em; }
.ps-linkbox a { color: var(--accent); text-decoration: none; }

.ps-logo-row { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.ps-logo-box { width: 96px; height: 96px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.ps-logo-box img { width: 100%; height: 100%; object-fit: contain; padding: 6px; box-sizing: border-box; }
.ps-logo-box .ps-initial { font-weight: 800; font-size: 2em; color: var(--muted); }
.ps-logo-icon { width: 64px; height: 64px; border-radius: 22%; background: var(--accent); }
.ps-logo-icon img { padding: 0; object-fit: cover; }
.ps-logo-icon .ps-initial { color: var(--accent-fg); font-size: 1.6em; }

.ps-ticket { width: 100%; max-width: 280px; background: #fff; color: #000; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; padding: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.ps-ticket .ps-t-line { display: flex; justify-content: space-between; margin: 2px 0; }

.ps-switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: 44px; }
.ps-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ps-switch-ui { flex: none; width: 46px; height: 26px; border-radius: 13px; background: var(--border); position: relative; transition: background .15s; margin-top: 2px; }
.ps-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.ps-switch input:checked + .ps-switch-ui { background: var(--accent); }
.ps-switch input:checked + .ps-switch-ui::after { transform: translateX(20px); }
.ps-switch input:focus-visible + .ps-switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.ps-switch input:disabled + .ps-switch-ui { opacity: .5; }

/* Lecture seule : rien ne se clique */
#page-parametres.ps-readonly .theme-card, #page-parametres.ps-readonly .color-swatch, #page-parametres.ps-readonly .cat-theme-sw,
#page-parametres.ps-readonly #cat-banner-preview, #page-parametres.ps-readonly #cat-manager { pointer-events: none; opacity: .6; }
#page-parametres.ps-readonly .ps-nav a { opacity: 1; }

@media (max-width: 700px) {
  .ps-nav { margin: 0 -4px; padding-left: 4px; padding-right: 4px; }
  .ps-nav a { min-height: 40px; padding: 8px 14px; }
  #page-parametres .btn-sm, #page-parametres .input { min-height: 44px; font-size: 1rem; }
  #page-parametres .ps-row .btn-sm { flex: 1 1 100%; justify-content: center; }
  .ps-logo-row { justify-content: flex-start; }
  #section-about .pp-group-grid { grid-template-columns: 1fr !important; }
}
#page-parametres a.btn { color: var(--text); }

/* Les boutons de section sont maintenant dans le sous-menu (public/pages/parametres-submenu.js) ; la barre de la page reste dans le DOM
   (menu-links.js y ajoute « Avancée ») mais n'est plus affichée. */
#ps-nav { display: none !important; }

.ps-health-table{border-collapse:collapse;width:100%;font-size:.9em}.ps-health-table th{text-align:left;font-weight:600;padding:4px 8px 4px 0;white-space:nowrap;vertical-align:top}.ps-health-table td{padding:4px 0;word-break:break-word}

/* Carte « Thème » : les boutons passent à la ligne au lieu d'être coupés (le style en ligne impose 3 colonnes). */
#theme-list{grid-template-columns:repeat(auto-fill,minmax(64px,1fr)) !important}
#theme-list .theme-card{min-width:0;padding:8px 4px;overflow-wrap:anywhere}

/* ───────── Disposition des menus : « Menus verticaux à gauche » (body.ot-menu-left, posé par parametres-ui.js) ─────────
   Le menu principal reste en haut (en-tête inchangé, même hauteur sur toutes les pages) ; la bande de sous-menu devient une colonne à gauche.
   Aucune règle ne dépend d'une page. Par défaut (menus en haut) rien ne change. */
#ot-menu-fab, #ot-menu-backdrop, #ot-menu-back { display: none; }
@media (min-width: 901px) {
  body.ot-menu-left { display: grid; grid-template-columns: 230px minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "tb tb" "sy sy" "hd hd" "rail main" "st st"; }
  body.ot-menu-left > #training-banner { grid-area: tb; }
  body.ot-menu-left > #sync-bar { grid-area: sy; }
  body.ot-menu-left > header.header { grid-area: hd; }
  body.ot-menu-left > #ot-submenu { grid-area: rail; min-height: 0; overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--border, #e5e7eb); }
  body.ot-menu-left > main { grid-area: main; min-height: 0; }
  body.ot-menu-left > #otchino-statusbar { grid-area: st; }
  body.ot-menu-left:not(:has(#ot-submenu .ot-sm-row > *)) { grid-template-columns: 0 minmax(0, 1fr); }
  body.ot-menu-left:not(:has(#ot-submenu .ot-sm-row > *)) > #ot-submenu { display: none; }
}
body.ot-menu-left #ot-submenu .ot-sm-row { flex-direction: column; align-items: stretch; height: auto; min-height: 0; white-space: normal; overflow: visible; padding: 8px; gap: 6px; }
body.ot-menu-left #ot-submenu .ot-sm-row2 { border-top: 1px dashed var(--border, #e5e7eb); }
body.ot-menu-left #ot-submenu .ot-sm-spacer { flex: 0 0 6px; }
body.ot-menu-left #ot-submenu .ot-sm-sep { width: auto; height: 1px; margin: 2px 0; align-self: stretch; }
body.ot-menu-left #ot-submenu .ot-sm-stat, body.ot-menu-left #ot-submenu .ot-sm-btn, body.ot-menu-left #ot-submenu .ot-sm-chip,
body.ot-menu-left #ot-submenu a.ot-sm-btn { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 40px; box-sizing: border-box; border-radius: 8px; text-align: left; }
body.ot-menu-left #ot-submenu .ot-sm-stat b { margin-left: auto; }
body.ot-menu-left #ot-submenu .ot-sm-lbl { display: inline; }
body.ot-menu-left #ot-submenu :focus-visible, #ot-menu-fab:focus-visible, #ot-menu-back:focus-visible { outline: 3px solid var(--accent, #2563eb); outline-offset: 2px; }
body.ot-menu-left #ot-menu-back { display: block; margin: 8px; padding: 8px 10px; width: calc(100% - 16px); min-height: 40px; border-radius: 8px; border: 1px dashed var(--border, #d1d5db); background: transparent; color: var(--muted, #6b7280); font: inherit; font-size: .85em; text-align: left; cursor: pointer; }
/* Téléphone / petite tablette : la colonne devient un tiroir ouvert par le bouton ☰ (bas à gauche, au-dessus de la barre d'état). */
@media (max-width: 900px) {
  body.ot-menu-left > #ot-submenu { position: fixed; left: 0; top: var(--ot-menu-top, 46px); bottom: var(--ot-menu-bottom, 36px); width: min(300px, 86vw); z-index: 9100; overflow-y: auto; background: var(--panel, #fff);
    border-right: 1px solid var(--border, #e5e7eb); border-bottom: 0; box-shadow: 4px 0 24px rgba(0, 0, 0, .25); transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  body.ot-menu-left.ot-menu-open > #ot-submenu { transform: none; visibility: visible; transition: transform .2s ease; }
  body.ot-menu-left #ot-menu-fab { display: flex; align-items: center; justify-content: center; position: fixed; left: 8px; bottom: 44px; z-index: 9000; width: 48px; height: 48px; border-radius: 50%; border: 0;
    background: var(--accent, #2563eb); color: #fff; font-size: 22px; box-shadow: 0 3px 12px rgba(0, 0, 0, .3); cursor: pointer; }
  body.ot-menu-left.ot-menu-open #ot-menu-backdrop { display: block; position: fixed; inset: 0; z-index: 9050; background: rgba(0, 0, 0, .4); }
}

/* Une seule barre de défilement : #ps-grid défile, ses blocs ne défilent plus en interne (audit responsive #19) */
#page-parametres .params-grid { overscroll-behavior: contain; }
#page-parametres #col-visibility-list { max-height: none !important; overflow: visible !important; }
#page-parametres #cat-wa-msg { overflow: hidden; field-sizing: content; min-height: 54px; }

/* ───────── En-tête compact sur téléphone et tablette (audit responsive #1, #24, #26, #27) ─────────
   Téléphone (≤ 600 px) : 2 rangées (logo / actions, puis onglets sur UNE rangée défilante) ≈ 92 px au lieu de 153–199 px.
   Tablette (601–1100 px) : 1 rangée ≈ 56 px (nom de la boutique en info-bulle du logo). Aucun onglet ni droit retiré.
   Barre d'état : 36 px au lieu de 48 px, horloge masquée sous 480 px. Indice de défilement : voir parametres-ui.js (classes ot-tabs-l / ot-tabs-r). */
#main-tabs.ot-tabs-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); }
#main-tabs.ot-tabs-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); }
#main-tabs.ot-tabs-l.ot-tabs-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); }
@media (max-width: 1100px) {
  html body header.header .shop-name { display: none !important; }
  html body header.header #main-tabs { scroll-snap-type: x proximity; overflow-y: hidden !important; }
  html body header.header #main-tabs .tab-btn { white-space: nowrap !important; flex: none !important; min-width: 0 !important; }
  html body #tip-btn { min-width: 40px; min-height: 40px; }
}
@media (min-width: 601px) and (max-width: 1100px) {
  html body header.header { flex-wrap: nowrap !important; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
  html body header.header #main-tabs { display: flex !important; order: 0 !important; flex: 1 1 0 !important; min-width: 0; margin: 0 4px !important; justify-content: flex-start !important; overflow-x: auto !important; }
  html body header.header #main-tabs .tab-btn { min-height: 44px; }
}
@media (max-width: 600px) {
  html body header.header { padding: max(4px, env(safe-area-inset-top)) 6px 4px; gap: 4px; row-gap: 4px; }
  /* « display: grid » à 4 colonnes (ventes-header.js) remplacé par UNE rangée défilante */
  html body header.header #main-tabs { display: flex !important; grid-template-columns: none !important; order: 10 !important; flex: 1 0 100% !important; margin: 0 !important; height: 40px; flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden !important; justify-content: flex-start !important; gap: 2px; }
  html body header.header #main-tabs .tab-btn { height: 40px; min-height: 40px !important; padding: 0 12px !important; font-size: 13px !important; line-height: 1 !important; overflow: visible !important; text-align: left; justify-content: flex-start !important; }
  html body header.header #hdr-more, html body header.header #user-badge { width: 40px !important; height: 40px !important; min-height: 40px; min-width: 40px; }
}
@media (max-width: 900px) {
  html body #otchino-statusbar { min-height: 36px !important; }
  html body #otchino-statusbar .sb-seg { min-height: 36px !important; min-width: 0 !important; padding: 0 8px !important; }
  html body #otchino-sb-panel { bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (max-width: 480px) { html body #otchino-statusbar .sb-clock { display: none; } }
@media (max-width: 400px) {
  html body #otchino-statusbar .sb-seg { padding: 0 6px !important; gap: 4px !important; }
  html body #otchino-statusbar .sb-user .sb-un { max-width: 64px !important; }
}
