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

:root {
  --primary: #2f855a;
  --primary-dark: #276749;
  --primary-light: #c6f6d5;
  --danger: #c53030;
  --warning: #b7791f;
  --bg: #f7fafc;
  --border: #e2e8f0;
  --text: #2d3748;
  --muted: #718096;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: #CCCCCC;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 20px;
  color: var(--primary-dark);
  white-space: nowrap;
}

/* Logo imagem "Férias Plan": resolução ajustada p/ header e modal de login. */
header h1.brand { line-height: 0; }
.brand-logo {
  height: 67px;
  width: auto;
  max-width: 470px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  padding: 3px 10px;
}
body.login-page .brand-logo-login {
  height: auto;
  width: 100%;
  max-width: 300px;
  max-height: 96px;
  margin: 0 auto;
}

#main-nav { display: flex; gap: 6px; flex: 1; min-width: 0; position: relative; margin-top: -12px; margin-bottom: -12px; }

.nav-btn {
  padding: 30px 16px 28px;
  border: none;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary-dark);
  transition: background .15s, color .15s;
  flex: none;
}

.nav-btn:hover { background: rgba(43,130,84,.12); border-color: transparent; color: var(--primary-dark); }

.nav-btn.active {
  background: linear-gradient(180deg, rgba(43,130,84,.89) 0%, rgba(43,130,84,.27) 55%, transparent 100%);
  color: #006600;
  font-weight: 700;
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}

/* Barra sólida do menu: move-se (só horizontal) até o botão ativo. */
.nav-indicator {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 5px;
  background: #2b8254;
  box-shadow: 0 0 8px rgba(43,130,84,.6);
  transition: left .25s ease, width .25s ease;
  pointer-events: none;
}

