:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --topbar-height: 60px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: #F1F5F9;
  margin: 0;
  overflow-x: hidden;
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%);
}

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

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

.login-header i {
  font-size: 48px;
  color: var(--primary);
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 4px;
  color: #1E293B;
}

.login-header p {
  color: #64748B;
  font-size: 14px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #1E293B;
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width 0.3s;
  z-index: 1000;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #334155;
  min-height: 60px;
}

.sidebar-header i {
  font-size: 24px;
  color: var(--primary);
  flex-shrink: 0;
}

.sidebar-header span {
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #94A3B8;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

.sidebar-nav a:hover {
  color: #fff;
  background: #334155;
}

.sidebar-nav a.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.15);
  border-left-color: var(--primary);
}

.sidebar-nav a i {
  font-size: 18px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #334155;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #CBD5E1;
  overflow: hidden;
}

.user-info i { font-size: 20px; flex-shrink: 0; }

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-nav a span,
.sidebar.collapsed .sidebar-footer span,
.sidebar.collapsed .user-info span,
.sidebar.collapsed .sidebar-footer .btn {
  display: none;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

.top-bar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #1E293B;
}

.top-bar-right { margin-left: auto; }

.sidebar-toggle {
  font-size: 20px;
  color: #64748B;
  padding: 4px 8px;
}

.page-content {
  padding: 24px;
}

/* Cards */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #E2E8F0;
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1E293B;
}

.stat-card .stat-label {
  font-size: 13px;
  color: #64748B;
  margin-top: 2px;
}

.icon-blue { background: var(--primary-light); color: var(--primary); }
.icon-green { background: #D1FAE5; color: var(--success); }
.icon-yellow { background: #FEF3C7; color: var(--warning); }
.icon-red { background: #FEE2E2; color: var(--danger); }

/* Table */
.data-table {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  overflow-x: auto;
}

.data-table .table {
  margin: 0;
}

.data-table .table thead th {
  background: #F8FAFC;
  border-bottom: 2px solid #E2E8F0;
  font-weight: 600;
  font-size: 13px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  white-space: nowrap;
}

.data-table .table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #F1F5F9;
}

.data-table .table tbody tr:hover {
  background: #F8FAFC;
}

/* Status badges */
.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-trabalhando { background: #D1FAE5; color: #065F46; }
.badge-saiu { background: #DBEAFE; color: #1E40AF; }
.badge-ausente { background: #FEE2E2; color: #991B1B; }
.badge-ativo { background: #D1FAE5; color: #065F46; }
.badge-inativo { background: #FEE2E2; color: #991B1B; }
.badge-feriado { background: #FEF3C7; color: #92400E; }
.badge-domingo { background: #EDE9FE; color: #5B21B6; }
.badge-sabado { background: #FCE7F3; color: #9D174D; }
.badge-normal { background: #F0FDF4; color: #166534; }

/* Action buttons */
.btn-action {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
}

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

.page-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #475569;
  margin: 0;
}

/* Filter bar */
.filter-bar {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-bar .form-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.filter-bar .form-control,
.filter-bar .form-select {
  font-size: 14px;
  border-radius: 8px;
}

/* Dashboard cards */
.employee-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.employee-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.employee-card .emp-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.employee-card .emp-info {
  flex: 1;
  min-width: 0;
}

.employee-card .emp-name {
  font-weight: 600;
  font-size: 14px;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-card .emp-cargo {
  font-size: 12px;
  color: #64748B;
}

.employee-card .emp-times {
  text-align: right;
  font-size: 13px;
  flex-shrink: 0;
}

.employee-card .emp-times .time-in { color: var(--success); font-weight: 600; }
.employee-card .emp-times .time-out { color: var(--primary); font-weight: 600; }

/* Report summary */
.summary-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 20px;
}

.summary-card h5 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1E293B;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 14px;
}

.summary-item:last-child { border-bottom: none; }
.summary-item .label { color: #64748B; }
.summary-item .value { font-weight: 600; color: #1E293B; }

/* Loading */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: #64748B;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94A3B8;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }
  .sidebar .sidebar-header span,
  .sidebar .sidebar-nav a span,
  .sidebar .sidebar-footer span,
  .sidebar .user-info span,
  .sidebar .sidebar-footer .btn {
    display: none;
  }
  .main-content {
    margin-left: var(--sidebar-collapsed);
  }
  .sidebar.mobile-open {
    width: var(--sidebar-width);
  }
  .sidebar.mobile-open .sidebar-header span,
  .sidebar.mobile-open .sidebar-nav a span,
  .sidebar.mobile-open .sidebar-footer span,
  .sidebar.mobile-open .user-info span,
  .sidebar.mobile-open .sidebar-footer .btn {
    display: inline;
  }
  .page-content { padding: 16px; }
  .filter-bar { flex-direction: column; }
}

/* Leaflet map in modal */
.modal .leaflet-container { z-index: 1060; }
.map-container { height: 250px; border-radius: 8px; margin-top: 8px; }
.map-mini { height: 200px; border-radius: 8px; }
.location-link { cursor: pointer; color: var(--primary); }
.location-link:hover { color: var(--primary-dark); }

/* Charts */
.chart-container { position: relative; background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 20px; }
.chart-canvas-wrapper { position: relative; height: 300px; }

/* Print */
@media print {
  .sidebar, .top-bar { display: none !important; }
  .main-content { margin-left: 0 !important; }
}

/* Presença heatmap */
.presenca-heatmap-table {
  font-size: 0.75rem;
}

.presenca-heatmap-table th,
.presenca-heatmap-table td {
  vertical-align: middle;
}

.presenca-heatmap-table td[title]:hover {
  opacity: 0.8;
  cursor: default;
}
