/* ============================================================
   EstoqPro - Sistema de Controle de Estoque
   Visual Consultoria
   ============================================================ */

:root {
  --cor-primaria: #1e3a5f;
  --cor-secundaria: #2563eb;
  --cor-texto: #ffffff;
  --cor-botoes: #3b82f6;
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ============================================================ LOGIN ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  padding: 16px;
}

.login-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo i {
  font-size: 48px;
  color: #2563eb;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1e3a5f;
}

.login-logo p {
  color: #64748b;
  font-size: 14px;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  font-size: 14px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
}

.login-form input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.login-hint {
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  margin-top: 12px;
}

/* ============================================================ APP LAYOUT ============================================================ */
.app-screen {
  display: flex;
  min-height: 100vh;
}

/* ============================================================ SIDEBAR ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--cor-primaria);
  color: var(--cor-texto);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}

.empresa-logo-container {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empresa-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.sidebar-icon {
  font-size: 28px;
  color: rgba(255,255,255,0.9);
}

.empresa-info {
  flex: 1;
  min-width: 0;
}

.sidebar-empresa-nome {
  display: block;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-empresa-tel {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.65);
}

.sidebar-menu {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 8px;
  margin: 2px 8px;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.menu-item:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.menu-item.active {
  background: var(--cor-secundaria);
  color: #fff;
}

.menu-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.btn-fechar-app {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-fechar-app:hover {
  background: rgba(239,68,68,0.35);
  color: #fff;
}

/* Sidebar overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ============================================================ MAIN CONTENT ============================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================ TOPBAR ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.btn-toggle-sidebar {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
  padding: 6px;
  border-radius: 6px;
  display: none;
}

.topbar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

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

.msg-btn-container {
  position: relative;
}

.btn-msg {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
  padding: 6px 8px;
  border-radius: 6px;
  position: relative;
  transition: color 0.2s, background 0.2s;
}

.btn-msg:hover {
  color: #2563eb;
  background: #eff6ff;
}

.msg-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  font-weight: 500;
  transition: background 0.2s;
}

.user-info:hover {
  background: #f1f5f9;
}

/* ============================================================ MESSENGER PANEL ============================================================ */
.msg-panel {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: 320px;
  max-width: 95vw;
  height: 420px;  /* Diminuída a altura */
  background: #fff;
  box-shadow: -4px 4px 20px rgba(0,0,0,0.15);
  border-radius: 0 0 0 12px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
}

.msg-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--cor-primaria);
  color: #fff;
  border-radius: 0 0 0 0;
  flex-shrink: 0;
}

.msg-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.msg-panel-header button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.msg-panel-header button:hover {
  color: #fff;
  background: rgba(255,255,255,0.2);
}

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.msg-item {
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border-left: 3px solid #2563eb;
  cursor: pointer;
}

.msg-item.nao-lida {
  background: #eff6ff;
  border-left-color: #ef4444;
  font-weight: 600;
}

.msg-item .msg-de {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
}

.msg-item .msg-texto {
  color: #1e293b;
}

.msg-send-form {
  padding: 8px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.msg-send-form select,
.msg-send-form input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.msg-send-form select:focus,
.msg-send-form input:focus {
  border-color: #2563eb;
}

.msg-send-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  resize: none;
  outline: none;
  height: 60px; /* Aumentada a altura do campo mensagem */
  font-family: inherit;
}

.msg-send-form textarea:focus {
  border-color: #2563eb;
}

.msg-send-form .btn-primary {
  padding: 10px 14px; /* Aumentada a altura do botão Enviar */
  font-size: 13px;
  justify-content: center;
}

