/* ============================================================
   PlayTech Sistemas — Design System
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a56db;
  --primary-dark: #1341a8;
  --primary-light: #e8f0fe;
  --success: #0e9f6e;
  --danger: #e02424;
  --warning: #d97706;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --sidebar-bg: rgb(0, 0, 0);
  --sidebar-text: #94a3b8;
  --sidebar-hover: #FF69B4;
  --sidebar-active: #FF0077;
  --sidebar-border: #FF0077;
  --sidebar-w: 230px;
  --topbar-h: 36px;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding-top: 0;
}

/* Barra Superior Fixa */
#global-header {
  background-color: rgb(102, 0, 153);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 50px;
}

#global-header h1 {
  color: white;
  font-size: 18px;
  flex: 1;
  margin-left: 20px;
  font-weight: 600;
}

/* Botão do Menu */
.toggle-menu {
  background-color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.toggle-menu:hover {
  background-color: #e0e0e0;
  transform: scale(1.05);
}

.toggle-menu:active {
  transform: scale(0.95);
}

.toggle-menu span {
  width: 18px;
  height: 2px;
  background-color: rgb(102, 0, 153);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Customização do Theme Switcher na Barra Superior */
#global-header .theme-switcher-header {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  transition: all 0.2s ease;
}

#global-header .theme-switcher-header:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
  color: white;
}

#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width .2s;
  overflow: hidden;
}

#sidebar.collapsed {
  width: 52px;
}

#sidebar.collapsed .logo-text,
#sidebar.collapsed .nav-group-label,
#sidebar.collapsed .nav-label,
#sidebar.collapsed #sidebar-footer {
  display: none;
}

#sidebar.collapsed .nav-item {
  justify-content: center;
}

#sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 2px solid var(--sidebar-border);
  min-height: 52px;
}

#sidebar.collapsed #sidebar-logo {
  justify-content: center;
  padding: 16px 0 12px;
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: .5px;
  flex: 1;
}

#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-group-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .8px;
  color: #f5f5f5;
  padding: 12px 14px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: all .15s;
}

.nav-item:hover {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--sidebar-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--sidebar-active);
}

.nav-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.nav-label {
  font-size: 13px;
  font-weight: 700;
}

#sidebar-footer {
  padding: 0;
  border-top: 2px solid var(--sidebar-border);
}

.nav-footer-sair:hover {
  background: #dc2626 !important;
  color: #fff !important;
  border-left-color: #dc2626 !important;
}

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#top-bar {
  display: none;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  flex-shrink: 0;
}

#top-bar.has-actions,
#top-bar.relat-topbar-layout {
  display: flex !important;
}

#top-bar #page-title {
  font-size: 14px;
  font-weight: 700;
}

#top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

#sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #fff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
}

#sidebar-toggle:hover {
  opacity: 0.8;
}

#top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#clock {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

#page-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ---- Dashboard ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.page-title {
  font-size: 15px;
  font-weight: 700;
}

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

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.kpi-card.kpi-danger {
  border-left: 3px solid var(--danger);
}

.kpi-card.kpi-success {
  border-left: 3px solid var(--success);
}

.kpi-card.kpi-warning {
  border-left: 3px solid var(--warning);
}

.kpi-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.kpi-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-row {
  display: flex;
  gap: 14px;
}

@media (max-width: 900px) {
  .dash-row {
    flex-direction: column;
  }
}

/* ---- TABLES & DATAGRIDS (GLOBAIS - ERP PLAYTECH) ---- */
.card:has(.table-wrap),
.card.datagrid-card,
.card.prod-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Forçar contêiner de rolagem vertical com limite de altura em todas as tabelas */
.table-wrap {
  flex: 1;
  max-height: calc(100vh - 170px) !important;
  min-height: 250px;
  overflow-y: auto !important;
  overflow-x: auto !important;
  position: relative !important;
}

/* Modais e Caixas de Diálogo (tabelas internas menores) */
#modal-box .table-wrap,
.modal-box .table-wrap,
.modal .table-wrap {
  max-height: 280px !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  position: relative !important;
}

.table-wrap:focus,
.prod-table-wrap:focus {
  outline: 1px solid var(--primary, #000066);
  outline-offset: -1px;
}

table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 12px;
}

/* Congelar Cabeçalho de Todas as Tabelas (Sticky Header 100% Funcional) */
.table-wrap table thead,
.prod-table-wrap table thead,
table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
}

.table-wrap table thead th,
.prod-table-wrap table thead th,
table thead th,
thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-bottom: 2px solid var(--border, #cbd5e1) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
  white-space: nowrap;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
}

