/* Product and company reference records. Shared controls are defined in design.css. */
.ref-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.ref-toolbar > .search { flex: 1; min-width: 220px; max-width: 440px; }
.ref-filter { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.ref-filter select { min-height: 40px; min-width: 112px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); outline: none; background: #fff; color: var(--ink); font-size: 13px; }
.ref-filter select:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.ref-count { display: inline-flex; align-items: center; margin-left: 8px; padding: 1px 7px; border-radius: 4px; background: #f0f4f8; color: #708198; font-size: 12px; font-weight: 400; vertical-align: middle; }
.ref-product-table { min-width: 960px; }
.ref-product-table td { vertical-align: top; }
.ref-product-table .ref-check-cell { position: sticky; left: 0; z-index: 1; width: 44px; min-width: 44px; padding-right: 10px; padding-left: 14px; background: #fff; text-align: center; vertical-align: middle; }
.ref-product-table thead .ref-check-cell { background: #f7f9fc; }
.ref-check-cell input { width: 16px; height: 16px; min-height: 0; margin: 0; cursor: pointer; }
.ref-check-cell input:disabled { cursor: not-allowed; opacity: .4; }
.ref-product-table tr.ref-selected > td, .ref-product-table tr.ref-selected:hover > td { background: var(--brand-soft); }
.ref-selection-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--brand-line); border-radius: var(--control-radius); background: var(--brand-soft); }
.ref-selection-bar > div { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.ref-selection-bar b { color: var(--brand-ink); font-size: 13px; font-weight: 500; }
.ref-selection-bar .link { font-size: 12px; }
.ref-selection-bar .primary, .ref-selection-bar .secondary { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.ref-product-name { display: flex; align-items: flex-start; gap: 12px; min-width: 220px; }
.ref-product-name > div { min-width: 0; }
.ref-product-name b { color: var(--ink); }
.ref-thumbnail { display: block; flex: 0 0 48px; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 6px; background: #fff; object-fit: contain; }
.ref-image-empty { display: grid; place-items: center; background: #f6f8fb; color: #95a5b9; font-size: 13px; }
.ref-row-actions { display: flex; align-items: flex-start; gap: 16px; min-width: 100px; }
.ref-row-actions > .link { min-height: 30px; font-size: 13px; }
.ref-row-actions .ref-muted-action { color: var(--muted); }
.ref-actions-menu { position: relative; }
.ref-actions-menu > summary { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 4px 0; color: #667a95; font-size: 13px; list-style: none; cursor: pointer; }
.ref-actions-menu > summary::-webkit-details-marker { display: none; }
.ref-actions-menu > summary:hover { color: var(--brand-ink); }
.ref-actions-menu > summary svg { width: 14px; height: 14px; }
.workspace-card .ref-actions-menu[open] > summary { margin-bottom: 0; }
.ref-actions-popover { position: absolute; top: calc(100% + 5px); right: 0; z-index: 10; width: 180px; padding: 5px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-menu); }
.ref-actions-popover button { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 4px; background: transparent; color: #45556e; font-size: 12px; font-weight: 400; text-align: left; }
.ref-actions-popover button:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.ref-actions-popover button.ref-muted-action { color: var(--muted); }
.ref-actions-popover button.danger { color: var(--danger); }
.ref-empty { min-height: 300px; align-content: center; padding: 48px 24px; }
.ref-table-footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.ref-image-empty > .ui-icon { width: 23px; height: 23px; }
.ref-form-section { min-width: 0; margin-top: 28px; }
.ref-form-section:first-child { margin-top: 0; }
.ref-form-section > h3 { margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.ref-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ref-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin-bottom: 16px; color: #526178; font-size: var(--font-caption); }
.ref-field input, .ref-field textarea, .ref-field select { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); outline: none; background: #fff; color: var(--ink); font-size: var(--font-body); line-height: 1.6; }
.ref-field input:focus, .ref-field textarea:focus, .ref-field select:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.ref-field input[aria-invalid="true"], .ref-field textarea[aria-invalid="true"] { border-color: var(--danger); }
.ref-field textarea { min-height: 88px; resize: vertical; }
.ref-field small, .ref-help { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.7; }
.ref-help { margin-top: 8px !important; }
.ref-asset-editor { display: flex; align-items: center; gap: 20px; }
.ref-asset-editor > div { min-width: 0; }
.ref-product-preview { width: 104px; height: 104px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; object-fit: contain; }
.ref-file-button { position: relative; display: inline-flex; margin-right: 8px; overflow: hidden; white-space: nowrap; cursor: pointer; }
.ref-file-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ref-file-button:focus-within { outline: 2px solid var(--brand); outline-offset: 3px; }
.ref-form-error { min-height: 0; margin-top: 12px; color: var(--danger); font-size: 12px; line-height: 1.8; }
.ref-form-error:empty { display: none; }
.ref-company-assets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ref-company-asset { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.ref-company-asset h3 { margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.ref-company-asset-preview { display: grid; place-items: center; min-height: 168px; padding: 16px; border: 1px dashed #ced9e6; border-radius: 6px; background: #f8fafc; }
.ref-brand-preview { display: block; width: auto; max-width: 100%; height: auto; max-height: 128px; object-fit: contain; }
.ref-image-empty.ref-brand-preview > .ui-icon { width: 36px; height: 36px; }
.ref-image-empty.ref-brand-preview { display: grid; place-items: center; width: 90px; height: 90px; background: transparent; color: #9eacc0; font-size: 24px; }
.ref-asset-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ref-company .form-row { row-gap: 2px; }
.ref-company .ref-form-section + .ref-form-section { padding-top: 24px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .ref-toolbar { align-items: stretch; gap: 14px; }
  .ref-toolbar > .search { flex-basis: 100%; max-width: none; }
  .ref-filter { flex: 1; }
  .ref-filter select { flex: 1; min-width: 0; max-width: 100%; }
  .ref-company-assets { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .ref-selection-bar { padding: 14px; gap: 12px; }
  .ref-selection-bar > .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .ref-selection-bar > .actions button { min-height: 42px; padding-inline: 8px; font-size: 12px; }
  .ref-field input, .ref-field select { min-height: 44px; }
  .ref-empty { min-height: 280px; padding: 36px 16px; }
  .ref-asset-editor { align-items: flex-start; gap: 14px; }
  .ref-company-asset { padding: 16px; }
}
@media (max-width: 420px) {
  .ref-two { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ref-product-preview { width: 80px; height: 80px; }
  .ref-filter { gap: 7px; }
}
