/* Tela produtos: estilos próprios desta tela, para não disputar o styles.css com outras rodadas. */
/* Medidas tiradas da referência de 1440 × 900 (captura em escala 2). Cores do relatório de fidelidade visual. */

#view-root[data-view='catalog'] {
  --product-dark: #0f1921;
  --product-line: #d9dee2;
  --product-head: #f6f6f6;
  --product-alt: #f3f3f3;
  --product-text: #262b2f;
  --product-muted: #6b7177;
  font-family: 'Source Sans Pro', 'Source Sans 3', system-ui, sans-serif;
  color: var(--product-text);
}

/* Ícone antes do título, como na referência da lista. */
main:has(#view-root[data-view='catalog']) .topbar h1[data-mode='list']::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: -3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23262b2f'%3E%3Cpath d='M12 2l9 4.5v11L12 22l-9-4.5v-11zm0 2.2L6.2 7 12 9.9 17.8 7zM5 8.7v7.6l6 3V11.7zm8 3v7.6l6-3V8.7z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.product-screen { display: flex; flex-direction: column; gap: 14px; }
.product-icon { display: inline-flex; width: 1em; height: 1em; line-height: 1; flex: none; }
.product-icon svg { display: block; width: 100%; height: 100%; }

/* Barra da lista: Adicionar e Mais ações à esquerda, busca à direita. */
.product-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.product-toolbar-start { display: flex; gap: 4px; align-items: center; }
.product-add, .product-submit {
  display: inline-flex; align-items: center; gap: 6px;
  height: 37px; padding: 0 12px; border: 1px solid var(--product-dark); border-radius: 3px;
  background: var(--product-dark); color: #fff; font-family: inherit; font-weight: 400; font-size: 16px; line-height: 1; text-decoration: none; cursor: pointer;
}
.product-add .product-icon { font-size: 15px; }
.product-add:hover, .product-submit:hover { background: #1f2d38; }
.product-outline {
  display: inline-flex; align-items: center; gap: 6px;
  height: 37px; padding: 0 12px; border: 1px solid var(--product-dark); border-radius: 3px;
  background: #fff; color: var(--product-text); font-family: inherit; font-weight: 400; font-size: 16px; line-height: 1; text-decoration: none; cursor: pointer;
}
.product-outline:disabled { cursor: not-allowed; opacity: 0.55; }
.product-more { position: relative; }
.product-more > summary { list-style: none; }
.product-more > summary::-webkit-details-marker { display: none; }
.product-caret { width: 0; height: 0; margin-left: 4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; }
.product-menu {
  position: absolute; z-index: 20; top: calc(100% + 2px); left: 0; min-width: 260px; margin: 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid var(--product-line); border-radius: 3px; box-shadow: 0 6px 16px rgb(15 25 33 / 12%);
}
.product-menu button {
  display: flex; width: 100%; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 14px; border: 0; background: none; color: var(--product-text); font-family: inherit; font-weight: 400; font-size: 14px; line-height: 1.3; text-align: left; cursor: pointer;
}
.product-menu button:hover:not(:disabled) { background: var(--product-alt); }
.product-menu button:disabled { color: var(--product-muted); cursor: not-allowed; }
.product-menu small { font-size: 11px; color: var(--product-muted); }

.product-search { display: flex; align-items: center; gap: 4px; }
.product-search input {
  width: 237px; height: 37px; min-height: 37px; padding: 0 12px; border: 1px solid #cfd4d8; border-radius: 3px 0 0 3px;
  font-family: inherit; font-weight: 400; font-size: 16px; line-height: 1; color: var(--product-text); background: #fff;
}
.product-square {
  display: inline-grid; place-items: center; width: 39px; height: 37px; border: 1px solid #cfd4d8; border-radius: 3px;
  background: #fff; color: var(--product-text); font-size: 16px; cursor: pointer;
}
.product-search input + .product-square { margin-left: -4px; border-radius: 0; }
.product-search .product-view-mode > .product-square { margin-right: 0; }
.product-square.dark { border-color: var(--product-dark); background: var(--product-dark); color: #fff; }
.product-square:disabled { cursor: not-allowed; }
.product-square:not(.dark):disabled { opacity: 0.85; }

/* Tabela da lista. */
.product-table-wrap { overflow-x: auto; border: 1px solid var(--product-line); border-radius: 4px; background: #fff; }
.product-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 15px; }
.product-table th {
  height: 46px; padding: 0 12px; background: var(--product-head); border-bottom: 1px solid var(--product-line);
  font-weight: 600; text-align: left; color: var(--product-text);
}
.product-table td { height: 53px; padding: 0 12px; border-top: 1px solid var(--product-line); vertical-align: middle; overflow-wrap: anywhere; }
.product-table th + th, .product-table td + td { border-left: 1px solid var(--product-line); }
.product-table tbody tr:nth-child(even) td { background: var(--product-alt); }
.product-table tbody tr:first-child td { border-top: 0; }
.product-col-code { width: 22.3%; }
.product-col-name { width: 33.4%; }
.product-col-value { width: 8.2%; }
.product-col-stock { width: 8.2%; }
.product-col-date { width: 15.8%; }
.product-col-actions { width: 12.1%; }
.product-list .product-table th:last-child { text-align: center; }
.product-row-actions > div { display: flex; justify-content: center; gap: 4px; }
.product-row-button {
  display: inline-grid; place-items: center; width: 27px; height: 27px; padding: 0;
  border: 1px solid var(--product-line); border-radius: 3px; background: #fff; color: var(--product-text);
  font-size: 13px; cursor: pointer; list-style: none; box-shadow: 0 1px 1px rgb(0 0 0 / 6%);
}
.product-row-button::-webkit-details-marker { display: none; }
.product-row-button:hover { border-color: #aeb6bd; }
.product-row-menu { position: relative; }
.product-row-menu .product-menu { left: auto; right: 0; min-width: 220px; }
.product-count { margin: 0; font-size: 14px; color: var(--product-muted); }
.product-count strong { font-weight: 600; color: var(--product-text); }
.product-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.product-pagination ul { display: flex; gap: 0; margin: 0; padding: 0; list-style: none; }
.product-pagination a, .product-page-gap {
  display: inline-grid; place-items: center; min-width: 38px; height: 36px; padding: 0 10px; margin-left: -1px;
  border: 1px solid #cfd4d8; background: #fff; color: var(--product-text); font-size: 15px; text-decoration: none;
}
.product-pagination li:first-child a { border-radius: 3px 0 0 3px; margin-left: 0; }
.product-pagination li:last-child a, .product-pagination li:last-child.product-page-gap { border-radius: 0 3px 3px 0; }
.product-pagination a:hover { background: var(--product-alt); }
.product-pagination a.is-current { background: var(--product-dark); border-color: var(--product-dark); color: #fff; }
.product-page-gap { color: var(--product-muted); }
/* "Por página" fica no botão de modo de exibição, como na referência. */
.product-view-mode { position: relative; }
.product-view-mode > summary { list-style: none; cursor: pointer; }
.product-view-mode > summary::-webkit-details-marker { display: none; }
.product-per-page { display: flex; align-items: center; gap: 8px; min-width: 190px; padding: 8px 12px; left: auto; right: 0; }
.product-per-page label { font-size: 14px; color: var(--product-muted); }
.product-per-page select { height: 32px; padding: 0 8px; border: 1px solid #cfd4d8; border-radius: 3px; font-family: inherit; font-size: 15px; background: #fff; }
.product-search .product-view-mode + input { border-radius: 0; }

.product-detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; margin: 0; }

/* Formulário: abas verticais à esquerda e caixas à direita. */
.product-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 31px; align-items: start; }
.product-tabs { display: flex; flex-direction: column; gap: 6px; }
.product-tab {
  display: flex; align-items: center; gap: 14px; min-height: 51px; padding: 8px 14px 8px 16px;
  border: 1px solid var(--product-line); border-radius: 3px; background: #fff; color: var(--product-text);
  font-family: inherit; text-align: left; cursor: pointer;
}
.product-tab .product-icon { font-size: 20px; color: #4a5258; }
.product-tab strong { display: block; font-size: 15px; font-weight: 400; line-height: 1.25; }
.product-tab small { display: block; font-size: 12px; line-height: 1.3; color: var(--product-muted); }
.product-tab[aria-selected='true'] { border-color: var(--product-dark); background: var(--product-dark); color: #fff; }
.product-tab[aria-selected='true'] .product-icon, .product-tab[aria-selected='true'] small { color: #e6e9eb; }
.product-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.product-boxes { display: flex; flex-direction: column; gap: 16px; }
.product-boxes[hidden] { display: none; }
.product-box { border: 1px solid var(--product-line); border-radius: 4px; background: #fff; }
.product-box-head { padding: 14px 20px 13px; background: var(--product-head); border-bottom: 1px solid var(--product-line); border-radius: 4px 4px 0 0; }
.product-box-head h2 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 20px; font-weight: 400; color: var(--product-text); }
.product-box-head h2 strong { font-weight: 600; }
.product-box-head h2 .product-icon { font-size: 16px; color: #555d63; }
.product-box-head p { margin: 4px 0 0; font-size: 12px; color: #4a5258; }
.product-box-body { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 11px; }
.product-span-2 { grid-column: span 2; }
.product-span-3 { grid-column: span 3; }
.product-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.product-label { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; color: var(--product-muted); }
.product-required { color: #e0352b; }
.product-tip { display: inline-flex; font-size: 12px; color: #262b2f; cursor: help; }
.product-field input, .product-field select, .product-field textarea, .product-prices input {
  width: 100%; min-height: 37px; padding: 0 12px; border: 1px solid #cfd4d8; border-radius: 3px;
  background: #fff; color: var(--product-text); font-family: inherit; font-weight: 400; font-size: 16px; line-height: 1.2;
}
.product-field textarea { padding: 8px 12px; min-height: 74px; }
.product-field :is(input, select, textarea):disabled { background: #f1f2f3; color: #7d858b; cursor: not-allowed; }
.product-field input[readonly] { background: #f6f6f6; }
.product-input-group { display: flex; }
.product-input-group > :first-child { flex: 1; min-width: 0; border-radius: 3px 0 0 3px; }
.product-addon {
  display: inline-flex; align-items: center; gap: 4px; flex: none; height: 37px; padding: 0 14px;
  border: 1px solid #cfd4d8; border-left: 0; border-radius: 0 3px 3px 0; background: #f6f6f6; color: var(--product-text);
  font-family: inherit; font-weight: 400; font-size: 16px; line-height: 1; cursor: pointer;
}
.product-addon.plain { background: #fff; color: #555d63; }
.product-addon:disabled { cursor: not-allowed; color: #7d858b; }
.product-pending { margin: 0; font-size: 11px; color: #9a6a00; }
.product-field.is-pending { cursor: not-allowed; }
.product-field.is-pending .product-label { color: #8a9197; }
.product-field input[type='file']:disabled { padding: 6px 12px; }
.product-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; color: #4a5258; }
.product-switch input { position: absolute; opacity: 0; pointer-events: none; }
.product-switch-track { position: relative; width: 28px; height: 16px; border: 1px solid #b9c0c5; border-radius: 9px; background: #e9ecef; }
.product-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #9aa2a8; }
.product-switch.is-pending { opacity: 0.75; cursor: not-allowed; }
.product-unit { max-width: 356px; }
.product-prices td { height: 50px; }
.product-prices td:nth-child(4) { width: 22%; }
#view-root[data-view='catalog'] .product-prices td:nth-child(1) { width: 18%; }
#view-root[data-view='catalog'] .product-prices output { font-variant-numeric: tabular-nums; }
.product-inline-actions { display: flex; gap: 6px; }
.product-actions { display: flex; justify-content: space-between; align-items: center; }
.product-cancel { border-color: #cfd4d8; height: 36px; }
.product-submit { height: 36px; font-size: 16px; }

@media (max-width: 900px) {
  .product-layout { grid-template-columns: 1fr; }
  .product-tabs { flex-direction: row; overflow-x: auto; }
  .product-tab { min-width: 180px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-search input { width: 100%; }
  .product-search { flex: 1; }
}
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-span-2, .product-span-3 { grid-column: auto; }
}

/* Menu "Mais ações" de produtos e serviços (itens com ícone e divisores) e coluna Selecionado. */
.product-menu.items-more-menu, .service-menu.items-more-menu { width: max-content; min-width: 0; padding: 0; }
.items-more-menu li + li { border-top: 1px solid #ececec; }
.items-more-menu li > button { flex-direction: row; align-items: center; gap: 10px; padding: 6px 22px; white-space: nowrap; font-size: 16px; }
.items-more-menu li > button .product-icon { font-size: 16px; color: #262b2f; }
.items-more-menu li > button:disabled .product-icon { opacity: 0.6; }
.items-select-col { width: 45px; }
.product-table th.items-select, .product-table td.items-select, .service-table th.items-select, .service-table td.items-select { padding: 0; text-align: center; }
.items-select input { width: 16px; height: 16px; margin: 0; vertical-align: middle; }

/* Leva 3 (grupo G2): medidas da captura da lista de produtos (colunas, texto de 14 px, botões de 41 px). */
#view-root[data-view='catalog'] .product-table { font-size: 14px; }
#view-root[data-view='catalog'] .product-col-code { width: 23.2%; }
#view-root[data-view='catalog'] .product-col-name { width: 31.3%; }
#view-root[data-view='catalog'] .product-col-value, #view-root[data-view='catalog'] .product-col-stock { width: 8.5%; }
#view-root[data-view='catalog'] .product-col-date { width: 16.4%; }
#view-root[data-view='catalog'] .product-add { padding: 0 13px; gap: 3px; }
#view-root[data-view='catalog'] .product-more > summary.product-outline { padding: 0 12px; gap: 5px; }
#view-root[data-view='catalog'] .product-caret { margin-left: 3px; border-left-width: 4px; border-right-width: 4px; border-top-width: 5px; }
#view-root[data-view='catalog'] .product-search input { width: 238px; height: 38px; min-height: 38px; }
#view-root[data-view='catalog'] .product-search .product-square { width: 41px; height: 38px; }
#view-root[data-view='catalog'] .product-search .product-view-mode > .product-square { width: 42px; }
#view-root[data-view='catalog'] .product-tab small { font-size: 11px; line-height: 1.25; }
#view-root[data-view='catalog'] .product-tab strong { font-size: 14px; }
#view-root[data-view='catalog'] .product-box-head p { font-size: 11px; }
#view-root[data-view='catalog'] .product-field small { font-size: 11px; }

/* Unidade de medida: lixeira dentro do campo, como no original (captura produto-novo.png). */
.product-unit-input { position: relative; display: block; }
.product-unit-input input { padding-right: 40px; }
.product-unit-clear { position: absolute; top: 50%; right: 8px; width: 28px; height: 28px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; color: #555d63; cursor: pointer; }
.product-unit-clear svg { width: 16px; height: 16px; }
