/* Shared visual charter. Page styles describe layout; controls use these tokens. */
:root {
  --table-heading:#edf1ef;
  --stock-category:#dce6e8;
  --stock-product:#eef2f2;
}

/* Save feedback never participates in page or dialog layout. */
:root .topbar .sync-state { display:block;width:124px;min-width:124px;max-width:none;text-align:right;font-size:11px;line-height:1.3;white-space:nowrap; }
:root .topbar .top-actions { flex-shrink:0; }
:root #toast { inset:auto 14px 14px auto;margin:0;max-width:min(330px,calc(100vw - 28px));padding:8px 12px;border:0;font-size:12px;line-height:1.4; }
:root .workspace-alert { position:fixed;inset:auto 14px 14px auto;margin:0;width:min(330px,calc(100vw - 28px));padding:10px 12px;display:block;border-radius:6px;z-index:30;font-size:12px;box-shadow:var(--shadow);color:var(--ink); }
:root .workspace-alert p { font-size:12px;line-height:1.4;margin:4px 0 0; }
:root .workspace-alert.is-blocked { width:min(420px,calc(100vw - 28px)); }
:root .workspace-alert .settings-inline-actions { margin-top:10px;gap:6px; }
:root .workspace-alert .settings-inline-actions:empty { display:none; }
:root .workspace-alert[hidden] { display:none!important; }

/* One size for actions, tabs and fields; icon actions use the same square. */
:root .button, :root .button.small, :root .inventory-flow-card {
  align-items:center;justify-content:center;gap:7px;
  min-height:var(--control-height);height:auto;padding:8px 12px;
  border-radius:var(--control-radius);font-size:13px;font-weight:650;line-height:1.35;
  text-decoration:none;white-space:normal;
}
:root .button.icon-button, :root .button.pc-icon-button {
  width:var(--control-height);min-width:var(--control-height);height:var(--control-height);
  padding:9px;flex-shrink:0;
}
:root .drag-buttons button, :root .menu-button {
  min-width:var(--control-height);min-height:var(--control-height);padding:8px;border-radius:var(--control-radius);
}
:root .control-icon { width:18px;height:18px;flex-shrink:0; }
:root .button:hover:not(:disabled) { filter:none;box-shadow:inset 0 0 0 1px currentColor; }
:root .button:disabled { opacity:.45;cursor:default;box-shadow:none; }
:root .field label { font-size:12px;font-weight:650;text-transform:none;letter-spacing:0;color:var(--muted); }
:root .field :is(input,select), :root .toolbar :is(input,select),
:root .product-costs :is(select,input[type=number]), :root .pc-chooser select {
  min-height:var(--control-height);padding:8px 10px;border-radius:var(--control-radius);font-size:13px;
}
:root select:not([multiple]) { padding-right:28px; }
:root :is(main,dialog) select:not([multiple]) {
  min-height:var(--control-height);padding:8px 28px 8px 10px;
  border:1px solid var(--line);border-radius:var(--control-radius);
  background-color:#fff;color:var(--ink);font-size:13px;font-weight:400;
}
:root .field textarea { min-height:72px;padding:10px;border-radius:var(--control-radius);font-size:13px; }
:root input[type=checkbox] { accent-color:var(--navy); }
:root :is(button,a,input,select,textarea,summary):focus-visible { outline:2px solid var(--navy);outline-offset:2px; }
.sidebar .nav-link:focus-visible { outline-color:var(--orange); }
:root .composer-menu>div>button { min-height:var(--control-height);font-size:13px;padding:8px 12px; }
:root .product-tabs button { min-height:var(--control-height);padding:8px 12px;font-size:13px; }
:root .language-tabs button { min-width:var(--control-height);min-height:var(--control-height);padding:8px 10px;font-size:13px; }

