/* OvniShell - mise en page adaptative des editeurs (OvniQuote, OvniOrder, OvniBL, OvniInvoice).
 *
 * Les points de rupture des modules sont calcules sur la largeur de la FENETRE ; or la barre laterale d'OvniShell (248 ou 76 px), le zoom
 * du navigateur et les marges retirent de la place : sur une fenetre de 1280 px, il ne reste qu'environ 1000 px au contenu. Les colonnes
 * (catalogue 300 px, synthese 318 px) se retrouvaient alors trop etroites et les elements d'une ligne se chevauchaient.
 *
 * js/adapt.js mesure la largeur REELLE du contenu et pose html[data-ovw] : full (>= 1360 px), mid (1000 a 1359), narrow (700 a 999),
 * tiny (< 700). Les regles ci-dessous sont les regles @media deja ecrites par les modules, recopiees sur ces niveaux (fichier genere :
 * voir la section 1) ; la section 2 ajoute ce qu'une media query ne sait pas faire (cartes de ligne qui s'adaptent a LEUR largeur, defilement).
 * Sans JavaScript, rien ne change : les regles @media des modules restent la base.
 */

/* === 1. Regles des modules, calculees sur la largeur du contenu ============================================ */
/* OvniOrder, OvniInvoice, OvniBL - contenu < 1360 px : deux colonnes */
html[data-ovw="mid"] .ox-workspace,
html[data-ovw="narrow"] .ox-workspace,
html[data-ovw="tiny"] .ox-workspace { grid-template-columns: 300px minmax(0, 1fr); }
html[data-ovw="mid"] .ox-workspace--sidebar-collapsed,
html[data-ovw="narrow"] .ox-workspace--sidebar-collapsed,
html[data-ovw="tiny"] .ox-workspace--sidebar-collapsed { grid-template-columns: 40px minmax(0, 1fr); }
html[data-ovw="mid"] .ox-workspace--readonly,
html[data-ovw="narrow"] .ox-workspace--readonly,
html[data-ovw="tiny"] .ox-workspace--readonly { grid-template-columns: minmax(0, 1fr); }
html[data-ovw="mid"] .ox-synth-panel,
html[data-ovw="narrow"] .ox-synth-panel,
html[data-ovw="tiny"] .ox-synth-panel { grid-column: -2 / -1; position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0 24px; align-content: start; }
html[data-ovw="mid"] .ox-synth-panel > .ox-synth-title,
html[data-ovw="narrow"] .ox-synth-panel > .ox-synth-title,
html[data-ovw="tiny"] .ox-synth-panel > .ox-synth-title { grid-column: 1 / -1; }

