/* Shared visual hierarchy for article, packaging, supplier-price and matching dialogs. */
.app-theme dialog.catalog-dialog{padding:0;width:min(720px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:hidden;border:1px solid var(--color-border,#e5e8ed);border-radius:16px;color:var(--color-text,#20242c);background:var(--color-surface,#fff)}
.app-theme dialog.catalog-dialog[open]{display:flex;flex-direction:column}.app-theme dialog.catalog-dialog.achats-wide-dialog{width:min(1320px,calc(100vw - 32px))}
.catalog-dialog .catalog-dialog-head{display:flex;align-items:flex-start;justify-content:space-between;flex-wrap:nowrap;gap:20px;margin:0;padding:22px 24px 18px;border-bottom:1px solid var(--color-border,#e5e8ed);flex:none;background:var(--color-surface,#fff)}
.catalog-dialog-head>div:first-child{min-width:0}.catalog-dialog .catalog-dialog-head h2,.catalog-dialog .catalog-dialog-head h5{font-size:21px;line-height:1.35;letter-spacing:-.35px;font-weight:700;margin:3px 0 0;color:var(--color-text,#20242c)}
.catalog-eyebrow{display:block;font-size:10px;font-weight:700;letter-spacing:.8px;text-transform:uppercase;color:var(--color-text-secondary,#758094)}.catalog-dialog-head p{font-size:12px;line-height:1.6;color:var(--color-text-secondary,#758094);margin:7px 0 0}.catalog-dialog-head>.achats-actions{flex:none;flex-wrap:nowrap;align-items:center;gap:8px}
.app-theme .catalog-dialog .catalog-close{width:36px;min-width:36px;height:36px;min-height:36px;padding:0;display:inline-grid;place-items:center;font-size:22px;font-weight:400;line-height:1;background:var(--color-background,#f5f6f8);color:var(--color-text-secondary,#758094)}
.catalog-dialog-form{display:flex;flex-direction:column;min-height:0;margin:0;overflow:hidden}.catalog-dialog .catalog-dialog-body{padding:20px 24px;min-height:0;overflow:auto;overscroll-behavior:contain;background:#f7f8fa}.catalog-dialog .catalog-dialog-body>form{min-width:0;margin:0}
.catalog-section{background:var(--color-surface,#fff);padding:18px;border:1px solid var(--color-border,#e5e8ed);border-radius:11px;margin:0 0 16px;min-width:0}.catalog-section:last-child{margin-bottom:0}.catalog-section-title{display:flex;align-items:flex-start;gap:10px;margin-bottom:16px}.catalog-section-title>div{min-width:0}.catalog-dialog .catalog-section-title h3{font-size:14px;font-weight:700;line-height:1.5;margin:1px 0 0;color:var(--color-text,#20242c)}.catalog-section-title p{font-size:11px;color:var(--color-text-secondary,#758094);line-height:1.6;margin:4px 0 0}.catalog-step{display:grid;place-items:center;flex:none;width:27px;height:27px;border-radius:8px;color:var(--color-primary,#ef0017);background:var(--color-primary-light,#fff0f2);font-size:12px;font-weight:700}
.catalog-dialog .achats-editor-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;margin:0}.catalog-dialog .achats-editor-grid .full{grid-column:1/-1}.catalog-dialog .achats-editor-grid>div{min-width:0}.catalog-dialog .achats-editor-grid>[hidden],.catalog-dialog [hidden]{display:none!important}
.catalog-dialog label{display:block;font-size:12px;font-weight:600;line-height:1.5;color:var(--color-text,#20242c);margin:0 0 6px}.catalog-dialog :is(.form-control,.custom-select){width:100%;font-size:13px}.catalog-dialog small{display:block;font-size:11px;line-height:1.6;color:var(--color-text-secondary,#758094);margin-top:6px}.catalog-required-note{font-size:10px;color:var(--color-text-secondary,#758094);margin:0 0 12px}.catalog-dialog .catalog-optional{margin:14px 0 0;padding-top:12px;border-top:1px solid var(--color-border,#e5e8ed)}.catalog-optional summary{font-size:12px;font-weight:600;color:var(--color-text-secondary,#758094);cursor:pointer;padding:5px 0;min-height:30px}.catalog-optional[open]>summary{margin-bottom:12px}.catalog-dialog .catalog-optional .achats-editor-grid{margin-top:10px}
.catalog-dialog .catalog-dialog-foot{flex:none;display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:16px 24px;border-top:1px solid var(--color-border,#e5e8ed);background:var(--color-surface,#fff)}.catalog-dialog-foot>p{font-size:11px;line-height:1.6;color:var(--color-text-secondary,#758094);margin:0;max-width:380px}.catalog-foot-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex:none}.app-theme .catalog-dialog .catalog-dialog-foot .btn{min-height:44px;font-size:12px;white-space:normal}.app-theme .catalog-dialog .button-blue{background:var(--color-background,#f5f6f8);color:var(--color-text,#20242c)}.app-theme .catalog-dialog .button-blue:hover{background:#e9ecf1}.app-theme .catalog-dialog .catalog-tertiary{background:transparent;color:var(--color-text-secondary,#758094);padding-left:0}.app-theme .catalog-dialog .catalog-destructive{background:transparent;color:var(--color-primary-dark,#a70019)}
.catalog-dialog .catalog-dialog-error:empty{display:none}.catalog-dialog .catalog-dialog-error{flex:none;font-size:12px;line-height:1.6;margin:0;padding:12px 24px;background:var(--color-primary-light,#fff0f2);color:var(--color-primary-dark,#a70019)}
.catalog-dialog .catalog-price-result{padding:16px;border:1px solid var(--color-border,#e5e8ed);border-radius:9px;background:var(--color-background,#f5f6f8);line-height:1.6;color:var(--color-text,#20242c);font-size:12px}.catalog-price-result .catalog-result-label{display:block;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--color-text-secondary,#758094);margin-bottom:4px}.catalog-price-result strong{display:block;font-size:23px;line-height:1.3;letter-spacing:-.4px;font-weight:700;margin-bottom:4px}.catalog-price-result small{font-size:11px}.catalog-auto-name{font-size:12px;margin:0;color:var(--color-text-secondary,#758094)}
.catalog-dialog label.catalog-check{display:flex;align-items:flex-start;gap:10px;font-weight:400;font-size:12px;line-height:1.6;margin:0 0 12px}.catalog-check:last-child{margin-bottom:0}.catalog-check input[type=checkbox]{flex:none;width:16px;height:16px;min-height:0;margin:2px 0 0}.catalog-check strong{display:block;font-size:12px;font-weight:600}.catalog-check small{margin:2px 0 0}.catalog-dialog .catalog-check-warning{padding-top:12px;border-top:1px solid var(--color-border,#e5e8ed)}
.catalog-invoice-summary{border:1px solid var(--color-border,#e5e8ed);border-radius:11px;padding:16px 18px;background:var(--color-surface,#fff);margin-bottom:16px;font-size:11px;color:var(--color-text-secondary,#758094);line-height:1.7}.catalog-invoice-summary strong{display:block;color:var(--color-text,#20242c);font-size:15px;line-height:1.5;margin:3px 0 5px}.catalog-invoice-metrics{display:flex;flex-wrap:wrap;gap:8px 20px;margin-top:10px;padding-top:10px;border-top:1px solid var(--color-border,#e5e8ed)}.catalog-invoice-metrics b{font-weight:600;color:var(--color-text,#20242c)}.catalog-dialog .catalog-selection{display:block;padding:12px 14px;border:1px solid var(--color-border,#e5e8ed);border-radius:8px;font-size:12px;line-height:1.7;margin-top:10px;background:var(--color-background,#f5f6f8)}.catalog-selection:empty{display:none!important}.catalog-inline-note{font-size:11px;line-height:1.7;color:var(--color-text-secondary,#758094);padding:10px 0 0;margin:0}.catalog-dialog .matching-catalog-actions{gap:8px}.catalog-dialog .matching-catalog-actions .btn{font-size:11px;min-height:36px;white-space:normal;text-align:left}.catalog-dialog .achats-product-results button{padding:12px 14px;min-height:44px}.catalog-dialog .achats-product-results button small{margin-top:3px}
.catalog-dialog #matching-editor-layout.achats-pdf-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start}.catalog-dialog #matching-editor-layout>iframe{position:sticky;top:0;height:calc(100dvh - 240px);min-height:300px;width:100%;border:0;border-radius:9px}.catalog-dialog #matching-create-layout.has-pdf{gap:20px}.catalog-dialog .catalog-invoice-panel{height:calc(100dvh - 270px);min-height:290px;border:1px solid var(--color-border,#e5e8ed);padding:14px;background:var(--color-surface,#fff)}.catalog-dialog .catalog-invoice-heading h3{font-size:13px}.catalog-dialog .catalog-invoice-heading .btn{min-height:36px;font-size:11px}.catalog-dialog .catalog-invoice-panel>.matching-catalog-help{font-size:10px}.catalog-dialog #catalog-pdf-unavailable{padding:10px 24px}
.catalog-dialog.modal-content{max-height:calc(100dvh - 48px);overflow:hidden;border-radius:16px;border:0}.catalog-dialog.modal-content .catalog-dialog-form{flex:1}.catalog-dialog.modal-content .catalog-dialog-body{max-height:none}.catalog-dialog .catalog-dialog-head .close{float:none;margin:0;opacity:1}
.catalog-dialog-foot>.catalog-foot-actions:last-child{margin-left:auto}
@media(max-width:767px){.catalog-dialog.catalog-pdf-focused #matching-form,.catalog-dialog.catalog-pdf-focused>.catalog-dialog-foot{display:none!important}.catalog-dialog.catalog-pdf-focused .catalog-invoice-panel{height:calc(100dvh - 210px)!important}.catalog-dialog.catalog-pdf-focused #matching-pdf{height:calc(100dvh - 210px);min-height:250px}}
@media(max-width:767px){.catalog-dialog .catalog-dialog-head{position:relative}.catalog-dialog .catalog-dialog-head>div:first-child{flex:1 1 100%;padding-right:48px}.catalog-dialog .catalog-dialog-head>.achats-actions{width:100%;justify-content:flex-start}.app-theme .catalog-dialog .catalog-dialog-head .catalog-close{position:absolute;right:14px;top:14px;width:44px;min-width:44px;height:44px;min-height:44px;margin:0}.catalog-dialog .catalog-dialog-head #catalog-pdf-toggle{max-width:none}.catalog-dialog .catalog-dialog-head>.achats-actions>.btn:not(.catalog-close){white-space:nowrap}}
@media(max-width:767px){.app-theme dialog.catalog-dialog{max-height:calc(100dvh - 24px);width:calc(100vw - 24px);border-radius:13px}.catalog-dialog .catalog-dialog-head{padding:16px;gap:10px;flex-wrap:wrap}.catalog-dialog .catalog-dialog-head h2,.catalog-dialog .catalog-dialog-head h5{font-size:18px}.catalog-dialog-head p{font-size:11px}.catalog-dialog .catalog-dialog-head>div:first-child{flex:1 1 150px}.catalog-dialog .catalog-dialog-body{padding:14px;}.catalog-dialog .catalog-section{padding:14px;margin-bottom:12px}.catalog-dialog .achats-editor-grid{grid-template-columns:minmax(0,1fr)}.catalog-dialog .catalog-dialog-foot{padding:12px 14px;gap:10px;flex-wrap:wrap}.catalog-dialog-foot>p{font-size:10px;max-width:none;width:100%}.catalog-dialog .catalog-foot-actions{flex:1;gap:8px}.catalog-foot-actions>.btn-primary{flex:1}.catalog-dialog .catalog-dialog-head .btn,.catalog-dialog .catalog-invoice-heading .btn,.catalog-dialog .matching-catalog-actions .btn{min-height:44px}.catalog-dialog .catalog-close{margin-left:auto}.catalog-dialog .catalog-dialog-head>.achats-actions{gap:6px}.catalog-dialog .catalog-dialog-head #catalog-pdf-toggle{max-width:130px;font-size:11px}.catalog-dialog .catalog-optional summary{min-height:44px;display:list-item;padding:12px 0}.catalog-dialog label.catalog-check{padding:6px 0;min-height:44px}.catalog-dialog .catalog-dialog-error{padding:10px 14px}.catalog-dialog .catalog-invoice-panel{height:calc(100dvh - 270px)!important;min-height:250px;max-height:none}.catalog-dialog #matching-editor-layout.achats-pdf-grid{grid-template-columns:minmax(0,1fr)}.catalog-dialog #matching-editor-layout>iframe{position:static;height:420px}.catalog-dialog.modal-content{max-height:calc(100dvh - 28px)}.catalog-dialog .catalog-price-result strong{font-size:22px}}

html:has(dialog[open] iframe[src*="pdf_viewer.php"]),html:has(#modalPdfViewer.show iframe[src*="pdf_viewer.php"]){overscroll-behavior-x:none}

/* Native radios presented as two quick choices; arrow keys and focus stay accessible. */
.catalog-quantity-choice{border:0;padding:0;margin:0 0 8px;min-width:0}.catalog-dialog .catalog-quantity-choice legend{float:none;width:auto;margin:0 0 8px;padding:0;font-size:12px;line-height:1.5;font-weight:600;color:var(--color-text,#20242c)}
.catalog-quantity-options{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}.catalog-dialog .catalog-quantity-options label{position:relative;margin:0;cursor:pointer;min-width:0}.catalog-quantity-options input[type=radio]{position:absolute;width:1px;height:1px;opacity:0;margin:0;overflow:hidden}.catalog-quantity-options label>span{display:flex;flex-direction:column;justify-content:flex-start;min-height:58px;height:100%;box-sizing:border-box;padding:9px 12px;border:1px solid var(--color-border,#e5e8ed);border-radius:8px;background:var(--color-surface,#fff);color:var(--color-text,#20242c);transition:background .15s,border-color .15s}.catalog-quantity-options strong{overflow-wrap:anywhere;font-size:12px;font-weight:600;line-height:1.5}.catalog-dialog .catalog-quantity-options small{font-size:10px;line-height:1.5;margin:2px 0 0;padding-right:14px;overflow-wrap:anywhere}.catalog-quantity-options label:hover>span{background:#f5f6f8;border-color:#abb4c1}.catalog-quantity-options input:checked+span{border-color:var(--color-primary,#ef0017);background:var(--color-primary-light,#fff0f2)}.catalog-quantity-options input:checked+span:after{content:'✓';position:absolute;right:10px;bottom:9px;color:var(--color-primary,#ef0017);font-size:14px;font-weight:700}.catalog-quantity-options input:focus-visible+span{outline:2px solid var(--color-primary,#ef0017);outline-offset:2px}

/* Matching review: separate the product identity, supplier and actual purchase. */
.catalog-selection .matching-identity{display:flex;gap:10px;align-items:flex-start}.matching-identity>i{font-size:18px;margin-top:3px;color:var(--color-primary)}.matching-identity strong{display:block;font-size:14px}.matching-supplier-line{display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin-top:8px}.matching-review{padding:14px;border:1px solid var(--color-border);border-radius:9px;margin-bottom:16px;background:var(--color-surface)}.matching-review dl{display:grid;grid-template-columns:110px minmax(0,1fr);gap:7px 12px;margin:0;font-size:12px;line-height:1.6}.matching-review dt{font-weight:400;color:var(--color-text-secondary)}.matching-review dd{margin:0;font-weight:600;overflow-wrap:anywhere}.catalog-dialog .achats-product-results button{display:block;width:100%;text-align:left}.catalog-dialog .matching-price-missing{color:var(--color-primary-dark);font-weight:600}.catalog-dialog input[readonly]{background:var(--color-background)}
@media(max-width:767px){.matching-review dl{grid-template-columns:90px minmax(0,1fr)}.catalog-dialog .matching-supplier-line{align-items:flex-start}}

/* Keep the disabled validation action explainable by mouse, keyboard and touch. */
.catalog-action-help{position:relative;display:inline-flex;max-width:100%;border-radius:8px}
.catalog-action-help>.btn{width:100%}.catalog-action-help.is-blocked{cursor:help}
.catalog-action-help.is-blocked>.btn:disabled{pointer-events:none}
.catalog-action-tooltip{display:none;position:absolute;bottom:calc(100% + 8px);right:0;width:min(320px,calc(100vw - 64px));padding:12px 14px;border:1px solid var(--color-border);border-radius:10px;background:var(--color-surface,#fff);color:var(--color-text);box-shadow:0 4px 18px rgba(0,0,0,.12);font-size:12px;font-weight:400;line-height:1.6;text-align:left;white-space:normal;z-index:20}
.catalog-action-help.is-blocked:hover>.catalog-action-tooltip,.catalog-action-help.is-blocked:focus-within>.catalog-action-tooltip{display:block}
.catalog-action-help:focus-visible{outline:2px solid var(--color-primary);outline-offset:3px}
@media(max-width:767px){.catalog-foot-actions>.catalog-action-help{flex:1}}
