/* ==========================================================
   RESET + BASE
========================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Roboto Condensed", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f6f7f9;
  color: #1f2937;
  line-height: 1.4;
  min-width: 0;
}

img, svg, video, canvas {
  max-width: 100%;
}

input, select, textarea, button {
  font: inherit;
}

/* ==========================================================
   LAYOUT GERAL (FOOTER NO RODAPÉ)
========================================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 32px 0;
  min-width: 0;
}

/* ==========================================================
   CONTAINER
========================================================== */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  min-width: 0;
}

/* ==========================================================
   HEADER / TOPBAR
========================================================== */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .container {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  height: auto;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* BRAND */
.brand {
  display: flex;
  align-items: center;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  text-decoration: none;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
}

.brand-name {
  letter-spacing: 0.5px;
}

/* ==========================================================
   NAV
========================================================== */
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #dbeafe;
}

.nav-link.active {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #bfdbfe;
}

.nav-sep {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
  margin: 0 4px;
  flex: 0 0 auto;
}

.mobile-nav-panel-header,
.mobile-nav-backdrop {
  display: none;
}

.mobile-current-page {
  display: none;
}

.mobile-current-page-short {
  display: none;
}

/* ==========================================================
   USER BOX
========================================================== */
.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.usertext {
  text-align: right;
}

.userlabel {
  font-size: 10px;
  color: #6b7280;
}

.username {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

/* ==========================================================
   BOTÕES
========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
  max-width: 100%;
  white-space: nowrap;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-outline {
  background: transparent;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  background: #f3f4f6;
}

.btn-master {
  background: #f59e0b;
  color: #111827;
  border: 1px solid #d97706;
}

.btn-master:hover {
  background: #d97706;
  color: #ffffff;
}

/* ==========================================================
   FOOTER
========================================================== */
.footer {
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 16px 0;
}

.footer-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  font-size: 13px;
  color: #6b7280;
}

.footer-version {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  color: #9ca3af;
}

/* ==========================================================
   UTILITÁRIOS
========================================================== */
.muted {
  color: #6b7280;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

/* ==========================================================
   CARDS (para painéis)
========================================================== */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
}

.card + .card {
  margin-top: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ==========================================================
   TABELAS (clientes, vendas, financeiro)
========================================================== */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 5px 5px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
  font-size: 13px;
}

.table th {
  background: #f9fafb;
  text-align: left;
  font-weight: 600;
  color: #374151;
}

.table tr:hover td {
  background: #f9fafb;
}

.table tr:last-child td {
  border-bottom: none;
}