/* OvniOrder, OvniInvoice, OvniBL - contenu < 1000 px */
html[data-ovw="narrow"] .ox-header-band,
html[data-ovw="tiny"] .ox-header-band { flex-direction: column; align-items: stretch; }
html[data-ovw="narrow"] .ox-header-band-total,
html[data-ovw="tiny"] .ox-header-band-total { text-align: left; }
html[data-ovw="narrow"] .ox-actions a,
html[data-ovw="narrow"] .ox-more-actions > summary,
html[data-ovw="tiny"] .ox-actions a,
html[data-ovw="tiny"] .ox-more-actions > summary { font-size: .74em; padding: 2px 4px; gap: 4px; }
html[data-ovw="narrow"] .ox-actions a i,
html[data-ovw="narrow"] .ox-more-actions > summary i,
html[data-ovw="tiny"] .ox-actions a i,
html[data-ovw="tiny"] .ox-more-actions > summary i { margin-right: 2px; }
html[data-ovw="narrow"] .ox-workspace,
html[data-ovw="narrow"] .ox-workspace--sidebar-collapsed,
html[data-ovw="narrow"] .ox-workspace--readonly,
html[data-ovw="tiny"] .ox-workspace,
html[data-ovw="tiny"] .ox-workspace--sidebar-collapsed,
html[data-ovw="tiny"] .ox-workspace--readonly { display: block; }
html[data-ovw="narrow"] .ox-catalog-sidebar,
html[data-ovw="tiny"] .ox-catalog-sidebar { position: static; max-height: none; margin-bottom: 16px; padding: 14px 16px; }
html[data-ovw="narrow"] .ox-catalog-sidebar-toggle,
html[data-ovw="tiny"] .ox-catalog-sidebar-toggle { display: none; }
html[data-ovw="narrow"] .ox-workspace--sidebar-collapsed .ox-catalog-sidebar-body,
html[data-ovw="tiny"] .ox-workspace--sidebar-collapsed .ox-catalog-sidebar-body { display: block; }
html[data-ovw="narrow"] .ox-synth-panel,
html[data-ovw="tiny"] .ox-synth-panel { position: static; max-height: none; margin-top: 16px; }
html[data-ovw="narrow"] .ox-workspace,
html[data-ovw="narrow"] .ox-workspace--sidebar-collapsed,
html[data-ovw="narrow"] .ox-workspace--readonly,
html[data-ovw="tiny"] .ox-workspace,
html[data-ovw="tiny"] .ox-workspace--sidebar-collapsed,
html[data-ovw="tiny"] .ox-workspace--readonly { display: block; }
html[data-ovw="narrow"] .ox-synth-panel,
html[data-ovw="tiny"] .ox-synth-panel { display: block; }
html[data-ovw="narrow"] .ox-header-band,
html[data-ovw="tiny"] .ox-header-band { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px 16px; }
html[data-ovw="narrow"] .ox-header-band-total,
html[data-ovw="tiny"] .ox-header-band-total { text-align: left; }
html[data-ovw="narrow"] .ox-header-meta,
html[data-ovw="tiny"] .ox-header-meta { gap: 12px 22px; padding: 11px 16px; }
html[data-ovw="narrow"] .ox-doc-toolbar,
html[data-ovw="narrow"] .ox-topbar,
html[data-ovw="tiny"] .ox-doc-toolbar,
html[data-ovw="tiny"] .ox-topbar { padding-left: 14px; padding-right: 14px; }
html[data-ovw="narrow"] .ox-catalog-sidebar-title,
html[data-ovw="tiny"] .ox-catalog-sidebar-title { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 4px 0; cursor: pointer; }
html[data-ovw="narrow"] .ox-catalog-sidebar-title::after,
html[data-ovw="tiny"] .ox-catalog-sidebar-title::after { content: "\25be"; font-size: 14px; transition: transform .15s; }
html[data-ovw="narrow"] .ox-catalog--closed .ox-catalog-sidebar-title::after,
html[data-ovw="tiny"] .ox-catalog--closed .ox-catalog-sidebar-title::after { transform: rotate(-90deg); }
html[data-ovw="narrow"] .ox-catalog--closed .ox-catalog-sidebar-body > :not(.ox-catalog-sidebar-title),
html[data-ovw="tiny"] .ox-catalog--closed .ox-catalog-sidebar-body > :not(.ox-catalog-sidebar-title) { display: none; }
html[data-ovw="narrow"] .ox-catalog--closed .ox-freeline,
html[data-ovw="tiny"] .ox-catalog--closed .ox-freeline { display: none; }
html[data-ovw="narrow"] .ox-catalog--closed,
html[data-ovw="tiny"] .ox-catalog--closed { padding-bottom: 10px; }
html[data-ovw="narrow"] .ox-st-table,
html[data-ovw="tiny"] .ox-st-table { display: block; overflow-x: auto; }
html[data-ovw="narrow"] .ox-topbar,
html[data-ovw="tiny"] .ox-topbar { position: static; }

