/* ========================================================
   BRP ENGENHARIA — Sistema de Apontamento
   Design: Dark mode, glassmorphism, modern UI
======================================================== */

:root {
  /* Common (Light Theme) */
  --bg-base: #f1f4f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-glass: rgba(255, 255, 255, 0.9);

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(249, 115, 22, 0.4);
  --primary-color: #004171;
  /* Azul BRP */
  --primary-light: #e0f2fe;

  --sidebar-width: 240px;
  --header-height: 80px;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);

  --blue: #2563eb;
  --blue-light: #3b82f6;
  --green: #059669;
  --green-light: #10b981;
  --yellow: #d97706;
  --red: #dc2626;

  /* Defaults (Engenharia - Light) */
  --accent: #f29c47;
  --accent-light: #f69546;
  --accent-glow: rgba(242, 156, 71, 0.15);
  --secondary: #504f9d;
  --mesh-color-1: rgba(242, 156, 71, 0.15);
  --mesh-color-2: rgba(80, 79, 157, 0.1);
  --shadow-accent: 0 4px 16px rgba(242, 156, 71, 0.25);
  --avatar-bg: linear-gradient(135deg, var(--secondary), #3b82f6);
  --badge-bg: rgba(59, 130, 246, 0.1);
  --badge-text: var(--blue-light);
}

/* Theme: Metálica (Light/Gray) */
body.theme-metalica {
  --bg-base: #f5f5f5;
  --accent: #5a514f;
  --accent-light: #7a716f;
  --accent-glow: rgba(90, 81, 79, 0.1);
  --secondary: #333333;
  --mesh-color-1: rgba(90, 81, 79, 0.08);
  --mesh-color-2: rgba(0, 0, 0, 0.05);
  --primary-color: #5a514f;
  /* Cinza Metálica */
  --primary-light: #f3f4f6;
  --shadow-accent: 0 4px 16px rgba(0, 0, 0, 0.1);
  --avatar-bg: linear-gradient(135deg, #5a514f, #333333);
  --badge-bg: rgba(0, 0, 0, 0.05);
  --badge-text: var(--text-primary);
}

body {
  transition: background 0.3s ease, color 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
}

/* ========================
   BG MESH ANIMATION
======================== */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, var(--mesh-color-1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, var(--mesh-color-2) 0%, transparent 60%);
  pointer-events: none;
}

/* ========================
   SIDEBAR
======================== */
.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-img {
  width: 100%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

/* Company Switcher in Sidebar */
.company-switcher {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.switcher-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-left: 8px;
}

.switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.switcher-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.switcher-btn.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
  color: var(--accent-light);
}

.switcher-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.switcher-btn.active .dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-base);
  color: var(--accent);
  border: 1px solid var(--border);
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

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

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--avatar-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ========================
   MAIN CONTENT