/* Temas Escuros (App / Dark / Purple-Dark / GP-Dark) */
body.theme-dark table thead th,
body.theme-dark .table-wrap table thead th,
body.theme-purple-dark table thead th,
body.theme-purple-dark .table-wrap table thead th,
body.theme-gp-dark table thead th,
body.theme-gp-dark .table-wrap table thead th {
  background-color: #1c2128 !important;
  color: #f0f6fc !important;
  border-bottom: 2px solid #30363d !important;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
  cursor: pointer;
}

tbody tr:hover {
  background-color: #e8eaf6;
}

/* Seleção de Linha Global (#00b8ff) */
tbody tr.row-selected,
.table-wrap tbody tr.row-selected,
body.theme-dark tbody tr.row-selected,
body.theme-dark .table-wrap tbody tr.row-selected {
  background-color: #00b8ff !important;
  color: #ffffff !important;
}

tbody tr.row-selected:hover,
.table-wrap tbody tr.row-selected:hover,
body.theme-dark tbody tr.row-selected:hover,
body.theme-dark .table-wrap tbody tr.row-selected:hover {
  background-color: #009ecc !important;
}

tbody tr.row-selected td,
.table-wrap tbody tr.row-selected td,
body.theme-dark tbody tr.row-selected td,
body.theme-dark .table-wrap tbody tr.row-selected td {
  color: #ffffff !important;
}

tbody tr.row-selected .badge {
  opacity: 0.85;
}

tbody td {
  padding: 4px 10px;
}

tfoot td {
  padding: 6px 10px;
  font-weight: 700;
  background: #f9fafb;
}

.th-sort {
  cursor: pointer;
  user-select: none;
}

.th-sort:hover {
  background: #eff6ff;
}

.table-footer {
  padding: 6px 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: #d1fae5;
  color: #065f46;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.badge-orange {
  background: #dbeafe;
  color: #1e40af;
}

/* Alterado para azul claro */
.badge-vence-hoje {
  background: rgb(255, 153, 51);
  color: #fff;
}

.badge-gray {
  background: #f3f4f6;
  color: #374151;
}

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #000000;
  text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  background: var(--surface);
  transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.form-group.full {
  grid-column: 1 / -1;
}

.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 2px;
}

.field-error.hidden {
  display: none;
}

.req {
  color: var(--danger);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #057a55;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c81e1e;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 5px 8px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-add {
  background: var(--primary) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

.btn-add:hover {
  background: var(--primary-dark) !important;
}

/* Botão verde no estilo btn-add */
.btn-add-success {
  background: var(--success) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

.btn-add-success:hover {
  background: #057a55 !important;
}

/* Botão com borda verde (estilo azul com borda verde) */
.btn-outline-success {
  background: var(--primary) !important;
  color: #ffffff !important;
  border: 2px solid var(--success) !important;
  border-radius: 4px !important;
  padding: 6px 14px !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.btn-outline-success:hover {
  background: var(--primary-dark) !important;
  border-color: #057a55 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.icon-circle-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #fff;
  color: var(--primary);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input[type=search],
.toolbar input[type=text] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  min-width: 220px;
}

.toolbar input:focus {
  border-color: var(--primary);
}

.toolbar select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  color: #000000;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}

.tab.active {
  color: #000000;
  font-weight: 700;
  border-bottom-color: var(--primary);
}

.tab:hover {
  color: #000000;
}

/* ---- Modal ---- */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modal-overlay.hidden {
  display: none;
}

#modal-box {
  background: var(--surface);
  border-radius: 8px;
  width: 90%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
  transition: all .2s;
}

#modal-box.maximized {
  width: 100% !important;
  max-width: 100% !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0;
}

#modal-overlay.maximized {
  align-items: stretch;
  padding: 0;
}

#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #000000;
}

#modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

#modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

#modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

#modal-footer.has-totais {
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
}

.os-footer-totais-group,
.orc-footer-totais-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 600px;
  flex-wrap: wrap;
}

.os-footer-total-item,
.orc-footer-total-item {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 85px;
  margin: 0;
}

.os-footer-total-item label,
.orc-footer-total-item label {
  font-size: 10px;
  font-weight: 700;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
  white-space: nowrap;
}

.os-footer-total-item input,
.orc-footer-total-item input {
  height: 32px;
  font-size: 12px;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 8px;
  box-sizing: border-box;
  width: 100%;
}

.os-footer-total-item.total-destaque label,
.orc-footer-total-item.total-destaque label {
  color: var(--primary);
  font-weight: 700;
}