/* OvniOrder, OvniInvoice, OvniBL - contenu < 700 px */
html[data-ovw="tiny"] .ox-item-fields,
html[data-ovw="tiny"] .ox-item-margin-group { gap: 6px; }
html[data-ovw="tiny"] .ox-mini-field span { display: none; }
html[data-ovw="tiny"] .ox-catalog-results { grid-template-columns: 1fr; }
html[data-ovw="tiny"] .ox-prep-check { width: 28px; height: 28px; }
html[data-ovw="tiny"] .ox-prep-qty { width: 64px; padding: 6px 8px; font-size: 15px; }
html[data-ovw="tiny"] .ox-btn { min-height: 38px; }
html[data-ovw="tiny"] .ox-grid-table input[type=text],
html[data-ovw="tiny"] .ox-grid-table input[type=number],
html[data-ovw="tiny"] .ox-grid-table textarea,
html[data-ovw="tiny"] .ox-grid-table select,
html[data-ovw="tiny"] .ox-structure-area input,
html[data-ovw="tiny"] .ox-structure-area textarea,
html[data-ovw="tiny"] .ox-structure-area select,
html[data-ovw="tiny"] .ox-freeline input,
html[data-ovw="tiny"] .ox-freeline textarea,
html[data-ovw="tiny"] .ox-freeline select,
html[data-ovw="tiny"] .ox-search-field input,
html[data-ovw="tiny"] .ox-blmodal-table input[type=number] { font-size: 16px; min-height: 40px; }
html[data-ovw="tiny"] .ox-topbar-actions { width: 100%; margin-left: 0; }
html[data-ovw="tiny"] .ox-topbar-actions .ox-btn,
html[data-ovw="tiny"] .ox-topbar-actions select { flex: 1 1 auto; }
html[data-ovw="tiny"] .ox-doc-toolbar .ox-btn { flex: 1 1 auto; justify-content: center; }
html[data-ovw="tiny"] .ox-toolbar-spacer { display: none; }
html[data-ovw="tiny"] .ox-prep-summary { flex: 1 1 100%; justify-content: center; }
html[data-ovw="tiny"] .ox-header-value--total { font-size: 22px; }
html[data-ovw="tiny"] .ox-prep { width: 100%; padding: 8px 10px; gap: 12px; box-sizing: border-box; }
html[data-ovw="tiny"] .ox-prep-check { width: 30px; height: 30px; }
html[data-ovw="tiny"] .ox-prep-qty { width: 84px; }
html[data-ovw="tiny"] .ox-prep-of { font-size: 14px; }
html[data-ovw="tiny"] .ox-blmodal { max-width: none; padding: 16px; }
html[data-ovw="tiny"] .ox-blmodal-scroll { max-height: 56vh; overflow-x: auto; }
html[data-ovw="tiny"] .ox-confmodal-overlay { padding: 10px; }
html[data-ovw="tiny"] .ox-st-table th,
html[data-ovw="tiny"] .ox-st-table td { padding: 7px 6px; }

/* OvniQuote - contenu < 1360 px : deux colonnes (meme regle qu OvniOrder) */
html[data-ovw="mid"] .oq-workspace,
html[data-ovw="narrow"] .oq-workspace,
html[data-ovw="tiny"] .oq-workspace { grid-template-columns: 300px minmax(0, 1fr); }
html[data-ovw="mid"] .oq-workspace--sidebar-collapsed,
html[data-ovw="narrow"] .oq-workspace--sidebar-collapsed,
html[data-ovw="tiny"] .oq-workspace--sidebar-collapsed { grid-template-columns: 40px minmax(0, 1fr); }
html[data-ovw="mid"] .oq-workspace--readonly,
html[data-ovw="narrow"] .oq-workspace--readonly,
html[data-ovw="tiny"] .oq-workspace--readonly { grid-template-columns: minmax(0, 1fr); }
html[data-ovw="mid"] .oq-synth-panel,
html[data-ovw="narrow"] .oq-synth-panel,
html[data-ovw="tiny"] .oq-synth-panel { grid-column: -2 / -1; position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0 24px; align-content: start; }
html[data-ovw="mid"] .oq-synth-panel > .oq-synth-title,
html[data-ovw="narrow"] .oq-synth-panel > .oq-synth-title,
html[data-ovw="tiny"] .oq-synth-panel > .oq-synth-title { grid-column: 1 / -1; }