======================== */
.main-content {
  margin-left: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.page {
  padding: 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page.hidden {
  display: none;
}

.page.active {
  display: flex;
}

/* ========================
   PAGE HEADER
======================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

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

/* ========================
   DATE PICKER
======================== */
.date-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.date-picker-wrapper svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.date-picker-wrapper input[type="date"] {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.date-picker-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-range span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========================
   BUTTONS
======================== */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-accent);
  white-space: nowrap;
}

.btn-primary svg {
  width: 16px;
  height: 16px;
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.btn-block {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 16px;
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ========================
   STATS BAR
======================== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--secondary);
  opacity: 0.8;
}

.stat-card.success::before {
  background: var(--green);
  opacity: 1;
}

.stat-card.warning::before {
  background: var(--yellow);
  opacity: 1;
}

.stat-card.info::before {
  background: var(--accent);
  opacity: 1;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.stat-card.success .stat-value {
  color: var(--green-light);
}

.stat-card.warning .stat-value {
  color: var(--yellow);
}

.stat-card.info .stat-value {
  color: var(--blue-light);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========================
   TABLE CONTAINER
======================== */
.table-container {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  flex: 1;
  max-width: 320px;
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  flex: 1;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-group.company-filter {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 10px;
}

.company-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.company-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.company-tab-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-accent);
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Forms & Selects */
.form-control {
  width: 100%;
  height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: white;
  color: #1e293b !important;
  font-size: 14px;
  transition: all 0.2s;
}

.form-control,
select,
.form-select,
.filter-select,
.filter-group select,
.search-box input {
  color: #000000 !important;
  background-color: #ffffff !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #000000 !important;
}

select option {
  background-color: #ffffff !important;
  color: #1e293b !important;
  -webkit-text-fill-color: #1e293b !important;
}

.form-control::placeholder {
  color: #64748b !important;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Checkmark Confirm Button */
.btn-confirm-obra {
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 50%;
  /* Faz o botão circular */
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-confirm-obra:hover {
  background-color: var(--green-light);
  color: #fff;
  border-color: var(--green-light);
  transform: scale(1.05);
  box-shadow: 0 4px 6px rgba(34, 197, 94, 0.2);
}

.btn-confirm-obra:active {
  transform: scale(0.95);
}

.filter-select {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-select:hover {
  border-color: var(--accent);
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.filter-select option {
  background: #ffffff;
  color: #1e293b;
}

/* ========================
   DATA TABLE
======================== */
.table-wrapper {
  overflow-x: auto;
  flex: 1;
}

.table-wrapper.hidden {
  display: none;
}

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

.data-table thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Coluna nome */
.col-nome {
  display: flex;
  align-items: center;
  gap: 10px;
}

.col-avatar {
  width: 32px;
  height: 32px;
  background: var(--avatar-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.col-nome-text {
  display: flex;
  flex-direction: column;
}

.col-nome-primary {
  font-weight: 600;
  font-size: 14px;
}

.col-nome-secondary {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Horas badge */
.horas-badge {
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
  cursor: help;
  text-decoration: underline dotted rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Tooltip Customizado */
.horas-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(5px) scale(0.95);
  background: var(--primary-color);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.horas-badge::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  border: 4px solid transparent;
  border-top-color: var(--primary-color);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.horas-badge:hover::after,
.horas-badge:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Ajuste para o tema Metálica */
body.theme-metalica .horas-badge::after {
  background: var(--secondary);
}
body.theme-metalica .horas-badge::before {
  border-top-color: var(--secondary);
}

.horas-badge.missing {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  border-color: rgba(245, 158, 11, 0.2);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.pendente {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.apontado {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Obra select */
.obra-select {
  width: 100%;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #1e293b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.obra-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.obra-select option {
  background: #ffffff;
  color: #1e293b;
}

.obra-select.selected {
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.05);
  color: var(--green-light);
}

/* Empty row */
.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
  font-style: italic;
}

/* ========================
   LOADING STATE
======================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-state.hidden {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========================
   EMPTY STATE
======================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px;
  color: var(--text-muted);
}

.empty-state.hidden {
  display: none;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

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

/* ========================
   MODAL / LOGIN
======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

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

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

/* ========================
   FORM ELEMENTS
======================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-group select {
  cursor: pointer;
}

.form-group select option {
  background: #ffffff;
  color: #1e293b;
}

/* ========================
   TOAST NOTIFICATIONS
======================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: toastIn 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

@keyframes toastIn {
  from {
    transform: translateX(20px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
}

.toast.info {
  border-color: rgba(59, 130, 246, 0.3);
}

.toast-icon {
  font-size: 18px;
}

/* ========================
   CONFIG PAGE
======================== */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1000px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

.permissions-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  max-height: 80vh;
}

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

.panel-header h3 {
  font-size: 14px;
  font-weight: 700;
}

.obras-perm-list {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.perm-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.perm-item input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.perm-item span {
  font-size: 13px;
}

.panel-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.modal-footer-text {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-footer-text a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.modal-footer-text a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* Ajuste fino para os cards de login/registro não ficarem lado a lado */
.modal-overlay .modal-card {
  margin: auto;
}



.btn-confirm-obra {
  background: #27ae6022;
  color: #27ae60;
  border: 1px solid #27ae6044;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-confirm-obra:hover {
  background: #27ae60;
  color: white;
}

.settings-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.settings-panel h3 {
  margin-bottom: 8px;
  font-size: 18px;
  color: var(--text-primary);
}

.settings-panel p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Sub-tabs na Configuração */
.sub-tabs {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: 12px;
  margin-top: 10px;
}

.dev-obra-select {
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 0 12px;
  background-color: #f8fafc;
  transition: all 0.3s ease;
  font-size: 14px;
}

.dev-obra-select:focus {
  border-color: var(--primary-color);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 122, 0, 0.1);
  outline: none;
}

.sub-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.sub-tab.active {
  background: white;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Painéis Laterais (Sidebars) */
.panel-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: white;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--border);
}

.panel-sidebar.hidden {
  transform: translateX(100%);
}

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

.panel-sidebar-header h3 {
  font-size: 18px;
  margin: 0;
}

.panel-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.panel-sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.perm-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #e2e8f0;
  color: var(--red);
}

@media (max-width: 768px) {
  .panel-sidebar {
    width: 100%;
    right: 0 !important;
  }
}

/* ============================================================ */
/* FLATPICKR CALENDAR OVERRIDES */
/* ============================================================ */

.date-picker-wrapper input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  width: auto;
  font-family: 'Inter', sans-serif !important;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
}

.flatpickr-calendar {
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

.flatpickr-day {
  border-radius: 50% !important;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0 !important;
  /* Borda cinza claro padrão */
}

.flatpickr-day.selected {
  background: #2563eb !important;
  /* Azul Vibrante para Seleção */
  border-color: #2563eb !important;
  color: white !important;
}

/* Custom Status Dots / Colors */
.flatpickr-day.has-incoerencia {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: #fff !important;
  font-weight: 700;
}

.flatpickr-day.has-incoerencia:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}

.flatpickr-day.has-pendencia {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
  font-weight: 700;
}

.flatpickr-day.has-pendencia:hover {
  background: #e67e00 !important;
  border-color: #e67e00 !important;
}

.flatpickr-day.tudo-apontado {
  background: var(--green) !important;
  border-color: var(--green) !important;
  color: #fff !important;
  font-weight: 700;
}

.flatpickr-day.tudo-apontado:hover {
  background: #15803d !important;
  border-color: #15803d !important;
}

/* ============================================================ */
/* TABS E LISTAS (MODULOS LATERAIS) */
/* ============================================================ */

.control-bar {
  display: flex;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  padding: 0 8px;
}

.control-bar .date-picker-wrapper {
  margin-bottom: -1px;
  border-bottom: 3px solid var(--primary-color);
  padding: 12px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-color);
  cursor: pointer;
}

.tabs-container {
  display: flex;
  gap: 24px;
  margin-bottom: 0;
  padding: 0;
  border-bottom: none;
}

.tab-item {
  padding: 12px 4px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  transition: all 0.2s;
}

.tab-item.active .tab-badge {
  background: var(--primary-color);
  color: white;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.incoerencia-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.incoerencia-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.inco-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.inco-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.inco-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inco-details-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 20px;
  align-items: center;
}

.inco-main-info h5 {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.inco-main-info .sub-text {
  font-size: 12px;
  color: var(--text-muted);
}

.inco-meta-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-item {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-item i {
  color: var(--primary-color);
  width: 14px;
  text-align: center;
  font-size: 11px;
}

.inco-status-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.time-badges-list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.inco-justificativa-box {
  background: #ecfdf5;
  border-left: 3px solid #059669;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #059669;
}

.inco-justificativa-box b {
  color: var(--green);
}

.inco-justificativa-box small {
  color: var(--text-muted);
  margin-left: 8px;
}

.inco-details h5 {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.inco-details span {
  font-size: 13px;
  color: var(--text-secondary);
}

.inco-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  margin-top: 4px;
}

.badge-red {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.badge-orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent);
}

.badge-green {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}

.inco-actions {
  display: flex;
  gap: 10px;
}

.btn-check-falta {
  background: var(--green);
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-check-falta:hover {
  background: #15803d;
  transform: scale(1.05);
}

.btn-confirm-obra:hover {
  background: #15803d;
  transform: scale(1.05);
}

.btn-edit-obra {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-edit-obra:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.obra-select:disabled {
  background: #f8fafc;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-justificar {
  background: var(--primary-light);
  color: var(--primary-color);
  border: none;
  padding: 0 16px;
  height: 38px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-justificar:hover {
  background: var(--primary-color);
  color: white;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================ */
/* CUSTOM DIALOG MODAL */
/* ============================================================ */

.dialog-card {
  max-width: 400px;
  text-align: center;
  padding: 32px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.dialog-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 20px;
}

.dialog-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.dialog-card p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.dialog-actions button {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

#custom-dialog.active .dialog-card {
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.time-badge {
  background: #f1f5f9;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  font-family: monospace;
  border: 1px solid var(--border-color);
}

/* ============================================================ */
/* AGENDA / FULLCALENDAR CUSTOM STYLES                          */
/* ============================================================ */

#agenda-wrapper {
  margin-top: 20px;
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
}

.fc-theme-standard th {
  background: #f8fafc;
  padding: 10px 0;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.fc .fc-toolbar-title {
  font-size: 1.25em;
  font-weight: 700;
  color: var(--text-primary);
}

.fc .fc-button-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}

.fc .fc-button-primary:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-light);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.agenda-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px;
}

.stat-ponto,
.stat-apontado,
.stat-pendente {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-ponto {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.stat-apontado {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.stat-pendente {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Esconder elementos quando a agenda está ativa */
#page-apontamento.agenda-active .stats-bar,
#page-apontamento.agenda-active .date-picker-wrapper,
#page-apontamento.agenda-active .table-container {
  display: none !important;
}

#page-apontamento.agenda-active .tabs-container {
  justify-content: flex-start;
}

#page-apontamento.agenda-active .tab-item {
  display: none !important;
}

#page-apontamento.agenda-active .tabs-container>div[style*="width: 1px"] {
  display: none !important;
}

/* Tornar os dias do calendário clicáveis */
.fc-daygrid-day,
.fc-event {
  cursor: pointer;
  transition: background 0.2s;
}

.fc-daygrid-day:hover {
  background: rgba(0, 0, 0, 0.02);
}

.custom-agenda-event {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Tema Metálica para o Ponto */
body.theme-metalica .stat-ponto {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Destacar melhor o mês atual deixando meses vizinhos mais transparentes */
.fc-day-other {
  opacity: 0.3 !important;
}

/* ============================================================ */
/* LOGIN PAGE REWORK (login-active) */
/* ============================================================ */
body.login-active .sidebar {
  display: none !important;
}

body.login-active .main-content {
  margin-left: 0 !important;
}

body.login-active .modal-overlay {
  background: rgba(255, 255, 255, 0.4) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
}

.login-split-card {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 1000px;
  min-height: 600px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.4);
  animation: slideUp 0.4s ease;
}

.login-image-side {
  flex: 1;
  background-image: url('https://jvwgtomqukdutsmfvpoc.supabase.co/storage/v1/object/public/login-image/login-image.png');
  background-size: cover;
  background-position: center;
  display: none;
}

@media (min-width: 900px) {
  .login-image-side {
    display: block;
  }
}

.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

body.login-active .modal-card {
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: 360px;
}

/* ========================================================
   MANUAL TIME REGISTRATION STYLES
   ======================================================== */
.search-results-dropdown {
  background-color: #ffffff !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05) !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  z-index: 1000 !important;
}

.search-result-item {
  padding: 10px 14px !important;
  cursor: pointer !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  transition: background 0.2s ease !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.search-result-item:last-child {
  border-bottom: none !important;
}

.search-result-item:hover {
  background-color: rgba(242, 156, 71, 0.08) !important; /* light accent tint */
}

body.theme-metalica .search-result-item:hover {
  background-color: rgba(90, 81, 79, 0.08) !important; /* light gray tint */
}

.search-result-item .item-nome {
  font-weight: 600 !important;
  font-size: 13.5px !important;
  color: var(--text-primary) !important;
}

.search-result-item .item-meta {
  font-size: 11px !important;
  color: var(--text-secondary) !important;
  display: flex !important;
  gap: 12px !important;
}

.dispositivo-manual-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: rgba(242, 156, 71, 0.12) !important; /* Soft Amber background */
  color: var(--yellow) !important;
  border: 1px solid rgba(242, 156, 71, 0.25) !important;
  padding: 4px 10px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

body.theme-metalica .dispositivo-manual-pill {
  background: rgba(90, 81, 79, 0.12) !important; /* Soft gray background */
  color: var(--accent) !important;
  border: 1px solid rgba(90, 81, 79, 0.25) !important;
}

.dispositivo-manual-pill i {
  font-size: 10px !important;
}