/**
 * PontoTrack — Design System v3.0
 * Mobile-First · Premium SaaS · iOS Safe Area · No Overflow
 *
 * Arquitetura:
 * 1. Foundation (reset + tokens)
 * 2. Layout System (containers, grids, stacks)
 * 3. Component Library (inputs, buttons, cards, modals)
 * 4. Page Layouts (login, admin, employee)
 * 5. Mobile-Specific (safe areas, touch, bottom sheets)
 * 6. Desktop-Specific (sidebar, multi-column)
 */

/* ════════════════════════════════════════════════════════════
   1. FOUNDATION — Reset Global + Design Tokens
   ════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box !important;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Imagens, vídeos, SVGs nunca extrapolam */
img, video, canvas, svg, iframe {
  max-width: 100%;
  height: auto;
}

/* Tabelas */
table { width: 100%; max-width: 100%; border-collapse: collapse; }

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Spacing scale (4px base) */
  --ds-1: 4px;
  --ds-2: 8px;
  --ds-3: 12px;
  --ds-4: 16px;
  --ds-5: 20px;
  --ds-6: 24px;
  --ds-7: 28px;
  --ds-8: 32px;
  --ds-10: 40px;
  --ds-12: 48px;

  /* Component heights */
  --h-input: 50px;
  --h-input-sm: 42px;
  --h-btn: 50px;
  --h-btn-sm: 38px;
  --h-btn-icon: 42px;
  --h-tab: 50px;
  --h-bottom-nav: 68px;

  /* Border radius scale */
  --rd-1: 6px;
  --rd-2: 10px;
  --rd-3: 12px;
  --rd-4: 16px;
  --rd-5: 20px;
  --rd-6: 24px;

  /* Container max widths */
  --container-sm: 480px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1440px;

  /* Touch targets */
  --touch-min: 44px;

  /* Z-index layers */
  --z-base: 1;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-banner: 900;
  --z-bottom-nav: 950;
  --z-modal-backdrop: 1000;
  --z-modal: 1010;
  --z-toast: 1100;
  --z-tooltip: 1200;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ════════════════════════════════════════════════════════════
   2. LAYOUT SYSTEM — Containers, Stacks, Grids
   ════════════════════════════════════════════════════════════ */

/* Páginas principais (admin, employee, login) */
.app-container,
.admin-panel,
.login-screen,
#employeeApp {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  position: relative;
}

/* Container interno (com padding lateral) */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: var(--ds-4);
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .container { padding: var(--ds-5); max-width: var(--container-md); }
}

@media (min-width: 1024px) {
  .container { padding: var(--ds-6); max-width: var(--container-2xl); }
}

/* ════════════════════════════════════════════════════════════
   3. INPUTS — Sistema unificado
   ════════════════════════════════════════════════════════════ */

input, select, textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

/* Wrapper com ícone */
.input-wrapper {
  position: relative;
  width: 100%;
  display: block;
}

.input-wrapper i,
.input-wrapper svg {
  position: absolute;
  left: var(--ds-4);
  top: 50%;
  transform: translateY(-50%);
  color: #6b88a8;
  font-size: 16px;
  pointer-events: none;
  z-index: 2;
}

