/* ==========================================================
   RESET + BASE
========================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

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

/* ==========================================================
   LAYOUT GERAL (FOOTER NO RODAPÉ)
========================================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 32px 0;
}

/* ==========================================================
   CONTAINER
========================================================== */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================
   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: 32px;
  height: 64px;
}

/* 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: 18px;
  flex: 1;
}

.nav-link {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: #2563eb;
}

.nav-link.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.nav-sep {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 8px;
}

/* ==========================================================
   USER BOX
========================================================== */
.userbox {
  display: flex;
  align-items: center;
  gap: 16px;
}

.usertext {
  text-align: right;
}

.userlabel {
  font-size: 11px;
  color: #6b7280;
}

.username {
  font-size: 14px;
  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;
}

.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;
}

/* ==========================================================
   FOOTER
========================================================== */
.footer {
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 16px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #6b7280;
}

.footer .muted {
  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;
}

.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;
}

.form-control:focus {
  outline: none;
  border-color: #2563eb;
}

/* ==========================================================
   RESPONSIVO
========================================================== */
@media (max-width: 1024px) {
  .nav {
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .topbar .container {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 24px;
  }

  .nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .userbox {
    margin-left: auto;
  }
}
/* ==========================================================
   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;
}

/* BOTÕES */
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 40px; /* 🔥 mesma altura do input */
  margin-top: 22px; /* 🔥 compensa o label */
}

/* RESPONSIVO */
@media (max-width: 768px) {
  .filters-bar {
    align-items: stretch;
  }

  .filter-actions {
    margin-top: 0;
    height: auto;
  }
}

/* ==========================================================
   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;
}

/* 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;
}
.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;
}