/* ============================================================
   PontoTrack - Design System & Styles v2.0
   Mobile-first, Dark Theme, Field-Work Optimized
   ============================================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
  /* Core palette */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);

  --accent: #06b6d4;
  --accent-light: #22d3ee;

  /* Status colors */
  --success: #22c55e;
  --success-light: #4ade80;
  --success-bg: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-light: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Dark theme surfaces */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --bg-card-hover: #263548;
  --bg-elevated: #283549;
  --bg-input: #0f172a;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0f172a;

  /* Borders */
  --border: #334155;
  --border-light: #475569;
  --border-focus: var(--primary);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--primary-glow);

  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-toast: 1100;
  --z-offline-banner: 1200;
  --z-loading: 9999;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: var(--primary-light); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* --- Utility Classes --- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
@media print {
  .no-print { display: none !important; }
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50% { box-shadow: 0 0 0 12px transparent; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes progressBar {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.animate-fade-in { animation: fadeIn var(--transition-base) ease; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease; }
.animate-slide-up { animation: slideUp 0.6s ease; }
.animate-scale-in { animation: scaleIn 0.3s ease; }

/* --- Offline Banner --- */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  z-index: var(--z-offline-banner);
  display: none;
  animation: slideDown 0.3s ease;
  letter-spacing: 0.3px;
}

.offline-banner.active {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.offline-banner i {
  animation: pulse 2s infinite;
}

body.is-offline {
  padding-top: 38px;
}

/* --- Sync Status Indicator --- */
.sync-status {
  position: fixed;
  bottom: 90px;
  right: 16px;
  background: var(--bg-card);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  z-index: var(--z-sticky);
  transition: all var(--transition-base);
  border: 1px solid var(--border);
}

.sync-status.active { display: flex; }
.sync-status.syncing { color: var(--warning); border-color: var(--warning); }
.sync-status.synced { color: var(--success); border-color: var(--success); }
.sync-status.offline { color: var(--danger); border-color: var(--danger); }
.sync-status.syncing i { animation: spin 1s linear infinite; }

/* --- Loading Screen --- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
  transition: opacity 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-ring {
  width: 56px;
  height: 56px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  margin-top: 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.loading-brand {
  margin-bottom: 30px;
  text-align: center;
}

.loading-brand h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-brand p {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-top: 4px;
}

/* --- Login Screen --- */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  animation: fadeIn 0.5s ease;
  background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08), transparent 70%),
              var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  padding: 36px 28px;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.6s ease;
  border: 1px solid var(--border);
}

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

.logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.logo-icon i { font-size: 32px; color: #fff; }

.logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.logo p {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

/* Login Tabs */
.login-tabs {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  font-size: 13px;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.2px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
  z-index: 1;
  pointer-events: none;
}

.form-input,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder {
  color: var(--text-tertiary);
}

.form-group select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.no-icon-input {
  padding-left: 14px !important;
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-full { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 18px 32px;
  font-size: 17px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
}

.btn-icon:hover {
  background: var(--border-light);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-icon.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --- App Container / Layout --- */
.app-container {
  display: none;
  animation: fadeIn 0.4s ease;
  padding-bottom: 80px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}

/* --- Header --- */
.header {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 8px;
  z-index: var(--z-sticky);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

body.is-offline .header {
  top: 46px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.user-details h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-details p {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

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

/* --- Clock Section --- */
.clock-section {
  background: var(--bg-card);
  padding: 28px 20px;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.clock-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--success));
}

.current-time {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 6px;
}

.current-date {
  font-size: 14px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: 24px;
  text-transform: capitalize;
}

.timer-display {
  font-size: 38px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 20px 0;
  font-variant-numeric: tabular-nums;
  display: none;
  letter-spacing: -1px;
}

.timer-display.active {
  display: block;
  animation: breathe 3s ease-in-out infinite;
}

/* Action Buttons - Large for field use with gloves */
.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn-action {
  padding: 20px 28px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 130px;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.btn-action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.1));
  pointer-events: none;
}

.btn-action i { font-size: 26px; }

.btn-action:active:not(:disabled) {
  transform: scale(0.95);
}

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

.btn-checkin {
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

.btn-checkout {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-break {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #fff;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.btn-lunch {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-extra {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

/* --- Location Info --- */
.location-info {
  background: var(--bg-primary);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  border: 1px solid var(--border);
}

.location-info i { color: var(--primary-light); font-size: 16px; }

.location-info.error {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger-light);
}

.location-info.error i { color: var(--danger); }

.location-info.success {
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success-light);
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--bg-card);
  padding: 18px 14px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: #a855f7; }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--primary-glow);
  color: var(--primary-light);
}

.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: rgba(168, 85, 247, 0.12); color: #a855f7; }

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Quick Actions --- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 480px) {
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
}

.quick-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.quick-action-btn i {
  font-size: 20px;
  color: var(--primary-light);
  width: 44px;
  height: 44px;
  background: var(--primary-glow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-action-btn span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* --- Sections --- */
.section-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: nowrap;
  gap: 12px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i { color: var(--primary-light); }

/* --- Records List --- */
.records-list {
  max-height: 500px;
  overflow-y: auto;
}

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.record-item:hover {
  border-color: var(--primary);
  background: var(--bg-elevated);
}

.record-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.record-type-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.record-type-icon.entry { background: var(--success-bg); color: var(--success); }
.record-type-icon.exit { background: var(--danger-bg); color: var(--danger); }
.record-type-icon.break { background: var(--warning-bg); color: var(--warning); }
.record-type-icon.break_end { background: var(--info-bg); color: var(--info); }

.record-details h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.record-details p {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.record-time {
  text-align: right;
  flex-shrink: 0;
}

.record-time .time {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.record-time .date {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.sync-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 4px;
}

.sync-badge.synced { background: var(--success); }
.sync-badge.pending { background: var(--warning); animation: pulse 2s infinite; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

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

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.empty-state p { font-size: 13px; }

/* --- Admin Panel --- */
.admin-panel { display: none; }

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--border);
}

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

.tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* Dashboard Stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .dashboard-stats { grid-template-columns: repeat(4, 1fr); }
}

.dashboard-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.dashboard-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  background: var(--primary-glow);
  border-radius: 50%;
  opacity: 0.3;
}

.dashboard-card h3 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dashboard-card p {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.trend.up { color: var(--success); background: var(--success-bg); }
.trend.down { color: var(--danger); background: var(--danger-bg); }

/* Employees Grid */
.employees-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) { .employees-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .employees-grid { grid-template-columns: repeat(3, 1fr); } }

.employee-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-base);
  border: 1px solid var(--border);
}

.employee-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.employee-header {
  padding: 20px;
  background: var(--bg-primary);
  position: relative;
}

.employee-status-dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.employee-status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  animation: pulseGlow 2s infinite;
}

.employee-status-dot.offline { background: var(--text-tertiary); }

.employee-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.employee-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
}

.employee-title h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.employee-title p {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.employee-body { padding: 20px; }

.employee-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.emp-stat-box {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.emp-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.emp-stat-label {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.employee-actions .btn-sm { flex: 1; }

/* --- Reports --- */
.reports-controls {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .control-grid { grid-template-columns: repeat(3, 1fr); }
}

.control-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-group input,
.control-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.control-group input:focus,
.control-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.export-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-export {
  padding: 12px 22px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-base);
  font-size: 13px;
  color: #fff;
}

.btn-excel { background: var(--success); }
.btn-pdf { background: var(--danger); }
.btn-export:hover { transform: translateY(-1px); filter: brightness(1.1); }

/* --- Search Box --- */
.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 18px;
}

/* --- Modal --- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal-backdrop);
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.close-btn {
  background: var(--bg-tertiary);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.close-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
  transform: rotate(90deg);
}

.modal-body { padding: 20px; }

/* --- Camera --- */
.camera-container {
  position: relative;
  width: 100%;
  max-width: 350px;
  margin: 0 auto 16px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border);
}

.camera-container video {
  width: 100%;
  height: auto;
  display: block;
}

.camera-container canvas { display: none; }

.camera-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.camera-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  transition: transform var(--transition-fast);
}

.camera-btn:active { transform: scale(0.9); }

.captured-photo {
  width: 100%;
  max-width: 350px;
  margin: 0 auto 16px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 2px solid var(--success);
}