/* Input com ícone */
.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
  width: 100% !important;
  min-height: var(--h-input) !important;
  padding: 12px 16px 12px 44px !important;
  border-radius: var(--rd-3) !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  background: var(--bg-input, #111827) !important;
  color: var(--text-primary, #f1f5f9) !important;
  border: 1.5px solid var(--border, #334155) !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
  outline: none !important;
  border-color: var(--primary, #2563eb) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18) !important;
}

/* Input sem ícone (.no-icon-input) */
.no-icon-input,
input.no-icon-input,
select.no-icon-input,
textarea.no-icon-input {
  width: 100% !important;
  min-height: var(--h-input) !important;
  padding: 12px 16px !important;
  border-radius: var(--rd-3) !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  background: var(--bg-input, #111827) !important;
  color: var(--text-primary, #f1f5f9) !important;
  border: 1.5px solid var(--border, #334155) !important;
  box-sizing: border-box !important;
}

/* Tipos especiais */
input[type="datetime-local"],
input[type="date"],
input[type="time"],
input[type="month"],
input[type="number"] {
  width: 100% !important;
  min-height: var(--h-input) !important;
  padding: 12px 16px !important;
  font-size: 15px !important;
  color-scheme: dark;
}

/* Select com seta customizada */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  padding-right: 40px !important;
  cursor: pointer;
}

.input-wrapper select {
  background-position: right 16px center !important;
}

select option {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  padding: 8px !important;
}

/* Textarea */
textarea {
  resize: vertical;
  min-height: 90px !important;
  padding: 12px 16px !important;
  line-height: 1.5 !important;
}

/* Placeholders legíveis */
::placeholder { color: #8ea3bb !important; opacity: 1 !important; font-size: 14px; }
::-webkit-input-placeholder { color: #8ea3bb !important; opacity: 1 !important; }
::-moz-placeholder           { color: #8ea3bb !important; opacity: 1 !important; }
:-ms-input-placeholder       { color: #8ea3bb !important; opacity: 1 !important; }

/* Checkbox custom dark */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

input[type="checkbox"]:hover {
  border-color: var(--primary-light, #3b82f6);
  background: rgba(37, 99, 235, 0.08);
}

input[type="checkbox"]:checked {
  background: var(--primary, #2563eb) !important;
  border-color: var(--primary, #2563eb) !important;
}

input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  position: absolute;
  top: 2px;
  left: 6px;
}

/* ════════════════════════════════════════════════════════════
   4. BUTTONS — Sistema unificado
   ════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: var(--h-btn) !important;
  padding: 12px 20px !important;
  border-radius: var(--rd-3) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  font-family: inherit;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box !important;
  max-width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

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

.btn.btn-sm {
  min-height: var(--h-btn-sm) !important;
  padding: 8px 14px !important;
  font-size: 12px !important;
}

.btn.btn-full,
.btn-full {
  width: 100% !important;
}

.btn-icon {
  width: var(--h-btn-icon) !important;
  height: var(--h-btn-icon) !important;
  min-width: var(--h-btn-icon) !important;
  min-height: var(--h-btn-icon) !important;
  padding: 0 !important;
  border-radius: var(--rd-2) !important;
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ════════════════════════════════════════════════════════════
   5. FORMS — Layout consistente
   ════════════════════════════════════════════════════════════ */

.form-group {
  width: 100%;
  margin-bottom: var(--ds-4);
  box-sizing: border-box;
}

.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.2px;
}

.form-row {
  display: flex;
  gap: var(--ds-3);
  width: 100%;
  flex-wrap: wrap;
}

.form-row > .form-group {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
  margin-bottom: var(--ds-4);
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 0; }
  .form-row > .form-group { flex: 1 1 100%; }
}

.form-group small {
  display: block;
  font-size: 11px;
  color: #8ea3bb;
  margin-top: 4px;
  line-height: 1.4;
}

/* ════════════════════════════════════════════════════════════
   6. CARDS — Sistema padronizado
   ════════════════════════════════════════════════════════════ */

.section-card {
  width: 100%;
  max-width: 100%;
  border-radius: var(--rd-5) !important;
  padding: var(--ds-4) !important;
  margin-bottom: var(--ds-4) !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

@media (min-width: 768px) {
  .section-card { padding: var(--ds-5) !important; }
}

.dashboard-card {
  width: 100%;
  border-radius: var(--rd-5) !important;
  padding: var(--ds-4) !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.settings-group {
  width: 100%;
  border-radius: var(--rd-4) !important;
  padding: var(--ds-4) !important;
  margin-bottom: var(--ds-3) !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

/* ════════════════════════════════════════════════════════════
   7. MODAIS — Bottom sheet mobile, centered desktop
   ════════════════════════════════════════════════════════════ */

.modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal) !important;
  display: none;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

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

.modal-content {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 92dvh !important;
  background: var(--bg-card, #0f1f3a) !important;
  border-radius: 22px 22px 0 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 768px) {
  .modal {
    align-items: center !important;
    padding: 20px !important;
  }
  .modal-content {
    border-radius: 20px !important;
    max-width: 520px !important;
    max-height: 88vh !important;
    padding-bottom: 0;
  }
}

/* Modal header */
.modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 16px 20px !important;
  border-bottom: 1px solid var(--border, #334155) !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.modal-header h2,
.modal-header h3 {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: var(--text-primary, #f1f5f9) !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 !important;
  min-width: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal body — scroll interno */
.modal-body {
  flex: 1 1 auto !important;
  padding: 16px 20px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Modal footer */
.modal-footer {
  display: flex !important;
  gap: 10px !important;
  padding: 14px 20px !important;
  border-top: 1px solid var(--border, #334155) !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.modal-footer .btn {
  flex: 1;
  min-height: 46px !important;
  width: auto;
}

@media (max-width: 480px) {
  .modal-footer { flex-direction: column !important; }
  .modal-footer .btn { width: 100% !important; }
}

/* Botão fechar */
.modal-close,
.close-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: all 0.18s !important;
}

.modal-close:hover,
.close-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

/* Modais pequenos — sempre centralizados */
#deleteModal,
#forgotPasswordModal,
#changePasswordModal,
#adminRequestModal {
  align-items: center !important;
  padding: 16px !important;
}

#deleteModal .modal-content,
#forgotPasswordModal .modal-content,
#changePasswordModal .modal-content,
#adminRequestModal .modal-content {
  border-radius: 20px !important;
  max-width: 420px !important;
  max-height: 88vh !important;
  padding-bottom: 0;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

/* ════════════════════════════════════════════════════════════
   8. ADMIN PANEL — Header, tabs, content
   ════════════════════════════════════════════════════════════ */

.admin-panel { background: var(--bg-primary, #0a1628); }

.admin-panel .container {
  padding-top: max(var(--ds-3), var(--safe-top));
  padding-bottom: max(var(--ds-6), calc(var(--ds-4) + var(--safe-bottom)));
}

/* Header admin */
.admin-panel .header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  border-radius: var(--rd-4) !important;
  margin-bottom: var(--ds-3) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.user-avatar {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  flex-shrink: 0;
  font-size: 16px !important;
}

.user-details {
  min-width: 0;
  flex: 1;
}

.user-details h3,
.user-details p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.user-details h3 { font-size: 14px !important; font-weight: 800; }
.user-details p  { font-size: 11px !important; color: #94a3b8; }

.header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Tabs admin */
.tabs {
  display: flex !important;
  gap: 2px !important;
  padding: 4px !important;
  border-radius: var(--rd-3) !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: var(--ds-3) !important;
}

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

.tab {
  flex: 1 1 0 !important;
  min-width: 50px !important;
  min-height: var(--h-tab) !important;
  padding: 8px 4px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  border-radius: var(--rd-2) !important;
  font-size: 9px !important;
  font-weight: 700;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab i { font-size: 17px !important; }
.tab > span { font-size: 9px !important; line-height: 1; letter-spacing: 0.2px; }

.tab.active {
  background: linear-gradient(135deg, var(--primary, #2563eb), var(--primary-dark, #1d4ed8)) !important;
  color: #fff !important;
}

.tab-content {
  display: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

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

/* ════════════════════════════════════════════════════════════
   9. EMPLOYEE APP — Top, content, bottom-nav
   ════════════════════════════════════════════════════════════ */

#employeeApp {
  min-height: 100vh;
  min-height: 100dvh;
}

.emp-home {
  width: 100%;
  max-width: 100%;
  padding: 0 var(--ds-4) !important;
  padding-bottom: calc(var(--h-bottom-nav) + var(--ds-3) + var(--safe-bottom)) !important;
  padding-top: max(var(--ds-3), var(--safe-top)) !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

/* Top bar funcionário */
.emp-top-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 10px 0 !important;
  width: 100% !important;
  overflow: hidden;
}

.emp-top-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.emp-top-logo span {
  font-size: 15px !important;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Saudação */
.emp-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--ds-3);
}

.emp-greeting > div:first-child {
  min-width: 0;
  flex: 1;
}

.emp-greeting h2 {
  font-size: 18px !important;
  font-weight: 800;
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emp-greeting p {
  font-size: 12px !important;
  color: #8ea3bb;
  margin: 0;
}

/* Status card */
.emp-status-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--rd-4);
  margin-bottom: var(--ds-3);
  box-sizing: border-box;
  overflow: hidden;
}

.emp-status-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.emp-status-icon-wrap {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.emp-status-main, .emp-status-detail {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Punch card */
.emp-punch-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px;
  border-radius: var(--rd-5);
  margin-bottom: var(--ds-3);
  box-sizing: border-box;
  overflow: hidden;
}

.emp-punch-outer {
  width: 200px;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.emp-punch-big {
  width: 178px;
  height: 178px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1d4ed8, #2563eb, #3b82f6);
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.1), 0 16px 48px rgba(37, 99, 235, 0.5);
}

.emp-punch-time { font-size: 28px; font-weight: 900; color: #fff; }
.emp-punch-icon { font-size: 22px; color: rgba(255,255,255,0.9); margin-bottom: 4px; }
.emp-punch-sub  { font-size: 11px; color: rgba(255,255,255,0.85); }

@media (max-width: 360px) {
  .emp-punch-outer { width: 170px; height: 170px; }
  .emp-punch-big { width: 152px; height: 152px; }
  .emp-punch-time { font-size: 24px; }
}

/* Quick actions grid */
.emp-qa-row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  margin-bottom: var(--ds-3) !important;
}

.emp-qa-btn {
  min-width: 0 !important;
  padding: 10px 4px !important;
  border-radius: var(--rd-3) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 5px !important;
  overflow: hidden !important;
}

.emp-qa-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.emp-qa-label {
  font-size: 10px !important;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.emp-qa-sub { display: none !important; }

/* Two-column info cards */
.emp-two-col {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  width: 100% !important;
  margin-bottom: var(--ds-3) !important;
}

@media (max-width: 360px) {
  .emp-two-col { grid-template-columns: 1fr !important; }
}

.emp-info-card {
  padding: 12px !important;
  border-radius: var(--rd-3) !important;
  min-width: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.emp-info-title {
  font-size: 11px !important;
  margin-bottom: 6px !important;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Summary list */
.emp-summary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.emp-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

/* Week chart */
.emp-week-chart {
  width: 100%;
  overflow: hidden;
}

.emp-week-bars {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  align-items: end;
  gap: 4px;
  width: 100%;
  height: 64px;
}

.emp-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}

.emp-bar { width: 100%; max-width: 14px; border-radius: 3px; }
.emp-bar-col span { font-size: 9px !important; white-space: nowrap; }

/* Bottom navigation */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  z-index: var(--z-bottom-nav) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-around !important;
  padding: 6px 4px !important;
  padding-bottom: max(6px, var(--safe-bottom)) !important;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.nav-item {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  min-height: 56px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  padding: 4px 2px !important;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.nav-item i { font-size: 18px !important; }
.nav-item span {
  font-size: 9px !important;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-item.nav-center { padding: 0 !important; }
.nav-center-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   10. DASHBOARD STATS / KPI CARDS
   ════════════════════════════════════════════════════════════ */

.dashboard-stats {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100% !important;
  margin-bottom: var(--ds-3) !important;
}

@media (min-width: 768px) {
  .dashboard-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: var(--ds-3) !important;
  }
}

.dashboard-card h3 { font-size: 22px !important; font-weight: 900; }
.dashboard-card p  { font-size: 11px !important; color: #94a3b8; }

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* ════════════════════════════════════════════════════════════
   11. TRIAL BANNER (Mobile bottom, Desktop top)
   ════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  #trialBanner {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 12px 16px !important;
    padding-bottom: max(12px, var(--safe-bottom)) !important;
    border-radius: 18px 18px 0 0 !important;
    z-index: var(--z-banner) !important;
    box-sizing: border-box !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  #trialBanner > div {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
  }

  #trialBanner button {
    padding: 10px 16px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
    min-height: 44px !important;
    flex-shrink: 0 !important;
    white-space: nowrap;
  }
}

/* ════════════════════════════════════════════════════════════
   12. LOGIN SCREEN — Centralizado com max-width
   ════════════════════════════════════════════════════════════ */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(var(--ds-4), var(--safe-top)) var(--ds-4) max(var(--ds-4), var(--safe-bottom));
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--rd-6);
  padding: 28px 22px;
  box-sizing: border-box;
  overflow: hidden;
}

.login-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--rd-3);
  margin-bottom: 18px;
  width: 100%;
}

.login-tab {
  flex: 1;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--rd-2);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-tab.active {
  background: linear-gradient(135deg, var(--primary, #2563eb), var(--primary-dark, #1d4ed8));
  color: #fff;
}

/* ════════════════════════════════════════════════════════════
   13. TYPOGRAPHY HIERARCHY
   ════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  h1 { font-size: 22px !important; line-height: 1.3 !important; }
  h2 { font-size: 18px !important; line-height: 1.35 !important; }
  h3 { font-size: 15px !important; line-height: 1.4 !important; }
  h4 { font-size: 13px !important; line-height: 1.4 !important; }
}

/* ════════════════════════════════════════════════════════════
   14. SECTION HEADER — Section title + actions
   ════════════════════════════════════════════════════════════ */

.section-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin-bottom: var(--ds-3) !important;
  flex-wrap: wrap;
  width: 100%;
}

.section-title {
  font-size: 14px !important;
  font-weight: 800 !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* ════════════════════════════════════════════════════════════
   15. EXPORT BUTTONS / BUTTONS GROUPS
   ════════════════════════════════════════════════════════════ */

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.btn-export {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  min-height: 46px;
  padding: 10px 8px;
  border-radius: var(--rd-3) !important;
  font-size: 13px !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

.export-buttons .btn { flex: 1 1 100%; }

@media (min-width: 480px) {
  .btn-export { flex: 1 1 auto; min-width: 100px; }
}

/* ════════════════════════════════════════════════════════════
   16. LISTS (records, employees, requests)
   ════════════════════════════════════════════════════════════ */

.records-list,
.employees-grid,
[id$="List"],
[id$="Grid"] {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.record-item, .employee-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

#batchEmployeeList {
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--rd-3);
  box-sizing: border-box;
}

#batchEmployeeList label {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 12px !important;
  border-radius: var(--rd-2) !important;
  width: 100% !important;
  min-height: 56px !important;
  box-sizing: border-box !important;
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════
   17. OVERFLOW / TEXT BREAKAGE — Universal
   ════════════════════════════════════════════════════════════ */

/* Texto longo nunca quebra layout */
h1, h2, h3, h4, h5, h6, p, span, a, li, label {
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Em flex containers, filhos não extrapolam */
.flex-row > *,
[style*="display:flex"] > *,
[style*="display: flex"] > * {
  min-width: 0;
}

/* ════════════════════════════════════════════════════════════
   18. TOUCH TARGETS — Acessibilidade mobile
   ════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  a, button, [role="button"], [onclick], label[for],
  input[type="checkbox"], input[type="radio"] {
    min-height: var(--touch-min);
  }
  input[type="checkbox"] { min-height: 22px !important; }
  .btn-icon { min-height: var(--h-btn-icon) !important; }
}

/* ════════════════════════════════════════════════════════════
   19. DESKTOP (≥1024px) — Sidebar layout admin
   ════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {
  .admin-panel .container {
    display: grid !important;
    grid-template-columns: 240px 1fr !important;
    gap: 0 24px !important;
    align-items: start !important;
    max-width: var(--container-2xl) !important;
    margin: 0 auto !important;
    padding: 24px !important;
  }

  .admin-panel .header  { grid-column: 1 / -1; }
  #trialBanner          { grid-column: 1 / -1; position: relative !important; bottom: auto !important; }
  #expiredOverlay       { grid-column: 1 / -1; }

  .admin-panel .tabs {
    grid-column: 1;
    flex-direction: column !important;
    position: sticky;
    top: 16px;
    overflow: visible !important;
    margin-bottom: 0 !important;
    padding: 8px !important;
    gap: 4px !important;
    align-self: start;
  }

  .admin-panel .tab {
    flex: none !important;
    width: 100% !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    font-size: 13px !important;
    gap: 10px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
  }

  .admin-panel .tab i { font-size: 14px !important; }
  .admin-panel .tab > span { font-size: 13px !important; }

  .admin-panel .tab-content { grid-column: 2; }

  .login-card { max-width: 480px; padding: 36px 32px; }
}

/* ════════════════════════════════════════════════════════════
   20. ANIMATIONS — Microinterações premium
   ════════════════════════════════════════════════════════════ */

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

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

/* Reduzir motion em modo de acessibilidade */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ════════════════════════════════════════════════════════════
   21. UTILITY — Truncate / Visually Hidden / Skeleton
   ════════════════════════════════════════════════════════════ */

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ════════════════════════════════════════════════════════════
   22. SCROLLBARS — Estilo dark consistente
   ════════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.5); }

/* ════════════════════════════════════════════════════════════
   23. HELP TAB GRIDS
   ════════════════════════════════════════════════════════════ */

.help-btn-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  width: 100% !important;
}

.help-btn-wa, .help-btn-email {
  width: 100% !important;
  min-height: 52px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 14px !important;
  border-radius: var(--rd-3) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
}

.help-btn-wa {
  background: linear-gradient(135deg, #25d366, #128c7e) !important;
  color: #fff !important;
}

.help-btn-email {
  background: rgba(37, 99, 235, 0.12) !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #60a5fa !important;
}

.help-install-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  width: 100% !important;
}

@media (max-width: 600px) {
  .help-btn-grid { grid-template-columns: 1fr !important; }
  .help-install-grid { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════════════════════
   24. PRINT
   ════════════════════════════════════════════════════════════ */

@media print {
  .bottom-nav, .tabs, #trialBanner, .btn-icon, .modal { display: none !important; }
  .tab-content { display: block !important; }
  * { color: #000 !important; background: #fff !important; }
}

/* ════════════════════════════════════════════════════════════
   25. ZONA DE SEGURANÇA — Páginas com nav fixa
   ════════════════════════════════════════════════════════════ */

/* Garantir que nada fica ESCONDIDO atrás da bottom nav */
.tab-content,
.section-card:last-child {
  margin-bottom: 0 !important;
}

#employeeApp .container,
#employeeApp .emp-home {
  padding-bottom: calc(var(--h-bottom-nav) + 24px + var(--safe-bottom)) !important;
}

/* Em desktop, sem bottom nav, sem padding extra */
@media (min-width: 1024px) {
  #employeeApp .container,
  #employeeApp .emp-home {
    padding-bottom: var(--ds-6) !important;
  }
  .bottom-nav { position: relative !important; }
}
