/* Agromilk — botões, campos, tabelas, janelas, atendimentos, financeiro e loja. Depende das variáveis de tema.css. */

/* ---------- Botões ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--control);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--raised); border-color: #b9c3b3; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary, .btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.primary:hover, .btn.primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); color: #fff; }
.icon { min-height: 0; padding: 9px; border: 0; border-radius: 50%; background: transparent; flex-shrink: 0; }
.icon:hover { background: var(--active); }
.icon.danger { color: var(--negative); }
.text-button { min-height: 0; padding: 4px 2px; border: 0; border-radius: 6px; background: transparent; color: var(--green-ink); font-size: 13px; font-weight: 600; }
.text-button:hover { background: transparent; color: var(--navy); }
.text-button.danger { color: var(--negative); }
.name-button {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}
.name-button:hover { background: transparent; color: var(--green-ink); }
.positive { color: var(--green-ink); }
.danger { color: var(--negative); }
.low-text { color: var(--warning-ink); }

/* ---------- Campos ---------- */
input, textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--control);
  border-radius: var(--r-inner);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
textarea { min-height: 96px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover, select:hover { border-color: #b4bfae; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-ink); box-shadow: 0 0 0 3px rgba(133, 183, 68, 0.3); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--green-ink); cursor: pointer; }
input[type="checkbox"]:focus { box-shadow: none; }
input[type="file"] { padding: 8px; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field > span { color: var(--ink); font-size: 13px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; font-size: 14px; cursor: pointer; }

details { border-top: 1px solid var(--rule); padding-top: 14px; }
summary { margin-bottom: 14px; font-size: 14px; font-weight: 600; cursor: pointer; list-style-position: inside; }
summary::marker { color: var(--green-ink); }

/* ---------- Abas, busca, tabelas ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; padding: 5px; border-radius: var(--r-pill); background: var(--active); overflow-x: auto; width: max-content; max-width: 100%; }
.tabs button { flex: none; min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font-size: 14px; }
.tabs button:hover { background: rgba(255, 255, 255, 0.6); color: var(--ink); }
.tabs button.selected { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(1, 22, 67, 0.08); }
.tabs span { margin-left: 4px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--raised); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tabs button.selected span { background: var(--green-soft); color: var(--positive-ink); }

.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.search { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 200px; max-width: 520px; padding-left: 14px; border: 1px solid var(--control); border-radius: var(--r-pill); background: var(--surface); color: var(--faint); }
.search:focus-within { border-color: var(--green-ink); box-shadow: 0 0 0 3px rgba(133, 183, 68, 0.3); }
.search input { min-height: 40px; padding: 8px 14px 8px 4px; border: 0; background: transparent; box-shadow: none; }
.search input:focus { box-shadow: none; }
.table-toolbar > select { width: auto; min-width: 180px; max-width: 240px; border-radius: var(--r-pill); }
.table-toolbar > button { margin-left: auto; }
.table-toolbar .field { flex: 1; min-width: 140px; margin: 0; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
thead { background: transparent; }
th { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; text-transform: lowercase; letter-spacing: 0; }
th::first-letter { text-transform: uppercase; }
td { padding: 14px 16px; border-bottom: 1px solid var(--rule); font-size: 14px; font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { padding-left: 24px; }
td:last-child, th:last-child { padding-right: 24px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--raised); }
td small { display: block; margin-top: 3px; font-size: 12px; }
td > small { display: inline; }
.product-cell { display: flex; align-items: center; gap: 14px; min-width: 240px; max-width: 420px; white-space: normal; }
.product-cell small { display: block; }
.category-label { display: inline-block; max-width: 170px; color: var(--muted); font-size: 13px; line-height: 1.4; white-space: normal; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions > button:not(.icon) { min-height: 34px; padding: 0 14px; font-size: 13px; }
.row-actions select { width: auto; min-height: 34px; padding: 4px 12px; border-radius: var(--r-pill); font-size: 13px; }
.table-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; }
.table-footer span { color: var(--faint); font-size: 12px; }

/* ---------- Etiquetas de situação ---------- */
.tag {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--positive-bg);
  color: var(--positive-ink);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.tag.amber { background: var(--warning-bg); color: var(--warning-ink); }
.tag.red { background: var(--negative-bg); color: var(--negative-ink); }
.tag.neutral { background: var(--raised); color: var(--muted); border: 1px solid var(--border); }
.tag.neutral::before { display: none; }
.tag.lime { background: var(--green); color: var(--navy); font-weight: 600; }
.tag.lime::before { display: none; }

/* ---------- Avisos e notificações ---------- */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid var(--warning-line);
  border-radius: 12px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: 14px;
  line-height: 1.55;
}
.alert svg { flex: none; }
.alert > button { margin-left: auto; }
.alert.error { border-color: #f3c9c4; background: var(--negative-bg); color: var(--negative-ink); }
.alert.below { margin-top: 20px; }
.pending-list { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.pending-list > div { min-width: 0; overflow-wrap: anywhere; }
.pending-list p { margin: 6px 0 12px; }
.pending-list button { white-space: normal; }
.subtle-note { margin: 16px 0; padding: 12px 14px; border-radius: var(--r-inner); background: var(--raised); color: var(--muted); font-size: 13px; line-height: 1.6; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
  padding: 14px 22px 14px 16px;
  border-radius: var(--r-pill);
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transform: translateX(-50%);
  box-shadow: var(--shadow-float);
}
.toast svg { color: var(--green); }

/* ---------- Janelas (cadastros) ---------- */
dialog { width: min(760px, 100% - 32px); max-height: 92vh; padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }
dialog::backdrop { background: rgba(1, 22, 67, 0.42); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px 18px; border-bottom: 1px solid var(--rule); }
.modal-header small { display: none; }
.modal-header h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.modal-body { max-height: 66vh; padding: 24px 28px; overflow: auto; }
.modal-body h3 { margin: 22px 0 12px; font-size: 15px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--rule); background: var(--raised); }

.photo-upload { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.photo-preview { display: flex; flex: none; align-items: center; justify-content: center; width: 104px; height: 104px; border: 1.5px dashed var(--control); border-radius: 16px; background: var(--raised); color: var(--faint); overflow: hidden; }
.photo-preview img { width: 100%; height: 100%; object-fit: contain; }
.photo-upload b { font-size: 15px; }
.photo-upload p { margin: 2px 0 10px; color: var(--muted); font-size: 13px; }
.photo-upload .btn { min-height: 36px; padding: 0 14px; font-size: 13px; }
.source-note { display: block; margin-top: 16px; font-size: 12px; }
.product-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.product-gallery a { display: block; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.product-gallery img { display: block; width: 104px; height: 104px; object-fit: contain; }

.inline { display: flex; align-items: center; gap: 10px; }
.inline > select { flex: 1; }
.inline > input { max-width: 120px; }
.between { justify-content: space-between; }
.cart-items { margin: 16px 0; }
.cart-items > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.cart-items > div > span { flex: 1; font-size: 14px; }
.cart-items small { display: block; margin-top: 2px; font-size: 12px; }
.cart-items input { width: 80px; min-height: 36px; }
.cart-items b { font-size: 14px; font-variant-numeric: tabular-nums; }
.total-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 18px 20px; border-radius: 14px; background: var(--navy); color: #fff; }
.total-row strong { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; padding: 28px; border: 1.5px dashed var(--control); border-radius: 16px; background: var(--raised); color: var(--muted); text-align: center; cursor: pointer; }
.dropzone:hover { border-color: var(--green-ink); background: var(--green-soft); }
.dropzone svg { color: var(--green-ink); }
.dropzone b { color: var(--ink); font-size: 15px; }
.dropzone span { font-size: 13px; }
.dropzone input { max-width: 320px; background: var(--surface); }
.import-preview { max-height: 240px; margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; }

/* ---------- Ordens de serviço, financeiro, configurações ---------- */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.service-card { display: flex; flex-direction: column; padding: 22px; }
.service-card h2 { margin: 18px 0 2px; font-size: 18px; }
.service-card p { color: var(--muted); font-size: 14px; }
.service-card .row-actions { flex-wrap: wrap; margin-top: auto; }
.service-problem { margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: var(--raised); color: var(--ink); font-size: 14px; line-height: 1.55; }
.service-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.service-meta span { padding: 3px 10px; border-radius: var(--r-pill); background: var(--raised); color: var(--muted); font-size: 12px; }
.service-values { padding: 12px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.service-values span { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); }
.service-values b { color: var(--ink); font-variant-numeric: tabular-nums; }
.service-photo-section { margin-bottom: 22px; }
.service-photos { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.service-photos > div { position: relative; }
.service-photos img { width: 100px; height: 100px; border-radius: 12px; object-fit: cover; }
.service-photos button { position: absolute; top: 4px; right: 4px; min-height: 0; padding: 4px; border-radius: 50%; background: var(--surface); }

.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.summary-row:last-child { border-bottom: 0; }
.summary-row small { display: block; margin-top: 2px; }
.summary-row b { font-variant-numeric: tabular-nums; }
.finance-period { margin-bottom: 20px; }
.finance-period .form-grid { max-width: 520px; }
.finance-period .muted { margin: 12px 0 0; font-size: 13px; }
.checklist { margin: 18px 0; }
.checklist > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: 14px; }
.checklist span { display: flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-size: 13px; font-weight: 600; }
.photo-migration { margin-bottom: 20px; border-top: 0; }
.photo-migration summary { margin: 0; font-weight: 600; }
.photo-migration[open] summary { margin-bottom: 12px; }
.photo-migration .photo-import-list { max-height: 240px; margin: 14px 0; overflow: auto; }
.photo-import-list p { margin: 4px 0; font-size: 13px; }

/* ---------- Aba "Minha loja virtual" ---------- */
.store-hero { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 40px 44px; border-radius: 20px; background: var(--navy); color: #fff; }
.store-hero h2 { margin: 16px 0 12px; color: #fff; font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; }
.store-hero p { max-width: 400px; margin-bottom: 24px; color: #c7d0e0; font-size: 15px; }
.store-hero .btn.primary { background: var(--green); border-color: var(--green); color: var(--navy); font-weight: 600; }
.store-hero .btn.primary:hover { background: #9ccc5a; border-color: #9ccc5a; }
.store-hero button:not(.primary) { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.store-hero button:not(.primary):hover { background: rgba(255, 255, 255, 0.1); }
.store-illustration { display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 220px; padding: 32px; border-radius: 120px 120px 24px 24px; background: #0b2758; color: var(--green); font-size: 14px; }
.store-illustration span { color: #fff; font-weight: 500; }
.store-selection .tag { font-variant-numeric: tabular-nums; }
.store-selection .check { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.store-selection tr:has(input:checked) .check { color: var(--positive-ink); font-weight: 600; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.shop-product { display: flex; flex-direction: column; padding: 14px 14px 16px; }
.shop-photo { display: flex; align-items: center; justify-content: center; height: 180px; margin-bottom: 14px; border-radius: 12px; background: var(--raised); color: var(--faint); overflow: hidden; }
.shop-photo img { width: 100%; height: 100%; object-fit: contain; }
.shop-product > small { color: var(--green-ink); font-size: 12px; font-weight: 500; }
.shop-product h3 { min-height: 42px; margin: 4px 0 10px; font-size: 15px; line-height: 1.4; }
.shop-product > b { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.shop-product > p { margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.shop-product > button { width: 100%; margin-top: auto; }
.shop-product details { margin: 6px 0 10px; }
.shop-description summary { font-size: 13px; }
.shop-description p { color: var(--muted); font-size: 14px; white-space: pre-wrap; }

@media (max-width: 1200px) {
  .store-hero { padding: 32px; }
  .heading-actions { justify-content: flex-end; }
}

@media (max-width: 980px) {
  .store-illustration, .table-footer span { display: none; }
  .table-toolbar > select { max-width: 100%; }
}

@media (max-width: 700px) {
  button, .btn { min-height: 44px; font-size: 14px; white-space: normal; touch-action: manipulation; }
  input, select, textarea, .cart-items input { min-height: 44px; font-size: 16px; }
  input[type="checkbox"] { flex-shrink: 0; width: 24px; height: 24px; min-height: 24px; }
  .icon { min-width: 44px; min-height: 44px; }
  .field > span { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .heading-actions { justify-content: flex-start; }
  .tabs { width: 100%; }
  .table-toolbar { padding: 14px; }
  .table-toolbar .search { max-width: none; min-width: 100%; }
  .table-toolbar > select { flex-basis: 100%; max-width: 100%; }
  .table-toolbar > button { margin-left: 0; }
  .table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
  .table-wrap:not(.inventory-table)::before { content: "Deslize para o lado para ver todas as colunas"; display: block; padding: 10px 14px; color: var(--muted); font-size: 12px; }
  .inventory-table table, .inventory-table tbody { display: block; white-space: normal; }
  .inventory-table thead { display: none; }
  .inventory-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 16px; border-bottom: 1px solid var(--rule); }
  .inventory-table td, .inventory-table td:first-child, .inventory-table td:last-child { display: block; min-width: 0; padding: 0; border: 0; font-size: 14px; }
  .inventory-table td:first-child, .inventory-table td:nth-child(2), .inventory-table td:last-child { grid-column: 1 / -1; }
  .inventory-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
  .inventory-table tr:hover td { background: transparent; }
  .inventory-table .product-cell { align-items: flex-start; min-width: 0; max-width: none; }
  .inventory-table .product-cell > div { min-width: 0; }
  .inventory-table .name-button { min-height: 44px; font-size: 15px; overflow-wrap: anywhere; }
  .inventory-table .category-label { max-width: none; }
  .inventory-table .row-actions { justify-content: flex-end; }
  dialog { width: calc(100% - 16px); max-width: 600px; max-height: calc(100dvh - 16px); margin: auto; border-radius: 18px; }
  dialog .modal { display: flex; flex-direction: column; max-height: calc(100dvh - 16px); }
  dialog .modal-header { flex-shrink: 0; padding: 14px 16px; }
  dialog form { display: flex; flex-direction: column; min-height: 0; }
  .modal-header h2 { font-size: 18px; }
  .modal-body { min-height: 0; max-height: none; padding: 16px; overflow-y: auto; overscroll-behavior: contain; }
  .modal-footer { flex-wrap: wrap; flex-shrink: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-footer button { flex: 1; }
  .inline { flex-wrap: wrap; }
  .inline > select { flex-basis: 100%; min-width: 0; }
  .cart-items > div { flex-wrap: wrap; }
  .cart-items > div > span { flex-basis: 100%; }
  .between { align-items: flex-start; }
  .between .heading-actions { justify-content: flex-start; }
  .alert { flex-wrap: wrap; overflow-wrap: anywhere; }
  .summary-row { gap: 12px; overflow-wrap: anywhere; }
  .summary-row > span, .summary-row > div { min-width: 0; }
  .service-grid { grid-template-columns: 1fr; }
  .service-card { padding: 18px; }
  .store-hero { flex-direction: column; align-items: flex-start; padding: 26px 22px; }
  .store-hero h2 { font-size: 28px; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .shop-product { padding: 10px 10px 12px; }
  .shop-photo { height: 132px; }
  .shop-product h3 { font-size: 14px; overflow-wrap: anywhere; }
  .shop-product > b { font-size: 17px; }
  .shop-product button { padding: 10px 6px; font-size: 13px; }
  .photo-upload { flex-wrap: wrap; gap: 14px; }
  .photo-upload input, .dropzone input { max-width: 100%; }
  .dropzone { padding: 20px; }
  .toast { bottom: calc(14px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 24px); }
}

@media (max-width: 359px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ---------- Lucro: por peça, por venda e bruto/líquido ---------- */
.profit-cell { display: flex; flex-direction: column; }
.profit-cell b { color: var(--green-ink); }
.profit-cell.danger b { color: var(--negative); }
.profit-cell small { margin-top: 2px; }
.profit-missing { color: var(--faint); }
.profit-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 4px 0 18px; border-radius: 14px; background: var(--rule); overflow: hidden; }
.profit-preview > div { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--green-soft); }
.profit-preview span { color: var(--muted); font-size: 12px; }
.profit-preview strong { color: var(--positive-ink); font-size: 20px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.profit-preview.loss > div { background: var(--negative-bg); }
.profit-preview.loss strong { color: var(--negative-ink); }
p.profit-preview { display: block; padding: 12px 14px; background: var(--raised); font-size: 13px; }
.summary-row.profit-gross b { font-size: 16px; }
.summary-row.profit-subtotal { border-top: 1px solid var(--border); }
.summary-row.profit-subtotal b { color: var(--ink); font-size: 16px; }
.summary-row.profit-net { margin-top: 6px; padding: 16px 18px; border: 0; border-radius: 14px; background: var(--navy); color: #fff; }
.summary-row.profit-net small { color: #c7d0e0; }
.summary-row.profit-net b { color: var(--green); font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.summary-row.profit-net.loss { background: var(--negative-ink); }
.summary-row.profit-net.loss b { color: #fff; }
.card.padded > .alert { margin: 14px 0 10px; font-size: 13px; }
@media (max-width: 700px) {
  .profit-preview { grid-template-columns: 1fr; }
}

/* ---------- Certificado digital (Configurações) ---------- */
.certificado .inline.between { align-items: flex-start; }
.certificado .cert-info { margin: 12px 0 14px; padding: 4px 16px; border-radius: 12px; background: var(--raised); }
.certificado .cert-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-top: 16px; }
.certificado .cert-form .heading-actions { grid-column: 1 / -1; }
.certificado .cert-form input[type="file"] { min-height: 42px; }
@media (max-width: 700px) { .certificado .cert-form { grid-template-columns: 1fr; } }
.certificado .alert[role="status"] { border-color: #cfe6b4; background: var(--positive-bg); color: var(--positive-ink); }

/* Importar: adicionar x substituir o estoque */
.import-modes{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:4px 0 12px}
.import-mode{display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left;padding:12px 14px;border-radius:12px;white-space:normal;height:auto}
.import-mode span{font-size:.82rem;color:var(--muted,#5b6472);font-weight:400;line-height:1.35}
.import-mode.selected{border-color:#85b744;box-shadow:0 0 0 2px rgba(133,183,68,.35);background:rgba(133,183,68,.08)}
.replace-summary{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.replace-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.replace-stat{display:flex;flex-direction:column;align-items:center;padding:10px 6px;border-radius:12px;background:rgba(1,22,67,.05)}
.replace-stat strong{font-size:1.4rem;color:#011643}
.replace-stat span{font-size:.78rem;text-align:center}
.replace-stat.green strong{color:#5a8a1f}
.replace-stat.red strong{color:#c0392b}
.replace-list summary{cursor:pointer;font-weight:600}
.replace-list ul{max-height:180px;overflow:auto;margin:6px 0 0;padding-left:20px;font-size:.85rem}
.replace-confirm{font-weight:600}
@media (max-width:560px){.import-modes{grid-template-columns:1fr}.replace-stats{grid-template-columns:repeat(2,1fr)}}

/* Fotos das peças: tirar uma por uma ou enviar várias */
.am-fotos-abas{margin-bottom:12px}
.am-fotos-peca{display:flex;flex-direction:column;gap:2px;padding:16px;border-radius:14px;background:rgba(1,22,67,.05);margin:8px 0 14px}
.am-fotos-peca small{color:#5b6472;font-weight:600;letter-spacing:.02em}
.am-fotos-peca strong{font-size:1.15rem;color:#011643;line-height:1.3}
.am-fotos-peca span{font-size:.85rem;color:#5b6472}
.am-fotos-acoes{display:flex;flex-wrap:wrap;gap:8px}
.am-fotos-acoes .btn{cursor:pointer}
.am-fotos-acoes .btn.disabled{opacity:.6;pointer-events:none}
.am-fotos-lista{list-style:none;margin:8px 0 0;padding:0;max-height:260px;overflow:auto;font-size:.85rem}
.am-fotos-lista li{display:flex;justify-content:space-between;gap:12px;padding:6px 2px;border-bottom:1px solid rgba(1,22,67,.08)}
.am-fotos-lista li span{color:#5b6472;overflow-wrap:anywhere}
.am-fotos-lista li b{text-align:right}
.am-fotos-lista li.sem b{color:#c0392b;font-weight:500}
@media (max-width:560px){.am-fotos-acoes{flex-direction:column}.am-fotos-acoes>*{width:100%;justify-content:center}}

/* Busca digitável (peças e clientes) */
.am-busca{position:relative;flex:1;min-width:0;width:100%}
.am-busca input{width:100%}
.am-busca-lista{position:absolute;z-index:40;left:0;right:0;top:calc(100% + 4px);margin:0;padding:4px;list-style:none;max-height:300px;overflow:auto;background:var(--surface,#fff);border:1px solid rgba(1,22,67,.12);border-radius:12px;box-shadow:0 12px 32px rgba(1,22,67,.16)}
.am-busca-lista li{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;cursor:pointer;font-size:.92rem}
.am-busca-lista li:hover,.am-busca-lista li:active{background:rgba(133,183,68,.14)}
.am-busca-lista img,.am-busca-sem-foto{width:36px;height:36px;flex:0 0 36px;border-radius:8px;object-fit:cover;background:rgba(1,22,67,.06)}
.am-busca-texto{display:flex;flex-direction:column;min-width:0}
.am-busca-texto b{font-weight:600;line-height:1.25;overflow-wrap:anywhere}
.am-busca-texto small{color:#5b6472;font-size:.8rem}
.am-busca-vazio{color:#5b6472;cursor:default!important}
.am-busca-novo{flex-wrap:wrap;color:#3d6b12}
.am-busca-novo small{width:100%;color:#5b6472}

/* Notas fiscais (NFS-e) */
.am-nf{display:flex;flex-direction:column;gap:14px}
.am-nf-cabeca .heading-actions{margin-top:12px}
.am-nf-titulo{margin:8px 0 0}
.am-nf-lista{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px}
.am-nf-item{padding:14px 16px;display:flex;flex-direction:column;gap:8px}
.am-nf-topo{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.am-nf-topo b{display:block;font-size:1.02rem}
.am-nf-topo small{color:#5b6472}
.am-nf-meio{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.am-nf-meio span{font-weight:600;overflow-wrap:anywhere}
.am-nf-meio strong{font-size:1.1rem;color:#011643;white-space:nowrap}
.am-nf-desc{margin:0;font-size:.85rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.am-nf-erro{font-size:.82rem;color:#b42318;background:rgba(180,35,24,.07);border-radius:8px;padding:6px 8px;margin-top:4px}
.am-nf-item .heading-actions{flex-wrap:wrap;gap:6px}
.am-nf-item .heading-actions>*{min-height:36px;padding:0 12px;font-size:.88rem}
.am-nf-form textarea{width:100%}
.danger-link{color:#b42318}
.primary.danger{background:#b42318;border-color:#b42318}
@media (max-width:560px){.am-nf-lista{grid-template-columns:1fr}}
/* Nota de venda (NF-e): resumo das peças da venda no formulário */
.am-nfe-itens{display:flex;flex-direction:column;gap:4px;background:#f6f7f9;border-radius:10px;padding:10px 12px;margin:4px 0 8px}
.am-nfe-itens>div{display:flex;justify-content:space-between;gap:10px;font-size:.9rem}
.am-nfe-itens>div span{overflow-wrap:anywhere}
.am-nfe-itens>div small{white-space:nowrap}