.os-footer-total-item.total-destaque input,
.orc-footer-total-item.total-destaque input {
  background: #e8f0fe;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

.os-footer-actions,
.orc-footer-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  height: 48px;
}

.os-footer-actions .btn,
.orc-footer-actions .btn {
  height: 32px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
}

.os-footer-actions .btn-danger {
  background: var(--danger) !important;
  color: #ffffff !important;
  border: none !important;
}

.os-footer-actions .btn-danger:hover {
  background: #c81e1e !important;
}

.os-footer-actions .btn-success {
  background: var(--success) !important;
  color: #ffffff !important;
  border: none !important;
}

.os-footer-actions .btn-success:hover {
  background: #057a55 !important;
}

/* ---- Formulário pagamento (abas) ---- */
.fp-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.fp-tab {
  padding: 9px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #000000;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  white-space: nowrap;
}

.fp-tab:hover {
  color: #000000;
}

.fp-tab.active {
  color: #000000;
  font-weight: 700;
  border-bottom-color: var(--primary);
}

.fp-panel {
  display: none;
}

.fp-panel.active {
  display: block;
}

.fp-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.fp-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fp-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 800px) {
  .fp-layout {
    grid-template-columns: 1fr;
  }
}

.fp-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
}

.fp-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.fp-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fp-grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (max-width: 900px) {
  .fp-grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {

  .fp-grid-4,
  .fp-grid-3,
  .fp-grid-2 {
    grid-template-columns: 1fr;
  }
}

.fp-valores {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.fp-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px solid var(--border);
}

.fp-total-num {
  font-size: 20px;
  color: var(--primary);
}

.fp-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.fp-footer-actions {
  display: flex;
  gap: 8px;
}

.fp-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.fp-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  background: #fafafa;
  transition: all .15s;
  cursor: pointer;
}

.fp-dropzone:hover,
.fp-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.fp-dropzone p {
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 14px;
}

.fp-dropzone small {
  color: var(--text-muted);
  font-size: 12px;
}

.fp-anexo-alert {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 14px;
}

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  top: 16px;
  right: 20px;
  bottom: auto;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 13px 20px;
  border-radius: var(--radius, 8px);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: slideInRight .2s ease;
  min-width: 260px;
  max-width: 420px;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-success {
  background: #10b981 !important;
  color: #ffffff !important;
}

.toast-error,
.toast-danger {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.toast-warning {
  background: #d97706 !important;
  color: #ffffff !important;
}

.toast-info {
  background: #2563eb !important;
  color: #ffffff !important;
}

@keyframes slideInRight {
  from {
    transform: translateX(110%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---- Paginação ---- */
.pager {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.pager:empty {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.pager-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
}

.pager-btn:hover {
  background: var(--bg);
}

.pager-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pager-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---- Financeiro ---- */
.fin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

.fin-card {
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.fin-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: .9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-card-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-card-icon {
  font-size: 14px;
  opacity: .7;
}

.fin-card-danger {
  background: #e02424;
}

.fin-card-warning {
  background: #d97706;
}

.fin-card-neutral {
  background: #6b7280;
}

.fin-card-success {
  background: #0e9f6e;
}

.fin-card-dark {
  background: #111827;
}

/* legado */
.fin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.fin-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.fin-box .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.fin-box .value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
}

.fin-box.pagar .value {
  color: var(--danger);
}

.fin-box.receber .value {
  color: var(--success);
}

.fin-box.saldo .value {
  color: var(--primary);
}

/* ---- Venda ---- */
.venda-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
}

@media (max-width: 900px) {
  .venda-layout {
    grid-template-columns: 1fr;
  }
}

.venda-totais {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.venda-totais .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.venda-totais .row.total {
  font-size: 18px;
  font-weight: 700;
  border-top: 2px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
}

/* ---- Estoque ---- */
.estoque-alert {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  color: #9a3412;
  font-size: 12px;
}

/* ---- Clientes/Fornecedores ---- */
.cf-section {
  margin-bottom: 20px;
}

.cf-section-title {
  font-size: 13px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.cf-form-grid {
  display: grid;
  gap: 10px;
}

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

.cf-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 800px) {

  .cf-grid-4,
  .cf-grid-5 {
    grid-template-columns: 1fr 1fr;
  }
}

.cf-span2 {
  grid-column: span 2;
}

.cf-endereco-row,
.cf-contato-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.cf-foto-box {
  width: 80px;
  height: 80px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---- Pagar Wizard ---- */
.pagar-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.pagar-tab {
  padding: 9px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #000000;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  white-space: nowrap;
}

.pagar-tab:hover {
  color: #000000;
}

.pagar-tab.active {
  color: #000000;
  font-weight: 700;
  border-bottom-color: var(--primary);
}

.pagar-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 700px) {
  .pagar-layout {
    grid-template-columns: 1fr;
  }
}

.pagar-section-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.pagar-valores {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.pagar-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin-top: 4px;
}

.pagar-total-num {
  font-size: 18px;
  color: var(--primary);
}

.parcelamento-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
}

.parcelamento-toggle:hover {
  color: var(--text);
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 20px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--primary);
}

.toggle-knob {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.toggle-switch.on .toggle-knob {
  left: 18px;
}

.parcelamento-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 10px;
  margin-top: 6px;
}

/* ---- Anexos ---- */
.anexo-info {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 14px;
}

.anexo-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all .15s;
  background: #fafafa;
}

.anexo-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ---- Cadastros Financeiros ---- */
.cf-hub-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cf-hub-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
}

.cf-hub-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.cf-hub-tab.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.cf-hub-icon {
  font-size: 16px;
}

/* ---- Utils ---- */
.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-primary {
  color: var(--primary);
}

.fw-bold {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.field-hint {
  color: var(--text-muted);
  cursor: help;
  font-size: 12px;
}

/* ===== CNPJ API ===== */
.cnpj-input-group {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.cnpj-input-group input {
  flex: 1;
  min-width: 0;
}

.cnpj-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 7px 12px;
}

.cnpj-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Status feedback abaixo do campo */
.cnpj-status {
  font-size: 12px;
  margin-top: 5px;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-weight: 500;
}

.cnpj-status-loading {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  animation: pulse 1.2s ease-in-out infinite;
}

.cnpj-status-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.cnpj-status-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .55;
  }
}

