/* ========================================
   PACKINGFLOW - DESIGN MODERNO & CLEAN
   ======================================== */

/* ====== VARIAVEIS CSS ====== */
:root {
  /* Cores principais - Paleta verde padronizada */
  --primary: #047857;
  --primary-dark: #065f46;
  --primary-light: #10b981;
  --primary-hover: #34d399;
  
  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #047857;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 260px;
  
  /* Backgrounds - Tons suaves para reduzir cansaço visual */
  --bg: #e5ebe5;
  --bg-alt: #dce5dd;
  --surface: #f2f5f2;
  --surface-hover: #ecf0ec;
  
  /* Borders & Shadows */
  --border: #d1d9d0;
  --border-light: #e2e7e0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-xl: 0 8px 24px rgba(0,0,0,0.1);
  
  /* Textos */
  --text: #1a2e1f;
  --text-secondary: #4a5d4f;
  --text-muted: #7a8d80;
  
  /* Status */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Bordas arredondadas */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Transicoes */
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Droid Sans", "Ubuntu", "Cantarell", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Evita flash durante verificacao de sessao */
body.auth-pending #loginScreen,
body.auth-pending #sidebar,
body.auth-pending #main,
body.auth-pending #statusBar { visibility: hidden !important; }

/* ====== TYPOGRAPHY ====== */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--text); }
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }

/* ====== SIDEBAR MODERNA ====== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-slow);
  overflow: hidden;
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}

.sidebar-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-logo-sub {
  font-size: 0.75rem;
  color: var(--sidebar-text);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section {
  padding: 16px 20px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  margin: 2px 12px;
  border-radius: var(--radius);
}

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

.nav-item.active {
  background: rgba(5, 150, 105, 0.15);
  color: var(--primary-light);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item span { flex: 1; }

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

/* ====== TOPBAR MODERNA ====== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.btn-toggle-sidebar {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.btn-toggle-sidebar:hover { background: var(--bg); color: var(--text); }

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: var(--bg);
  border-radius: var(--radius-full);
}

.topbar-badge {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.topbar-user i { color: var(--primary); font-size: 1.1rem; }

.btn-logout {
  width: 36px;
  height: 36px;
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { background: #dc3545; border-color: #dc3545; }

/* ====== PAGE CONTENT ====== */
.page-content { padding: 28px; flex: 1; }

/* ====== PAGE HEADER ====== */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
}
.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-header h2 i { color: var(--primary); }
.page-header p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }

/* ====== CARDS MODERNOS ====== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  border-bottom: none;
  padding: 14px 20px !important;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
}

.card-header i { color: rgba(255,255,255,0.9); font-size: 1.1rem; }
.card-header .btn { 
  border-color: rgba(255,255,255,0.4);
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.card-header .btn:hover { background: rgba(255,255,255,0.2); }

.card-body { padding: 20px; background: var(--surface); }

/* ====== STAT CARDS ====== */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.stat-card:hover { 
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-info { flex: 1; min-width: 0; }
.stat-value { 
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ====== TABLES MODERNAS ====== */
.table {
  font-size: 0.875rem;
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th {
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}
.table tbody td {
  padding: 14px 16px !important;
  border-bottom: 1px solid var(--border-light) !important;
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover) !important; }
.table tbody tr:last-child td { border-bottom: none !important; }

/* ====== BADGES MODERNOS ====== */
.badge {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-ativo { background: #d1fae5; color: #065f46; }
.badge-inativo { background: #fee2e2; color: #991b1b; }
.badge-gerado { background: #dbeafe; color: #1e40af; }
.badge-lido { background: #d1fae5; color: #065f46; }

/* ====== BUTTONS ====== */
.btn {
  font-weight: 500;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.875rem;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.btn-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

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

.btn-secondary { background: var(--bg); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--border); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn:focus-visible { box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2); }

/* ====== FORMS MODERNOS ====== */
.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.9rem;
  background: var(--surface);
  transition: all var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }

/* ====== SEARCH BAR ====== */
.search-bar { position: relative; }
.search-bar input {
  padding-left: 40px;
  border-radius: var(--radius-full) !important;
  border: 1px solid var(--border);
  background: var(--surface);
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

/* ====== MODAL MODERNO ====== */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.modal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
}
.modal-header.bg-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  color: #fff;
}
.modal-title { font-weight: 600; font-size: 1.1rem; }
.modal-body { padding: 24px; }
.modal-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
}

/* ====== STATUS BAR ====== */
.status-bar {
  position: fixed;
  bottom: 0; left: var(--sidebar-width); right: 0;
  height: 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 999;
}
body.has-statusbar .page-content { padding-bottom: 52px; }
body.has-statusbar .coletor-screen { margin-bottom: 48px; }

.status-bar-left, .status-bar-right { display: flex; align-items: center; gap: 16px; }
.status-bar-center { flex: 1; text-align: center; }
.status-bar strong { color: var(--text); }

/* ====== LOGIN SCREEN MODERNO ====== */
.login-screen {
  position: fixed;
  inset: 0;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

.login-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

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

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 2.5rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.35);
}

.login-logo-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-logo-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-form { width: 100%; }

.login-field {
  margin-bottom: 20px;
}

.login-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: all var(--transition);
  background: var(--surface);
}
.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 20px;
  display: none !important;
  align-items: center;
  gap: 8px;
}
.login-error.show { display: flex !important; }
.login-error i { font-size: 1.1rem; }

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-info {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.login-info span { color: var(--text-secondary); font-weight: 500; }

.login-footer {
  padding: 10px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: -8px;
}

.login-footer-logo {
  width: auto;
  max-width: 350px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 4px;
}

.login-footer-text {
  font-size: 1rem;
  color: rgba(255,255,255,0.8);
}

.login-footer-version {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* Animacao de saida do login */
.login-screen.fade-out {
  animation: loginFadeOut 0.4s ease forwards;
}
@keyframes loginFadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.02); pointer-events: none; }
}

