/* ── planeamento.css — Módulo de Planeamento ─────────────────────────────── */

/* Loading */
.plan-loading {
  padding: 60px 24px;
  text-align: center;
  color: var(--texto-secundario);
  font-size: .9rem;
}

/* Empty state */
.plan-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--texto-secundario);
  font-size: .88rem;
  background: var(--cor-superficie);
  border-radius: var(--radius);
  border: 1px solid var(--borda);
  margin-top: 8px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.plan-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--g-200, #E5E6EA);
  margin-bottom: 18px;
}

.plan-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 12px;
  margin-right: 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--f-ui, 'Poppins', sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--g-500, #6E7178);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.plan-tab-btn:hover { color: var(--red, #D81F2A); }
.plan-tab-btn.ativo {
  color: var(--red, #D81F2A);
  border-bottom-color: var(--red, #D81F2A);
  font-weight: 600;
}
.plan-tab-btn svg { flex-shrink: 0; }

/* ── Toolbar (barra de filtros — sem card, só flex row) ──────────────── */

.plan-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Selects e inputs dentro do toolbar */
.plan-toolbar select,
.plan-toolbar .form-select,
.plan-toolbar input[type="text"],
.plan-toolbar input[type="search"] {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--g-200, #E5E6EA);
  border-radius: var(--r-sm, 8px);
  background: var(--g-50, #F6F7F9);
  color: var(--g-900, #1A1C20);
  font-family: var(--f-ui, 'Poppins', sans-serif);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s;
}

.plan-toolbar select:focus,
.plan-toolbar .form-select:focus,
.plan-toolbar input:focus {
  border-color: var(--red, #D81F2A);
  box-shadow: 0 0 0 3px rgba(216,31,42,.1);
}

/* ── Legenda ─────────────────────────────────────────────────────────────── */

.plan-legenda {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--texto-secundario);
  margin-bottom: 10px;
}
.plan-leg {
  font-size: 1.1em;
  line-height: 1;
}

/* ── Matrix wrapper ────────────────────────────────────────────────── */

.plan-matrix-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg, 16px);
  border: 1px solid var(--g-200, #E5E6EA);
  background: var(--white, #fff);
  box-shadow: var(--sh-1);
}

.plan-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 700px;
}
.plan-matrix th {
  padding: 12px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g-400, #9A9CA3);
  background: transparent;
  border-bottom: 1px solid var(--g-100, #EFF0F3);
  white-space: nowrap;
  text-align: center;
  font-family: var(--f-ui, 'Poppins', sans-serif);
}
.plan-matrix td {
  border-bottom: 1px solid var(--g-100, #EFF0F3);
  vertical-align: middle;
}
.plan-matrix tbody tr:last-child td { border-bottom: none; }
.plan-matrix tfoot td {
  border-top: 1px solid var(--g-200, #E5E6EA);
  background: var(--g-50, #F6F7F9);
}

/* Coluna de nome */
.plan-cap-nome-hdr {
  text-align: left !important;
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--cor-superficie) !important;
}
.plan-cap-nome {
  padding: 8px 12px;
  font-weight: 500;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: var(--cor-superficie);
  z-index: 1;
  min-width: 160px;
}
.plan-cap-total-label {
  font-weight: 700;
  font-size: .8rem;
  color: var(--texto-secundario);
}

/* Células de capacidade */
.plan-cap-cell {
  text-align: center;
  padding: 6px 8px;
  min-width: 88px;
  border-left: 1px solid var(--borda);
  transition: background .2s;
}
.plan-cap-alocado {
  font-weight: 700;
  font-size: .88rem;
  line-height: 1.3;
}
.plan-cap-disp {
  font-size: .75rem;
  color: var(--texto-secundario);
  line-height: 1.2;
}
.plan-cap-pct {
  font-size: .72rem;
  opacity: .8;
}
.plan-cap-real {
  font-size: .72rem;
  color: var(--texto-secundario);
  opacity: .75;
  margin-top: 2px;
}
.plan-cap-total .plan-cap-alocado { font-size: .82rem; }

/* Cores de ocupação */
.plan-cell-green  { background: rgba(34, 197, 94,  .12); }
.plan-cell-orange { background: rgba(234,179,  8, .15); }
.plan-cell-red    { background: rgba(239, 68, 68, .15); }

/* Mês atual */
.plan-mes-atual     { background: rgba(59, 130, 246, .07) !important; }
.plan-mes-atual-cel { background: rgba(59, 130, 246, .05) !important; }

/* ── Tabela simples (alocações / ausências) ──────────────────────────────── */

.plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  margin-top: 4px;
  background: var(--cor-superficie);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  overflow: hidden;
}
.plan-table th {
  padding: 9px 14px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--texto-secundario);
  background: var(--cor-superficie);
  border-bottom: 2px solid var(--borda);
  text-align: left;
  white-space: nowrap;
}
.plan-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--borda);
  vertical-align: middle;
}
.plan-table tbody tr:last-child td { border-bottom: none; }
.plan-table tbody tr:hover { background: var(--hover-bg, rgba(0,0,0,.025)); }

/* ── Ausências — badges de tipo ─────────────────────────────────────────── */

.plan-aus-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}
.plan-aus-ferias   { background: rgba(34, 197, 94, .15); color: #15803d; }
.plan-aus-baixa    { background: rgba(239, 68, 68, .15); color: #b91c1c; }
.plan-aus-formacao { background: rgba(59, 130, 246, .15); color: #1d4ed8; }
.plan-aus-outro    { background: rgba(156,163,175, .25); color: var(--texto-secundario); }

/* Linha a decorrer */
.plan-aus-corrente { background: rgba(250,204, 21, .08); }
/* Linha futura */
.plan-aus-futura { }

/* ── Forecast ─────────────────────────────────────────────────────────────── */

.plan-fc-cell {
  text-align: center;
  padding: 4px 6px;
  border-left: 1px solid var(--borda);
  min-width: 90px;
}
.plan-fc-total {
  text-align: center;
  padding: 8px 10px;
  border-left: 1px solid var(--borda);
}

.plan-fc-input {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--borda-input);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--texto);
  font-size: .82rem;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.plan-fc-input::-webkit-inner-spin-button,
.plan-fc-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.plan-fc-input:focus {
  outline: none;
  border-color: var(--azul-primario);
  box-shadow: 0 0 0 2px rgba(59,130,246,.2);
}
.plan-fc-input::placeholder { color: var(--borda); }

/* Cores de forecast */
.plan-fc-verde    { border-color: #22c55e; background: rgba(34,197,94,.1);  }
.plan-fc-laranja  { border-color: #f59e0b; background: rgba(245,158,11,.1); }
.plan-fc-azul     { border-color: var(--azul-primario); background: rgba(59,130,246,.08); }
/* Sugerido pelas alocações (não guardado ainda) */
.plan-fc-sugerido {
  border-style: dashed;
  border-color: var(--borda);
  color: var(--texto-secundario);
  font-style: italic;
}

/* Legenda forecast (fundo) */
.plan-fc-verde-bg   { color: #22c55e; }
.plan-fc-laranja-bg { color: #f59e0b; }
.plan-fc-azul-bg    { color: var(--azul-primario); }

/* Tema escuro */
[data-tema="escuro"] .plan-cell-green  { background: rgba(34, 197, 94,  .1); }
[data-tema="escuro"] .plan-cell-orange { background: rgba(234,179,  8, .12); }
[data-tema="escuro"] .plan-cell-red    { background: rgba(239, 68, 68, .12); }
[data-tema="escuro"] .plan-fc-verde    { background: rgba(34,197,94,.12); }
[data-tema="escuro"] .plan-fc-laranja  { background: rgba(245,158,11,.12); }
[data-tema="escuro"] .plan-fc-azul     { background: rgba(59,130,246,.1); }
[data-tema="escuro"] .plan-aus-corrente { background: rgba(250,204,21,.06); }

/* ── Vista — controles (toggle + nav + legenda) ──────────────────────────── */

.plan-vista-controles {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Toggle Semanal / Mensal / Anual */
.plan-vista-toggle {
  display: inline-flex;
  background: var(--g-100, #EFF0F3);
  border-radius: 9px;
  padding: 3px;
  border: none;
  overflow: hidden;
}

.plan-toggle-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-family: var(--f-ui, 'Poppins', sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--g-500, #6E7178);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.plan-toggle-btn:hover { color: var(--g-900, #1A1C20); }
.plan-toggle-btn.ativo {
  background: var(--red, #D81F2A);
  color: #fff;
}

.plan-vista-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-nav-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--texto);
  min-width: 170px;
  text-align: center;
  white-space: nowrap;
}

.plan-vista-legenda {
  font-size: .78rem;
  color: var(--texto-secundario);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Pills de área / tipo ─────────────────────────────────────────────── */

.plan-area-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--g-200, #E5E6EA);
  background: var(--white, #fff);
  font-family: var(--f-ui, 'Poppins', sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--g-700, #474747);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.plan-pill:hover {
  border-color: var(--g-300, #C9CBD1);
  background: var(--g-50, #F6F7F9);
}
.plan-pill.ativo {
  background: var(--g-900, #1A1C20);
  color: #fff;
  border-color: var(--g-900);
  font-weight: 600;
}

.plan-pill-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Vista — tabela principal ─────────────────────────────────────────────── */

.plan-vista-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--borda);
  background: var(--cor-superficie);
}

.plan-vista-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.plan-vista-nome-hdr {
  text-align: left;
  padding: 8px 12px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--texto-secundario);
  background: var(--cor-superficie);
  border-bottom: 2px solid var(--borda);
  white-space: nowrap;
  min-width: 190px;
  position: sticky;
  left: 0;
  z-index: 3;
}

.plan-vista-th {
  padding: 8px 10px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--texto-secundario);
  background: var(--cor-superficie);
  border-bottom: 2px solid var(--borda);
  border-left: 1px solid var(--borda);
  white-space: nowrap;
  text-align: center;
}

.plan-col-hoje {
  background: rgba(59, 130, 246, .06) !important;
  color: var(--azul-primario) !important;
}

/* Linha de cabeçalho de área */
.plan-grupo-hdr td {
  padding: 9px 12px 7px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--texto);
  background: var(--fundo, #edf0f4);
  border-bottom: 1px solid var(--borda);
  border-top: 3px solid var(--borda);
}
.plan-grupo-hdr:first-child td { border-top: none; }

.plan-grupo-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Linha de pessoa */
.plan-vista-row td {
  border-bottom: 1px solid var(--borda);
  vertical-align: top;
}
.plan-vista-row:last-child td { border-bottom: none; }

/* td wrapper — sem display:flex para não quebrar border-collapse */
.plan-vista-person-td {
  position: sticky;
  left: 0;
  background: var(--cor-superficie);
  z-index: 1;
  min-width: 190px;
  padding: 0;
}
/* Célula fixa: o tom de hover vai por cima do fundo opaco — transparente deixava ver os
   blocos das colunas que deslizam por baixo */
.plan-vista-row:hover .plan-vista-person-td { background: linear-gradient(var(--hover-bg, rgba(0,0,0,.025)), var(--hover-bg, rgba(0,0,0,.025))), var(--cor-superficie); }

/* div interior com flex */
.plan-vista-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  white-space: nowrap;
}

.plan-vista-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.plan-vista-nome {
  font-size: .84rem;
  font-weight: 500;
  color: var(--texto);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Célula de dados */
.plan-vista-cell {
  padding: 6px 8px;
  border-left: 1px solid var(--borda);
  vertical-align: top;
}

.plan-blocos-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Bloco de alocação de projeto */
.plan-bloco {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 6px 3px 5px;
  border-radius: 3px;
  font-size: .74rem;
  overflow: hidden;
}

.plan-bloco-linha1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  white-space: nowrap;
}

.plan-bloco-nome {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.plan-bloco-pct {
  font-weight: 700;
  font-size: .72rem;
  flex-shrink: 0;
  opacity: .85;
}

.plan-bloco-real {
  font-size: .68rem;
  opacity: .75;
  font-weight: 500;
}

.plan-vista-vazio {
  color: var(--borda);
  font-size: .8rem;
}

/* Aviso de sobreocupação */
.plan-vista-warn {
  display: inline-block;
  font-size: .71rem;
  font-weight: 700;
  color: #b45309;
  background: rgba(245, 158, 11, .13);
  border-radius: 3px;
  padding: 1px 5px;
  margin-bottom: 4px;
}

/* Horas reais (timesheets) */
.plan-real-horas {
  font-size: .71rem;
  color: var(--texto-secundario);
  opacity: .7;
  margin-top: 4px;
}

/* Bloco ausência na Vista */
/* Alocação prevista (Project Tasks do NetSuite): mesma cor do projeto, mas contorno
   tracejado e ligeiramente esbatida — é plano, não alocação confirmada à mão. */
.plan-bloco-prev { opacity: .82; }
.plan-bloco-prev .plan-bloco-pct { font-style: italic; }

.plan-bloco-aus {
  background: rgba(245,158,11,.12);
  color: #b45309;
  border-left: 3px solid #f59e0b;
}

/* ── Ausências — calendário anual ────────────────────────────────────────── */

.plan-cal-mes-hdr {
  padding: 7px 6px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--texto-secundario);
  background: var(--cor-superficie);
  border-bottom: 2px solid var(--borda);
  border-left: 1px solid var(--borda);
  text-align: center;
  min-width: 62px;
  white-space: nowrap;
}

.plan-cal-row td { border-bottom: 1px solid var(--borda); vertical-align: middle; }
.plan-cal-row:last-child td { border-bottom: none; }

.plan-cal-nome-td {
  position: sticky;
  left: 0;
  background: var(--cor-superficie);
  z-index: 1;
  min-width: 210px;
  padding: 0;
}
.plan-cal-row:hover .plan-cal-nome-td { background: linear-gradient(var(--hover-bg, rgba(0,0,0,.025)), var(--hover-bg, rgba(0,0,0,.025))), var(--cor-superficie); }

.plan-cal-nome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  white-space: nowrap;
}

.plan-cal-cell {
  padding: 6px 4px;
  border-left: 1px solid var(--borda);
  vertical-align: middle;
}

/* Timeline strip: full width of the cell, proportional day positioning */
.plan-cal-dias {
  position: relative;
  width: 100%;
  height: 10px;
}

.plan-cal-dia {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 2px;
  border-radius: 1px;
  background: #f59e0b;
  cursor: default;
}

.plan-cal-total {
  font-size: .71rem;
  color: var(--texto-secundario);
  background: rgba(0,0,0,.07);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Tema escuro — Vista */
[data-tema="escuro"] .plan-grupo-hdr td {
  background: rgba(255,255,255,.05);
  color: var(--texto);
}
[data-tema="escuro"] .plan-col-hoje {
  background: rgba(59, 130, 246, .1) !important;
}
[data-tema="escuro"] .plan-toggle-btn.ativo {
  background: var(--azul-primario);
}
[data-tema="escuro"] .plan-cal-total {
  background: rgba(255,255,255,.08);
}