/* Itens do menu que não cabem legivelmente vão para o dropdown "☰". */
.nav-btn.nav-overflowed { display: none !important; }
.nav-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: none;
  background: transparent;
  color: var(--primary-dark);
  font-size: 22px;
  line-height: 1;
  padding: 0 12px;
  cursor: pointer;
}
.nav-more-btn[hidden] { display: none !important; }
.nav-more-btn:hover { background: rgba(43,130,84,.12); color: var(--primary-dark); }
.nav-more-btn.has-active { color: #006600; background: rgba(43,130,84,.16); box-shadow: inset 0 -3px 0 #2b8254; }
.nav-more-menu {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  z-index: 90;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.nav-more-menu[hidden] { display: none !important; }
.nav-more-item {
  border: none;
  background: none;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
  color: var(--primary-dark);
  cursor: pointer;
}
.nav-more-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-more-item.active { background: rgba(43,130,84,.18); color: #006600; font-weight: 700; }
body.dark .nav-more-btn { color: #9ae6b4; }
body.dark .nav-more-btn:hover { background: rgba(154,230,180,.12); color: #c6f6d5; }
body.dark .nav-more-btn.has-active { color: #c6f6d5; background: rgba(43,130,84,.35); box-shadow: inset 0 -3px 0 #2b8254; }
body.dark .nav-more-menu { background: #2d3748; border-color: #4a5568; }
body.dark .nav-more-item { color: #9ae6b4; }
body.dark .nav-more-item:hover { background: rgba(154,230,180,.12); color: #c6f6d5; }
body.dark .nav-more-item.active { background: rgba(43,130,84,.35); color: #c6f6d5; }

#header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.user-control { font-size: 14px; color: #333333; display: flex; align-items: center; gap: 6px; }

.user-control[hidden] { display: none !important; }

.user-control select { max-width: 260px; background: #CCCCCC; border: 1px solid #999999; }

/* Nomes curtos no header e nos filtros: evita que o menu se esprema. */
#sel-usuario-logado { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; padding: 4px 2px 4px 6px; }
#filter-func { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#sel-func-individual { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* Toggle Inserir/Editar Férias nunca sobrepõe o seletor de usuário. */
#btn-editar-toggle { flex: none; }
#header-actions { min-width: 0; }

/* ---------- chave ON/OFF "Inserir / Editar Férias" (só Admin) ---------- */
#btn-editar-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #CCCCCC;
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

#btn-editar-toggle[hidden] { display: none !important; }

#btn-editar-toggle:hover { background: var(--primary-light); color: var(--primary-dark); }

/* Estado acima da chave: ON verde (escuro no tema claro / claro no escuro),
   OFF cinza escuro no tema claro / branco no escuro. */
#btn-editar-toggle .toggle-state {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .5px;
  white-space: nowrap;
}

#btn-editar-toggle.on .toggle-state { color: #276749; }
body.dark #btn-editar-toggle.on .toggle-state { color: #9ae6b4; }

#btn-editar-toggle.off .toggle-state { color: #4a5568; }
body.dark #btn-editar-toggle.off .toggle-state { color: #ffffff; }

#btn-editar-toggle .toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #5f6368;
  position: relative;
  flex: none;
  transition: background .2s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.45);
}

#btn-editar-toggle .toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s, background .2s, box-shadow .2s;
}

#btn-editar-toggle.on .toggle-track { background: #2e6b2e; }

#btn-editar-toggle.on .toggle-knob {
  left: 21px;
  background: #d3f8d3;
  box-shadow: 0 0 6px 2px rgba(154,230,180,.9);
}

#btn-editar-toggle:disabled { opacity: .6; cursor: wait; }

.year-control { font-size: 14px; color: #333333; display: flex; align-items: center; gap: 6px; }

.year-control[hidden] { display: none !important; }

.year-control input {
  width: 80px;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  background: #CCCCCC;
  outline: none;
}

.year-control input:focus { outline: none; border: none; }

/* Seletor de ano do Gráfico de Férias: linha própria, alinhado à direita, abaixo dos cards. */
.gantt-yearbar { display: flex; justify-content: flex-end; margin: 2px 0 10px; }
.gantt-yearbar .year-control { font-weight: 600; }
body.dark .year-control { color: var(--muted); }
body.dark .year-control input { background: #2d3748; border-color: #4a5568; color: var(--text); }

/* Filtro de anos (multisseleção) da tela Períodos de Férias */
.ms-year { position: relative; }
#ms-anos-btn { min-width: 110px; padding: 6px 10px; text-align: left; font-size: 14px; font-weight: 700; background: #CCCCCC; border: none; color: #333333; }
body.dark #ms-anos-btn { background: #2d3748; border: 1px solid #4a5568; color: var(--text); }
.ms-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  min-width: 180px; max-height: 260px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px;
}
.ms-panel[hidden] { display: none; }
.ms-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text); }
.ms-item:hover { background: var(--primary-light); }
.ms-item input { width: auto; margin: 0; }
.ms-all { border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 700; }
body.dark .ms-panel { background: #2d3748; border-color: #4a5568; }
body.dark .ms-item:hover { background: #3a4a5f; }

#btn-export-xls, #btn-comp-export-xls { background: #CCCCCC; border: 1px solid #999999; }

#btn-export-xls:hover, #btn-comp-export-xls:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }

button {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}

button:hover { border-color: var(--primary); color: var(--primary-dark); }

button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

button.primary:hover { background: var(--primary-dark); }

button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }

/* ---------- botões somente-ícone 📝 / ❌ (Editar / Excluir em todo o ambiente) ---------- */
button.icon-only {
  background: none;
  border: none;
  padding: 2px 6px;
  font-size: 18px;
  line-height: 1;
  min-width: 0;
  text-align: center;
  cursor: pointer;
}
button.icon-only:hover, button.icon-only:focus {
  background: none;
  border: none;
  color: inherit;
  outline: none;
  box-shadow: none;
  filter: none;
  transform: none;
}

main { padding: 20px; max-width: 1400px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.panel-head h2 { font-size: 17px; flex: 1; }

.panel-head .filters { display: flex; gap: 8px; flex-wrap: wrap; }

.panel-body { padding: 16px; }

select, input[type="text"], input[type="date"], input[type="number"], textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}

select:focus, input:focus, textarea:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }

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

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

thead th { background: #f8fafc; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: .3px; }

tbody tr:hover { background: #f7fafc; }

td .actions { display: flex; gap: 6px; }

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.active { background: var(--primary-light); color: var(--primary-dark); }
.badge.inactive { background: #e2e8f0; color: var(--muted); }
.badge.confirmado { background: #bee3f8; color: #2b6cb0; }
.badge.pendente { background: #fefcbf; color: #975a16; }
.badge.concluido { background: var(--primary-light); color: var(--primary-dark); }

.dept-list { list-style: none; }

.dept-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border);
}

.dept-list li:last-child { border-bottom: none; }

.dept-name { font-weight: 600; }
/* Feriados SP: azul anterior no tema claro, #5d9fe2 no escuro. */
.sp-holiday { color: #2b6cb0; }
body.dark .sp-holiday { color: #5d9fe2; }
.dept-count { color: var(--muted); font-size: 13px; }
.dept-list .actions { display: flex; gap: 6px; }
.holiday-source { color: var(--muted); font-size: 11px; margin-top: 3px; font-style: italic; }

/* ---------- Logs (auditoria) ---------- */
#table-logs tbody td { background: #f7fafc; }
body.dark #table-logs tbody td { background: #374151; }
#table-logs td { vertical-align: top; }
#table-logs td:nth-child(3) { overflow-wrap: anywhere; }
.log-error { color: var(--danger); }
body.dark .log-error { color: #ed5050; }

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  padding: 2px 8px;
}

.icon-btn:hover { color: var(--danger); border: none; }

/* ---------- MODAL ---------- */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  z-index: 100;
  overflow-y: auto;
}

#modal-backdrop:not([hidden]) {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

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

.modal-head h3 { font-size: 17px; }

.modal-body { padding: 20px; }

.form-group { margin-bottom: 16px; }

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

.form-group input, .form-group select {
  width: 100%;
}

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-error {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

/* ---------- GANTT ---------- */
#gantt-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.gantt { min-width: 1200px; position: relative; }

.gantt-header {
  display: grid;
  grid-template-columns: 240px 1fr;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 10;
}

.gantt-header .g-labels { padding: 8px 12px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: center; }

.gantt-header .g-months { display: grid; grid-template-columns: repeat(12, 1fr); }

.gantt-header .g-month { padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); border-left: 1px solid var(--border); }

.gantt-dept {
  border-top: 2px solid var(--primary);
  background: #eef4f6;
}

.gantt-dept-title {
  padding: 8px 12px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.gantt-dept-title .dept-headcount { font-size: 12px; font-weight: 500; color: var(--muted); }

.gantt-row {
  display: grid;
  grid-template-columns: 240px 1fr;
}

.gantt-dept .gantt-row:not(:last-child) { margin-bottom: 8px; }

.gantt-row:hover { background: #f7fafc; outline: 2px solid #259bfc; box-shadow: 0 0 5px 2px rgba(37, 155, 252, .55); }

.gantt-label {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-right: 1px solid var(--border);
  background: #eef4f6;
}

.gantt-label .emp-name { font-weight: 600; font-size: 13px; }
.gantt-label .emp-role { font-size: 11px; color: var(--muted); }

.gantt-track {
  position: relative;
  min-height: 44px;
  align-self: stretch;
  background: repeating-linear-gradient(
    90deg,
    #fef3c7 0px, #fef3c7 29px, #f6e05e 29px, #f6e05e 30px
  );
}

.gantt-track .weekend-bg { position: absolute; top: 0; bottom: 0; background: #c9c9c9; opacity: .55; }

.gantt-bar {
  position: absolute;
  top: 8px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .1s;
}

.gantt-bar:hover { transform: scaleY(1.15); filter: brightness(1.1); }

.gantt-bar.overlap { background: var(--danger); }
.gantt-bar.sepro { background: #2b6cb0; }
.gantt-bar.seins { background: #d69e2e; color: #744210; }
.gantt-bar.seger { background: #38a169; }
.gantt-bar.detec { background: #ed8936; }
.gantt-bar.y-group { background: #d69e2e; color: #744210; }
.gantt-bar.z-overlap { background: #9b2c2c; }
.gantt-bar.ignored { border: 2px dashed #4a5568; box-shadow: 0 0 0 1px rgba(255,255,255,.6) inset; }

.gantt-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #e53e3e; z-index: 5; }

.gantt-tip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: #1a202c;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}

.gantt-tip[hidden] { display: none; }

.gantt-tip strong { font-weight: 700; }

body.dark .gantt-tip { background: #0b1220; border: 1px solid #4a5568; }

.gantt-footer { padding: 8px 12px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }

#legend { margin-top: 12px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }

.legend-item { display: flex; align-items: center; gap: 6px; }

.legend-color { width: 18px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid var(--border); }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- melhorias U1 ---------- */
.stats-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 16px; min-width: 180px; }
.stat-card strong { display: block; font-size: 22px; color: var(--primary-dark); }
.stat-card span { font-size: 12px; color: var(--muted); }

.gantt-controls { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; font-size: 14px; }
.gantt-controls .check { display: flex; align-items: center; gap: 6px; color: var(--muted); }

th[data-sort], th[data-sort-vac] { cursor: pointer; user-select: none; }
th[data-sort]:hover, th[data-sort-vac]:hover { color: var(--primary-dark); }

#toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #2d3748; color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; max-width: 320px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#confirm-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 150; }
#confirm-backdrop[hidden] { display: none; }
#confirm-message { font-size: 14px; white-space: pre-line; }

.saldo-ok { color: var(--primary-dark); font-weight: 600; }
.saldo-neg { color: var(--danger); font-weight: 600; }

/* ---------- visão por funcionário (espelho do template Excel) ---------- */
.ind-head { display: flex; flex-direction: column; gap: 0; background: #2b6cb0; color: #fff; border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; font-size: 14px; }
.ind-head-row { display: flex; gap: 8px; padding: 8px 16px; border-bottom: 1px solid rgba(255,255,255,.2); }
.ind-head-row:last-child { border-bottom: none; }
.ind-head-row strong { color: #fff; }
.ind-label { color: #bee3f8; font-weight: 600; min-width: 90px; }
.ind-cols { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 1000px) { .ind-cols { grid-template-columns: 1fr; } }
/* Trava anti-sobreposição: colunas do grid nunca estouram a trilha. */
.ind-periods, .ind-parcels { min-width: 0; }
/* Tabela da esquerda com layout fixo: soma das colunas = 100%, nunca invade o vão. */
.ind-periods .ind-table { table-layout: fixed; }
.ind-periods .ind-table th:nth-child(1), .ind-periods .ind-table td:nth-child(1) { width: 25%; }
.ind-periods .ind-table th:nth-child(2), .ind-periods .ind-table td:nth-child(2) { width: 25%; }
.ind-periods .ind-table th:nth-child(3), .ind-periods .ind-table td:nth-child(3) { width: 25%; }
.ind-periods .ind-table th:nth-child(4), .ind-periods .ind-table td:nth-child(4) { width: 25%; }
.ind-periods .ind-table th, .ind-periods .ind-table td { padding: 8px 6px; }
/* Ícones da lista (até 3 no Admin) sem folga desperdiçada: cabem sem espremer. */
.period-actions { gap: 4px; }
.period-actions .icon-only { padding: 0 2px; }
/* "Ver Férias": lista de períodos (esq.) filtra o bloco exibido (dir.). */
.period-row { cursor: pointer; }
.period-row.sel-period td { background-color: #cfe4f7; }
body.dark .period-row.sel-period td { background-color: #4a5568; }
.period-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.period-status { font-size: 16px; }
.btn-sel-period { background: none; border: none; font-size: 16px; cursor: pointer; padding: 0 2px; }
.btn-sel-period.eye-off { opacity: .35; filter: grayscale(1); }
/* "Ver Férias": bloco de parcelas com largura limitada; botão à direita; nota centralizada. */
.ind-parcels { max-width: 1000px; }
/* Proporção das colunas do bloco exibido (fixo p/ "PERÍODO(S)" ficar estreito). */
.ind-parcels .ind-table { table-layout: fixed; }
.ind-parcels .ind-table th:nth-child(1), .ind-parcels .ind-table td:nth-child(1) { width: 12%; }
.ind-parcels .ind-table th:nth-child(2), .ind-parcels .ind-table td:nth-child(2) { width: 12%; }
.ind-parcels .ind-table th:nth-child(3), .ind-parcels .ind-table td:nth-child(3) { width: 11%; }
.ind-parcels .ind-table th:nth-child(4), .ind-parcels .ind-table td:nth-child(4) { width: 15%; }
.ind-parcels .ind-table th:nth-child(5), .ind-parcels .ind-table td:nth-child(5) { width: 19%; }
.ind-parcels .ind-table th:nth-child(6), .ind-parcels .ind-table td:nth-child(6) { width: 9%; }
.ind-parcels .ind-table th:nth-child(7), .ind-parcels .ind-table td:nth-child(7) { width: 12%; }
.ind-parcels .ind-table th:nth-child(8), .ind-parcels .ind-table td:nth-child(8) { width: 10%; }
/* "PERÍODO(S)" em linha única: sem letter-spacing p/ caber na coluna estreita. */
.ind-parcels .ind-table th:nth-child(1) { letter-spacing: 0; }
/* Cabeçalhos quebram em 2 linhas quando a coluna aperta (sem cortar texto). */
.ind-parcels .ind-table thead th { white-space: normal; overflow-wrap: break-word; }
.ind-actions.actions-end { display: flex; justify-content: flex-end; }
.ind-ret-note { text-align: center; margin-top: 10px; }
.ind-parcels h3, .ind-periods h3 { font-size: 13px; margin: 0 0 8px; color: #fff; padding: 8px 12px; border-radius: var(--radius)  var(--radius) 0 0; }
.ind-parcels h3 { background: #2b6cb0; }
.ind-periods h3 { background: #38a169; }
.ind-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); }
.ind-table th, .ind-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; text-align: left; }
.ind-table thead th { background: #2b6cb0; color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.ind-table.period-table thead th { background: #38a169; }
body:not(.dark) .ind-table tbody td { background-color: #e9eaea; }
body:not(.dark) .ind-table tbody tr.saldo-row td { background-color: #fff; border-top: 2px solid #cbd5e0; }
.saldo-row .saldo-label { color: var(--primary-dark); font-weight: 700; letter-spacing: .3px; }
.saldo-row .saldo-days { color: var(--primary-dark); font-size: 15px; }
body.dark .ind-table tbody tr.saldo-row td { background: #2d3748; border-top: 2px solid #4a5568; color: #e2e8f0; }
body.dark .saldo-row .saldo-label, body.dark .saldo-row .saldo-days { color: #ed8936; }
.ind-actions { margin: 8px 0 4px; }

/* Ver Férias: parcela com retorno já passado fica com o texto esmaecido (fundo intacto). */
body .ind-table tbody tr.parcel-past td { color: color-mix(in srgb, var(--text) 45%, transparent); }
body .ind-table tbody tr.parcel-past td > * { opacity: .45; }

/* Mini calendário das datas (hover na "Ver Férias") */
.date-hover { cursor: pointer; }
body:not(.dark) .date-hover:hover { color: var(--primary-dark); text-decoration: underline dotted; text-underline-offset: 2px; }
body.dark .date-hover:hover { color: #9ae6b4; text-decoration: underline dotted; text-underline-offset: 2px; }
.mini-cal {
  position: fixed;
  z-index: 1200;
  width: 218px;
  padding: 10px 12px 12px;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
  color: #2d3748;
  font-size: 12px;
  pointer-events: none;
  user-select: none;
}
.mini-cal[hidden] { display: none; }
.mini-cal-head {
  position: relative;
  margin-bottom: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
}
.mini-cal-arrow { position: absolute; right: 2px; top: -1px; color: #718096; font-weight: 700; }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.mini-cal-grid .mc-wd { padding: 2px 0 6px; color: #718096; font-size: 10px; }
.mini-cal-grid .mc-day { padding: 4px 0; border-radius: 4px; line-height: 1.4; }
.mini-cal-grid .mc-day.weekend { background: #e2e8f0; color: #4a5568; }
.mini-cal-grid .mc-day.holiday { background: #b3c7dd; color: #fff; font-weight: 600; }
.mini-cal-grid .mc-day.in-range { background: #c6f6d5; color: #22543d; font-weight: 600; }
.mini-cal-grid .mc-day.boundary { background: #2f855a; color: #fff; font-weight: 700; border-radius: 5px; }
.mini-cal-grid .mc-day.active-return { background: #ed8936; color: #fff; font-weight: 700; border-radius: 5px; }
.mini-cal-grid .mc-empty { visibility: hidden; }

/* Mini calendário no tema escuro: fundo mais escuro e textos claros */
body.dark .mini-cal { background: #1a202c; border-color: #4a5568; color: #e2e8f0; box-shadow: 0 12px 30px rgba(0,0,0,.55); }
body.dark .mini-cal-head { color: #f7fafc; }
body.dark .mini-cal-arrow { color: #a0aec0; }
body.dark .mini-cal-grid .mc-wd { color: #a0aec0; }
body.dark .mini-cal-grid .mc-day { color: #e2e8f0; }
body.dark .mini-cal-grid .mc-day.weekend { background: #4a5568; color: #e2e8f0; }
body.dark .mini-cal-grid .mc-day.holiday { background: #2a4365; color: #bee3f8; font-weight: 600; }
body.dark .mini-cal-grid .mc-day.in-range { background: #22543d; color: #c6f6d5; }
body.dark .mini-cal-grid .mc-day.boundary { background: #2f855a; color: #f0fff4; }
body.dark .mini-cal-grid .mc-day.active-return { background: #ed8936; color: #1a202c; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

#feriados-hint-admin[hidden] { display: none !important; }

/* Respiro entre o enunciado e a lista de feriados */
#view-feriados .panel-body .hint { margin-bottom: 20px; }

/* ---------- regras CLT (Por Funcionário) ---------- */
.regras-wrap { margin-top: 12px; text-align: right; }
.btn-ver-regras { background: #ed8936; border-color: #ed8936; color: #fff; font-size: 13px; padding: 6px 12px; font-weight: 700; }
.btn-ver-regras:hover { background: #dd6b20; border-color: #dd6b20; color: #fff; }
.regras-box { margin-top: 10px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; }
.regras-box[hidden] { display: none; }
.regras-box p { margin-bottom: 8px; }
.regras-box ul { margin: 0 0 8px 18px; }
.regras-box li { margin-bottom: 6px; }
.regras-box .regras-destaque { color: #9b2c2c; font-weight: 600; }
.btn-gen-periods, .btn-new-period, .btn-new-parcel { font-size: 13px; padding: 6px 12px; }

/* ---------- conflitos no Gantt ---------- */
.conflict-bar { display: flex; align-items: center; gap: 12px; background: #fffbeb; border: 1px solid #fbd38d; color: #975a16; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 14px; }
.conflict-bar[hidden] { display: none !important; }
.conflict-icon { font-size: 18px; }
#conflict-text { flex: 1; font-weight: 600; }
.conflict-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: #fff; }
.conflict-card h4 { margin: 0 0 8px; color: #2b6cb0; font-size: 14px; }
.conflict-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.conflict-table th, .conflict-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; text-align: left; }
.conflict-table tr.selectable { cursor: pointer; transition: background .15s; }
.conflict-table tr.selectable:hover { background: #ebf8ff; }
.conflict-table tr.selected { background: #c6f6d5; outline: 2px solid var(--primary); }

/* ---------- card "ignorado": conteúdo apagado, botões com contraste total ---------- */
.conflict-card.ignored .conflict-table { opacity: .65; }
.conflict-card.ignored h4 { opacity: .75; }

/* ---------- hover do "Reativar conflito": verde mais escuro ---------- */
button.btn-reactivate-group:hover {
  background: #14532d;
  border-color: #14532d;
  color: #fff;
}
.proposal { background: #f0fff4; border: 1px solid #c6f6d5; padding: 8px; border-radius: var(--radius); margin-top: 8px; font-size: 13px; }
.proposal.invalid { background: #fff5f5; border-color: #feb2b2; }
.modal.wide { max-width: 760px; }
.gantt-label.selectable { cursor: pointer; }
.gantt-label.selectable:hover { background: #ebf8ff; }

/* ---------- tema escuro ---------- */
#btn-theme {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  background: #CCCCCC;
  border: 1px solid #999999;
}
#btn-theme:hover { border-color: var(--primary); }
#btn-theme.moon { background: transparent; border: none; width: auto; height: auto; }
#btn-theme.moon img { display: block; width: 25px; height: 25px; }
#btn-theme.moon:hover { border-color: transparent; }
#btn-theme.sun { background: transparent; border: none; width: auto; height: auto; }
#btn-theme.sun img { display: block; width: 25px; height: 23px; }
#btn-theme.sun:hover { border-color: transparent; }
body.dark #btn-theme.sun { background: transparent; border: none; }

body.dark {
  --bg: #1a202c;
  --border: #4a5568;
  --text: #e2e8f0;
  --muted: #a0aec0;
  --primary-light: #22543d;
  --shadow: 0 1px 6px rgba(0,0,0,.4);
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
}
body.dark header { background: #2d3748; border-color: #4a5568; }
body.dark header h1 { color: #9ae6b4; }
/* Menu principal no tema escuro: itens em texto + barra verde deslizante no topo. */
body.dark .nav-btn { background: transparent; border: none; color: #9ae6b4; border-radius: 0; padding: 30px 16px 28px; }
body.dark .nav-btn:hover { background: rgba(154,230,180,.12); border-color: transparent; color: #c6f6d5; }
body.dark .nav-btn.active {
  background: linear-gradient(180deg, rgba(56,161,105,.95) 0%, rgba(56,161,105,.35) 55%, rgba(56,161,105,.05) 100%);
  border-color: transparent;
  color: #eafff3;
  box-shadow: inset 0 1px 0 rgba(198,246,213,.5);
}
/* Barra sólida verde (tema escuro): mesmo comportamento, tom próprio. */
body.dark .nav-indicator {
  background: #38a169;
  box-shadow: 0 0 8px rgba(56,161,105,.9);
}
body.dark #btn-editar-toggle { background: #2d3748; color: #e2e8f0; }
body.dark #btn-editar-toggle:hover { background: #374151; color: #9ae6b4; }
body.dark #header-actions .user-control { color: var(--muted); }
body.dark #header-actions .user-control select { background: #2d3748; border-color: #4a5568; color: var(--text); }
body.dark #btn-theme { background: #2d3748; border-color: #4a5568; color: #e2e8f0; }
body.dark main { color: var(--text); }
body.dark .panel, body.dark .stat-card, body.dark .modal, body.dark #gantt-scroll, body.dark .conflict-card { background: #2d3748; border-color: #4a5568; color: var(--text); }
body.dark .stat-card strong { color: #c6f6d5; }
body.dark .panel-head, body.dark .modal-head { border-color: #4a5568; }
body.dark .gantt-header { background: #2d3748; border-color: #4a5568; }
body.dark .gantt-header .g-labels { color: #9ae6b4; }
body.dark .gantt-header .g-month { border-color: #4a5568; color: var(--muted); }
body.dark .gantt-dept { border-color: var(--primary); background: transparent; }
body.dark .gantt-dept-title { background: #22543d; color: #c6f6d5; }
body.dark .gantt-row { border-color: #4a5568; }
body.dark .gantt-row:hover { background: #374151; outline: 2px solid #7dd3fc; box-shadow: 0 0 5px 2px rgba(125, 211, 252, .55); }
body.dark .gantt-label { background: #2d3748; border-color: #4a5568; }
body.dark .gantt-track { background: repeating-linear-gradient(90deg, #fef3c7 0px, #fef3c7 29px, #f6e05e 29px, #f6e05e 30px); }
body.dark .gantt-footer { color: var(--muted); }
body.dark #legend { color: var(--muted); }
body.dark table:not(.ind-table):not(.comp-grid) thead th { background: #2d3748; color: var(--muted); }
body.dark tbody tr:hover { background: #374151; }
body.dark th, body.dark td { border-color: #4a5568; }
body.dark .ind-table { background: #2d3748; border-color: #4a5568; }
body.dark .ind-table thead th { background: #2b6cb0; color: #bee3f8; }
body.dark .ind-table.period-table thead th { background: #38a169; color: #fff; }
body.dark .ind-table tbody { background: #2d3748; }
body.dark .ind-table tbody tr { background: #374151; }
body.dark .ind-table tbody tr:hover { background: #4a5568; }
body.dark .ind-table tbody td { color: var(--text); border-color: #4a5568; }
body.dark .ind-table tbody td.empty-state { background: #374151; color: var(--muted); }
/* Férias por Funcionário (tema escuro): rótulos #68c5fd; brancos sobre #2b6cb0 → #bee3f8. */
body.dark .ind-label { color: #68c5fd; }
body.dark .ind-head-row strong { color: #bee3f8; }
body.dark .ind-parcels h3 { color: #bee3f8; }
body.dark .ind-hint { color: #68c5fd; }
/* Botão Gerar período(s) aquisitivo(s) no tema escuro: fundo padrão, texto e linha em verde claro. */
body.dark .btn-gen-periods { background: #2d3748; border-color: #9ae6b4; color: #9ae6b4; }
body.dark .btn-gen-periods:hover { background: #22543d; border-color: #9ae6b4; color: #9ae6b4; }
/* "+ VER REGRAS" no tema escuro: azul do ind-head (#2b6cb0); hover #4192e2. */
body.dark .btn-ver-regras { background: #2b6cb0; border-color: #2b6cb0; color: #fff; }
body.dark .btn-ver-regras:hover { background: #4192e2; border-color: #4192e2; color: #fff; }
/* "+ Período manual" igual ao "+ Inserir novo período" (primary) no tema escuro. */
body.dark .btn-new-period { background: var(--primary); border-color: var(--primary); color: #fff; }
body.dark .btn-new-period:hover { background: var(--primary-dark); border-color: var(--primary); color: #fff; }
/* Editar / Excluir somente-ícone: sem moldura e sem efeito no hover (vale em todas as telas). */
body.dark .btn-edit-vac, body.dark .btn-edit-emp, body.dark .btn-edit-dept,
body.dark .btn-del-vac, body.dark .btn-del-emp, body.dark .btn-del-dept, body.dark .btn-del-holiday,
body.dark .btn-del-period { background: none; border: none; color: inherit; }
body.dark .btn-edit-vac:hover, body.dark .btn-edit-emp:hover, body.dark .btn-edit-dept:hover,
body.dark .btn-del-vac:hover, body.dark .btn-del-emp:hover, body.dark .btn-del-dept:hover, body.dark .btn-del-holiday:hover,
body.dark .btn-del-period:hover, body.dark button.icon-only:hover { background: none; border: none; color: inherit; box-shadow: none; filter: none; }
body.dark select, body.dark input[type="text"], body.dark input[type="date"], body.dark input[type="number"], body.dark textarea { background: #2d3748; border-color: #4a5568; color: var(--text); }
/* Ícone do calendário (input date) em #AAC7FF no tema escuro. */
body.dark input[type="date"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23AAC7FF'%3E%3Cpath d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zM5 8V6h14v2H5z'/%3E%3C/svg%3E"); background-size: 16px 16px; background-repeat: no-repeat; background-position: center; opacity: 1; filter: none; cursor: pointer; }
body.dark .badge.active, body.dark .badge.concluido { background: #22543d; color: #9ae6b4; }
body.dark .saldo-ok { color: #9ae6b4; }
body.dark .badge.inactive { background: #4a5568; color: var(--muted); }
body.dark .conflict-bar { background: #744210; border-color: #975a16; color: #fefcbf; }
body.dark .conflict-table th, body.dark .conflict-table td { border-color: #4a5568; }
body.dark .conflict-table tr.selectable:hover { background: #374151; }
body.dark .conflict-table tr.selected { background: #22543d; }
body.dark button.btn-reactivate-group:hover { background: #14532d; border-color: #14532d; color: #fff; }
body.dark .proposal { background: #22543d; border-color: #38a169; }
body.dark .proposal.invalid { background: #742a2a; border-color: #fc8181; }
body.dark .empty-state { color: var(--muted); }
body.dark #individual-body .empty-state .big { filter: grayscale(1) brightness(1.8); }
body.dark .hint { color: var(--muted); }
body.dark .regras-box { color: #fff; background: #2d3748; border-color: #4a5568; }
body.dark .regras-box .regras-destaque { color: #f6e05e; }
body.dark .dept-list li { border-color: #4a5568; }
body.dark button { background: #2d3748; border-color: #4a5568; color: var(--text); }
body.dark button:hover { border-color: var(--primary); color: #9ae6b4; }
body.dark #btn-export-xls, body.dark #btn-comp-export-xls { background: #2d3748; border-color: #4a5568; color: #e2e8f0; }
body.dark #btn-export-xls:hover, body.dark #btn-comp-export-xls:hover { border-color: var(--primary); color: #9ae6b4; }
body.dark button.danger:hover { border-color: #fc8181; color: #fc8181; background: #742a2a; }
/* Exceção: Editar / Excluir somente-ícone nunca têm moldura nem hover, nem no escuro. */
body.dark button.icon-only, body.dark button.icon-only:hover, body.dark button.icon-only:focus,
body.dark button.danger.icon-only, body.dark button.danger.icon-only:hover { background: none; border: none; color: inherit; box-shadow: none; filter: none; transform: none; }
body.dark button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
body.dark .toast { background: #2d3748; }
body.dark .toast.success { background: var(--primary); }
body.dark .toast.error { background: #c53030; }
body.dark #modal-backdrop { background: rgba(0,0,0,.6); }
body.dark #confirm-backdrop { background: rgba(0,0,0,.6); }

/* ---------- fundo pós-login (mesmo do login, 10% nos temas claro e escuro) ---------- */
body:not(.login-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("login-beach.jpg") center / cover no-repeat;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
}

body:not(.login-page)::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(560px, 45%);
  background: url("login-calendar.jpg?v=6") center / cover no-repeat;
  -webkit-mask-image: linear-gradient(to right, #000 55%, transparent 100%);
  mask-image: linear-gradient(to right, #000 55%, transparent 100%);
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
}

/* Conteúdo do app acima das camadas de fundo. O header fica acima do main
   para que o dropdown do menu hambúrguer não seja coberto pelos painéis. */
body:not(.login-page) > header {
  position: relative;
  z-index: 5;
}
body:not(.login-page) > main {
  position: relative;
  z-index: 1;
}

/* ---------- página de login (passagem obrigatória) ---------- */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

/* Fundo em vídeo em tela cheia, atrás do cartão. */
body.login-page::before,
body.login-page::after {
  content: none;
}

.login-bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
}

body.login-page .login-card h2 { color: #00ff00; }

/* Cartão totalmente opaco em cinza (legibilidade sobre o fundo). */
body.login-page .login-card,
body.dark.login-page .login-card {
  background: #666666;
  border: 1px solid rgba(255,255,255,0.9);
  opacity: 1;
}

body.login-page .login-sub,
body.login-page .login-label { color: #c6f6d5; }

.login-wrap {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-card h2 { color: var(--primary-dark); font-size: 22px; }

.login-sub { font-size: 14px; color: var(--muted); }

.login-tagline {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255,255,255,0.85);
  max-width: 330px;
}

#gsi-btn { min-height: 44px; display: flex; justify-content: center; }

#gsi-btn[hidden] { display: none; }

#dev-login { display: flex; flex-direction: column; gap: 10px; width: 100%; }

#dev-login[hidden] { display: none; }

.login-label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 6px; text-align: left; }

.login-error {
  font-size: 13px;
  color: var(--danger);
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
}

.login-error[hidden] { display: none; }

#user-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menu TEMPORÁRIO do usuário: seletor "User" em dropdown abaixo do nome (só Admin). */
#user-menu { position: relative; display: inline-flex; }
#user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: default;
  max-width: 250px;
}
#user-chip-btn[hidden] { display: none !important; }
#user-menu.has-dev #user-chip-btn { cursor: pointer; }
#user-chip-btn .user-menu-arrow { display: none; font-size: 11px; color: var(--primary-dark); }
#user-menu.has-dev #user-chip-btn .user-menu-arrow { display: inline; }
#user-menu #dev-login-wrap {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  white-space: nowrap;
}
#user-menu #dev-login-wrap:not([hidden]) { display: flex; }
body.dark #user-chip-btn .user-menu-arrow { color: #9ae6b4; }
body.dark #user-menu #dev-login-wrap { background: #2d3748; border-color: #4a5568; }

#btn-logout { font-size: 13px; padding: 6px 12px; background: #742a2a; border-color: #fc8181; color: #fc8181; }
#btn-logout:hover { background: #742a2a; border-color: #fff; color: #fff; }

/* Sair somente-ícone (claro/escuro): sem moldura e sem efeito no hover. */
#btn-logout.icon-only { background: none; border: none; padding: 2px 6px; }
#btn-logout.icon-only:hover { background: none; border: none; box-shadow: none; filter: none; }
#btn-logout.icon-only img { display: block; width: 30px; height: 29px; }
body.dark #btn-logout.icon-only, body.dark #btn-logout.icon-only:hover { background: none; border: none; color: inherit; box-shadow: none; }

body.dark .login-card { background: #2d3748; border-color: #4a5568; }
body.dark .login-error { background: #742a2a; border-color: #fc8181; color: #fff; }
body.dark #user-chip { background: #22543d; color: #9ae6b4; }
body.dark #btn-logout { background: #742a2a; border-color: #fc8181; color: #fc8181; }
body.dark #btn-logout:hover { background: #742a2a; border-color: #fff; color: #fff; }

/* Rodapé fixo ao fim da página, mesma cor do menu superior em cada tema. */
body:not(.login-page) { display: flex; flex-direction: column; min-height: 100vh; }
body:not(.login-page) > main { flex: 1; width: 100%; }
.app-footer {
  background: #CCCCCC;
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 10px 20px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #333333;
}
body.dark .app-footer { background: #2d3748; border-color: #4a5568; color: #9ae6b4; }

/* ---------- responsivo: o layout se adapta a telas médias e pequenas ---------- */
/* Rolagem horizontal das tabelas grandes (nunca espreme as colunas). */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 0; }

/* Logo acompanha a largura da tela sem estourar. */
.brand-logo { max-width: min(470px, 55vw); height: auto; max-height: 67px; }

@media (max-width: 1100px) {
  .nav-btn { padding-left: 10px; padding-right: 10px; }
  #sel-usuario-logado { max-width: 110px; }
}

@media (max-width: 860px) {
  header { gap: 10px; padding: 10px 14px; }
  /* Menu vira linha própria; o que não couber vai para o hambúrguer. */
  #main-nav { flex: 1 0 100%; order: 3; overflow: visible; margin: 0 -14px; padding: 0 14px; }
  .nav-btn { padding: 12px 12px 10px; white-space: nowrap; }
  .nav-indicator { display: none; }
  #header-actions { flex-wrap: wrap; }
  main { padding: 14px; }
  #table-funcionarios, #table-ferias { min-width: 680px; }
  #table-logs { min-width: 720px; }
  .stat-card { flex: 1 1 150px; min-width: 140px; }
  .panel-head h2 { flex: 1 1 100%; }
  #search-func, #search-ferias { flex: 1 1 160px; }
  .ind-head-row { flex-wrap: wrap; }
  .dept-list li { flex-wrap: wrap; gap: 8px; }
  .conflict-bar { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  header h1 { font-size: 17px; }
  .brand-logo { max-height: 52px; }
  main { padding: 10px; }
  th, td { padding: 8px; font-size: 13px; }
  /* Gantt: coluna de nomes mais estreita, a trilha rola na horizontal. */
  .gantt { min-width: 720px; }
  .gantt-header, .gantt-row { grid-template-columns: 150px 1fr; }
  .gantt-label .emp-role { display: none; }
  .gantt-footer { flex-wrap: wrap; gap: 4px; }
  /* Tabelas geradas via JS rolam dentro do painel. */
  .panel-body { overflow-x: auto; }
  .ind-periods .ind-table, .ind-parcels .ind-table { min-width: 540px; }
  .form-row { flex-direction: column; gap: 0; }
  #modal-backdrop { padding: 16px 10px; }
  .modal-body { padding: 16px 14px; overflow-x: auto; }
  .conflict-table { min-width: 500px; }
  #toast-container { left: 12px; right: 12px; }
  .toast { max-width: none; }
  .login-card { padding: 24px 20px; }
  .app-footer { padding: 10px 12px; }
}
/* ---------- Compensação de horas (Gantt próprio, independente das férias) ---------- */
.comp-hint { margin: 0 0 12px; }
.comp-scroll { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius); }
.comp-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: max-content; }
.comp-grid th, .comp-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 6px; text-align: center; white-space: nowrap; }
.comp-grid thead th { background: #2b6cb0; color: #fff; font-weight: 600; position: sticky; top: 0; z-index: 2; }
.comp-grid thead tr:nth-child(2) th { top: 40px; }
.comp-grid th.comp-fixed { white-space: normal; font-size: 11px; line-height: 1.25; }
.comp-grid .comp-sticky { position: sticky; left: 0; z-index: 1; text-align: left; width: 180px; min-width: 180px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.comp-grid thead th.comp-sticky { z-index: 3; }
.comp-grid tbody td.comp-sticky { background: #fff; }
.comp-grid th.comp-month { height: 40px; text-align: left; border-left: 2px solid #1a4e85; }
.comp-month-name { display: block; font-size: 12px; letter-spacing: .4px; }
.comp-month-hol { display: block; font-size: 10px; font-weight: 500; color: #fefcbf; }
.comp-grid th.comp-off-group { background: #c05621; }
.comp-grid th.comp-off-day { background: #dd6b20; }
.comp-grid th small { display: block; font-size: 9px; font-weight: 500; opacity: .85; }
.comp-grid th.comp-day-h { padding: 3px 0; }
.comp-grid th.comp-day-h.is-holiday { background: #1a365d; color: #fefcbf; }
.comp-grid th.comp-day-h.is-off { background: #c05621; }
.comp-grid .month-start { border-left: 2px solid #90a4bd; }
.comp-grid td.num { font-variant-numeric: tabular-nums; }
.comp-grid td.comp-name { font-weight: 600; }
.comp-week.invalid { color: var(--danger); font-weight: 700; }
.comp-muted { color: var(--muted); }
.comp-saldo.falta { color: var(--danger); font-weight: 600; }
.comp-saldo.extra { color: #2b6cb0; font-weight: 600; }
.comp-saldo.ok { color: var(--primary-dark); font-weight: 600; }
.comp-grid tbody tr.comp-sector-row td { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; text-align: left; letter-spacing: .3px; }
.comp-grid td.comp-day, .comp-grid td.comp-off-cell { height: 26px; padding: 0; font-weight: 700; }
/* Larguras travadas: trocar X → 1 → 1,5 → 2 (ou o saldo) não pode alargar colunas e deslocar a grade */
.comp-grid th.comp-day-h, .comp-grid td.comp-day { width: 34px; min-width: 34px; max-width: 34px; }
.comp-grid th.comp-off-day, .comp-grid td.comp-off-cell { width: 44px; min-width: 44px; max-width: 44px; }
.comp-grid .c-sector { width: 64px; min-width: 64px; max-width: 64px; }
.comp-grid .c-week { width: 150px; min-width: 150px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.comp-grid .c-hours { width: 104px; min-width: 104px; max-width: 104px; }
.comp-grid .c-saldo { width: 110px; min-width: 110px; max-width: 110px; }
.comp-grid .c-count { width: 104px; min-width: 104px; max-width: 104px; }
.comp-grid td.editable { cursor: pointer; }
.comp-grid td.editable:hover { outline: 2px solid #259bfc; outline-offset: -2px; }
.comp-grid td.is-off { background: #fffaf0; }
.comp-grid td.planned { background: #fefcbf; color: #744210; }
.comp-grid td.done { background: #90cdf4; color: #1a365d; }
.comp-grid td.is-folga, .comp-grid td.comp-off-cell.on { background: #feebc8; color: #9c4221; }
.comp-grid td.is-holiday { background: repeating-linear-gradient(45deg, #bee3f8, #bee3f8 4px, #e2ecf7 4px, #e2ecf7 8px); }
.comp-grid td.is-nowork { background: repeating-linear-gradient(45deg, #e2e8f0, #e2e8f0 4px, #f7fafc 4px, #f7fafc 8px); }
.comp-grid th.comp-day-h.is-nowork { background: #4a5568; color: #edf2f7; }
.comp-grid td.comp-off-cell.is-vac, .comp-grid td.comp-day.is-vac { background: #fed7d7; color: #9b2c2c; font-size: 10px; }
.comp-title-dates { color: #2b6cb0; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.comp-lg-planned { background: #fefcbf; }
.comp-lg-done { background: #90cdf4; }
.comp-lg-folga { background: #feebc8; }
.comp-lg-holiday { background: repeating-linear-gradient(45deg, #bee3f8, #bee3f8 4px, #e2ecf7 4px, #e2ecf7 8px); }
.comp-lg-off { background: #fffaf0; }
.comp-lg-nowork { background: repeating-linear-gradient(45deg, #e2e8f0, #e2e8f0 4px, #f7fafc 4px, #f7fafc 8px); }
.comp-lg-vac { background: #fed7d7; }
.comp-grid tr.is-me td:not(.planned):not(.done):not(.is-folga):not(.on):not(.is-holiday):not(.is-nowork):not(.is-vac) { background: #e2e8f0; }
.comp-grid tr.is-me td { border-color: #a0aec0; box-shadow: inset 0 1px 0 #a0aec0; }
/* Comunicado do Gestão de Pessoas: mesmo quadro do "VER REGRAS" */
.comunicado-box h4 { font-size: 13px; margin: 12px 0 6px; color: #2b6cb0; }
.comunicado-box { line-height: 1.5; }

body.dark .comp-scroll { border-color: #4a5568; }
body.dark .comp-grid th, body.dark .comp-grid td { border-color: #4a5568; }
body.dark .comp-grid thead th { background: #1f3350; color: #c3dafe; }
body.dark .comp-grid th.comp-off-group, body.dark .comp-grid th.comp-off-day, body.dark .comp-grid th.comp-day-h.is-off { background: #9c4221; color: #feebc8; }
body.dark .comp-grid th.comp-day-h.is-holiday { background: #1a365d; color: #fefcbf; }
body.dark .comp-grid tbody td { color: var(--text); }
body.dark .comp-grid tbody td.comp-sticky { background: #2d3748; }
body.dark .comp-grid tbody tr.comp-sector-row td { background: #22543d; color: #9ae6b4; }
body.dark .comp-grid td.is-off { background: #3a3326; }
body.dark .comp-grid td.planned { background: #744210; color: #fefcbf; }
body.dark .comp-grid td.done { background: #2b6cb0; color: #ebf8ff; }
body.dark .comp-grid td.is-folga, body.dark .comp-grid td.comp-off-cell.on { background: #7b341e; color: #feebc8; }
body.dark .comp-grid td.is-holiday { background: repeating-linear-gradient(45deg, #2a4365, #2a4365 4px, #1f2f48 4px, #1f2f48 8px); }
body.dark .comp-grid td.is-nowork { background: repeating-linear-gradient(45deg, #4a5568, #4a5568 4px, #2d3748 4px, #2d3748 8px); }
body.dark .comp-grid td.comp-off-cell.is-vac, body.dark .comp-grid td.comp-day.is-vac { background: #44337a; color: #e9d8fd; }
body.dark .comp-lg-nowork { background: repeating-linear-gradient(45deg, #4a5568, #4a5568 4px, #2d3748 4px, #2d3748 8px); }
body.dark .comp-title-dates { color: #c3dafe; }
body.dark .comp-lg-vac { background: #44337a; }
body.dark .comp-grid tr.is-me td:not(.planned):not(.done):not(.is-folga):not(.on):not(.is-holiday):not(.is-nowork):not(.is-vac) { background: #4a5568; }
body.dark .comp-grid tr.is-me td { border-color: #1a202c; box-shadow: inset 0 1px 0 #1a202c; }
body.dark .comunicado-box h4 { color: #90cdf4; }
body.dark .comp-saldo.falta { color: #fc8181; }
body.dark .comp-saldo.extra { color: #90cdf4; }
body.dark .comp-saldo.ok { color: #9ae6b4; }
body.dark .comp-lg-planned { background: #744210; }
body.dark .comp-lg-done { background: #2b6cb0; }
body.dark .comp-lg-folga { background: #7b341e; }
body.dark .comp-lg-off { background: #3a3326; }
body.dark .comp-lg-holiday { background: repeating-linear-gradient(45deg, #2a4365, #2a4365 4px, #1f2f48 4px, #1f2f48 8px); }