/* One compact title bar, then tabs/actions and filters in the same rhythm. */
:root .topbar { height:56px;flex-basis:56px;padding:0 20px;gap:12px; }
:root .topbar h1 { font-size:25px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
:root body:not(.publication-route) .page { padding:16px 20px 32px; }
.publication-route .page { padding:16px 20px 8px; }
.page-controls { display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:12px;min-height:40px; }
.page-caption { font-size:13px;line-height:1.45;color:var(--muted);margin:0 0 12px; }
.page-controls .page-caption { margin:0;flex:1 1 220px; }
.page-controls>.button { margin-left:auto; }
:root .hero { gap:12px;margin-bottom:16px;align-items:center; }
:root .hero h2 { font-size:26px;margin:0; }
:root .hero p { font-size:13px;line-height:1.5;margin-top:5px; }
.page-summary { display:flex;align-items:center;flex-wrap:wrap;gap:6px 22px;min-height:40px;margin:0 0 12px;font-size:13px;color:var(--muted); }
.page-summary span { display:inline-flex;gap:5px;align-items:baseline; }
.page-summary strong { font-weight:700;font-variant-numeric:tabular-nums;color:var(--navy); }
.page-summary .needs-attention strong { color:var(--red); }
.result-count { margin:0 0 12px;color:var(--muted);font-size:12px; }
:root :is(.printing-tabs,.catalog-tabs) { margin-bottom:12px;padding-bottom:8px;gap:6px; }
:root .page-controls .catalog-tabs { margin:0;padding:0;border:0; }
:root .print-actions { margin-bottom:12px;gap:8px; }
:root .inventory-topline { padding-bottom:8px;margin-bottom:12px;gap:8px; }
:root .inventory-sheet { padding:12px 16px; }
:root .composer-toolbar { padding-bottom:8px; }
:root .composer-tools { padding:6px 0; }
:root .toolbar { position:static;border-radius:var(--surface-radius);padding:10px;margin-bottom:10px; }
:root :is(.panel,.settings-card,.supplier-context,.purchase-sheet) { border-radius:var(--surface-radius);padding:var(--content-inset); }
:root .panel-head { margin-bottom:12px;flex-wrap:wrap; }
:root .panel-head .panel-actions { display:flex;gap:6px;flex-wrap:wrap; }
:root .settings-heading { margin-bottom:12px; }
:root .settings-heading h3 { font-size:20px; }
:root .settings-card { margin-bottom:12px;padding:16px; }
:root .supplier-context { gap:12px;margin-bottom:16px;padding:16px; }
:root .cost-section { margin-bottom:24px; }

/* Shared multiple selection: photos identify the article; formats stay compact. */
.article-selector-dialog { width:min(760px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:20px; }
.article-selector-tools { display:flex;gap:8px;margin-bottom:8px; }
.article-selector-tools input { flex:1;min-width:0;min-height:var(--control-height);padding:8px 10px;border:1px solid var(--line);border-radius:var(--control-radius);font-size:13px; }
.article-selector-tools select { max-width:220px; }
.article-selector-actions { display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap; }
.article-selector-actions [data-select-count] { margin-left:auto;font-size:12px;color:var(--muted); }
.article-selector-list { max-height:min(48dvh,440px);overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:var(--control-radius); }
.article-selector-row { display:flex;align-items:center;gap:10px;padding:6px 10px;min-height:52px;border-bottom:1px solid var(--line);font-size:13px;cursor:pointer; }
.article-selector-row[hidden] { display:none; }
.article-selector-row:last-child { border-bottom:0; }
.article-selector-row:has(input:checked) { background:var(--stock-product); }
.article-selector-row:has(input:disabled) { opacity:.55;cursor:default; }
.article-selector-row :is(img,.article-selector-placeholder) { width:34px;height:40px;object-fit:contain;flex:none; }
.article-selector-row strong { font-size:13px;font-weight:650; }
.article-selector-row small { display:block;margin-top:3px;color:var(--muted);font-size:12px; }
:root .purchase-variant-picker .article-selector-row { width:auto;flex:none; }
:root .pc-components-table { min-width:460px; }
.pc-components-table td:nth-child(3) { width:90px; }
.pc-components-table input { width:80px; }
.pc-components-table td:last-child { width:88px; }
:root .inventory-consignment-table { table-layout:fixed;min-width:850px; }
:root .inventory-consignment-table :is(th,td):first-child { width:25%;min-width:0; }
:root .inventory-consignment-table :is(th,td):last-child { width:140px; }
.inventory-group-toggle { display:flex;align-items:center;gap:8px;border:0;background:none;padding:5px 0;color:inherit;font:inherit;cursor:pointer;text-align:left; }
:root .purchase-needs-table th { white-space:nowrap; }
:root .purchase-needs-table :is(th,td):nth-child(n+3) { width:auto;min-width:95px; }
@media(max-width:620px) {
  .article-selector-dialog { padding:14px; }
  .article-selector-tools { flex-wrap:wrap; }
  .article-selector-tools input { flex-basis:100%; }
  .article-selector-tools select { width:100%;max-width:none; }
  .article-selector-actions [data-select-count] { width:100%;margin:0; }
}

/* Catalogue: generous photos with a short summary beside them, grouped by category. */
.catalog-section { border:1px solid var(--line);border-radius:var(--surface-radius);overflow:hidden;background:var(--paper);margin-bottom:16px; }
.catalog-section-title { margin:0;padding:10px 14px;background:var(--stock-category);display:flex;align-items:center;gap:12px;justify-content:space-between;font-size:14px;font-weight:750; }
.catalog-section-title span { font-size:12px;font-weight:400;color:#4b6269; }
.catalog-grid { display:grid;grid-template-columns:repeat(auto-fill,minmax(350px,1fr));gap:0; }
:root .product-card { display:grid;grid-template-columns:160px minmax(0,1fr);gap:14px;padding:14px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;box-shadow:none;align-items:center;min-width:0; }
.product-card.inactive { opacity:.65; }
.product-card .image-stage { display:grid;place-items:center;width:160px;height:160px;aspect-ratio:1;border:0;border-radius:var(--control-radius);padding:0;background:#f0ece4;cursor:pointer;overflow:hidden; }
.product-card .image-stage img { width:100%;height:100%;object-fit:contain;padding:6px; }
.product-card .product-body { padding:0;display:flex;flex-direction:column;gap:7px;min-width:0; }
.product-card h3 { margin:0;font:500 20px/1.2 Georgia,serif; }
.product-title { border:0;background:none;color:inherit;font:inherit;padding:0;text-align:left;cursor:pointer; }
.product-title:hover:not(:disabled) { text-decoration:underline;text-underline-offset:3px; }
.product-title:disabled,.image-stage:disabled { cursor:default; }
.product-variants,.product-price { margin:0;font-size:12px;line-height:1.55;overflow-wrap:anywhere; }
.product-variants,.product-price>span { color:var(--muted); }
.product-price { font-weight:650;font-variant-numeric:tabular-nums; }
.product-price>span { margin-right:5px;font-weight:400; }
.product-body>.status,.product-body>.button { align-self:flex-start; }

/* One table for wholesale groups; each tier keeps its quantity beside its price. */
.tariff-list { border:1px solid var(--line);background:var(--paper); }
.tariff-list table { min-width:640px; }
.tariff-list th:first-child { width:26%; }
.tariff-list td:last-child { width:150px; }
.tariff-list .panel-actions { display:flex;flex-wrap:nowrap;align-items:center;gap:8px;white-space:nowrap; }
.tariff-list .panel-actions .button { flex-shrink:0; }
.tariff-list td { vertical-align:middle; }
.tariff-list td>strong { display:block;font-size:13px; }
.tariff-list td>small { display:block;color:var(--muted);font-size:11px;margin-top:4px; }
.tariff-list .archived-panel { opacity:.6; }
.tariff-brackets { display:flex;flex-wrap:wrap;gap:8px 0;list-style:none;margin:0;padding:0; }
.tariff-brackets li { display:grid;gap:3px;min-width:96px;padding:0 16px;border-left:1px solid var(--line);font-variant-numeric:tabular-nums;text-align:right; }
.tariff-brackets li:first-child { border-left:0;padding-left:0; }
.tariff-brackets span { color:var(--muted);font-size:11px; }
.tariff-brackets strong { font-size:13px;white-space:nowrap; }

/* Reorder handles remain compact in every article-selection table. */
:root .row-grip{display:inline-flex;align-items:center;justify-content:center;width:32px;min-width:32px;height:40px;min-height:40px;padding:4px;border:0;background:transparent;color:var(--muted);cursor:grab;touch-action:none;vertical-align:middle}
:root .row-grip:active{cursor:grabbing}.row-grip .control-icon{width:18px;height:18px}.row-dragging{opacity:.55}
.row-drop-before>td { box-shadow:inset 0 3px var(--orange); }
.row-drop-after>td { box-shadow:inset 0 -3px var(--orange); }
:root .row-move-menu { position:fixed;inset:auto;margin:0;padding:4px;min-width:156px;border:1px solid var(--line);border-radius:var(--control-radius);background:var(--paper);box-shadow:var(--shadow); }
:root .row-move-menu .button { display:flex;width:100%;justify-content:flex-start;border:0; }
:root .sidebar .nav-link .nav-label { text-align:left;flex:1;min-width:0; }
/* All data tables share headings, separators, type and number alignment. */
:root table { border-collapse:collapse;font-size:13px; }
:root .data-table { width:100%; }
:root .data-table :is(th,td) { padding:8px 10px;vertical-align:middle;border-bottom:1px solid var(--line); }
:root .data-table th { white-space:nowrap;text-align:left; }
:root .data-table tbody tr:not(.table-category):not(.table-product):not(.table-variant) { background:transparent; }
:root .data-table tbody tr:is(:hover,:focus-within):not(.table-category):not(.table-product):not(.table-variant) { background:#f5f7f5; }
:root .data-table :is(th,td).is-number { text-align:right;font-variant-numeric:tabular-nums; }
:root .data-table td.is-number input { text-align:right;font-variant-numeric:tabular-nums; }
:root .data-table :is(th,td).is-selection { text-align:center;width:40px; }
:root .data-table :is(th,td).is-actions { text-align:right;width:48px;white-space:nowrap; }
:root .data-table small { display:block;font-size:11px;line-height:1.4;color:var(--muted);margin-top:3px; }
:root .data-table .table-mobile-detail { display:none; }
:root .data-table tbody tr:last-child td { border-bottom:0; }
:root .data-table .row-grip-cell { width:36px;padding:4px;text-align:center; }
:root .data-table .table-category { background:var(--stock-category);font-weight:700; }
:root .data-table .table-category>th { background:var(--stock-category);color:var(--navy);font-size:14px;font-weight:700;white-space:normal; }
:root .data-table .table-product { background:var(--stock-product); }
:root .data-table .table-variant { background:var(--paper); }
:root .data-table .table-variant td:first-child { padding-left:32px; }
:root table th { background:var(--table-heading);color:#4b6269;font-size:12px;font-weight:650;text-transform:none;letter-spacing:0;padding:9px 10px; }
:root :is(.order-table,.tier-table,.receipt-table,.inventory-table) td { padding:8px 10px;font-size:13px; }
:root :is(.order-table,.tier-table,.receipt-table,.inventory-table) tr:last-child td { border-bottom:0; }
:root .tier-table :is(th,td) { text-align:right;font-variant-numeric:tabular-nums; }
:root .tier-table input { min-height:var(--control-height);max-width:none;text-align:right;font-size:13px; }
.tier-editor-table { table-layout:fixed; }
.tier-editor-table th:last-child { width:48px; }
:root .tier-editor-table td { padding:5px 4px; }
.tier-editor-table input { min-width:0;padding:8px 6px; }
:root .order-lines :is(th,td):nth-child(3) { text-align:right;font-variant-numeric:tabular-nums; }
.order-lines { min-width:380px;table-layout:fixed; }
.order-lines th:first-child { width:50%; }
.order-lines th:nth-child(2) { width:18%; }
.order-lines th:nth-child(3) { width:12%; }
:root .order-summary>div { background:transparent;padding:0; }
.order-summary { padding-bottom:14px;border-bottom:1px solid var(--line); }
:root .order-addresses>div { border:0;border-left:2px solid var(--line);border-radius:0;padding:0 0 0 10px; }
:root .operation-table :is(input,select), :root .purchase-lines :is(input:not([type=checkbox]),select) {
  min-height:var(--control-height);height:var(--control-height);font-size:13px;border-radius:var(--control-radius);
}
:root .operation-table .button, :root .purchase-lines .button { width:auto; }
:root .operation-table th:last-child:has(.sr-only), :root .purchase-lines th:last-child { width:48px; }
:root .inventory-entry-table th:last-child { width:44px; }
:root .purchase-lines th:nth-child(4) { text-align:right;width:80px; }
:root .purchase-lines input[type=number] { text-align:right;font-variant-numeric:tabular-nums; }
:root .operation-table-scroll { margin-top:14px; }
:root .table-scroll, :root .operation-table-scroll, :root .variant-table-scroll { position:relative;max-width:100%;border-radius:var(--control-radius); }
:root .panel.table-scroll { padding:0; }
.table-scroll:focus-visible { outline:2px solid var(--navy);outline-offset:2px; }

/* Dialogs have one inset, regardless of the workflow that opened them. */
:root dialog:is(.purchase-dialog,.inventory-dialog,.receipt-dialog,.text-link-dialog,.action-dialog):has(>form) { padding:0; }
:root dialog>form { padding:var(--content-inset); }
:root dialog:not(:has(>form)) { padding:var(--content-inset); }
:root dialog { border-radius:var(--surface-radius); }
#editor-dialog:not(:has(.product-general)) { max-width:680px; }
.receipt-dialog .field-grid+.field { margin-top:12px; }
:root .dialog-head { gap:12px;margin-bottom:16px;align-items:flex-start; }
:root .dialog-head h2 { font-size:26px;line-height:1.2; }
:root .dialog-head>.button { margin-top:0; }
:root .dialog-actions { gap:8px;margin-top:16px;padding:12px 0 0;bottom:0;background:var(--paper); }
:root .inventory-dialog:has(.inventory-entry-table) .dialog-actions { padding:12px 0 0;bottom:0; }
:root .print-preview-dialog .dialog-actions { padding:0;margin:0; }
:root .dialog-scope, :root .inventory-intro { margin-bottom:12px;font-size:13px; }
:root .empty { padding:28px 16px; }

/* Inventory: the tint expresses depth, never row parity. */
:root .inventory-category>summary { background:var(--stock-category);color:var(--navy); }
:root .inventory-product>summary { background:var(--stock-product); }
:root .inventory-variant-row { background:var(--paper); }
.inventory-stock-tree .inventory-product>summary { font-weight:600; }
.inventory-stock-tree .inventory-variant-row { min-height:34px; }
.inventory-stock-tree .inventory-product { border-color:#d5dfe0; }
.inventory-column-head { background:var(--paper); }
:root .inventory-flow-card { border:1px solid var(--line);gap:8px; }
:root .inventory-flow-card strong { font:inherit; }
:root .inventory-flow-card:hover { border-color:var(--navy);background:var(--stock-product); }
:root .inventory-flow-icon { display:flex;gap:2px;color:var(--navy); }
:root .inventory-flow-icon .control-icon { width:16px;height:16px; }
:root .inventory-flow-icon .control-icon:nth-child(2) { width:12px;color:var(--orange); }
.flow-label-short { display:none; }
:root .inventory-actionbar { padding:12px 0;gap:8px; }
:root .inventory-stock-actions { gap:8px; }

/* Product variants are edited in one table, like orders and stock movements. */
.variant-table-scroll { margin-top:12px;border:1px solid var(--line);border-radius:var(--control-radius); }
.variant-table { width:100%;min-width:880px;table-layout:fixed; }
.variant-table th { text-align:left; }
.variant-table th.variant-format-column { width:180px; }
.variant-table th.variant-group-column { width:220px; }
.variant-table th.variant-price-column { width:100px;text-align:right; }
.variant-table th.variant-active-column { width:120px; }
.variant-table th.variant-details-column { width:160px; }
.variant-table th:last-child { width:48px; }
.variant-table td { padding:5px 6px;border-top:1px solid var(--line);vertical-align:middle; }
.variant-table .field { display:block; }
.variant-table input[data-field=retailPrice] { text-align:right;font-variant-numeric:tabular-nums; }
.variant-table .variant-photo-menu>summary { width:40px;height:40px; }
.variant-table .variant-photo-menu img { width:34px;height:36px; }
.variant-table .variant-photo-menu>div { left:0; }
.variant-table .common-photo-check { grid-column:auto; }
:root .pc-list { gap:0;border:1px solid var(--line);border-radius:var(--control-radius);overflow:hidden; }
:root .pc-offer { border:0;border-radius:0;border-top:1px solid var(--line);padding:10px; }
:root .pc-offer:first-child { border-top:0; }
.pc-list:empty { display:none; }
.pc-heading h3 { font:500 21px Georgia,serif; }
.pc-supplies-scroll { border:1px solid var(--line); }
.pc-supplies-table { width:100%;min-width:780px;table-layout:fixed; }
.pc-supplies-table th { text-align:left; }
.pc-supplies-table th:nth-child(2) { width:92px;text-align:right; }
.pc-supplies-table th:nth-child(3) { width:23%; }
.pc-supplies-table th:nth-last-child(2) { width:110px;text-align:right; }
.pc-supplies-table th:last-child { width:84px; }
.pc-supplies-table td { padding:5px 6px;border-top:1px solid var(--line); }
.pc-supplies-table :is(input,select) { min-width:0;width:100%; }
.pc-supplies-table input { text-align:right; }
.pc-supplies-table .pc-price { text-align:right; }
.pc-supplies-table .pc-price small { display:block;font-size:11px;font-weight:400;color:var(--muted); }

/* Narrow screens keep every table column; tables alone can scroll sideways. */
@media(max-width:900px) {
  .variant-table-scroll { overflow:auto; }
  .variant-table-scroll:has(.variant-photo-menu[open]) { padding-bottom:110px; }
}
@media(max-width:760px) {
  :root { --content-inset:16px; }
  :root body:not(.publication-route) .page { padding:16px 12px 32px; }
  .publication-route .page { padding:8px; }
  :root .topbar { padding:0 12px; }
  :root .topbar h1 { font-size:23px; }
  .catalog-grid { grid-template-columns:minmax(0,1fr); }
  :root .product-card { grid-template-columns:130px minmax(0,1fr);padding:12px;gap:12px; }
  .product-card .image-stage { width:130px;height:130px; }
  .product-card h3 { font-size:19px; }
  .tariff-list table { min-width:0; }
  .tariff-list thead { position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%); }
  .tariff-list tbody { display:block; }
  .tariff-list tr { display:grid;grid-template-columns:minmax(0,1fr) auto;padding:10px 12px;border-bottom:1px solid var(--line);gap:10px; }
  .tariff-list tr:last-child { border-bottom:0; }
  :root .tariff-list td { display:block;padding:0;border:0;width:auto; }
  :root .tariff-list .data-table td.is-actions { width:auto; }
  .tariff-list td:nth-child(2) { grid-column:1/-1;grid-row:2; }
  .tariff-list td:last-child { grid-column:2;grid-row:1; }
  .tariff-brackets li { min-width:85px;padding:0 12px; }
  :root .hero { flex-wrap:wrap; }
  :root .hero h2 { font-size:23px; }
  :root .dialog-head h2 { font-size:23px; }
  #editor-dialog:has(.product-general) { width:calc(100% - 16px); }
  :root .order-table :is(th,td):nth-child(3) { display:table-cell; }
  .order-summary { grid-template-columns:1fr; }
  .order-summary>div { display:grid;grid-template-columns:72px minmax(0,1fr);gap:8px;align-items:baseline; }
  :root .inventory-flow-actions { width:100%;gap:6px; }
  :root .inventory-flow-card { flex:1;padding:8px;gap:6px;text-align:left; }
  :root .inventory-stock-actions { width:100%;display:grid;grid-template-columns:1fr 1fr; }
  .inventory-stock-actions .orange { grid-column:1/-1; }
  .inventory-stock-actions>.button:nth-child(2):last-child { grid-column:1/-1; }
  .page-summary { gap:5px 16px; }
  :root .inventory-stock-tree .inventory-product>summary { padding-left:36px; }
  :root .inventory-stock-tree .inventory-product>summary::after { left:18px; }
  :root .inventory-stock-tree .inventory-variant-row { padding-left:68px; }
}
@media(max-width:480px) {
  :root .topbar { gap:8px; }
  :root .topbar h1 { font-size:22px;line-height:1.1;white-space:normal;text-overflow:clip; }
  .topbar .top-actions { flex-shrink:0;max-width:104px; }
  :root .topbar .sync-state { font-size:10px;width:104px;min-width:104px;max-width:104px; }
  .toolbar:has(#add-product) { display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .toolbar #catalog-search,.toolbar #add-product { grid-column:1/-1;width:100%; }
  :root .product-card { grid-template-columns:112px minmax(0,1fr);gap:10px; }
  .product-card .image-stage { width:112px;height:120px; }
  .page-controls { gap:8px; }
  .page-controls>.button { margin-left:0; }
  .flow-label-short { display:inline; }
  .flow-label-wide { display:none; }
  :root .operation-table { font-size:12px; }
  :root .operation-table th { font-size:11px;padding:8px 4px; }
  :root .operation-table td { padding:4px 2px; }
  :root .operation-table :is(input,select) { font-size:12px;padding-left:4px; }
  :root .inventory-entry-table th:nth-child(3) { width:48px; }
  :root .inventory-entry-table th:nth-child(4) { width:64px; }
  :root .inventory-entry-table th:last-child { width:44px; }
  :root .receipt-entry-table th:nth-child(3), :root .receipt-entry-table th:last-child { width:64px; }
  :root .dialog-actions>.button { flex:1; }
  :root .dialog-actions>.danger { flex-basis:100%;margin-right:0; }
}

:root .receipt-entry-table th:nth-child(4) { width:88px; }
:root .receipt-entry-table th:last-child { width:88px; }

/* Row movement always starts at the left edge. */
:root table th.row-grip-cell, :root table td.row-grip-cell { width:32px;padding:4px;vertical-align:middle;text-align:center; }
:root .row-grip-cell .row-grip { margin:0; }
.tier-editor-hint { margin:0 0 10px;font-size:12px; }
.tier-maximum { color:var(--muted);font-variant-numeric:tabular-nums; }

/* Article images and controls share one vertical alignment. */
.article-identity { display:flex;align-items:center;gap:8px;min-width:0; }
.article-image { display:block;width:40px;height:44px;object-fit:contain;flex:0 0 40px;border-radius:3px; }
.inventory-variant-label { display:flex;align-items:center;gap:8px;min-width:0; }
.inventory-variant-label img,.inventory-variant-label .inventory-photo-empty { width:32px;height:36px;object-fit:contain;flex:0 0 32px; }
.article-image-empty { background:var(--cream); }
.article-content { display:grid;align-content:center;gap:3px;flex:1;min-width:0;overflow-wrap:anywhere; }
.article-content small { display:block;color:var(--muted);font-size:11px; }
:root .article-stock-hint { position:static;display:block;min-height:16px;max-width:100%;white-space:normal;font-size:12px;line-height:1.4;color:var(--muted); }
.customer-edit-table td { padding-top:17px !important;padding-bottom:9px !important; }
.purchase-lines .article-content { display:flex;align-items:center; }
.purchase-lines .article-content>select { flex:1;min-width:0; }
.purchase-lines .purchase-line-tariff { margin:0; }
.purchase-lines .purchase-cost-action { gap:4px; }
.purchase-lines .purchase-tariff-status { font-size:11px; }

/* Preparation: draft choice, order details, items, totals, then sending. */
.purchase-draft-manager { display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin:12px 0; }
.purchase-draft-manager>.field { flex:1;min-width:220px;max-width:540px; }
.purchase-draft-manager .panel-actions { display:flex;gap:8px;flex-wrap:nowrap; }
.purchase-info { grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) minmax(0,.65fr); }
.purchase-final-actions { border-top:1px solid var(--line);padding-top:14px;margin:14px 0 0; }
.purchase-final-actions .draft-state { margin-right:auto;font-size:12px;color:var(--muted); }

/* Product photo spans the two rows of general information. */
:root .product-general { grid-template-columns:144px minmax(0,.8fr) minmax(0,1.3fr);align-items:stretch;gap:12px 18px; }
.product-general .common-photo-button { grid-column:1;grid-row:1/3;min-height:144px;height:100%; }
.product-general .common-photo-button img { width:100%;height:144px;object-fit:contain; }
.product-general .common-photo-button>.control-icon { bottom:4px; }
.product-general .product-category { grid-column:2;grid-row:1; }
.product-general .product-name { grid-column:3;grid-row:1; }
.product-general .product-web-link { grid-column:2/4;grid-row:2;margin:0; }
.pc-tariff-heading { display:grid;grid-template-columns:auto minmax(150px,230px) auto;justify-content:start;gap:10px; }
.pc-tariff-heading .pc-add-tariff { margin:0;min-width:0; }
.pc-tariff-heading .pc-add-tariff select { min-width:0;width:100%; }

/* Desktop tables use proportional columns rather than a fixed minimum width. */
@media(min-width:801px) {
  :root .data-table { table-layout:fixed;width:100%;min-width:0 !important; }
  :root .data-table th { width:auto !important;max-width:none;white-space:normal;overflow-wrap:normal; }
  :root .data-table td { min-width:0;vertical-align:middle;overflow-wrap:anywhere; }
  :root .data-table :is(input:not([type=checkbox]),select,textarea) { width:100%;min-width:0 !important;max-width:100%;box-sizing:border-box; }
  :root .data-table input[type=checkbox] { width:18px;min-width:18px; }
  :root .data-table :is(.is-actions,.is-selection) { overflow-wrap:normal; }
  :root .data-table .is-actions .button { white-space:nowrap; }
  .variant-table-scroll,.table-scroll { max-width:100%;min-width:0; }
  .tariff-brackets li { min-width:80px;padding:0 10px; }
}
@media(max-width:800px) {
  .data-table colgroup[data-responsive-columns] col { width:auto !important; }
  :root .data-table th { white-space:normal; }
  :root .operation-table { min-width:480px; }
  :root .operation-table th.is-number { width:112px; }
  :root .table-mobile-compact { min-width:0; }
  :root .table-mobile-compact colgroup, :root .table-mobile-compact :is(th,td)[data-column-priority=context] { display:none; }
  :root .table-mobile-compact th.is-number { width:88px; }
  :root .table-mobile-compact .table-mobile-detail { display:block; }
  :root .customer-heading-actions { flex-wrap:wrap; }
  .purchase-info { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .purchase-info>.field:first-child { grid-column:1/-1; }
  .purchase-draft-manager>.field { flex-basis:100%;max-width:none;min-width:0; }
  .pc-tariff-heading { grid-template-columns:minmax(0,1fr) auto; }
  .pc-tariff-heading .pc-add-tariff { grid-column:1/-1;grid-row:2;width:min(100%,230px); }
  :root .product-general { grid-template-columns:108px minmax(0,1fr);gap:10px 12px; }
  .product-general .common-photo-button { grid-column:1;grid-row:1/4;min-height:160px; }
  .product-general .common-photo-button img { height:160px; }
  .product-general .product-category { grid-column:2;grid-row:1; }
  .product-general .product-name { grid-column:2;grid-row:2; }
  .product-general .product-web-link { grid-column:2;grid-row:3; }
}

/* Reading hierarchy: common navigation, important data and contextual details. */
:root { --state-waiting:#eeeae1; --state-attention:#fff0d9; }
@media(min-width:901px) {
  :root .shell { grid-template-columns:216px minmax(0,1fr); }
  :root .sidebar { width:216px;padding:22px 12px;font-family:var(--interface-font);font-weight:400; }
  :root .sidebar .nav-link { justify-content:flex-start;gap:10px;height:auto;min-height:44px;padding:10px; }
  :root .sidebar .nav-label { display:block;position:static;background:none;box-shadow:none;padding:0;white-space:normal;width:auto;font-size:14px;line-height:1.3; }
  :root .sidebar .nav-link>span:first-child { flex:0 0 20px; }
  :root .sidebar .brand { display:flex;justify-content:flex-start;align-items:center;background:transparent;padding:0;text-align:left;margin:0 10px 24px;height:44px;min-height:44px; }
  :root .sidebar .brand:not([data-brand-status="ready"])>* { visibility:hidden; }
  :root .sidebar .brand img { display:block;width:100%;max-height:42px;object-fit:contain;object-position:left center; }
  :root .sidebar .sidebar-foot { display:grid;grid-template-columns:10px minmax(0,1fr);justify-content:flex-start;gap:4px 8px; }
  :root .sidebar .sidebar-foot>span:not(.live-dot) { display:block; }
  :root .sidebar .sidebar-foot small { display:block;grid-column:2;font-size:10px; }
  :root .topbar .sync-state { max-width:none;font-family:var(--interface-font); }
}
@media(min-width:901px) {
  .desktop-actions>summary { list-style:none;cursor:pointer; }
  .desktop-actions>summary::-webkit-details-marker { display:none; }
  .desktop-actions>summary::before { display:none; }
  .desktop-actions-menu { margin:0;padding:6px;min-width:150px;border:1px solid var(--line);border-radius:6px;background:white;box-shadow:0 5px 20px #102b3b20; }
  .desktop-actions-menu .button { display:flex;width:100%;justify-content:flex-start;margin:0; }
  .settings-local-reset { border:0;background:transparent;padding-top:12px; }
  .settings-local-reset>details>summary { cursor:pointer;color:var(--muted);font-size:13px; }
  .settings-local-reset p { font-size:13px;color:var(--muted); }
}
@media(min-width:701px) and (max-width:900px) {
  :root .shell { grid-template-columns:minmax(0,1fr); }
  :root .sidebar { position:fixed;width:236px;transform:translateX(-100%);visibility:hidden; }
  :root .shell.menu-open .sidebar { transform:none;visibility:visible; }
  :root .menu-button { display:block!important; }
  :root .shell.menu-open .menu-backdrop { display:block!important; }
  :root .sidebar .nav-label { display:block;position:static;white-space:normal;background:none;padding:0;box-shadow:none;width:auto; }
  :root .sidebar .nav-link { justify-content:flex-start; }
}
:root .button,:root .button.small,:root :is(main,dialog) select:not([multiple]),:root .field :is(input,textarea),:root .data-table { font-size:14px; }
:root .data-table th { font-size:13px;line-height:1.35; }
:root .article-content strong,:root .inventory-product-label,:root .inventory-variant-label { font-size:14px; }
:root .article-content small { font-size:12px;line-height:1.45; }
.article-photo { display:block;border:0;background:transparent;padding:0;width:40px;height:44px;flex:0 0 40px;cursor:zoom-in;border-radius:3px; }
.image-preview-dialog { width:min(840px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:20px; }
.image-preview-dialog header { display:flex;align-items:center;gap:16px;margin-bottom:14px; }
.image-preview-dialog h2 { flex:1;min-width:0;font:500 24px/1.3 Georgia,serif;margin:0; }
.image-preview-dialog img { display:block;width:100%;height:min(70dvh,700px);object-fit:contain; }
:root .customer-status.waiting { color:var(--ink);background:var(--state-waiting); }
:root .customer-status.orange { color:#835011;background:var(--state-attention); }
:root .customer-status.yellow { color:#765d16;background:#fff6d8; }
:root .customer-status.red { color:#923a36;background:#fbe9e5; }
:root .customer-status.green { color:#285c43;background:#e1eee6; }
:root .customer-status { font-size:13px;line-height:1.4; }
.customer-assign-warning { position:static!important;width:auto!important;min-width:0!important;border-radius:4px!important;padding:3px 6px!important;font-size:12px!important;white-space:nowrap; }
:root .customer-client-line { gap:8px;flex-wrap:wrap; }
.customer-client-line .customer-order-link { font-size:14px; }
.customer-overview { display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,.4fr);gap:16px;margin-bottom:20px; }
.customer-overview .customer-addresses { margin:0; }
.customer-amount-summary { display:grid;gap:10px;align-content:start;background:var(--stock-product);padding:16px;border-radius:var(--surface-radius); }
.customer-amount-summary>span { display:flex;justify-content:space-between;gap:12px;font-size:14px; }
.customer-amount-summary strong { font-size:24px;font-variant-numeric:tabular-nums; }
.customer-amount-summary small { font-size:12px;color:var(--muted); }
:root .customer-heading { gap:20px;align-items:flex-start; }
:root .customer-heading-actions { gap:8px; }
:root .customer-order-state { display:flex;gap:6px;flex-wrap:wrap; }
:root .customer-item-head { padding:10px 0;border-top:1px solid var(--line); }
:root .customer-addresses p { font-size:14px;line-height:1.5; }
:root .customer-note { font-size:13px;line-height:1.5; }
.purchase-draft-heading { display:flex;align-items:flex-end;gap:20px;justify-content:space-between;margin-bottom:16px; }
.purchase-draft-heading>.field { flex:1;min-width:200px;max-width:500px; }
:root .purchase-final-actions { padding:0;margin:0;border:0;align-items:center;gap:8px; }
.purchase-final-actions .draft-state { margin:0 6px 0 0;width:150px;font-size:12px; }
:root .purchase-draft-manager>.field { max-width:430px; }
:root .purchase-info { grid-template-columns:minmax(0,1fr) minmax(150px,.45fr); }
.purchase-article-controls { display:grid;grid-template-columns:minmax(0,1fr) minmax(86px,105px);gap:8px; }
:root .purchase-lines .article-content { display:grid; }
:root .purchase-lines .purchase-line-tariff { display:block; }
.line-details { margin-top:6px;text-align:left;font-size:12px;color:var(--muted); }
.line-details summary { cursor:pointer;width:fit-content;padding:2px 0; }
.line-details summary .line-flags { color:var(--orange-dark,#a7471d);font-weight:650; }
.line-details-content { display:grid;gap:8px;margin-top:8px;padding:10px;background:var(--stock-product);border-radius:4px; }
.line-details-content p { margin:0; }
.line-details-content label { display:flex;align-items:center;gap:8px; }
:root .line-details input[type=checkbox] { width:18px;min-width:18px; }
:root .line-details .field label { display:block; }
:root .purchase-lines .article-identity { align-items:flex-start; }
:root .purchase-lines .article-photo { margin-top:1px; }
:root .print-add-row { margin:0;gap:8px; }
.purchase-articles-actions { display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:12px; }
.purchase-order-heading { display:flex;align-items:flex-start;gap:16px;justify-content:space-between;margin:16px 0; }
.purchase-order-heading h2 { margin:0 0 6px;font:500 27px/1.3 Georgia,serif; }
.purchase-order-heading p { margin:0;color:var(--muted);font-size:14px; }
.purchase-order-heading .panel-actions { gap:8px;flex-wrap:wrap; }
:root .saved-purchase { margin:0; }
.purchase-needs-table .need-quantity { color:var(--orange-dark,#a7471d);font-weight:750;font-size:18px;font-variant-numeric:tabular-nums; }
.purchase-needs-calculation { margin:0;font-size:13px;text-align:left; }
.purchase-needs-calculation dl { display:grid;grid-template-columns:1fr auto;gap:5px 10px;font-size:13px; }
.purchase-needs-calculation dt,.purchase-needs-calculation dd { margin:0; }
:root .supplier-context { display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:14px; }
:root .supplier-select-controls { display:flex;align-items:flex-end;gap:8px; }
:root .supplier-context .field { width:min(340px,100%);margin:0; }
:root .supplier-context .supplier-discount { font-size:14px; }
:root .inventory-stock-tree .inventory-category>summary { background:var(--stock-category); }
:root .inventory-stock-tree .inventory-product>summary { background:var(--stock-product); }
:root .inventory-stock-tree .inventory-variant-row { background:var(--paper); }
:root .inventory-stock-number b { font-size:16px; }
:root .inventory-stock-number small { font-size:12px; }
:root .product-general { grid-template-columns:160px minmax(0,1fr);gap:12px 20px; }
:root .product-general .common-photo-button { grid-column:1;grid-row:1/4;min-height:160px; }
:root .product-general .common-photo-button img { height:180px; }
:root .product-general .product-name { grid-column:2;grid-row:1; }
:root .product-general .product-category { grid-column:2;grid-row:2; }
:root .product-general .product-web-link { grid-column:2;grid-row:3; }
.product-save-top { margin-left:auto;display:flex;align-items:center;gap:8px; }
.variant-secondary { font-size:12px; }
.variant-secondary summary { cursor:pointer;white-space:nowrap; }
.variant-secondary[open] { min-width:150px; }
:root .product-price { font-size:14px; }
:root .settings-workspace { max-width:1100px;display:grid;grid-template-columns:1fr 1fr;gap:14px; }
:root #brand-settings { grid-column:1/-1; }
:root .settings-card { margin:0;min-width:0; }
:root .settings-card p { font-size:14px;line-height:1.5; }
:root .settings-workspace>.settings-card:last-child { grid-column:1/-1; }
:root .brand-name-field { max-width:380px; }
:root .brand-uses { display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px; }
:root .brand-use { display:grid;grid-template-columns:minmax(0,1fr) 60px;gap:8px;align-items:center; }
:root .settings-save-state:empty { display:none; }
:root .composer-preview-caption { font-size:13px; }
:root .inspector-field>label { font-size:13px; }
@media(max-width:1100px) {
  .purchase-draft-heading { flex-wrap:wrap; }
  .customer-overview { grid-template-columns:1fr; }
  :root .brand-uses { grid-template-columns:1fr; }
}
@media(max-width:800px) {
  :root .settings-workspace { grid-template-columns:1fr; }
  :root .product-general { grid-template-columns:minmax(0,1fr); }
  :root .product-general .common-photo-button { grid-column:1;grid-row:1;min-height:160px;max-width:220px;margin-inline:auto;width:100%; }
  :root .product-general .product-name { grid-column:1;grid-row:2; }
  :root .product-general .product-category { grid-column:1;grid-row:3; }
  :root .product-general .product-web-link { grid-column:1;grid-row:4; }
  .purchase-article-controls { grid-template-columns:minmax(150px,1fr) 90px; }
  :root .purchase-info { grid-template-columns:1fr; }
  .purchase-final-actions { flex-wrap:wrap;width:100%; }
  .purchase-final-actions .draft-state { width:100%; }
  .purchase-draft-heading>.field { min-width:0;width:100%;max-width:none; }
  .purchase-order-heading { flex-wrap:wrap; }
  :root .brand-use { grid-template-columns:minmax(0,1fr) 48px; }
  .product-save-top { width:100%; }
  :root .customer-heading-actions { justify-content:flex-start;width:100%; }
  :root .customer-assign-warning { white-space:normal; }
}

/* Shared controls keep labels and images readable at the new navigation width. */
.article-selector-row > label { flex:1;min-width:0;cursor:pointer; }
.article-selector-row :is(.article-photo,.article-image) { width:40px;height:44px; }
.article-selector-row strong, .tariff-brackets strong { font-size:14px; }
.inventory-filters { grid-template-columns:minmax(160px,1fr) minmax(145px,220px) minmax(130px,180px); }
.inventory-product-label .article-photo,.inventory-variant-label .article-photo { flex:none; }
.variant-secondary > div { display:grid;gap:8px;padding-top:8px; }
.variant-secondary summary small { display:block;color:var(--muted);white-space:normal; }
.tier-impact:empty { display:none; }
.pc-filter-hint { flex-basis:100%;margin:0; }
@media (max-width:700px) {
  .inventory-filters { grid-template-columns:minmax(0,1fr); }
  .product-save-top { width:auto;flex-wrap:wrap; }
}

:root .data-table td { font-size:14px; }
:root .data-table :is(input,select) { font-size:14px; }
.customer-edit-table .article-stock-hint { padding-left:50px; }
:root .purchase-lines tbody td, :root .customer-edit-table tbody td { vertical-align:top; }
:root .purchase-lines tbody td:is([data-unit-price],[data-line-total]) { padding-top:23px; }
:root .customer-edit-table td:has([data-line-price]), :root .customer-edit-table [data-line-total] { padding-top:23px; }
:root .customer-controls { justify-content:flex-start;gap:8px; }
:root .customer-controls>.customer-tools-menu { margin-left:auto; }
@media(min-width:901px) {
  :root .composer.has-panel { grid-template-columns:240px minmax(0,1fr); }
  :root .composer-toolbar .button { font-size:14px!important; }
}

:root .customer-lines .article-content { display:block;line-height:1.45; }
.customer-lines .article-content strong { display:inline; }
:root .customer-lines .article-format { display:inline;margin-left:8px; }
.pc-filter-hint { margin:0 0 10px;font-size:12px; }
#editor-content>.dialog-head { position:sticky;top:0;background:var(--surface,#fffdf9);z-index:3;padding-bottom:10px; }

:root .inventory-stock-tree .article-image { width:40px;height:44px; }
:root .inventory-variant-row>b { font-size:14px; }
.supplier-select-controls { flex-wrap:wrap; }
.cost-fees { padding:14px 0; }
.cost-fees>summary { font-size:16px;font-weight:650;cursor:pointer; }
.cost-fees[open]>summary { margin-bottom:12px; }
@media(max-width:700px) {
  :root .supplier-select-controls { width:100%; }
  :root .supplier-context .field { width:100%; }
  .supplier-context-details { display:flex;gap:8px;flex-wrap:wrap; }
}

:root #brand-settings { grid-template-columns:minmax(0,1fr); }
:root .settings-inline-actions { flex-wrap:wrap; }

:root .tariff-list td>strong { font-size:14px;white-space:normal;overflow-wrap:break-word; }
:root .supplier-select-controls>.field { width:280px; }
:root .supplier-select-controls>.button { margin-top:0; }
@media(max-width:700px) {
  :root .supplier-select-controls>.field { width:100%; }
}

.draft-state.is-attention { color:#835011; }

/* Product identity remains visible while photo/SKU editing stays secondary. */
.variant-identity > [data-variant-preview] { display:flex;flex:none; }
.variant-identity > .field { flex:1;min-width:0; }
.common-photo-caption { position:absolute;left:6px;right:24px;bottom:5px;font-size:11px;line-height:1.3;text-align:left;color:var(--muted); }
:root #editor-content:has(.product-general) > .dialog-actions { position:static; }
@media(max-width:700px) {
  :root #editor-content:has(.product-general) > .dialog-head { display:grid;grid-template-columns:minmax(0,1fr) 40px;gap:10px; }
  :root #editor-content:has(.product-general) > .dialog-head > div:first-child { grid-column:1;grid-row:1; }
  .product-save-top { display:contents; }
  :root #close-product { grid-column:2;grid-row:1;margin:0; }
  :root #save-product { grid-column:1/-1;grid-row:2;width:100%; }
  :root .product-general .common-photo-button { min-height:144px;max-width:160px; }
  :root .product-general .common-photo-button img { height:120px;margin-bottom:18px; }
  :root #editor-content:has(.product-general) > .dialog-actions > .danger { flex:1 1 auto;margin-right:auto; }
}