/* ====== TOAST MODERNO ====== */
.toast-container { z-index: 9999; }
.toast {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: none;
  padding: 0;
  overflow: hidden;
}
.toast .toast-body {
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 500;
}
.toast.bg-success { background: linear-gradient(135deg, #10b981 0%, #047857 100%) !important; color: #fff; }
.toast.bg-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important; color: #fff; }
.toast.bg-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important; color: #fff; }
.toast.bg-info { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important; color: #fff; }
.toast .btn-close { filter: brightness(0) invert(1); opacity: 0.7; }
.toast .btn-close:hover { opacity: 1; }

/* ====== COLETOR ====== */
.coletor-screen {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-radius: var(--radius-xl);
  color: #fff;
  padding: 32px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow-xl);
}

.coletor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.coletor-header-icon {
  width: 56px;
  height: 56px;
  background: rgba(16, 185, 129, 0.15);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--primary-light);
}

.coletor-header h4 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.coletor-header p { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-muted); }

.coletor-counter {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

.coletor-counter .count {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary-light);
  line-height: 1;
  text-shadow: 0 0 40px rgba(16, 185, 129, 0.3);
}

.coletor-counter .label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.coletor-field label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.coletor-field input, .coletor-field select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: #fff;
  padding: 14px 16px;
  font-size: 1rem;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.coletor-field input:focus, .coletor-field select:focus {
  outline: none;
  border-color: var(--primary-light);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.coletor-field select option { background: #0f172a; color: #fff; }

.coletor-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  margin-bottom: 10px;
}

.coletor-btn-finalizar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}
.coletor-btn-finalizar:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.coletor-btn-zerar {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.coletor-btn-zerar:hover { background: rgba(239, 68, 68, 0.2); }

/* ====== LOG LEITURAS ====== */
.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.875rem;
}
.log-item .log-code { 
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary-light);
  font-weight: 600;
  flex: 1;
}
.log-item .log-name { color: rgba(255,255,255,0.6); }
.log-item .log-time { color: rgba(255,255,255,0.3); font-size: 0.8rem; }
.log-item.log-error .log-code { color: #fca5a5; }
.log-container {
  max-height: 300px;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 16px;
  color: var(--border);
}
.empty-state h4 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; }

/* ====== DASHBOARD V2 ====== */
.dashboard-v2 { display: flex; flex-direction: column; gap: 20px; }

