/* LOGIN & MODAIS */
.login-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.login-card {
  background: var(--surface); padding: 32px; border-radius: 12px;
  border: 1px solid var(--border); width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 14px;
}
.brand-header h1 { margin: 0; font-size: 1.5rem; letter-spacing: 1px; }
.brand-header span { color: var(--sage); }
.brand-header p { margin: 4px 0 0; color: var(--espresso-light); font-size: 0.9rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin: 0; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(45, 36, 30, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 900; padding: 20px;
}
.modal-overlay.modal-top { z-index: 950; background: rgba(45, 36, 30, 0.65); }

.modal-card {
  background: var(--surface); padding: 28px; border-radius: 12px;
  border: 1px solid var(--border); width: 100%; max-width: 900px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}
.modal-card.modal-md { max-width: 920px; }
.modal-card.modal-lg { max-width: 1020px; }
.modal-card.modal-xl {
  width: min(1480px, 94vw);
  max-width: 1480px;
  min-height: 540px;
  max-height: 92vh;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

#lote-itens-container,
#venda-itens-container {
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* FORMS & IMAGENS */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: end; }
.full-col { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.84rem; font-weight: 500; }
input, select, textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.9rem; background: #fff; color: var(--espresso);
}
input:not([type="checkbox"]):not([type="radio"]), select { height: 38px; }

.img-url-row { display: flex; gap: 12px; align-items: flex-end; }
.img-preview { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #faf8f5; }
.thumb-prod { width: 38px; height: 38px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border); display: block; }
.thumb-empty { width: 38px; height: 38px; border-radius: 5px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: #999; }

.currency-inline-group { display: flex; gap: 6px; align-items: center; }
.currency-inline-group .moeda-select { width: 76px; flex-shrink: 0; padding: 6px 8px; font-weight: 600; }
.currency-inline-group input { flex: 1; min-width: 0; }

.lote-item-row {
  display: grid;
  grid-template-columns: minmax(340px, 3fr) 85px 155px 185px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.lote-item-row label { min-width: 0; }
.lote-item-row select,
.lote-item-row input { width: 100%; min-width: 0; }
.lote-item-row .moeda-select { width: 76px; }
.lote-item-row button { white-space: nowrap; height: 38px; }
.sku-inline-group { display: flex; gap: 6px; align-items: center; }
.sku-inline-group select { flex: 1; min-width: 0; }

.venda-item-row {
  display: grid;
  grid-template-columns: minmax(340px, 3fr) 150px 85px 155px 140px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.venda-item-row label { min-width: 0; }
.venda-item-row select,
.venda-item-row input { width: 100%; min-width: 0; }
.venda-item-row button { white-space: nowrap; height: 38px; }

/* BUSCA INLINE COM LUPA NO SELETOR DE PRODUTO (SKU) */
.sku-picker-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.sku-picker-wrap select,
.sku-picker-wrap input[type="search"] {
  flex: 1;
  min-width: 0;
}
.btn-sku-search {
  height: 38px;
  padding: 0 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sku-search-dropdown {
  position: fixed;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(45, 36, 30, 0.24);
  z-index: 2000;
}
.sku-search-option {
  padding: 9px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid #f2ede6;
}
.sku-search-option:last-child { border-bottom: none; }
.sku-search-option:hover { background: #f6f1ea; }
.sku-search-empty {
  padding: 12px;
  font-size: 0.84rem;
  color: #777;
  text-align: center;
}