/* ---- Datagrid Toolbar & Busca avançada toggle ---- */
.datagrid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pg-busca-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 7px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  width: 50%;
  max-width: 50%;
  text-align: left;
  transition: all .15s;
  box-sizing: border-box;
  margin-bottom: 0;
}

.pg-busca-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.datagrid-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 768px) {
  .pg-busca-toggle-btn {
    width: 100%;
    max-width: 100%;
  }

  .datagrid-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
  }
}

/* ---- Autocomplete de Fornecedor ---- */
.fp-autocomplete-wrap {
  position: relative;
}

.fp-ac-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  z-index: 9999;
  max-height: 220px;
  overflow-y: auto;
}

.fp-ac-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.fp-ac-item:last-child {
  border-bottom: none;
}

.fp-ac-item:hover,
.fp-ac-item.fp-ac-active {
  background: var(--primary-light);
  color: var(--primary);
}

.fp-ac-nome {
  font-weight: 500;
}

.fp-ac-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Estado vazio / sem resultados */
.fp-ac-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Documento exibido na sugestão */
.fp-ac-doc {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  padding-left: 8px;
  white-space: nowrap;
}

/* Highlight do trecho que bate com o termo */
.fp-ac-item mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ---- Diagnóstico / Banco de Dados ---- */
.diag-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.diag-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.diag-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.diag-card-active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.diag-card-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.diag-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.diag-card-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Paginação nova (Clientes / Fornecedores) ---- */
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 4px;
}

.pager-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pager-next-btn {
  font-size: 12px;
  padding: 5px 12px;
  font-weight: 600;
}

.pager-ellipsis {
  padding: 4px 6px;
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
}

.pager-info {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Deduplicação de fornecedores ---- */
.diag-dup-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  flex-wrap: wrap;
}

.btn-warning {
  background: #d97706;
  color: #fff;
}

.btn-warning:hover {
  background: #b45309;
}

.dup-grupo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.dup-grupo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.dup-doc {
  font-weight: 700;
  font-size: 13px;
}

/* Original = verde claro, cópia = vermelho claro */
tr.dup-original td {
  background: #f0fdf4;
}

tr.dup-copia td {
  background: #fff1f2;
}

/* ---- Cartão de Crédito - Autocomplete ---- */
.cc-ac-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  z-index: 9999;
  max-height: 220px;
  overflow-y: auto;
}

.cc-ac-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.cc-ac-item:last-child {
  border-bottom: none;
}

.cc-ac-item:hover,
.cc-ac-item.cc-ac-active {
  background: var(--primary-light);
  color: var(--primary);
}

.cc-ac-nome {
  font-weight: 500;
}

.cc-ac-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.cc-ac-item mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ============================================================
   MODULO PRODUTOS
   ============================================================ */
.prod-form-page {
  padding: 0 0 40px;
}

.prod-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 0 12px;
}