/* ==========================================================
   FORMULÁRIOS
========================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  min-width: 0;
}

textarea.form-control,
textarea {
  min-height: 96px;
  padding-top: 10px;
  resize: vertical;
}

.form-control:focus {
  outline: none;
  border-color: #2563eb;
}

/* ==========================================================
   RESPONSIVO
========================================================== */
@media (max-width: 1024px) {
  .nav {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    width: 70vw;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    gap: 6px;
    padding: 0 12px 24px;
    background: #ffffff;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.24);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.28s ease, visibility 0s linear 0.28s;
  }

  .topbar.is-open .nav {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.28s ease;
  }

  .topbar .container {
    flex-wrap: nowrap;
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .mobile-current-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .mobile-nav-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    margin: 0 -12px 8px;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
  }

  .mobile-nav-panel-header strong {
    font-size: 16px;
    color: #111827;
  }

  .mobile-nav-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    border: 0;
    padding: 0;
    background: rgba(15, 23, 42, 0.62);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0s linear 0.28s;
  }

  .topbar.is-open .mobile-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.28s ease;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .nav-link {
    width: 100%;
    min-height: 42px;
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: 14px;
  }

  .nav-sep {
    display: none;
  }

  .userbox {
    margin-left: auto;
    min-width: 0;
    gap: 6px;
  }

  .usertext {
    min-width: 0;
    text-align: left;
  }

  .username {
    width: clamp(52px, 18vw, 110px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .userbox .btn {
    width: auto;
    height: 34px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 16px 0 24px;
  }

  .container {
    padding: 0 12px;
  }

  .topbar .container {
    flex-wrap: nowrap;
    height: auto;
    padding: 10px 12px;
  }

  .userbox {
    margin-left: auto;
  }

  .usertext {
    display: block;
  }

  .card {
    padding: 14px;
    border-radius: 8px;
  }

  .card-title {
    font-size: 17px;
    margin-bottom: 12px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
  }

  .footer-version {
    margin-left: 0;
    text-align: center;
  }
}

@media (max-width: 340px) {
  .topbar .container {
    gap: 4px;
  }

  .mobile-nav-toggle {
    padding-right: 8px;
    padding-left: 8px;
  }

  .mobile-current-page {
    padding-right: 6px;
    padding-left: 6px;
  }

  .mobile-current-page-full {
    display: none;
  }

  .mobile-current-page-short {
    display: inline;
  }

  .userbox {
    gap: 3px;
  }

  .userbox .btn {
    padding-right: 6px;
    padding-left: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav,
  .mobile-nav-backdrop {
    transition: none !important;
  }
}
/* ==========================================================
   FILTROS (BUSCA / STATUS / BOTÕES)
========================================================== */
.filters-bar {
  display: flex;
  align-items: flex-end; /* 🔥 chave do alinhamento */
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-search {
  flex: 1;
  min-width: 320px;
}

.filter-status {
  width: 180px;
}

.upper,
.js-filter-busca,
.filters-bar input[name="busca"],
.filters-bar textarea[name="busca"] {
  text-transform: uppercase;
}

.js-filter-busca::-webkit-search-cancel-button,
.filters-bar input[name="busca"]::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

/* BOTÕES */
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 40px; /* 🔥 mesma altura do input */
  margin-top: 22px; /* 🔥 compensa o label */
}

.filter-actions .btn {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
}

/* RESPONSIVO */
@media (max-width: 768px) {
  .filters-bar {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .filter-group,
  .filter-search,
  .filter-status {
    width: 100%;
    min-width: 0;
  }

  .filter-actions {
    margin-top: 0;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .filter-actions .btn {
    width: 100%;
  }
}

/* ==========================================================
   TOAST (NOTIFICAÇÕES)
========================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  min-width: 280px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
}

/* TIPOS */
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.warning { background: #f59e0b; color:#111827; }
.toast.info    { background: #2563eb; }

/* ANIMAÇÕES */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

/* ==========================================================
   TABELAS – PADRÃO ADMIN (ALINHAMENTO PERFEITO)
========================================================== */

/* Wrapper com scroll horizontal */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Evita quebra e mantém colunas alinhadas */
.table {
  min-width: 900px; /* ajuste conforme crescer */
}

/* Alinhamento vertical perfeito em todas as células */
.table th,
.table td {
  vertical-align: middle;
}

/* ============================
   COLUNA DE AÇÕES
============================ */
.table-actions {
  padding: 8px;  
  justify-content: center;   /* alinhamento padrão */
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  min-width: 150px;
}

/* Botões da tabela */
.table-actions .btn {
  padding: 6px 10px;
  height: 32px;
  font-size: 13px;
  line-height: 1;
}

/* Botão outline */
.table-actions .btn-outline {
  background: #fff;
}

.table-actions .btn-outline:hover {
  background: #f3f4f6;
}

/* Evita imagens desalinharem a linha */
.table td img {
  display: block;
}

.auto-preenchido {
  background: #f8fafc;
}
.recalc-source {
  outline: 2px solid #22c55e;
  background: #f0fdf4;
}
/* ================= MODAL ================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ESCONDIDO */
.modal.hidden {
  display: none !important;
}

.modal-box {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 8px;
  padding: 16px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}
.client-filter{display:flex;gap:8px;align-items:center}
.modal-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.modal-list{max-height:320px;overflow:auto;margin-top:10px}
.modal-item{padding:10px;border-bottom:1px solid #e5e7eb;cursor:pointer}
.modal-item:hover{background:#f3f4f6}

/* Grid */
.grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;align-items: baseline;}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;align-items: baseline;}
.d-none{display:none!important}
.grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;align-items: baseline;}
.grid-5{display:grid;grid-template-columns:repeat(5,1fr);gap:14px;align-items: baseline;}

/* ABA-PRODUTOS (VENDAS) */
.prod-table{width:100%;border-collapse:collapse}
.prod-table th,.prod-table td{border:1px solid #e5e7eb;padding:8px;text-align:left}
.prod-table th{background:#f3f4f6;font-weight:600}
.prod-table input{width:100%}

/* ===============================
   TEXTAREA ORDEM DE SERVIÇO
=============================== */
.textarea-os {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.autocomplete-wrapper{
  position: relative;
  width: 100%;
}

.autocomplete-dropdown{
  position: absolute;
  top: 100%;              /* 🔥 sempre abaixo do input */
  left: 0;
  right: 0;
  width: 100%;
  margin-top: 4px;

  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;

  max-height: 260px;
  overflow-y: auto;

  z-index: 99999;         /* 🔥 sobe acima da tabela */
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.autocomplete-item{
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s ease;
}

.autocomplete-item:hover{
  background: #f3f4f6;
}

/* ===== AUTOCOMPLETE PRODUTO PREMIUM ===== */

.ac-produto-titulo {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.ac-produto-info {
  font-size: 12px;
  color: #6b7280;
}

.ac-ncm {
  font-family: monospace;
  font-weight: 600;
  color: #2563eb;
  letter-spacing: 0.5px;
}

.grid{
display:grid;
gap:15px;
}

.grid-4{
grid-template-columns:repeat(4,1fr);
}

.card-mini{
background:#fff;
border:1px solid #e5e7eb;
border-radius:10px;
padding:16px;
}

.card-mini-title{
font-size:13px;
color:#6b7280;
margin-bottom:6px;
}

.card-mini-value{
font-size:22px;
font-weight:600;
color:#111827;
}

/* ==========================================================
   RESPONSIVO GLOBAL - CRM/ERP
========================================================== */
.form-grid,
form {
  min-width: 0;
}

[class*="grid-"] > *,
.grid > * {
  min-width: 0;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card > div[style*="display:flex"],
.page-head,
.section-head {
  min-width: 0;
}

.card > div[style*="display:flex"] {
  row-gap: 10px;
}

.card > div[style*="display:flex"] > * {
  min-width: 0;
}

.tabs,
.tab-nav,
.actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.tabs,
.tab-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  white-space: nowrap;
}

.prod-table {
  min-width: 760px;
}

.prod-table,
.prod-table tbody,
.prod-table thead {
  overflow-x: auto;
}

@media (max-width: 1180px) {
  .grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal {
    align-items: flex-start;
    overflow: auto;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .form-control,
  .btn {
    min-height: 42px;
  }

  .btn {
    width: 100%;
    padding: 0 10px;
  }

  .form-actions,
  .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 760px;
    font-size: 13px;
  }

  .table th,
  .table td {
    padding: 8px;
  }

  .table-actions {
    min-width: 140px;
  }

  .table-actions .btn {
    width: auto;
    min-height: 32px;
  }

  .client-filter {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .modal-box {
    max-width: none;
    width: 100%;
  }

  .card-mini {
    padding: 14px;
  }

  .card-mini-value {
    font-size: 20px;
  }
}

/* ==========================================================
   LISTAS AUXILIARES DE PRODUTOS
========================================================== */
.produto-aux-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.produto-aux-page-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
}

.produto-aux-page-count {
  color: #6b7280;
  font-size: 14px;
  font-weight: 400;
}

.produto-aux-title-mobile,
.produto-aux-mobile-list {
  display: none;
}

.produto-aux-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .produto-aux-page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .produto-aux-page-title {
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .produto-aux-title-desktop {
    display: none;
  }

  .produto-aux-title-mobile {
    display: inline;
    white-space: nowrap;
  }

  .produto-aux-page-count {
    font-size: clamp(9px, 3vw, 12px);
    letter-spacing: -.1px;
    white-space: nowrap;
  }

  .produto-aux-page-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .produto-aux-page-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 6px 8px;
    font-size: 11px;
    text-align: center;
  }

  .produto-aux-page-actions .produto-aux-new-button {
    grid-column: 1 / -1;
    order: -1;
    min-height: 42px;
    font-size: 13px;
  }

  .produto-aux-page-actions.is-single-secondary .btn:not(.produto-aux-new-button) {
    grid-column: 1 / -1;
  }

  .produto-aux-filters {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .produto-aux-filters .filter-group {
    width: auto;
    min-width: 0;
  }

  .produto-aux-filters .filter-actions {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .produto-aux-desktop-table {
    display: none;
  }

  .produto-aux-mobile-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
  }

  .produto-aux-card {
    padding: 10px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
  }

  .produto-aux-card-head {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .produto-aux-card-head.no-badge {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .produto-aux-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #f8fafc;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
  }

  .produto-aux-card-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
  }

  .produto-aux-card-title {
    min-width: 0;
  }

  .produto-aux-card-id {
    display: block;
    margin-bottom: 2px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
  }

  .produto-aux-card-name {
    margin: 0;
    color: #111827;
    font-size: 13px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .produto-aux-card-meta {
    margin-top: 3px;
    color: #64748b;
    font-size: 10px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .produto-aux-card-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
  }

  .produto-aux-card-badge.is-positive {
    background: #dcfce7;
    color: #166534;
  }

  .produto-aux-card-badge.is-negative {
    background: #fef3c7;
    color: #92400e;
  }

  .produto-aux-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
  }

  .produto-aux-card-actions .btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 32px;
    padding: 0 6px;
    font-size: 11px;
  }

  .produto-aux-delete {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fff;
  }

  .produto-aux-empty {
    padding: 24px 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
  }

  .produto-aux-pagination {
    gap: 4px !important;
    margin-top: 16px !important;
  }

  .produto-aux-pagination .btn {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    font-size: 11px;
  }
}

.produto-aux-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .produto-aux-form-card .card-title {
    margin-bottom: 14px;
    font-size: 16px;
    line-height: 1.25;
  }

  .produto-aux-form .form-group {
    min-width: 0;
    margin-bottom: 12px;
  }

  .produto-aux-form .form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
  }

  .produto-aux-form .form-control {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    font-size: 16px;
  }

  .produto-aux-form input[type="file"].form-control {
    height: auto;
    min-height: 44px;
    padding: 8px;
    font-size: 12px;
  }

  .produto-aux-form small.muted {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.35;
  }

  .produto-aux-form-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
  }

  .produto-aux-form-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .container {
    padding: 0 10px;
  }

  .card {
    padding: 12px;
  }

  .nav-link {
    font-size: 13px;
  }
}

/* ==========================================================
   AJUDA / ASSISTENTE
========================================================== */
.help-top-button {
  gap: 6px;
}

.help-assistant-panel {
  position: fixed;
  inset: 0;
  z-index: 2200;
  pointer-events: none;
  visibility: hidden;
}

.help-assistant-panel.is-open {
  pointer-events: auto;
  visibility: visible;
}

.help-assistant-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .44);
  opacity: 0;
  transition: opacity .18s ease;
}

.help-assistant-panel.is-open .help-assistant-backdrop {
  opacity: 1;
}

.help-assistant-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(480px, calc(100vw - 22px));
  height: 100%;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -20px 0 50px rgba(15, 23, 42, .22);
  display: flex;
  flex-direction: column;
  transform: translateX(104%);
  transition: transform .22s ease;
}

.help-assistant-panel.is-open .help-assistant-drawer {
  transform: translateX(0);
}

.help-assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid #e5e7eb;
}

.help-assistant-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  line-height: 1.15;
}

.help-assistant-subtitle {
  margin-top: 4px;
  color: #6b7280;
  font-size: 13px;
}

.help-assistant-close {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  font-weight: 700;
}

.help-assistant-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  min-height: 0;
  overflow-y: auto;
}