/* ============================================================ CONTENT AREA ============================================================ */
.content-area {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

/* ============================================================ MÓDULO CARDS ============================================================ */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.module-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

/* ============================================================ TOOLBAR (botões de ação no topo) ============================================================ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  align-items: center;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 4px;
}

/* ============================================================ BOTÕES ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-success {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-success:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-warning {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #d97706;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

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

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #64748b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: #2563eb;
  border: 1.5px solid #2563eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-outline:hover {
  background: #eff6ff;
}

.btn-sm {
  padding: 5px 10px !important;
  font-size: 12px !important;
}

/* ============================================================ TABELA ============================================================ */
.table-container {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow-x: auto;
}

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

thead tr {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
  cursor: pointer;
}

tbody tr:hover {
  background: #f0f9ff;
}

tbody tr.selecionado {
  background: #dbeafe;
}

tbody td {
  padding: 9px 12px;
  color: #374151;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-ok { background: #dcfce7; color: #16a34a; }
.badge-low { background: #fef3c7; color: #d97706; }
.badge-critical { background: #fee2e2; color: #dc2626; }

/* ============================================================ FORMULÁRIOS ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

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

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

.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input {
  padding: 8px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  color: #1e293b;
  width: 100%;
}

.form-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.form-input[readonly] {
  background: #f8fafc;
  color: #94a3b8;
}

.form-input-group {
  display: flex;
  gap: 6px;
}

.form-input-group .form-input {
  flex: 1;
}

.form-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

/* ============================================================ ABAS ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.tab-btn:hover {
  color: #2563eb;
}

/* ============================================================ MODAL ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-container {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--cor-primaria);
  color: #fff;
  border-radius: 14px 14px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.modal-header .btn-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}

.modal-header .btn-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.2);
}

/* Toolbar dentro do modal (Salvar/Fechar no topo) */
.modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  align-items: center;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-radius: 0 0 14px 14px;
}

/* ============================================================ ALERTA ESTOQUE MÍNIMO ============================================================ */
.estoque-alerta-overlay {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
  max-width: 380px;
  width: calc(100vw - 40px);
}

.estoque-alerta-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  border: 2px solid #f59e0b;
  overflow: hidden;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.estoque-alerta-header {
  background: #f59e0b;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
}

.estoque-alerta-header button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.estoque-alerta-header button:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.estoque-alerta-list {
  max-height: 260px;
  overflow-y: auto;
}

.estoque-alerta-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
  gap: 10px;
  user-select: none;
}

.estoque-alerta-item:last-child {
  border-bottom: none;
}

.estoque-alerta-item:hover {
  background: #fffbeb;
}

.estoque-alerta-item .alerta-icon {
  color: #f59e0b;
  font-size: 16px;
  flex-shrink: 0;
}

.estoque-alerta-item .alerta-info {
  flex: 1;
  min-width: 0;
}

.estoque-alerta-item .alerta-codigo {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.estoque-alerta-item .alerta-descricao {
  font-size: 13px;
  color: #1e293b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.estoque-alerta-item .alerta-detalhes {
  font-size: 11px;
  color: #94a3b8;
}

.estoque-alerta-item .alerta-qtd {
  text-align: right;
  flex-shrink: 0;
}

.estoque-alerta-item .alerta-qtd-num {
  font-size: 16px;
  font-weight: 700;
  color: #dc2626;
}

.estoque-alerta-item .alerta-qtd-min {
  font-size: 10px;
  color: #94a3b8;
}

.estoque-alerta-hint {
  padding: 6px 14px 8px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  background: #fffbeb;
}

/* ============================================================ CARDS ESTOQUE ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  border-left: 4px solid #2563eb;
}

.stat-card.warning { border-left-color: #f59e0b; }
.stat-card.danger { border-left-color: #dc2626; }
.stat-card.success { border-left-color: #16a34a; }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* ============================================================ SEARCH BAR ============================================================ */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  min-width: 180px;
}

.search-input-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
}

.search-input-wrap input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-wrap input:focus {
  border-color: #2563eb;
}

/* ============================================================ TOAST ============================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  min-width: 220px;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }
.toast.warning { background: #d97706; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================ USER MENU ============================================================ */
.user-menu {
  position: absolute;
  top: calc(var(--topbar-height) + 4px);
  right: 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid #e2e8f0;
  min-width: 180px;
  z-index: 300;
  padding: 6px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: background 0.15s;
}

.user-menu-item:hover {
  background: #f1f5f9;
}

.user-menu-item.danger {
  color: #dc2626;
}

/* ============================================================ CONFIGURAÇÕES ============================================================ */
.config-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
}

/* ============================================================ UPLOAD LOGO ============================================================ */
.logo-preview-container {
  width: 120px;
  height: 120px;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s;
}

.logo-preview-container:hover {
  border-color: #2563eb;
}

.logo-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ============================================================ RESPONSIVO - TABLET ============================================================ */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 200px;
  }
}

/* ============================================================ RESPONSIVO - MOBILE ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-overlay.hidden {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }

  .btn-toggle-sidebar {
    display: flex;
  }

  .content-area {
    padding: 10px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-group.span-3 {
    grid-column: span 2;
  }

  .msg-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    right: 0;
    left: 0;
    height: 400px;
  }

  .modal-container {
    max-width: 100%;
    margin: 8px;
    max-height: 95vh;
  }

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

  .topbar-title {
    font-size: 15px;
  }

  .toolbar {
    padding: 8px;
    gap: 5px;
  }

  table {
    font-size: 12px;
  }

  thead th, tbody td {
    padding: 8px 8px;
  }

  .estoque-alerta-overlay {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: 100%;
  }
}

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

  .form-group.span-2,
  .form-group.span-3 {
    grid-column: 1;
  }

  .btn-primary, .btn-success, .btn-warning, .btn-danger, .btn-secondary, .btn-outline {
    padding: 7px 10px;
    font-size: 12px;
  }

  .login-box {
    padding: 24px 16px;
  }

  .tabs {
    gap: 0;
  }

  .tab-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================ SCROLLBAR PERSONALIZADA ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ============================================================ IMPRESSÃO ============================================================ */
@media print {
  .sidebar, .topbar, .toolbar, .msg-panel, .toast-container, .estoque-alerta-overlay {
    display: none !important;
  }
  .main-content {
    margin-left: 0;
  }
}