.prod-form-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.prod-form-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.prod-form-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.prod-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.prod-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #000000;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
  transition: color .15s, border-color .15s;
}

.prod-tab:hover {
  color: #000000;
  background: var(--bg-hover, rgba(0, 0, 0, .04));
}

.prod-tab.active {
  color: #000000;
  font-weight: 700;
  border-bottom-color: var(--primary);
  background: none;
}

.prod-tab-body {
  min-height: 300px;
}

.prod-form-nav {
  display: flex;
  gap: 10px;
  margin: 20px 0 8px;
}

.prod-form-footer {
  display: flex;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.prod-section {}

.prod-section-box {
  background: var(--card-bg, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.prod-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

.prod-info-box {
  background: var(--info-bg, #eff6ff);
  border: 1px solid var(--info-border, #bfdbfe);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--info-text, #1e40af);
}

.prod-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  cursor: help;
}

.req {
  color: var(--danger);
}

.prod-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.prod-span2 {
  grid-column: span 2;
}

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

  .prod-span2 {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .prod-grid-4 {
    grid-template-columns: 1fr;
  }

  .prod-span2 {
    grid-column: span 1;
  }
}

.badge-orange {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Alterado para azul claro */
.badge-vence-hoje {
  background: rgb(255, 153, 51);
  color: #fff;
  border: none;
}

/* ============================================================
   Scrollbar customizada para Dashboard
   ============================================================ */
.dash-scrollable::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.dash-scrollable::-webkit-scrollbar-track {
  background: var(--bg, #f3f4f6);
  border-radius: 4px;
}

.dash-scrollable::-webkit-scrollbar-thumb {
  background: var(--border, #e5e7eb);
  border-radius: 4px;
  transition: background 0.2s;
}

.dash-scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, #6b7280);
}

/* Firefox */
.dash-scrollable {
  scrollbar-width: thin;
  scrollbar-color: var(--border, #e5e7eb) var(--bg, #f3f4f6);
}

/* ============================================================
   Módulo de Controle de Acesso — Estilos
   ============================================================ */

/* Abas do módulo de usuários */
.btn-aba {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.15s;
  margin-bottom: -2px;
}

.btn-aba:hover {
  color: var(--primary);
}

.btn-aba.aba-ativa {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Alertas inline */
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 10px 14px;
  color: #1e40af;
  font-size: 13px;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 14px;
  color: #991b1b;
  font-size: 13px;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #166534;
  font-size: 13px;
}

/* Badge de permissão */
.badge-perm {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

/* Botão desabilitado por falta de permissão */
button[disabled] {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

/* Tela de acesso negado */
.acesso-negado {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}

.acesso-negado .icone-lock {
  font-size: 64px;
  margin-bottom: 20px;
}

/* ============================================================
   MÓDULO PRODUTOS v2 — 8 Abas
   ============================================================ */

/* Form page wrapper */
.prod-form-page-v2 {
  padding-bottom: 60px;
}

/* Header */
.prod-form-header-v2 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 0 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.prod-form-title-v2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.prod-form-breadcrumb-v2 {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.prod-form-breadcrumb-v2 a {
  color: var(--primary);
  text-decoration: none;
}

.prod-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Tabs v2 */
.prod-tabs-v2 {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.prod-tabs-v2::-webkit-scrollbar {
  display: none;
}

.prod-tab-v2 {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #000000;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s, background .15s;
  border-radius: 4px 4px 0 0;
}

.prod-tab-v2:hover:not(:disabled) {
  color: #000000;
  background: var(--bg);
}

.prod-tab-v2.active {
  color: #000000;
  font-weight: 700;
  border-bottom-color: var(--primary);
}

.prod-tab-v2.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.prod-tab-v2 .tab-icon {
  font-size: 14px;
}

/* Tab body */
.prod-tab-body-v2 {
  min-height: 300px;
  padding-bottom: 20px;
}

/* Grid 2 colunas para formulário (prod-grid-2 + alias fp-grid-2) */
.prod-grid-2,
.fp-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.prod-span-2 {
  grid-column: span 2;
}

@media (max-width: 768px) {

  .prod-grid-2,
  .fp-grid-2 {
    grid-template-columns: 1fr;
  }

  .prod-span-2 {
    grid-column: span 1;
  }
}

/* Form label com tooltip */
.form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.form-label .req {
  color: var(--danger);
}

.tooltip-icon {
  font-size: 11px;
  color: var(--text-muted);
  cursor: help;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .08);
}

.form-control[readonly] {
  background: #f9fafb;
  color: var(--text-muted);
  cursor: default;
}

.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 36, 36, .08);
}

.field-error-msg {
  font-size: 11px;
  color: var(--danger);
  margin-top: 3px;
  display: none;
}

.field-error-msg.show {
  display: block;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Input with button */
.input-with-btn {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.input-with-btn .form-control {
  flex: 1;
}

/* Section box */
.prod-section-box-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
  margin-bottom: 16px;
}

.prod-section-title-v2 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prod-section-title-v2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Tags chips */
.tag-input-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  background: var(--surface);
  cursor: text;
  min-height: 38px;
  transition: border-color .15s;
}

.tag-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .08);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  padding: 2px 8px 2px 10px;
  font-size: 12px;
  font-weight: 500;
}

.tag-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #1e40af;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: .7;
}

.tag-chip-remove:hover {
  opacity: 1;
}

.tag-input-field {
  border: none;
  outline: none;
  font-size: 13px;
  min-width: 120px;
  flex: 1;
  padding: 2px;
  background: transparent;
}

/* Fotos drag-and-drop */
.foto-drop-zone-v2 {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafafa;
}

.foto-drop-zone-v2:hover,
.foto-drop-zone-v2.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.foto-drop-zone-v2 .drop-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.foto-drop-zone-v2 p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.foto-drop-zone-v2 small {
  color: var(--text-muted);
  font-size: 12px;
}

.foto-grid-v2 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.foto-thumb-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}

.foto-thumb-wrap:hover {
  border-color: var(--primary);
  transform: scale(1.02);
}

.foto-thumb-wrap.is-principal {
  border-color: var(--primary);
  border-width: 3px;
}

.foto-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.foto-badge-principal {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.foto-btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}

.foto-thumb-wrap:hover .foto-btn-remove {
  opacity: 1;
}

/* Lightbox */
.foto-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.foto-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
}

/* Composição e Fornecedores — tabelas internas */
.prod-inner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.prod-inner-table th {
  background: #f9fafb;
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.prod-inner-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.prod-inner-table tfoot td {
  padding: 10px 12px;
  font-weight: 700;
  background: #f9fafb;
  font-size: 14px;
}

.radio-principal {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Footer bar com navegação */
.prod-footer-bar-v2 {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  margin: 20px -20px -60px;
}

.prod-footer-center {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Spinner inline */
.btn-spinner {
  animation: spin .6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Valores — campos readonly especiais */
.valor-calc-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #166534;
  text-align: right;
}

.margem-negativa {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Info box */
.prod-info-box-v2 {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: #1e40af;
  margin-bottom: 16px;
}

/* --- Importação de Dados (Premium) --- */
.import-modal-v2 {
  padding: 10px;
}

.import-steps {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 15px;
  position: relative;
}

.import-steps .step {
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.import-steps .step.active {
  color: var(--primary);
}

.import-steps .step.active::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.import-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-hover);
  margin-bottom: 20px;
}

.import-upload-zone:hover,
.import-upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(26, 86, 219, 0.03);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.import-upload-zone .icon {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.import-preview-table {
  max-height: 400px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.import-preview-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.import-preview-table th {
  background: #f8fafc;
  padding: 12px 15px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
}

.import-preview-table td {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}

.import-preview-table tr:last-child td {
  border-bottom: none;
}

.import-summary {
  padding: 15px 20px;
  background: #f1f5f9;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.import-result-success {
  text-align: center;
  padding: 50px 20px;
  animation: fadeInScale 0.4s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.import-result-success .icon {
  font-size: 72px;
  display: block;
  margin-bottom: 20px;
  color: var(--success);
}

.import-tips {
  background: #fff9eb;
  border-left: 4px solid #f59e0b;
  padding: 15px;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
}

.import-tips p {
  margin: 5px 0;
}

/* ============================================================
   OS Lookup Produto — Modal de consulta de produtos (Alt+L)
   ============================================================ */

/* Overlay — fica acima do modal principal de OS */
.os-lookup-overlay,
.orc-lookup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: os-lookup-fade-in .15s ease;
}

@keyframes os-lookup-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Caixa principal */
.os-lookup-box {
  background: var(--surface);
  border-radius: 10px;
  width: 92%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  animation: os-lookup-slide-in .18s ease;
  overflow: hidden;
}

@keyframes os-lookup-slide-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Cabeçalho */
.os-lookup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.os-lookup-title {
  font-size: 15px;
  font-weight: 700;
  color: #000;
}

.os-lookup-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.os-lookup-close:hover {
  color: var(--danger);
  background: #fee2e2;
}

/* Barra de busca */
.os-lookup-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #fafafa;
}

.os-lookup-search-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.os-lookup-search {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.os-lookup-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Área da tabela (scroll interno) */
.os-lookup-table-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.os-lookup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.os-lookup-table thead th {
  background: #f9fafb;
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Linhas */
.os-lookup-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .1s;
}

.os-lookup-row td {
  padding: 7px 12px;
}

.os-lookup-row:last-child {
  border-bottom: none;
}

.os-lookup-row:hover {
  background-color: #e8eaf6;
}

.os-lookup-row.os-lookup-row-active {
  background-color: var(--primary) !important;
}

.os-lookup-row.os-lookup-row-active td {
  color: #ffffff !important;
}

.os-lookup-row.os-lookup-row-active .os-lookup-cod {
  color: #e0e7ff !important;
}

.os-lookup-row.os-lookup-row-active mark {
  background: #fbbf24;
  color: #000;
}

/* Estado vazio / loading */
.os-lookup-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* Highlight do termo pesquisado */
.os-lookup-table mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Rodapé */
.os-lookup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #fafafa;
}

.os-lookup-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Botão Alt+L ao lado do campo produto */
.os-lookup-btn {
  transition: all .15s;
}

.os-lookup-btn:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ============================================================
   Command Palette (Alt+1 / Ctrl+K) Styles
   ============================================================ */

.gp-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  outline: none;
}

.gp-btn-icon:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
}

.gp-btn-icon:active {
  transform: translateY(0);
}

.gp-overlay-cmd {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 14vh;
  background: rgba(14, 17, 40, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: gp-fadeIn 0.14s ease;
}

.gp-cmd {
  width: 540px;
  max-width: 92vw;
  height: fit-content;
  max-height: 75vh;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--bg-surface, #ffffff);
  box-shadow: 0 25px 60px -15px rgba(10, 14, 40, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: gp-popIn 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
}

body.theme-gp-dark .gp-cmd {
  background: #181926;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.gp-cmd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--bg-surface, #ffffff);
}

body.theme-gp-dark .gp-cmd-head {
  background: #1e1f2f;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.gp-cmd-head svg {
  color: var(--primary, rgb(102, 0, 153));
  flex-shrink: 0;
}

.gp-cmd-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  color: var(--text-color, #1f2937) !important;
  font-size: 14.5px !important;
  font-weight: 500 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

body.theme-gp-dark .gp-cmd-input {
  color: #f3f4f6 !important;
}

.gp-cmd-kbd {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border: 1px solid var(--border, #660099);
  border-radius: 6px;
  color: var(--text-muted, #6b7280);
  background: var(--bg-body, #f9fafb);
  letter-spacing: 0.5px;
}

body.theme-gp-dark .gp-cmd-kbd {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #9ca3af;
}

.gp-cmd-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.gp-cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-color, #1f2937);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease, color 0.1s ease;
  outline: none;
  box-sizing: border-box;
}

body.theme-gp-dark .gp-cmd-item {
  color: #e5e7eb;
}

.gp-cmd-item:hover,
.gp-cmd-item-active {
  background: rgba(102, 0, 153, 0.08) !important;
  color: rgb(102, 0, 153) !important;
}

body.theme-gp-dark .gp-cmd-item:hover,
body.theme-gp-dark .gp-cmd-item-active {
  background: rgba(102, 0, 153, 0.3) !important;
  color: #c4b5fd !important;
}

.gp-cmd-icon {
  flex-shrink: 0;
  color: rgb(102, 0, 153);
  transition: transform 0.1s ease;
}

body.theme-gp-dark .gp-cmd-icon {
  color: #a78bfa;
}

.gp-cmd-item-active .gp-cmd-icon {
  transform: scale(1.1);
}

.gp-cmd-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.gp-cmd-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gp-cmd-desc {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-gp-dark .gp-cmd-desc {
  color: #9ca3af;
}

.gp-cmd-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.gp-cmd-badge-module {
  background: #ede9fe;
  color: #6b21a8;
}

body.theme-gp-dark .gp-cmd-badge-module {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.gp-cmd-badge-action {
  background: #dcfce7;
  color: #15803d;
}

body.theme-gp-dark .gp-cmd-badge-action {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.gp-cmd-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
}

@keyframes gp-fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes gp-popIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Ajustes Responsivos Globais (Modais, Rodapés e Formulários)
   ============================================================ */
@media (max-width: 900px) {
  #modal-box {
    width: 96% !important;
    max-width: 96% !important;
    max-height: 94vh !important;
    height: auto !important;
  }
}

@media (max-width: 768px) {

  /* Garante que o rodapé com totais não estoure horizontalmente */
  #modal-footer.has-totais {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .os-footer-totais-group,
  .orc-footer-totais-group {
    min-width: 100% !important;
    gap: 8px 12px;
  }

  .os-footer-total-item,
  .orc-footer-total-item {
    flex: 1 1 calc(50% - 6px);
    /* Coloca os totais em 2 colunas no celular */
  }

  .os-footer-actions,
  .orc-footer-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 500px) {
  .os-footer-total-item,
  .orc-footer-total-item {
    flex: 1 1 100%;
    /* Coloca os totais em 1 coluna em telas minúsculas */
  }
}

/* Cor roxa para a linha inferior das abas ativas */
.tab.active,
.fp-tab.active,
.pagar-tab.active,
.prod-tab.active,
.prod-tab-v2.active {
  border-bottom-color: #660099 !important;
}
/* ============================================================
   DROPDOWN DE AÇÕES - Orçamento | Pedidos e Faturamento
   ============================================================ */
.orc-dd-item,
.fat-dd-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.15s;
  border-radius: 0;
}
.orc-dd-item:hover,
.fat-dd-item:hover {
  background: var(--bg, #f3f4f6);
}
.orc-dd-item-success {
  color: #16a34a !important;
  font-weight: 600;
}
.orc-dd-item-warn {
  color: #d97706 !important;
}
.orc-dd-item-danger {
  color: var(--color-danger, #dc2626) !important;
}
.orc-dd-divider {
  height: 1px;
  background: var(--border, #e5e7eb);
  margin: 4px 0;
}

/* Badge roxa para situação "Pedido" */
.badge-purple {
  background: #7c3aed18;
  color: #7c3aed;
  border: 1px solid #7c3aed44;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

/* ============================================================
   TOGGLE SWITCH COMPONENT
   ============================================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  vertical-align: middle;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .25s ease;
  border-radius: 20px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-slider {
  background-color: #10b981;
}
.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 1px #10b981;
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
}



/* ============================================================
   Datagrids ERP — Container Fixo & Scroll Apenas dos Dados
   ============================================================ */
.fin-cards {
  display: none !important;
}

body.sicoob-layout #page-content:has(.pg-card-fixed, .erp-card-fixed),
#page-content:has(.pg-card-fixed, .erp-card-fixed) {
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  background: var(--surface, #ffffff) !important;
}

.pg-card-fixed,
.erp-card-fixed {
  flex: 1 1 0% !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  padding: 12px 16px !important;
  box-sizing: border-box !important;
  position: relative;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: var(--surface, #ffffff) !important;
}

@media (max-width: 768px) {
  .pg-card-fixed,
  .erp-card-fixed {
    height: 100% !important;
    max-height: 100% !important;
    padding: 8px 10px !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
}

.datagrid-toolbar,
.module-busca-bar {
  flex-shrink: 0 !important;
}

[id$="-busca-panel"],
[id*="-busca-panel"] {
  flex-shrink: 0 !important;
  max-height: 42vh;
  overflow-y: auto;
}

@media (max-height: 700px) {
  [id$="-busca-panel"],
  [id*="-busca-panel"] {
    max-height: 35vh !important;
  }
}

#cli-table,
#forn-table,
#func-table,
#transp-table,
#gp-table-container,
#prod-table {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.pg-table-scroll,
.erp-table-scroll {
  flex: 1 1 0% !important;
  min-height: 120px !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  background: var(--surface);
}

.pg-table-scroll table,
.erp-table-scroll table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.pg-table-scroll thead th,
.erp-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f9fafb;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pg-table-scroll tbody td,
.erp-table-scroll tbody td {
  border-bottom: 1px solid var(--border);
}

.pg-table-scroll tfoot td,
.erp-table-scroll tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 9;
  background-color: #f9fafb;
  border-top: 2px solid var(--border);
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.05);
}

/* Scrollbar moderno e sutil */
.pg-table-scroll::-webkit-scrollbar,
.erp-table-scroll::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
.pg-table-scroll::-webkit-scrollbar-track,
.erp-table-scroll::-webkit-scrollbar-track {
  background: var(--bg, #f3f4f6);
  border-radius: 4px;
}
.pg-table-scroll::-webkit-scrollbar-thumb,
.erp-table-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.pg-table-scroll::-webkit-scrollbar-thumb:hover,
.erp-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Rodapé fixo do card */
.pg-card-footer,
.erp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.pg-card-footer-info,
.erp-card-footer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 14px;
  flex-wrap: wrap;
}

.pg-card-footer-hint,
.erp-card-footer-hint {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .pg-card-footer,
  .erp-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