.help-assistant-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.help-assistant-search .form-control {
  height: 40px;
}

.help-assistant-status {
  min-height: 20px;
  font-size: 13px;
  color: #6b7280;
}

.help-assistant-status.error {
  color: #b91c1c;
  font-weight: 700;
}

.help-assistant-results {
  display: grid;
  gap: 10px;
}

.help-topic {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.help-topic-title {
  width: 100%;
  border: 0;
  background: #f9fafb;
  color: #111827;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.help-topic-title::after {
  content: "+";
  font-size: 18px;
  line-height: 1;
  color: #2563eb;
}

.help-topic-title[aria-expanded="true"]::after {
  content: "-";
}

.help-topic > small {
  display: block;
  padding: 8px 12px 0;
  color: #6b7280;
}

.help-topic-answer {
  padding: 10px 12px 12px;
  color: #374151;
  white-space: pre-line;
}

.help-topic-answer strong {
  display: block;
  color: #111827;
  margin-bottom: 6px;
}

.help-topic-answer p {
  margin: 0;
}

.help-assistant-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  color: #64748b;
  background: #f8fafc;
}

.help-assistant-ticket {
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
  padding-top: 14px;
}

.help-assistant-ticket-title {
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.help-assistant-ticket form {
  display: grid;
  gap: 8px;
}

.help-assistant-ticket textarea {
  min-height: 86px;
  resize: vertical;
}

.help-ticket-message {
  min-height: 20px;
  color: #4b5563;
  font-size: 13px;
}

@media (max-width: 640px) {
  .help-assistant-search {
    grid-template-columns: 1fr;
  }

  .help-assistant-search .btn,
  .help-assistant-ticket .btn {
    width: 100%;
  }
}