/* OvniQuote - contenu < 1000 px */
html[data-ovw="narrow"] .oq-header-band,
html[data-ovw="tiny"] .oq-header-band { flex-direction: column; align-items: stretch; }
html[data-ovw="narrow"] .oq-header-band-total,
html[data-ovw="tiny"] .oq-header-band-total { text-align: left; }
html[data-ovw="narrow"] .oq-actions a,
html[data-ovw="narrow"] .oq-more-actions > summary,
html[data-ovw="tiny"] .oq-actions a,
html[data-ovw="tiny"] .oq-more-actions > summary { font-size: .74em; padding: 2px 4px; gap: 4px; }
html[data-ovw="narrow"] .oq-actions a i,
html[data-ovw="narrow"] .oq-more-actions > summary i,
html[data-ovw="tiny"] .oq-actions a i,
html[data-ovw="tiny"] .oq-more-actions > summary i { margin-right: 2px; }
html[data-ovw="narrow"] .oq-workspace,
html[data-ovw="narrow"] .oq-workspace--sidebar-collapsed,
html[data-ovw="narrow"] .oq-workspace--readonly,
html[data-ovw="tiny"] .oq-workspace,
html[data-ovw="tiny"] .oq-workspace--sidebar-collapsed,
html[data-ovw="tiny"] .oq-workspace--readonly { display: block; }
html[data-ovw="narrow"] .oq-catalog-sidebar,
html[data-ovw="tiny"] .oq-catalog-sidebar { position: static; max-height: none; margin-bottom: 16px; padding: 14px 16px; }
html[data-ovw="narrow"] .oq-catalog-sidebar-toggle,
html[data-ovw="tiny"] .oq-catalog-sidebar-toggle { display: none; }
html[data-ovw="narrow"] .oq-workspace--sidebar-collapsed .oq-catalog-sidebar-body,
html[data-ovw="tiny"] .oq-workspace--sidebar-collapsed .oq-catalog-sidebar-body { display: block; }
html[data-ovw="narrow"] .oq-synth-panel,
html[data-ovw="tiny"] .oq-synth-panel { position: static; max-height: none; margin-top: 16px; }

/* OvniQuote - contenu < 700 px */
html[data-ovw="tiny"] .oq-item-fields,
html[data-ovw="tiny"] .oq-item-margin-group { gap: 6px; }
html[data-ovw="tiny"] .oq-mini-field span { display: none; }
html[data-ovw="tiny"] .oq-catalog-results { grid-template-columns: 1fr; }

/* === 2. Cartes de ligne : elles s'adaptent a leur propre largeur ============================================ */
/* Les actions d'une ligne (OvniQuote, OvniOrder) sont posees en absolu en haut a droite et le titre reserve 250 a 300 px a droite pour elles.
   Dans une colonne centrale etroite, ces 300 px ne laissent plus de place au titre et les elements se chevauchent. En dessous de 820 px de
   largeur de carte, les actions passent sur leur propre rangee, sous la ligne, et le titre reprend toute la largeur. */