.captured-photo img { width: 100%; display: block; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  width: calc(100% - 32px);
}

body.is-offline .toast-container {
  top: 52px;
}

.toast {
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-left: 4px solid;
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.toast::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  animation: progressBar 3s linear forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.success::before { background: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error::before { background: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning::before { background: var(--warning); }
.toast.info { border-left-color: var(--primary); }
.toast.info::before { background: var(--primary); }

.toast-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast.warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast.info .toast-icon { background: var(--info-bg); color: var(--info); }

.toast-content h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-content p {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 max(12px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.3);
  z-index: var(--z-sticky);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius-md);
  flex: 1;
}

.nav-item.active {
  color: var(--primary-light);
  background: var(--primary-glow);
}

.nav-item i { font-size: 20px; }

@media (min-width: 1200px) {
  .bottom-nav { display: none; }
  .app-container { padding-bottom: 16px; }
}

/* --- Status Badges --- */
.status-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active { background: var(--success-bg); color: var(--success); }
.status-inactive { background: var(--danger-bg); color: var(--danger); }

/* --- Map Container --- */
.map-container {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* Leaflet dark theme overrides */
.leaflet-container {
  background: var(--bg-primary) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
}

/* --- Obras/Fazendas Cards --- */
.obra-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 12px;
  transition: all var(--transition-base);
}

.obra-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.obra-card .obra-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.obra-card .obra-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.obra-card .obra-location {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.obra-card .obra-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.obra-card .obra-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Report Summary Card --- */
.report-summary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 20px;
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}

.report-summary-value {
  font-size: 24px;
  font-weight: 800;
}

.report-summary-label {
  font-size: 10px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* --- Settings --- */
.settings-section {
  max-width: 700px;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
}

.settings-group h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-group h3 i { color: var(--primary-light); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  font-size: 14px;
  color: var(--text-secondary);
}

.checkbox-label:hover { background: var(--bg-primary); }

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.3);
}

.danger-zone h3 { color: var(--danger); }

/* --- Print --- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .section-card, .record-item { box-shadow: none; border: 1px solid #ddd; }
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .current-time { font-size: 40px; }
  .timer-display { font-size: 32px; }
  .btn-action { min-width: 110px; padding: 16px 20px; font-size: 14px; }
  .btn-action i { font-size: 22px; }
  .header { padding: 12px; }
  .user-avatar { width: 40px; height: 40px; font-size: 15px; }
  .user-details h3 { font-size: 14px; }
  .login-card { padding: 24px 20px; }
  .stat-value { font-size: 20px; }
  .toast-container { max-width: 300px; }
}

@media (max-width: 360px) {
  .container { padding: 8px; }
  .action-buttons { gap: 8px; }
  .btn-action { min-width: 95px; padding: 14px 16px; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

/* --- Live Activity Colors --- */
.border-entry { border-left: 4px solid var(--success) !important; }
.border-exit { border-left: 4px solid var(--danger) !important; }
.border-break { border-left: 4px solid var(--warning) !important; }

.status-entry { background: var(--success-bg); color: var(--success); }
.status-exit { background: var(--danger-bg); color: var(--danger); }
.status-break { background: var(--warning-bg); color: var(--warning); }

.record-location-small {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.live-item {
  transition: all 0.3s ease;
  animation: fadeInDown 0.4s ease;
}

/* --- Service Cards --- */
.service-card {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 8px !important;
  border-left: 4px solid var(--info) !important;
}

.service-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: flex-start;
}

.service-main h4 {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.service-main p {
  font-size: 12px;
  color: var(--text-secondary);
}

.service-dist {
  font-size: 12px;
  font-weight: 700;
  color: var(--info);
  background: var(--info-bg);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.service-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 4px;
  padding: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  width: 100%;
}

.record-obs {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  border-left: 3px solid var(--primary-light);
  font-style: italic;
}

/* Fix for tab visibility */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes progressBar {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* --- Registration Alert Style --- */
#regTimeAlert {
  animation: fadeIn 0.3s ease;
}

#regTimeAlert i {
  font-size: 16px;
  animation: pulse 2s infinite;
}