.dashboard-meta-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-meta-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  box-shadow: var(--shadow-sm);
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dashboard-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.dashboard-mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.dashboard-mini-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.dashboard-mini-icon.icon-people { background: #d1fae5; color: #047857; }
.dashboard-mini-icon.icon-setor { background: #dbeafe; color: #2563eb; }
.dashboard-mini-icon.icon-box { background: #fef3c7; color: #d97706; }
.dashboard-mini-icon.icon-read { background: #ede9fe; color: #7c3aed; }

.dashboard-mini-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.dashboard-mini-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
.dashboard-mini-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.dashboard-top-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dashboard-top-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-bottom: none;
}

.dashboard-top-card-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-top-total {
  background: rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.dashboard-top-table-wrap { max-height: 400px; overflow: auto; }
.dashboard-top-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dashboard-top-table tbody tr:hover { background: var(--surface-hover) !important; }
.dashboard-top-table td { font-size: 0.875rem; padding: 12px 16px !important; }

.dashboard-rank-badge {
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: none;
}
.dashboard-rank-badge.is-rank-1 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #ffffff; border-color: #d97706; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4); }
.dashboard-rank-badge.is-rank-2 { background: linear-gradient(135deg, #64748b 0%, #475569 100%); color: #ffffff; border-color: #475569; box-shadow: 0 2px 8px rgba(100, 116, 139, 0.4); }
.dashboard-rank-badge.is-rank-3 { background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); color: #ffffff; border-color: #c2410c; box-shadow: 0 2px 8px rgba(234, 88, 12, 0.4); }
.dashboard-rank-badge.is-rank-4 { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); color: #ffffff; border-color: #0284c7; box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4); }
.dashboard-rank-badge.is-rank-5 { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); color: #ffffff; border-color: #7c3aed; box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4); }

/* ====== COLLECTOR DASHBOARD ====== */
.collector-dashboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.collector-summary-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.collector-summary-chip span {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.collector-summary-chip strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.collector-summary-chip.is-total { background: var(--primary); }
.collector-summary-chip.is-total span, .collector-summary-chip.is-total strong { color: #fff; }
.collector-summary-chip.is-online { background: var(--info); }
.collector-summary-chip.is-online span, .collector-summary-chip.is-online strong { color: #fff; }
.collector-summary-chip.is-offline { background: var(--danger); }
.collector-summary-chip.is-offline span, .collector-summary-chip.is-offline strong { color: #fff; }
.collector-summary-chip.is-alert { background: var(--warning); }
.collector-summary-chip.is-alert span, .collector-summary-chip.is-alert strong { color: #1f2937; }
.collector-summary-chip.is-collecting { background: var(--primary-light); }
.collector-summary-chip.is-collecting span, .collector-summary-chip.is-collecting strong { color: #fff; }
.collector-summary-chip.is-reading { background: var(--primary-dark); }
.collector-summary-chip.is-reading span, .collector-summary-chip.is-reading strong { color: #fff; }

.collector-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.collector-dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.collector-dashboard-card:hover { box-shadow: var(--shadow); }
.collector-dashboard-card.status-offline { border-left: 4px solid #ef4444; }
.collector-dashboard-card.status-alert { border-left: 4px solid #f59e0b; }
.collector-dashboard-card.status-collecting { border-left: 4px solid #10b981; }

.collector-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.collector-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.collector-name { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-top: 4px; }
.collector-subtitle { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

.collector-status-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.collector-status-badge.online { background: #d1fae5; color: #065f46; }
.collector-status-badge.offline { background: #fee2e2; color: #991b1b; }
.collector-status-badge.alert { background: #fef3c7; color: #92400e; }

.collector-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.collector-metric {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
}
.collector-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.collector-metric strong { font-size: 1rem; color: var(--text); }
.collector-metric small { font-size: 0.75rem; color: var(--text-secondary); }

.collector-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.collector-card-footer strong { color: var(--text); }

/* ====== REFERENCIAS ====== */
.referencia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.referencia-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.referencia-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.referencia-thumb {
  height: 160px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--border) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.referencia-thumb img { width: 100%; height: 100%; object-fit: cover; }
.referencia-thumb i { font-size: 3rem; color: var(--border); }

.referencia-meta { padding: 16px; }
.referencia-title { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.referencia-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

/* ====== PRINT ====== */
@media print {
  .sidebar, .topbar, .modal-header, .modal-footer, .no-print, #statusBar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .coletor-screen { box-shadow: none; }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1200px) {
  .dashboard-main-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .status-bar { left: 0; }
  .collector-dashboard-grid { grid-template-columns: 1fr; }
  .collector-dashboard-filters { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .page-content { padding: 20px; }
  .dashboard-main-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .login-card { padding: 32px 24px; }
  .coletor-screen { padding: 20px; margin: 16px; }
  .coletor-counter .count { font-size: 3rem; }
  .stat-card { flex-direction: column; text-align: center; }
}

/* ====== ANIMACOES ====== */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-slide-up { animation: slideUp 0.3s ease forwards; }
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }

/* Stagger animation for cards */
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }

/* ====== UTILIDADES ====== */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }

.shadow-hover:hover { box-shadow: var(--shadow) !important; }
.border-primary { border-color: var(--primary) !important; }