html .oq-line, html .ox-line { flex-wrap: wrap; container-type: inline-size; }
html .oq-line-body, html .ox-line-body { min-width: 0; }
@container (max-width: 819px) {
	html .oq-line > .oq-line-actions, html .ox-line > .ox-line-actions { position: static; flex: 1 0 100%; order: 9; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
	html .oq-line--item .oq-item-top, html .ox-line--item .ox-item-top { padding-right: 0; }
}

/* === 3. Defilement ======================================================================================== */
/* Le catalogue et la synthese sont collants et defilent dans leur propre cadre : sur un ecran peu haut ou avec la barre d'adresse mobile,
   le bas du cadre restait inatteignable (100vh depasse la zone visible : 100dvh la mesure). Le defilement garde son chainage par defaut :
   au bout du cadre, la molette fait defiler la page (un « contain » aurait piege la molette sur ces panneaux). La grille de lignes qui
   defile en largeur ne passe plus la main a la page quand on atteint son bord gauche ou droit. */
html .oq-catalog-sidebar, html .oq-synth-panel, html .ox-catalog-sidebar, html .ox-synth-panel {
	max-height: calc(100vh - 80px);
	max-height: calc(100dvh - 80px);
}
html .ox-grid-viewport, html .ox-lines-list, html .ox-blmodal-scroll { overscroll-behavior-x: contain; }

/* === 4. Grilles de lignes sans defilement horizontal ============================================== */
/* js/adapt.js essaie la mise en page par defaut, puis « synthese sous les lignes » (html[data-ovg^="twocol"]), puis « catalogue en tiroir » (html[data-ovg="stack"] : bouton flottant, synthese sous
   les lignes), puis « cartes » (html[data-ovg="cards"] : une carte par ligne, toutes les colonnes y figurent). Il garde la premiere qui tient
   sans defilement horizontal ; sous 700 px de contenu, ce sont toujours des cartes. */
/* -- OvniOrder / OvniBL / OvniInvoice : catalogue empile (colonnes trop etroites) -- */
html[data-ovg]:not([data-ovg^="twocol"]) .ox-workspace, html[data-ovg] .ox-workspace--sidebar-collapsed, html[data-ovg] .ox-workspace--readonly { display: block; }
/* Catalogue en tiroir : il glisse depuis la droite (depuis le bas sous 700 px), ouvert par le bouton flottant ou « Ajouter un article ». */
html[data-ovg]:not([data-ovg^="twocol"]) .ox-catalog-sidebar { position: fixed; z-index: 1210; top: 0; right: 0; bottom: 0; left: auto; width: min(440px, 100vw); max-height: none; margin: 0; padding: 0 16px 16px; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px 0 0 16px; box-shadow: -14px 0 44px rgba(15, 23, 42, .28); transform: none; transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-catalog--closed { transform: translateX(105%); visibility: hidden; box-shadow: none; transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s .24s; }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-catalog-sidebar-toggle { display: none; }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-workspace--sidebar-collapsed .ox-catalog-sidebar-body { display: block; }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-catalog-sidebar-title { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 8px; padding: 14px 16px 10px; background: var(--ox-surface, #fff); border-bottom: 1px solid var(--ox-border, #e3e6ea); font-size: .85em; cursor: pointer; }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-catalog-sidebar-title::after { content: "\2715"; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ox-primary-soft, #eef2ff); color: var(--ox-primary, #2f5fe0); font-size: 15px; }
html[data-ovw="tiny"][data-ovg] .ox-catalog-sidebar { top: auto; left: 0; right: 0; width: auto; height: min(84vh, 680px); border-radius: 18px 18px 0 0; box-shadow: 0 -14px 44px rgba(15, 23, 42, .28); }
html[data-ovw="tiny"][data-ovg] .ox-catalog--closed { transform: translateY(105%); }
html[data-ovw="tiny"][data-ovg] .ox-catalog-sidebar-title { padding-top: 22px; }
html[data-ovw="tiny"][data-ovg] .ox-catalog-sidebar-title::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--ox-border-strong, #c9ced6); }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-synth-panel { position: static; max-height: none; margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0 24px; align-content: start; }
html[data-ovg]:not([data-ovg^="twocol"]) .ox-synth-panel > .ox-synth-title { grid-column: 1 / -1; }
/* -- OvniOrder / OvniBL / OvniInvoice : la grille devient une liste de cartes, toutes les colonnes y sont -- */
html[data-ovg="cards"] .ox-grid-viewport,
html[data-ovg="cards"] .ox-lines-list { overflow: visible; }
html[data-ovg="cards"] .ox-grid-table { display: block; width: 100%; min-width: 0 !important; table-layout: auto; }
html[data-ovg="cards"] .ox-grid-table colgroup,
html[data-ovg="cards"] .ox-grid-table thead,
html[data-ovg="cards"] .ox-grid-table tfoot { display: none; }
html[data-ovg="cards"] .ox-grid-table tbody { display: block; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-form { display: block; height: 0; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-form > td { display: block; height: 0; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item,
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr)); gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--ox-border); }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td { display: block; min-width: 0; padding: 0 !important; border: 0 !important; width: auto !important; text-align: left; background: transparent; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ox-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-act { grid-column: 1 / -1; order: -4; text-align: right; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-act .ox-actions { justify-content: flex-end; gap: 4px; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-act .ox-btn,
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-act button { opacity: 1; min-width: 36px; min-height: 36px; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-ref { grid-column: 1 / -1; order: -3; font-size: 12px; font-weight: 700; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-desc { grid-column: 1 / -1; order: -2; margin-bottom: 4px; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-prep { grid-column: 1 / -1; order: -1; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td.ox-c-totht { text-align: right; font-weight: 800; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td input[type=text],
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td input[type=number],
html[data-ovg="cards"] .ox-grid-table tr.ox-row-item > td textarea { width: 100%; box-sizing: border-box; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct > td { display: block; padding: 0 !important; border: 0 !important; grid-column: 1 / -1; width: auto !important; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct .ox-line { flex-wrap: wrap; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct .ox-line-body { flex: 1 1 100%; flex-wrap: wrap; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct .ox-line-actions { position: static; flex: 1 1 100%; justify-content: flex-end; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct .ox-line-body input[type=text],
html[data-ovg="cards"] .ox-grid-table tr.ox-row-struct .ox-line-body textarea { width: 100% !important; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-insert { display: block; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-insert > td { display: block; }
html[data-ovg="cards"] .ox-insert-top { height: auto; opacity: 1; font-size: 12px; padding: 6px 0; }
html[data-ovg="cards"] .ox-grid-table tr.ox-row-insert .ox-insert-here-row-div { height: auto; opacity: 1; padding: 4px 0; }
/* -- OvniQuote : catalogue empile (colonnes trop etroites) -- */
html[data-ovg]:not([data-ovg^="twocol"]) .oq-workspace, html[data-ovg] .oq-workspace--sidebar-collapsed, html[data-ovg] .oq-workspace--readonly { display: block; }
/* Catalogue en tiroir : il glisse depuis la droite (depuis le bas sous 700 px), ouvert par le bouton flottant ou « Ajouter un article ». */
html[data-ovg]:not([data-ovg^="twocol"]) .oq-catalog-sidebar { position: fixed; z-index: 1210; top: 0; right: 0; bottom: 0; left: auto; width: min(440px, 100vw); max-height: none; margin: 0; padding: 0 16px 16px; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px 0 0 16px; box-shadow: -14px 0 44px rgba(15, 23, 42, .28); transform: none; transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-catalog--closed { transform: translateX(105%); visibility: hidden; box-shadow: none; transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s .24s; }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-catalog-sidebar-toggle { display: none; }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-workspace--sidebar-collapsed .oq-catalog-sidebar-body { display: block; }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-catalog-sidebar-title { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 8px; padding: 14px 16px 10px; background: var(--oq-surface, #fff); border-bottom: 1px solid var(--oq-border, #e3e6ea); font-size: .85em; cursor: pointer; }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-catalog-sidebar-title::after { content: "\2715"; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--oq-primary-soft, #eef2ff); color: var(--oq-primary, #2f5fe0); font-size: 15px; }
html[data-ovw="tiny"][data-ovg] .oq-catalog-sidebar { top: auto; left: 0; right: 0; width: auto; height: min(84vh, 680px); border-radius: 18px 18px 0 0; box-shadow: 0 -14px 44px rgba(15, 23, 42, .28); }
html[data-ovw="tiny"][data-ovg] .oq-catalog--closed { transform: translateY(105%); }
html[data-ovw="tiny"][data-ovg] .oq-catalog-sidebar-title { padding-top: 22px; }
html[data-ovw="tiny"][data-ovg] .oq-catalog-sidebar-title::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--oq-border-strong, #c9ced6); }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-synth-panel { position: static; max-height: none; margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0 24px; align-content: start; }
html[data-ovg]:not([data-ovg^="twocol"]) .oq-synth-panel > .oq-synth-title { grid-column: 1 / -1; }
/* -- OvniQuote : la grille devient une liste de cartes, toutes les colonnes y sont -- */
html[data-ovg="cards"] .oq-grid-viewport,
html[data-ovg="cards"] .oq-lines-list { overflow: visible; }
html[data-ovg="cards"] .oq-grid-table { display: block; width: 100%; min-width: 0 !important; table-layout: auto; }
html[data-ovg="cards"] .oq-grid-table colgroup,
html[data-ovg="cards"] .oq-grid-table thead,
html[data-ovg="cards"] .oq-grid-table tfoot { display: none; }
html[data-ovg="cards"] .oq-grid-table tbody { display: block; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-form { display: block; height: 0; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-form > td { display: block; height: 0; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item,
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr)); gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--oq-border); }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td { display: block; min-width: 0; padding: 0 !important; border: 0 !important; width: auto !important; text-align: left; background: transparent; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--oq-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-act { grid-column: 1 / -1; order: -4; text-align: right; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-act .oq-actions { justify-content: flex-end; gap: 4px; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-act .oq-btn,
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-act button { opacity: 1; min-width: 36px; min-height: 36px; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-ref { grid-column: 1 / -1; order: -3; font-size: 12px; font-weight: 700; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-desc { grid-column: 1 / -1; order: -2; margin-bottom: 4px; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-totht { text-align: right; font-weight: 800; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td input[type=text],
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td input[type=number],
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td textarea { width: 100%; box-sizing: border-box; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct > td { display: block; padding: 0 !important; border: 0 !important; grid-column: 1 / -1; width: auto !important; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct .oq-line { flex-wrap: wrap; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct .oq-line-body { flex: 1 1 100%; flex-wrap: wrap; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct .oq-line-actions { position: static; flex: 1 1 100%; justify-content: flex-end; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct .oq-line-body input[type=text],
html[data-ovg="cards"] .oq-grid-table tr.oq-row-struct .oq-line-body textarea { width: 100% !important; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-insert { display: block; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-insert > td { display: block; }
html[data-ovg="cards"] .oq-insert-top { height: auto; opacity: 1; font-size: 12px; padding: 6px 0; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-insert .oq-insert-here-row-div { height: auto; opacity: 1; padding: 4px 0; }
html[data-ovg="cards"] .oq-lines-list.oq-grid,
html[data-ovg="cards"] .oq-grid-scroll { overflow: visible; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-item > td.oq-c-drag { display: none; }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-anomaly { background: rgba(180, 35, 24, .07); }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-dirty { background: var(--oq-warning-soft, #fdf3e2); box-shadow: inset 3px 0 0 var(--oq-warning, #b26b00); }
html[data-ovg="cards"] .oq-grid-table tr.oq-row-dirty > td:first-child { box-shadow: none; }
html[data-ovg="cards"] .oq-insert-here-row-div a { opacity: .7; padding: 4px 0; }
html[data-ovg^="twocol"] .ox-workspace { grid-template-columns: 300px minmax(0, 1fr); }
html[data-ovg^="twocol"] .ox-workspace--sidebar-collapsed { display: grid; grid-template-columns: 40px minmax(0, 1fr); }
html[data-ovg^="twocol"] .ox-workspace--readonly { grid-template-columns: minmax(0, 1fr); }
html[data-ovg="twocol-rail"] .ox-synth-panel,
html[data-ovg^="twocol"] .ox-synth-panel { grid-column: -2 / -1; position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0 24px; align-content: start; }
html[data-ovg="twocol-rail"] .ox-synth-panel > .ox-synth-title,
html[data-ovg^="twocol"] .ox-synth-panel > .ox-synth-title { grid-column: 1 / -1; }
html[data-ovg^="twocol"] .oq-workspace { grid-template-columns: 300px minmax(0, 1fr); }
html[data-ovg^="twocol"] .oq-workspace--sidebar-collapsed { display: grid; grid-template-columns: 40px minmax(0, 1fr); }
html[data-ovg^="twocol"] .oq-workspace--readonly { grid-template-columns: minmax(0, 1fr); }
html[data-ovg="twocol-rail"] .oq-synth-panel,
html[data-ovg^="twocol"] .oq-synth-panel { grid-column: -2 / -1; position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0 24px; align-content: start; }
html[data-ovg="twocol-rail"] .oq-synth-panel > .oq-synth-title,
html[data-ovg^="twocol"] .oq-synth-panel > .oq-synth-title { grid-column: 1 / -1; }

/* Etat « twocol-tight » : comme twocol, mais catalogue plus etroit et designation ramenee a ~240 px (plancher pose par adapt.js dans --ovg-comfort)
   pour garder le catalogue a cote des lignes sur les ecrans un peu justes avant de l'empiler. */
html[data-ovg="twocol-tight"] .ox-workspace, html[data-ovg="twocol-tight"] .oq-workspace { grid-template-columns: 240px minmax(0, 1fr); }
html[data-ovg="twocol-tight"] .ox-workspace--sidebar-collapsed, html[data-ovg="twocol-tight"] .oq-workspace--sidebar-collapsed { grid-template-columns: 40px minmax(0, 1fr); }
html[data-ovg="twocol-tight"] .ox-workspace--readonly, html[data-ovg="twocol-tight"] .oq-workspace--readonly { grid-template-columns: minmax(0, 1fr); }
html[data-ovg="twocol-tight"] table.ox-grid-table, html[data-ovg="twocol-tight"] table.oq-grid-table { min-width: var(--ovg-comfort, 0) !important; }

/* Etat « rail » : plus la place pour le catalogue a cote d'une designation lisible. Il se replie en bande etroite (le bouton « < » des fiches)
   et se deplie PAR-DESSUS les lignes (rien ne se decale) ; designation ramenee a ~130 px au minimum (--ovg-min). */
html[data-ovg="twocol-rail"] .ox-workspace, html[data-ovg="twocol-rail"] .oq-workspace,
html[data-ovg="twocol-rail"] .ox-workspace--sidebar-collapsed, html[data-ovg="twocol-rail"] .oq-workspace--sidebar-collapsed { display: grid; grid-template-columns: 44px minmax(0, 1fr); }
html[data-ovg="twocol-rail"] .ox-workspace--readonly, html[data-ovg="twocol-rail"] .oq-workspace--readonly { grid-template-columns: minmax(0, 1fr); }
html[data-ovg="twocol-rail"] table.ox-grid-table, html[data-ovg="twocol-rail"] table.oq-grid-table { min-width: var(--ovg-min, 0) !important; }
html[data-ovg="twocol-rail"] .ox-workspace:not(.ox-workspace--sidebar-collapsed):not(.ox-workspace--readonly) .ox-catalog-sidebar,
html[data-ovg="twocol-rail"] .oq-workspace:not(.oq-workspace--sidebar-collapsed):not(.oq-workspace--readonly) .oq-catalog-sidebar { width: 330px; max-width: calc(100vw - 32px); z-index: 60; box-shadow: 0 16px 40px rgba(15, 23, 42, .28); }
html[data-ovg="twocol-rail"] .ox-workspace--sidebar-collapsed .ox-catalog-sidebar, html[data-ovg="twocol-rail"] .oq-workspace--sidebar-collapsed .oq-catalog-sidebar { cursor: pointer; }
html[data-ovg="twocol-rail"] .ox-workspace--sidebar-collapsed .ox-catalog-sidebar::after, html[data-ovg="twocol-rail"] .oq-workspace--sidebar-collapsed .oq-catalog-sidebar::after { content: attr(aria-label); display: block; writing-mode: vertical-rl; margin: 10px auto 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ox-text-muted, var(--oq-text-muted, #64748b)); white-space: nowrap; }

html[data-ovs-measure] .ox-workspace, html[data-ovs-measure] .oq-workspace { transition: none !important; }

/* Bouton flottant et voile du tiroir du catalogue (crees par adapt.js quand le catalogue ne tient plus a cote des lignes). */
.ovs-fab, .ovs-scrim { display: none; }
.ovs-fab { position: fixed; z-index: 1195; right: 18px; bottom: 18px; align-items: center; gap: 8px; padding: 0 20px; height: 48px; border: 0; border-radius: 999px; background: var(--ox-primary, var(--oq-primary, #2f5fe0)); color: #fff; font: 700 14px/1 inherit; font-family: inherit; box-shadow: 0 8px 24px rgba(15, 23, 42, .32); cursor: pointer; }
.ovs-fab:active { transform: scale(.97); }
.ovs-scrim { position: fixed; z-index: 1200; inset: 0; background: rgba(15, 23, 42, .5); }
html[data-ovs-drawer="closed"] .ovs-fab { display: inline-flex; }
html[data-ovs-drawer="open"] .ovs-scrim { display: block; }
html[data-ovs-drawer="open"] { overflow: hidden; }
