.category-panel { margin-bottom: 24px; }
.category-panel > summary { justify-content: flex-start; list-style: none; color: #424242; font-weight: 560; border-bottom: 0; }
.category-panel[open] > summary { border-bottom: 1px solid var(--line); }
.category-panel > summary > .bc-icon { margin-left: auto; color: #666; transform: rotate(90deg); }
.category-panel[open] > summary > .bc-icon { transform: rotate(-90deg); }
.count-badge { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 12px; background: var(--accent); color: white; font-size: 11px; font-weight: 600; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 17px; }
.list-tools .searchbox { flex: 1 1 230px; max-width: 610px; }
.index-table .item-link { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; }
.item-link strong { font-weight: 550; overflow-wrap: anywhere; }
.item-link:hover { color: var(--accent); text-decoration: none; }
.list-thumb, .mini { width: 43px; height: 43px; border: 1px solid var(--line); border-radius: 5px; background: #f4f4f4; object-fit: cover; }
.list-thumb { flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; color: #999; }
.list-thumb > img { width: 100%; height: 100%; object-fit: cover; }
.list-thumb > svg { width: 23px; }
.index-table .arrow-col { width: 32px; padding-inline: 8px; color: #848484; text-align: center; }
.index-table th.arrow-col::before { display: none; }
.index-table td { height: 56px; }
.index-table .numeric { font-variant-numeric: tabular-nums; }
.mobile-meta { display: none; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr)); align-items: start; gap: 15px; }
.product-card { min-width: 0; display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); text-align: left; }
.product-card:hover { text-decoration: none; border-color: #ababab; }
.thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 1.63; overflow: hidden; background: #f1f1f1; color: #999; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { display: grid; gap: 3px; padding: 11px 13px 13px; }
.card-body strong { font-weight: 600; overflow-wrap: anywhere; }
.card-body .small:empty { display: none; }
.section-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: minmax(195px, .78fr) minmax(300px, 1.35fr); gap: 18px; align-items: start; }
.detail-image, .photo-tile {
  display: grid; place-items: center; min-height: 128px; background: #f7f7f7; overflow: hidden; color: #888;
}
.detail-image { border-bottom: 1px solid var(--line); }
.detail-image img { width: 100%; max-height: 390px; object-fit: contain; }
.photo-tile { height: 180px; border: 1px solid var(--line); border-radius: var(--control); }
.photo-tile img { width: 100%; height: 100%; object-fit: contain; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 14px; }
.facts b { margin-left: 3px; color: var(--ink); }
.photo-boxes { align-items: stretch; }
.photo-boxes .panel-body { display: grid; gap: 9px; }
.photo-boxes .upload { min-height: 180px; }
.upload {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; align-content: center; gap: 10px;
  padding: 20px; border: 1px dashed #b5b5b5; border-radius: var(--control); background: #fbfbfb; color: #535353; text-align: center;
}
label.upload:hover, .upload.drag, .upload:focus-within { border-color: var(--accent); background: #f5f9ff; }
.file-trigger { position: relative; }
.file-trigger:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.search-upload { position: relative; display: grid; justify-items: center; min-height: 180px; gap: 5px; }
.search-upload .bc-icon { color: #858585; margin-bottom: 5px; }
#cropper { display: block; max-width: 100%; height: auto; max-height: 56vh; justify-self: center; object-fit: contain; touch-action: none; cursor: crosshair; }
.history-entry, .doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line); color: var(--ink); }
.history-entry:last-child, .doc-row:last-child { border-bottom: 0; }
a.history-entry:hover { background: var(--soft); text-decoration: none; }
.doc-row { justify-content: flex-start; }
.doc-row > .bc-icon { color: #686868; }
.doc-row a { margin-left: auto; }
.doc-row strong, .history-entry b { font-weight: 560; }
.panel-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 15px; background: #f7f7f7; border-top: 1px solid var(--line); }
.panel-head > a { font-size: 13px; }
.cost-box > .spread { min-height: 38px; padding: 6px 15px; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; background: #f7f7f7; }
.cost-box > .spread h3 { font-size: 14px; }
.cost-box > .spread .btn { min-height: 26px; padding-block: 3px; font-size: 13px; }
.cost-items { padding: 3px 15px; }
.cost-items:empty { display: none; }
.cost-box:has(.cost-items:empty) > .spread { border-bottom: 0; border-radius: var(--radius); }
.cost-edit { display: grid; grid-template-columns: 88px minmax(84px,1fr) 97px 36px; align-items: center; gap: 7px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cost-edit:last-child { border-bottom: 0; }
.cost-more { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.cost-more .row { margin: 9px 0 6px; }
.cost-more .control { flex: 1 1 150px; }
.tag-options { margin-top: 8px; }
.tag-options .chip { min-height: 25px; padding: 2px 8px; }
.fold { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--control); background: #fafafa; }
.fold > summary { font-size: 14px; }
.fold[open] > summary { margin-bottom: 10px; }
.fold pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.variant-editor { display: grid; grid-template-columns: minmax(110px,1fr) auto auto 35px; gap: 10px; align-items: center; }
#cost-subtotal { align-self: center; padding-block: 5px; font-size: 17px; }
.order-group { overflow: hidden; }
.order-group > summary { display: flex; align-items: center; gap: 10px; padding: 11px 15px; list-style: none; background: #f7f7f7; }
.order-group[open] > summary { border-bottom: 1px solid var(--line); }
.order-group > summary::after { content: ""; flex: 0 0 7px; width: 7px; height: 7px; margin: 0 2px 3px; border: solid #666; border-width: 0 1px 1px 0; transform: rotate(45deg); }
.order-group[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.order-group > summary > b { margin-left: auto; white-space: nowrap; }
.summary-name { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.summary-name strong { font-weight: 590; overflow-wrap: anywhere; }
.group-content { display: grid; padding: 14px; gap: 10px; }
.group-content input { min-width: 75px; }
.group-content [data-col=packing] { min-width: 100px; }
.group-content [data-line-total] { white-space: nowrap; text-align: right; }
.total-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; background: white; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.total-bar strong, .big-total { color: var(--ink); font-size: 20px; font-weight: 650; }
#pick-options { padding-top: 15px; }
#categories .row { flex-wrap: nowrap; }
#sheet-cost + .spread, #sheet-cost ~ label { margin-top: 14px; }
.status-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; }
.status-tag.quoted::before { background: #3374cf; }
.status-tag.confirmed::before { background: #2a805a; }
#matches:empty, .panel-body:empty { display: none; }
.panel:has(> .panel-body:empty) > .panel-head { border-bottom: 0; }
.dialog-message { margin: 0 14px 12px; flex-shrink: 0; }
@media (max-width: 990px) {
  .library-table .wide-col, .orders-table .wide-col { display: none; }
  .mobile-meta { display: block; font-size: 12px; font-weight: 400; }
}
@media (max-width: 800px) {
  .detail-grid { grid-template-columns: minmax(0,1fr); gap: 15px; }
  .detail-image img { max-height: 275px; }
  .category-panel { margin-bottom: 16px; }
  .list-tools .searchbox { max-width: none; }
}
@media (max-width: 580px) {
  .list-tools { gap: 7px; margin-bottom: 14px; }
  .list-tools .searchbox { flex-basis: 100%; }
  .list-tools .primary { margin-left: auto; }
  .list-thumb { width: 35px; height: 35px; }
  .index-table .item-link { gap: 7px; line-height: 1.35; }
  .index-table th, .index-table td { padding: 9px 7px; font-size: 13px; }
  .index-table th:first-child, .index-table td:first-child { padding-left: 10px; }
  .index-table .arrow-col { display: none; }
  .index-table th.numeric, .index-table td.numeric { font-size: 12px; }
  .gallery { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .card-body { padding: 9px; font-size: 13px; }
  .variant-editor { grid-template-columns: minmax(70px,1fr) auto; gap: 7px; }
  .cost-items { padding: 2px 9px; }
  .cost-edit { grid-template-columns: 62px minmax(65px,1fr) 60px 28px; gap: 4px; }
  .cost-edit .control { padding-inline: 5px; }
  .cost-more { grid-column: 1 / -1; }
  .group-content { padding: 9px; }
  .group-content .actions { justify-content: flex-start; }
  .group-content input { min-width: 72px; }
  .summary-name { gap: 6px; }
  .summary-name small { display: none; }
  .doc-row { flex-wrap: wrap; padding-inline: 11px; }
  .doc-row > div { flex: 1 1 130px; }
  .photo-boxes .upload, .photo-tile { min-height: 130px; height: 140px; }
}
