* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', Roboto, Arial, sans-serif;
  background: radial-gradient(120% 100% at 50% -10%, #145339 0%, #0d3527 45%, #071e15 100%);
  color: #1a1a1a;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.screen::before {
  content: '';
  position: absolute;
  inset: -15%;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.07), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.screen::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.screen > * {
  position: relative;
  z-index: 1;
}

h1 {
  color: #ffffff;
  font-size: clamp(1.5rem, 4.5vw, 1.9rem);
  font-weight: 680;
  letter-spacing: -0.02em;
  margin: 4px 0 4px;
  text-align: center;
}

.screen-subtitle {
  color: rgba(217, 242, 226, 0.65);
  font-size: 0.92rem;
  font-weight: 400;
  margin: 0 0 22px;
  text-align: center;
}

.card-subtitle {
  color: #8a8f8c;
  font-size: 0.85rem;
  margin: -6px 0 4px;
}

.clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e8f7ee;
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 9px 20px;
  border-radius: 999px;
  margin-bottom: 32px;
  backdrop-filter: blur(12px) saturate(1.4);
}

.clock-icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
  flex-shrink: 0;
}

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 900px;
}

.employee-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  padding: 22px 12px 16px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 10px 24px -10px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: fadeInUp 0.4s ease backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.employee-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 16px 32px -12px rgba(0, 0, 0, 0.4);
}

.employee-btn:active {
  transform: scale(0.97);
}

.employee-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2e7d32, #0f3d2e);
  color: #ffffff;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

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

.employee-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #e3e6e4;
}

.employee-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2e7d32, #0f3d2e);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.employee-name {
  font-size: 1rem;
  font-weight: 590;
  color: #1a1a1a;
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.card {
  background: #ffffff;
  border-radius: 24px;
  padding: 34px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 30px 60px -16px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: fadeInUp 0.3s ease;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0 26px;
  min-height: 20px;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d3dad6;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.pin-dot.filled {
  background: #0f3d2e;
  border-color: #0f3d2e;
  transform: scale(1.15);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
  justify-items: center;
}

.keypad button {
  width: 62px;
  height: 62px;
  font-size: 1.35rem;
  font-weight: 600;
  border-radius: 50%;
  border: none;
  background: #f2f4f3;
  color: #0f3d2e;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease, transform 0.08s ease;
}

.keypad button:active {
  background: #dfe6e2;
  transform: scale(0.92);
}

.keypad button[data-key='clear'],
.keypad button[data-key='back'] {
  font-size: 1rem;
  color: #888;
}

.punch-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.punch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px 14px;
  font-size: 0.88rem;
  font-weight: 590;
  color: #1a1a1a;
  background: #f6f7f6;
  border: 1px solid #ebeeec;
  border-radius: 16px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.punch-btn:hover {
  background: #eff2f0;
}

.punch-btn:active {
  transform: scale(0.96);
  background: #e8ebe9;
}

.punch-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.punch-icon-badge svg {
  width: 18px;
  height: 18px;
}

.punch-label {
  letter-spacing: -0.01em;
}

.punch-time {
  font-size: 0.72rem;
  font-weight: 400;
  color: #8a8f8c;
}

.punch-icon-badge.entrada { background: #2e7d32; }
.punch-icon-badge.saida_almoco { background: #ef6c00; }
.punch-icon-badge.volta_almoco { background: #1565c0; }
.punch-icon-badge.saida { background: #c62828; }

.back-link {
  margin-top: 20px;
  background: none;
  border: none;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.95rem;
}

.message {
  min-height: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  white-space: pre-line;
}

.message.error { color: #c62828; }
.message.success { color: #2e7d32; }
.message.warning { color: #e65100; }

#btn-ack-warning {
  margin-bottom: 12px;
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

.pending-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pending-item {
  background: #fff3e0;
  border-left: 4px solid #e65100;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #4e342e;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin-bottom: 28px;
}

.brand-logo {
  max-height: 52px;
  max-width: 200px;
  object-fit: contain;
}

.main-nav {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px) saturate(1.4);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 590;
  color: rgba(217, 242, 226, 0.7);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-icon {
  margin-right: 7px;
  display: inline-flex;
}

.nav-icon svg {
  width: 15px;
  height: 15px;
}

.nav-link.active {
  background: #ffffff;
  color: #0f3d2e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- painel admin --- */
.admin-body {
  background: #f2f4f3;
  color: #1a1a1a;
}

.admin-body .topbar {
  max-width: none;
  margin-bottom: 22px;
}

.admin-body .main-nav {
  background: #eaece9;
  border-color: #e0e4e1;
  backdrop-filter: none;
}

.admin-body .nav-link {
  color: #4c5a53;
}

.admin-body .nav-link.active {
  background: #0f3d2e;
  color: #ffffff;
  box-shadow: none;
}

.login-logo {
  display: block;
  margin: 0 auto 16px;
}

.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-header h1 {
  color: #0f3d2e;
  font-size: 1.5rem;
  margin: 0;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.panel h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.form-row input, .form-row select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

button.primary {
  background: #0f3d2e;
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

button.secondary {
  background: #eee;
  border: 1px solid #ccc;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

button.danger {
  background: #c62828;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.login-card {
  max-width: 360px;
  margin: 15vh auto;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #444;
}

.field-label input {
  padding: 7px 9px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.kpi-card {
  background: #f7f9f8;
  border: 1px solid #e3e6e4;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f3d2e;
}

.kpi-label {
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 4px 0 18px;
}

.balance-card {
  background: #f7f9f8;
  border: 1px solid #e3e6e4;
  border-left: 4px solid #ccc;
  border-radius: 10px;
  padding: 12px 14px;
}

.balance-card.positive { border-left-color: #2e7d32; }
.balance-card.negative { border-left-color: #c62828; }

.balance-card-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.balance-card-saldo {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.balance-card-saldo.positive { color: #2e7d32; }
.balance-card-saldo.negative { color: #c62828; }

.balance-card-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: #555;
}

.text-green { color: #2e7d32; }
.text-red { color: #c62828; }
.text-muted { color: #888; }

.chart-block {
  margin-top: 22px;
}

.chart-block h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #333;
}

.chart-block svg {
  max-width: 100%;
}

/* --- responsivo: tela de bater ponto no celular --- */
@media (max-width: 480px) {
  .screen {
    padding: 16px;
  }

  .screen::before,
  .screen::after {
    width: 220px;
    height: 220px;
  }

  h1 {
    margin-bottom: 2px;
  }

  .screen-subtitle {
    margin-bottom: 18px;
  }

  .clock {
    padding: 8px 16px;
    margin-bottom: 20px;
  }

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

  .employee-btn {
    padding: 18px 8px 14px;
    border-radius: 16px;
  }

  .employee-avatar {
    width: 56px;
    height: 56px;
  }

  .employee-name {
    font-size: 0.9rem;
  }

  .card {
    padding: 26px 18px;
    border-radius: 20px;
  }

  .keypad {
    gap: 10px;
  }

  .keypad button {
    width: 54px;
    height: 54px;
    font-size: 1.15rem;
  }

  .punch-btn {
    padding: 12px 6px 10px;
    font-size: 0.8rem;
  }

  .punch-icon-badge {
    width: 30px;
    height: 30px;
  }

  .punch-icon-badge svg {
    width: 16px;
    height: 16px;
  }

  .topbar {
    justify-content: center;
    text-align: center;
  }

  .brand-logo {
    max-height: 40px;
  }

  .nav-link {
    padding: 7px 14px;
    font-size: 0.85rem;
  }
}
