:root {
  --fundo: #f6f7f9; --painel: #fff; --texto: #1f2937; --suave: #6b7280; --linha: #e5e7eb;
  --marca: #e4572e; --marca-escura: #c2410c; --azul: #2563eb; --verde: #16a34a; --amarelo: #d97706; --vermelho: #dc2626;
  --rascunho: #f3f4f6; --raio: 8px; --sombra: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --azul: #7aa7ff;
    --fundo: #0f1115; --painel: #181b21; --texto: #e5e7eb; --suave: #9ca3af; --linha: #2b2f37; --rascunho: #22262e;
    --sombra: 0 1px 3px rgba(0,0,0,.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fundo); color: var(--texto); }
a { color: var(--azul); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.suave { color: var(--suave); }
.pequeno { font-size: 12px; }
.oculto { display: none !important; }

.app { display: grid; grid-template-columns: 210px 1fr; height: 100vh; height: 100dvh; }
.lateral { background: #111827; color: #d1d5db; display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; overflow-y: auto; }
.lateral .logo { color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 14px; display: flex; gap: 8px; align-items: center; }
.lateral .logo img { display: block; max-width: 100%; max-height: 44px; object-fit: contain; }
.logo .marca-texto { display: flex; align-items: center; gap: inherit; }
.logo .so-escuro { display: none !important; }
@media (prefers-color-scheme: dark) {
  .logo .so-claro { display: none !important; }
  .logo .so-escuro { display: flex !important; }
  .logo img.so-escuro { display: block !important; }
}
.lateral .logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--marca); display: inline-block; }
.lateral a { color: #d1d5db; padding: 8px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.lateral a:hover { background: #1f2937; color: #fff; }
.lateral a.ativo { background: #374151; color: #fff; }
.lateral .contador { background: var(--marca-escura); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.lateral .rodape { margin-top: auto; padding: 10px; font-size: 13px; color: #b6bcc6; border-top: 1px solid #1f2937; }
.lateral .rodape a { padding: 4px 0; display: inline; color: #c9ced6; text-decoration: underline; text-underline-offset: 2px; }
.lateral .rodape a:hover { color: #fff; background: none; }
.principal { overflow: auto; padding: 18px 22px 60px; min-width: 0; }
.topo-movel, .fundo-gaveta { display: none; }

.barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.barra .espaco { flex: 1; }
.btn { border: 1px solid var(--linha); background: var(--painel); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--suave); }
.btn.primario { background: var(--marca-escura); border-color: var(--marca-escura); color: #fff; } /* #c2410c sobre branco ≈ 5,2:1 */
.btn.primario:hover { background: #9a3412; border-color: #9a3412; }
.btn.perigo { color: var(--vermelho-texto); }
.btn.pequeno { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.cartao { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra); margin-bottom: 14px; }
.grelha-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.numero { font-size: 26px; font-weight: 700; }
.positivo { color: var(--verde); } .negativo { color: var(--vermelho-texto); }
table.tabela { width: 100%; border-collapse: collapse; background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; }
.tabela th, .tabela td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--linha); vertical-align: top; }
.tabela th { font-size: 12px; color: var(--suave); font-weight: 600; background: var(--fundo); }
.tabela tr:last-child td { border-bottom: 0; }
.tabela td.num, .tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }
.etiqueta { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--rascunho); color: var(--suave); }
.etiqueta.verde { background: #dcfce7; color: #166534; } .etiqueta.amarela { background: #fef3c7; color: #92400e; }
.etiqueta.vermelha { background: #fee2e2; color: #991b1b; } .etiqueta.azul { background: #dbeafe; color: #1e40af; }
.separadores { display: flex; gap: 4px; border-bottom: 1px solid var(--linha); margin-bottom: 14px; flex-wrap: wrap; }
.separadores a { padding: 8px 12px; color: var(--suave); border-bottom: 2px solid transparent; cursor: pointer; }
.separadores a.ativo { color: var(--texto); border-color: var(--marca); font-weight: 600; }
.vazio { padding: 30px; text-align: center; color: var(--suave); }

.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.campo > span { font-size: 12px; color: var(--suave); font-weight: 600; }
.campo input, .campo select, .campo textarea, input.entrada, select.entrada {
  border: 1px solid var(--linha); border-radius: 6px; padding: 7px 9px; background: var(--painel); width: 100%;
}
input.entrada, select.entrada { width: auto; }
.campo textarea { min-height: 60px; resize: vertical; }
.linha-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.verificar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; cursor: pointer; }
.campo input[type=checkbox], .campo input[type=radio] { width: auto; padding: 0; flex: none; }
.lista-escolha .verificar { justify-content: flex-start; margin-bottom: 4px; }
.lista-escolha .disp { margin-left: auto; font-size: 12px; color: var(--suave); }
.lista-escolha .disp.aviso { color: var(--aviso-texto); }
.lista-escolha .disp.indisponivel { color: var(--vermelho-texto); }
.lista-escolha { max-height: 240px; overflow: auto; border: 1px solid var(--linha); border-radius: 6px; padding: 6px; }

.fundo-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 50; overflow: auto; }
.modal { background: var(--painel); border-radius: 10px; width: 100%; max-width: 520px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal.largo { max-width: 860px; }
.modal header { padding: 14px 16px; border-bottom: 1px solid var(--linha); font-weight: 600; display: flex; justify-content: space-between; }
.modal header button { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--suave); }
.modal .corpo { padding: 16px; }
.modal footer { padding: 12px 16px; border-top: 1px solid var(--linha); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal footer .esquerda { margin-right: auto; }
.avisos { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: 380px; }
.aviso { background: #111827; color: #fff; padding: 10px 12px 10px 14px; border-radius: 8px; box-shadow: var(--sombra); display: flex; gap: 8px; align-items: flex-start; }
.aviso .aviso-texto { flex: 1; min-width: 0; }
.aviso .aviso-texto ul { margin: 4px 0 0; padding-left: 18px; }
.aviso .aviso-fechar { border: 0; background: none; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; opacity: .8; }
.aviso .aviso-fechar:hover { opacity: 1; }
.aviso.erro { background: var(--vermelho); }
.caixa-alerta { border-left: 4px solid var(--amarelo); background: #fffbeb; color: #78350f; padding: 8px 12px; border-radius: 4px; margin-bottom: 6px; display: flex; gap: 8px; align-items: flex-start; }
.caixa-alerta > div { flex: 1; }
.caixa-alerta.grave { border-color: var(--vermelho); background: #fef2f2; color: #7f1d1d; }
@media (prefers-color-scheme: dark) { .caixa-alerta { background: #2a2310; color: #fcd34d; } .caixa-alerta.grave { background: #2a1414; color: #fca5a5; } }

.escala-envolvente { overflow: auto; border: 1px solid var(--linha); border-radius: var(--raio); background: var(--painel); max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); }
table.escala { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1000px; table-layout: fixed; }
.escala th, .escala td { border-right: 1px solid var(--linha); border-bottom: 1px solid var(--linha); padding: 4px; vertical-align: top; }
.escala thead th { position: sticky; top: 0; background: var(--painel); z-index: 2; font-weight: 600; font-size: 12px; text-align: left; padding: 8px 6px; }
.escala thead th.hoje { color: var(--marca); }
.escala thead th .feriado { color: var(--vermelho-texto); font-weight: 500; display: block; }
.escala th.pessoa, .escala td.pessoa { position: sticky; left: 0; background: var(--painel); z-index: 1; width: 190px; }
.escala thead th.pessoa { z-index: 3; }
.escala td.pessoa { font-size: 13px; }
.escala td.pessoa .nome { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.escala td.pessoa .bola { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.escala td.dia { height: 64px; cursor: cell; }
.escala td.dia.fim-semana { background: rgba(0,0,0,.015); }
.escala td.dia.alvo { background: #eff6ff; outline: 2px dashed var(--azul); outline-offset: -3px; }
.escala tr.por-atribuir td { background: var(--fundo); }
.escala tfoot td { font-size: 12px; color: var(--suave); background: var(--fundo); position: sticky; bottom: 0; }
.turno { border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; font-size: 12px; color: #fff; cursor: grab; position: relative; line-height: 1.25; user-select: none; }
.turno .horas { font-weight: 700; }
.turno .info { opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turno.rascunho { opacity: .5; filter: saturate(.6); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.2) 0 6px, transparent 6px 12px); outline: 2px dashed rgba(0,0,0,.35); outline-offset: -2px; }
.turno.rascunho:hover { opacity: .85; }
.turno.nao-planeado::after { content: "!"; position: absolute; top: 2px; right: 5px; font-weight: 800; }
.turno.arrastar { opacity: .4; }
.dia-tipo { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 5px; margin-bottom: 4px; display: inline-block; }
.dia-tipo.descanso_obrigatorio { background: #e5e7eb; color: #374151; }
.dia-tipo.descanso_complementar { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.dia-tipo.ferias { background: #dbeafe; color: #1e40af; }
.dia-tipo.ausencia_justificada, .dia-tipo.ausente { background: #ede9fe; color: #5b21b6; }
.dia-tipo.falta_injustificada { background: #fee2e2; color: #991b1b; }
.dia-tipo.descanso_compensatorio, .dia-tipo.descanso_compensatorio_do { background: #dcfce7; color: #166534; }
.dia-tipo.feriado { background: #fef3c7; color: #92400e; }
.dia-tipo.descanso_compensatorio_prazo { background: #ccfbf1; color: #115e59; }
.dia-tipo.sem_trabalho { background: var(--rascunho); color: var(--suave); border: 1px dashed var(--linha); }
.dia-tipo.turno { display: none; }
.indisp { font-size: 12px; color: var(--vermelho-texto); }
.marcador-alerta { color: var(--amarelo); font-weight: 700; cursor: help; }
.menu-contexto { position: fixed; z-index: 70; background: var(--painel); border: 1px solid var(--linha); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.2); padding: 4px; min-width: 230px; }
.menu-contexto button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 5px; cursor: pointer; }
.menu-contexto button:hover { background: var(--fundo); }
.menu-contexto a.menu-ligacao { display: block; padding: 7px 10px; border-radius: 5px; color: inherit; text-decoration: none; }
.menu-contexto a.menu-ligacao:hover { background: var(--fundo); }
.menu-contexto hr { border: 0; border-top: 1px solid var(--linha); margin: 4px 0; }
.legenda { font-size: 12px; color: var(--suave); margin-top: 8px; }
.legenda-tipos { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.legenda-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legenda-item .dia-tipo, .legenda-item .etiqueta { margin: 0; }
.legenda-item .turno { display: inline-block; margin: 0; padding: 1px 6px; cursor: default; background: #475569; }
.linha-clicavel { cursor: pointer; }
.linha-clicavel:hover td { background: var(--fundo); }
.cartao.filtro { cursor: pointer; }
.cartao.filtro:hover { border-color: var(--suave); }
.cartao.filtro.ativo { border-color: var(--marca); box-shadow: 0 0 0 1px var(--marca); }
.btn.mais { padding: 0 8px; font-weight: 700; line-height: 1.4; }

.ecra-entrar { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ecra-entrar .cartao { width: 100%; max-width: 380px; padding: 26px; }
.ecra-entrar .logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; margin-bottom: 18px; }
.ecra-entrar .logo img { display: block; max-width: 260px; max-height: 64px; object-fit: contain; }
.ecra-entrar .logo i { width: 32px; height: 32px; border-radius: 8px; background: var(--marca); display: inline-block; }
.ecra-entrar .btn { width: 100%; padding: 9px; }
.ou { text-align: center; color: var(--suave); margin: 12px 0; font-size: 12px; }
.erro-form { color: var(--vermelho-texto); margin-bottom: 10px; min-height: 1em; }
.qr { font-family: ui-monospace, monospace; word-break: break-all; background: var(--fundo); padding: 8px; border-radius: 6px; font-size: 12px; }

.folha-dia td { background: var(--fundo); font-weight: 600; }
.picagem-antiga { text-decoration: line-through; color: var(--suave); }

.com-botao { display: flex; gap: 6px; align-items: stretch; }
.com-botao > select { flex: 1; min-width: 0; }

/* Vista mensal */
.segmentado { display: inline-flex; }
.segmentado .btn { border-radius: 0; }
.segmentado .btn:first-child { border-radius: 6px 0 0 6px; }
.segmentado .btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.segmentado .btn.ativo { background: var(--marca-escura); color: #fff; border-color: var(--marca-escura); }
table.mes { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--painel); }
table.mes th { padding: 6px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--linha); }
td.mes-dia { vertical-align: top; height: 118px; padding: 4px; border: 1px solid var(--linha); cursor: default; overflow: hidden; }
td.mes-dia.fora { opacity: .45; }
td.mes-dia.fim-semana { background: rgba(148,163,184,.08); }
td.mes-dia.hoje { box-shadow: inset 0 0 0 2px var(--marca); }
.mes-cabeca { display: flex; gap: 6px; align-items: baseline; margin-bottom: 3px; }
.mes-num { font-weight: 700; text-decoration: none; color: inherit; }
.mes-cabeca .feriado { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mes-turno { font-size: 12px; line-height: 1.35; padding: 1px 4px; margin: 1px 0; border-left: 3px solid #475569; background: rgba(148,163,184,.12);
  border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mes-turno.rascunho { border-left-style: dashed; opacity: .5; }
.mes-hora { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 720px) { td.mes-dia { height: 84px; } .mes-turno .suave { display: none; } }

/* Relatórios */
.tabela-rolar { overflow-x: auto; }
table.rel { font-size: 12px; }
table.rel td, table.rel th { padding: 4px 5px; white-space: nowrap; }
input.mini, select.mini { font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid transparent; background: transparent; color: inherit; border-radius: 4px; width: 66px; }
input.mini.largo, select.mini { width: 130px; }
input.mini:hover, select.mini:hover, input.mini:focus, select.mini:focus { border-color: var(--linha); background: var(--painel); }
input.mini::placeholder { color: var(--suave); }
input.mini.sem-tarifa { color: var(--amarelo); }
.btn.mini-btn { padding: 0 5px; font-size: 11px; line-height: 18px; }
.ordem { display: inline-flex; flex-direction: column; margin-right: 4px; vertical-align: middle; }
.ordem .btn { line-height: 10px; font-size: 8px; padding: 1px 3px; }
.com-marca { display: flex; align-items: center; gap: 3px; }
.origem { font-size: 9px; font-weight: 700; border-radius: 3px; padding: 0 3px; }
.origem.o-T { background: #dcfce7; color: #166534; } .origem.o-TE { background: #dbeafe; color: #1e40af; } .origem.o-TP { background: #fef3c7; color: #92400e; }
tr.oculto-rel td { opacity: .4; text-decoration: line-through; }
.tabela tr.total td { background: rgba(223,107,38,.09); }
.btn.ativo-filtro { border-color: var(--marca); }
.nowrap { white-space: nowrap; }
iframe.pdf { width: 100%; height: 62vh; border: 1px solid var(--linha); border-radius: 6px; margin-top: 8px; background: #fff; }
.modal.largo { max-width: 1000px; }

/* Eventos do Google Calendar na escala */
.escala tr.eventos td { background: var(--fundo); border-bottom: 2px solid var(--linha); }
.evento { font-size: 12px; line-height: 1.3; padding: 2px 5px; margin: 1px 0 3px; border-left: 3px solid #64748b; border-radius: 4px;
  background: var(--painel); box-shadow: var(--sombra); cursor: pointer; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.evento:hover { outline: 1px solid var(--azul); }
.evento.compacto { -webkit-line-clamp: 1; box-shadow: none; background: rgba(37,99,235,.08); }
.evento.cancelado { text-decoration: line-through; opacity: .6; }
.evento-hora { font-weight: 600; font-variant-numeric: tabular-nums; }
.evento-marca.falta { color: var(--amarelo); font-weight: 600; }
.evento-marca.ok { color: var(--verde); }
.descricao-evento { white-space: pre-wrap; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--fundo); padding: 8px; border-radius: 6px; max-height: 260px; overflow: auto; }
td.centro, th.centro { text-align: center; }
.bola { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }

.linha-check { display: flex; gap: .5rem; align-items: center; margin: .5rem 0 1rem; }

.pendencia { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.resolver { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.resolver select.entrada { padding: 3px 6px; }
tr.futuro td { color: var(--suave); }

/* Definições › Logótipo */
.logotipos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.logotipos .amostra { height: 120px; border-radius: var(--raio); border: 1px solid var(--linha); display: flex; align-items: center; justify-content: center; padding: 14px; margin: 8px 0 10px; }
.logotipos .amostra.claro { background: #fff; color: #6b7280; }
.logotipos .amostra.escuro { background: #111827; color: #9ca3af; }
.logotipos .amostra img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Calendário das ausências */
.calendario-ausencia { margin: 6px 0 12px; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cal-meses { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.cal-titulo { font-weight: 600; text-transform: capitalize; margin-bottom: 4px; text-align: center; }
.cal-grelha { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-cab { text-align: center; font-size: 12px; color: var(--suave); padding: 2px 0; }
.cal-dia { border: 1px solid transparent; background: var(--painel); color: var(--texto); border-radius: 6px; padding: 6px 0; font-size: 13px; cursor: pointer; position: relative; }
.cal-dia:hover { border-color: var(--azul); }
.cal-dia.passado { opacity: .55; }
.cal-dia.fds, .cal-legenda i.fds { background: var(--rascunho); color: var(--suave); }
.cal-dia.feriado, .cal-legenda i.feriado { background: repeating-linear-gradient(135deg, var(--rascunho), var(--rascunho) 4px, transparent 4px, transparent 8px); color: var(--suave); }
.cal-dia.ferias, .cal-legenda i.ferias { background: #dcfce7; color: #166534; }
.cal-dia.ocupado, .cal-legenda i.ocupado { background: #e0e7ff; color: #3730a3; }
.cal-dia.pendente, .cal-legenda i.pendente { background: #fef3c7; color: #92400e; border-style: dashed; border-color: #d97706; }
.cal-dia.hoje { font-weight: 700; text-decoration: underline; }
.cal-dia.sel { background: var(--marca-escura); color: #fff; opacity: 1; }
.cal-dia.sel.fds, .cal-dia.sel.feriado { background: #f4a68e; color: #431407; }
.cal-dia.sel-ini, .cal-dia.sel-fim { box-shadow: 0 0 0 2px var(--marca-escura) inset; }
.cal-legenda { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; color: var(--suave); }
.cal-legenda span { display: inline-flex; align-items: center; gap: 4px; }
.cal-legenda i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--linha); }
.cal-resumo { padding: 8px 10px; border-radius: var(--raio); background: var(--fundo); }
@media (prefers-color-scheme: dark) {
  .cal-dia.ferias, .cal-legenda i.ferias { background: #14532d; color: #bbf7d0; }
  .cal-dia.ocupado, .cal-legenda i.ocupado { background: #312e81; color: #c7d2fe; }
  .cal-dia.pendente, .cal-legenda i.pendente { background: #451a03; color: #fcd34d; }
}
.cal-dia sup { font-size: 9px; margin-left: 1px; }
.cal-colegas { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: var(--rascunho); }
.cal-ano { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.cal-dia.mini { padding: 3px 0; font-size: 11px; }
.cal-dia.feriado-ano, .cal-legenda i.feriado-ano { background: #fee2e2; color: #b91c1c; font-weight: 700; }
@media (prefers-color-scheme: dark) { .cal-dia.feriado-ano, .cal-legenda i.feriado-ano { background: #450a0a; color: #fca5a5; } }

/* Detalhe de turno (só leitura) */
.detalhe-turno { display: grid; gap: 6px; }
.detalhe-horas { font-size: 22px; font-weight: 700; }
.detalhe-linha { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: baseline; }

.nota-dia { font-size: 11px; font-weight: 400; text-align: left; background: #fffbeb; color: #78350f; border: 1px solid #fde68a; border-radius: 4px; padding: 2px 4px; margin-top: 3px; cursor: default; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
button.nota-dia { display: block; width: 100%; cursor: pointer; }
.btn-nota { display: block; margin: 3px auto 0; font-size: 12px; border: 0; background: none; color: var(--suave); cursor: pointer; }
.btn-nota:hover { color: var(--marca); }
@media (prefers-color-scheme: dark) { .nota-dia { background: #2a2410; color: #fde68a; border-color: #5b4a12; } }
.lista-turnos-alerta { margin: 6px 0 0; padding-left: 18px; }
.lista-turnos-alerta li { margin: 2px 0; }
.caixa-alerta > .barra { flex: none; flex-wrap: wrap; justify-content: flex-end; }

/* bloco B — escala */
:root { --marca-texto: #c2410c; --aviso-texto: #b45309; --fds: #eef0f4; }
@media (prefers-color-scheme: dark) { :root { --marca-texto: #e4572e; --fds: #1c2027; } }
/* Fins de semana com fundo visível nos dois temas */
.escala td.dia.fim-semana, .escala thead th.fim-semana, .escala tr.eventos td.fim-semana, td.mes-dia.fim-semana { background: var(--fds); }
.escala td.dia.fim-semana.alvo { background: #eff6ff; }
.escala thead th.hoje { color: var(--marca-texto); }
.btn-nota:hover { color: var(--marca-texto); }
/* Avisos e ⚠ com contraste AA (#b45309) */
.marcador-alerta, .evento-marca.falta { color: var(--aviso-texto); }
.aviso.alerta { background: #b45309; }
/* Estado do turno explícito: barra lateral de 4 px + etiqueta */
.turno { border-left: 4px solid rgba(0,0,0,.3); }
.turno .horas { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.turno .info { opacity: 1; }
.turno .estado-turno { font-size: 10px; font-weight: 700; line-height: 1.3; padding: 0 5px; border-radius: 8px; background: #fff; color: #111; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.turno.rascunho { opacity: 1; filter: none; outline: none; color: var(--texto); border-left: 4px dashed var(--cor, #475569);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cor, #475569) 22%, var(--painel)) 0 6px, color-mix(in srgb, var(--cor, #475569) 10%, var(--painel)) 6px 12px); }
.turno.rascunho:hover { opacity: 1; box-shadow: 0 0 0 1px var(--cor, #475569); }
.estado-turno.rascunho { background: var(--texto); color: var(--painel); box-shadow: none; }
.turno.alterado { border-left-color: #b45309; }
.estado-turno.alterado { background: #b45309; color: #fff; }
.turno.nao-planeado { border-left-color: #6d28d9; }
.turno.nao-planeado::after { content: none; }
.estado-turno.nao-planeado { background: #6d28d9; color: #fff; }
.estado-turno.limite { background: #b91c1c; color: #fff; }
.legenda-item .turno.amostra { display: inline-flex; gap: 4px; align-items: center; }
.legenda-item .turno.amostra.rascunho { background: repeating-linear-gradient(135deg, color-mix(in srgb, #475569 22%, var(--painel)) 0 6px, color-mix(in srgb, #475569 10%, var(--painel)) 6px 12px); }
.mes-turno.rascunho { opacity: 1; background: repeating-linear-gradient(135deg, rgba(148,163,184,.22) 0 6px, transparent 6px 12px); font-style: italic; }
/* Botão ⋯ do dia (menu do botão direito): aparece ao passar o rato; sempre visível em ecrãs táteis */
.escala td.dia { position: relative; z-index: 0; -webkit-touch-callout: none; } /* contexto próprio: o ⋯ não passa por cima da coluna fixa */
.btn-dia-menu { position: absolute; top: 2px; right: 2px; z-index: 1; border: 1px solid var(--linha); background: var(--painel); color: var(--texto);
  border-radius: 5px; font-size: 13px; line-height: 1; padding: 2px 5px; cursor: pointer; opacity: 0; }
.escala td.dia:hover .btn-dia-menu, .btn-dia-menu:focus-visible { opacity: 1; }
@media (hover: none) { .btn-dia-menu { opacity: 1; padding: 4px 7px; min-width: 40px; min-height: 40px; } .btn-nota { min-height: 40px; min-width: 40px; } }
/* Novo turno: Opções recolhidas */
.opcoes-turno { border: 1px solid var(--linha); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.opcoes-turno > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 2px 0; }
.opcoes-turno[open] > summary { margin-bottom: 8px; }

/* bloco B — páginas */
/* Ações destrutivas principais (confirmações, modais) a vermelho cheio; as pequenas em linha ficam texto vermelho. */
/* Vermelho cheio só nos botões de confirmação destrutiva dos diálogos; o resto mantém o texto vermelho. */
.modal footer .btn.perigo:not(.pequeno):not(.esquerda) { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.modal footer .btn.perigo:not(.pequeno):not(.esquerda):hover { background: #991b1b; border-color: #991b1b; }
/* Validação dos formulários (modais): erro debaixo do campo. */
.erro-campo { color: var(--vermelho-texto); font-size: 12px; font-weight: 500; }
.campo [aria-invalid="true"], input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--vermelho) !important; }
/* Separadores com URL e foco visível. */
.separadores a:focus-visible, .faixa-contagens a:focus-visible, .tabela th.ordenavel:focus-visible { outline: 2px solid var(--azul); outline-offset: -2px; border-radius: 4px; }
/* Tabelas ordenáveis e com pesquisa. */
.tabela-ferramentas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.tabela-ferramentas input[type=search] { min-width: 220px; }
.tabela th.ordenavel { cursor: pointer; user-select: none; white-space: nowrap; }
.tabela th.ordenavel:hover { color: var(--texto); }
.tabela th .seta { margin-left: 4px; font-size: 10px; opacity: .35; }
.tabela th[aria-sort] .seta { opacity: 1; }
/* Definições › Geral em cartões, com barra de gravação fixa. */
.defs-cartao h2 { margin-top: 0; }
.barra-guardar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px 14px; box-shadow: 0 -2px 10px rgba(0,0,0,.08); margin-top: 8px; }
.barra-guardar .estado-alteracoes { color: var(--suave); }
.barra-guardar.com-alteracoes .estado-alteracoes { color: var(--aviso-texto, #b45309); font-weight: 600; }
/* Aprovações: faixa de contagens e ligações por linha. */
.faixa-contagens { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.faixa-contagens a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--linha); border-radius: 999px; background: var(--painel); color: var(--texto); }
.faixa-contagens a:hover { border-color: var(--suave); }
.faixa-contagens a strong { color: var(--marca-texto, #c2410c); }
.tudo-em-dia { font-size: 16px; }
.ver-ligacao { font-size: 12px; white-space: nowrap; }

/* bloco C — acabamento */
:root { --vermelho-texto: #dc2626; --foco: #2563eb; }
@media (prefers-color-scheme: dark) { :root { --vermelho-texto: #f87171; --aviso-texto: #fbbf24; --foco: #7aa7ff; } }
/* Foco visível em todos os controlos (teclado). */
.btn:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, [role=button]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, td.dia:focus-visible, .modal:focus-visible {
  outline: 2px solid var(--foco); outline-offset: 2px; }
.modal:focus-visible { outline-offset: -2px; }
.lateral a:focus-visible { outline-color: #93c5fd; outline-offset: -2px; }
/* Itens destrutivos dos menus a vermelho. */
.menu-contexto button.perigo { color: var(--vermelho-texto); font-weight: 600; }
.menu-contexto button.perigo:hover { background: color-mix(in srgb, var(--vermelho) 12%, var(--painel)); }
.menu-contexto button:disabled { color: var(--suave); cursor: default; }
.menu-contexto button:disabled:hover { background: none; }
/* Rodapé dos modais sempre à vista quando o conteúdo é alto. */
.modal footer { position: sticky; bottom: 0; background: var(--painel); border-radius: 0 0 10px 10px; z-index: 2; }

/* Modo escuro: chips e etiquetas com fundo escuro e texto claro (≥ 4,5:1). */
@media (prefers-color-scheme: dark) {
  .etiqueta.verde, .dia-tipo.descanso_compensatorio, .dia-tipo.descanso_compensatorio_do, .origem.o-T { background: #14532d; color: #bbf7d0; }
  .etiqueta.amarela, .dia-tipo.feriado, .origem.o-TP { background: #451a03; color: #fcd34d; }
  .etiqueta.vermelha, .dia-tipo.falta_injustificada { background: #450a0a; color: #fca5a5; }
  .etiqueta.azul, .dia-tipo.ferias, .origem.o-TE { background: #1e3a8a; color: #bfdbfe; }
  .dia-tipo.descanso_obrigatorio { background: #374151; color: #e5e7eb; }
  .dia-tipo.descanso_complementar { background: #1f2937; color: #d1d5db; border-color: #4b5563; }
  .dia-tipo.ausencia_justificada, .dia-tipo.ausente { background: #3b0764; color: #ddd6fe; }
  .dia-tipo.descanso_compensatorio_prazo { background: #134e4a; color: #99f6e4; }
  .escala td.dia.alvo, .escala td.dia.fim-semana.alvo { background: #172554; }
  .cal-dia.sel.fds, .cal-dia.sel.feriado { background: #9a3412; color: #fff; }
  .lista-escolha .disp.aviso { color: var(--aviso-texto); }
  .tabela tr.total td { background: rgba(228,87,46,.16); }
  .aviso { background: #1f2937; border: 1px solid #374151; }
}

/* Telemóvel (≤ 800 px): barra de topo + menu em gaveta. */
@media (max-width: 800px) {
  .app { display: block; height: auto; min-height: 100vh; min-height: 100dvh; }
  .topo-movel { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; height: 52px; padding: 0 10px;
    background: #111827; color: #fff; }
  .botao-menu { border: 1px solid #374151; background: #1f2937; color: #fff; border-radius: 6px; width: 40px; height: 36px; font-size: 20px; line-height: 1; cursor: pointer; flex: none; }
  .botao-menu:focus-visible { outline-color: #93c5fd; }
  .topo-marca { font-size: 13px; color: #b6bcc6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
  .topo-titulo { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .lateral { position: fixed; top: 0; bottom: 0; left: 0; width: 270px; max-width: 84vw; z-index: 60; transform: translateX(-100%);
    visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .lateral a { padding: 11px 12px; }
  .app.menu-aberto .lateral { transform: none; visibility: visible; transition: transform .2s ease; }
  .app.menu-aberto .fundo-gaveta { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .principal { overflow: visible; padding: 12px 12px 40px; }
  /* Tabelas que não estão num contentor .tabela-rolar rolam elas próprias. */
  :not(.tabela-rolar) > table.tabela { display: block; overflow-x: auto; }
  .tabela-ferramentas input[type=search] { min-width: 0; flex: 1 1 160px; }
  .grelha-cartoes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .grelha-cartoes .cartao { margin-bottom: 0; padding: 10px 12px; }
  .numero { font-size: 22px; }
  .barra > h1 { font-size: 18px; }
  .barra-guardar { bottom: 0; margin-left: -12px; margin-right: -12px; border-radius: 0; padding: 8px 12px; }
  .escala-envolvente { max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); }
  .avisos { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .lateral { transition: none !important; } }

/* Barra da escala: no computador tudo numa linha (o contentor das ações não conta);
   no telemóvel ◀ Hoje ▶ + período na primeira linha e o resto em «Ações ▾». */
.escala-navegar { display: inline-flex; gap: 8px; }
.escala-acoes { display: contents; }
.botao-acoes { display: none; }
.contador-acoes { background: var(--marca-escura); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-left: 6px; }
@media (max-width: 800px) {
  .barra-escala { gap: 6px; }
  .barra-escala > h1 { display: none; }
  .escala-navegar { gap: 4px; }
  .escala-navegar .btn, .barra-escala .btn { padding: 6px 10px; }
  .escala-periodo { font-size: 13px; white-space: nowrap; }
  .botao-acoes { display: inline-flex; align-items: center; margin-left: auto; }
  .escala-acoes { display: none; flex-basis: 100%; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--linha); border-radius: var(--raio); background: var(--painel); }
  .escala-acoes.aberto { display: flex; }
  .escala-acoes .espaco { display: none; }
  .escala-acoes input.entrada, .escala-acoes select.entrada { max-width: 100%; }
  .legenda-tipos { gap: 4px 10px; }
}

/* Modais no telemóvel: largura total, conteúdo a rolar, rodapé fixo. */
@media (max-width: 600px) {
  .fundo-modal { padding: 0; align-items: stretch; }
  .modal, .modal.largo { max-width: none; border-radius: 0; min-height: 100%; display: flex; flex-direction: column; }
  .modal > .modal-form { flex: 1; display: flex; flex-direction: column; }
  .modal .corpo { flex: 1; padding: 14px 12px; }
  .modal header { position: sticky; top: 0; background: var(--painel); z-index: 3; }
  .modal header button { min-width: 36px; min-height: 32px; }
  .modal footer { border-radius: 0; padding: 10px 12px; }
  .modal footer .btn { flex: 1 1 auto; }
  .modal footer .esquerda { flex: 0 1 auto; }
  .modal .linha-campos { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .cal-meses { grid-template-columns: 1fr; }
  .menu-contexto { max-width: calc(100vw - 8px); }
}
body.com-modal { overflow: hidden; }
@media (max-width: 800px) {
  /* Legendas longas partem a linha em vez de alargar a página. */
  .legenda-item { white-space: normal; min-width: 0; }
  .legenda-item > .dia-tipo, .legenda-item > .etiqueta, .legenda-item > .turno { flex: none; }
}

/* Texto só para leitores de ecrã. */
.so-leitor { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Regime novo (três contadores): etiqueta do contador no turno, dia feriado, valores neutros. */
.etiqueta-contador { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1.3; padding: 0 5px; border-radius: 8px; margin-left: 3px; background: #fff; color: #111; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.etiqueta-contador.c-B { background: #dbeafe; color: #1e40af; }
.etiqueta-contador.c-S { background: #fef3c7; color: #92400e; }
.etiqueta-contador.reposicao { background: #ede9fe; color: #5b21b6; }
.escala td.dia.dia-feriado { background-image: repeating-linear-gradient(135deg, rgba(234,179,8,.10), rgba(234,179,8,.10) 6px, transparent 6px, transparent 12px); }
.neutro { color: var(--texto); }
@media (prefers-color-scheme: dark) {
  .etiqueta-contador.c-B { background: #1e3a8a; color: #bfdbfe; }
  .etiqueta-contador.c-S { background: #451a03; color: #fcd34d; }
  .etiqueta-contador.reposicao { background: #3b0764; color: #ddd6fe; }
}

/* Ecrãs estreitos (≤ 800 px): tabelas em cartões, contagens no mês, alvos de toque ≥ 40 px. */
.mes-contagem { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; }
@media (max-width: 800px) {
  .tabela-cartoes, .tabela-cartoes tbody, .tabela-cartoes tr, .tabela-cartoes td { display: block; width: 100%; box-sizing: border-box; }
  .tabela-cartoes thead { display: none; }
  .tabela-cartoes tr { border: 1px solid var(--linha); border-radius: 8px; margin: 0 0 8px; padding: 6px 10px; }
  .tabela-cartoes tr.folha-dia { margin-top: 16px; border-width: 0 0 2px; border-radius: 0; padding: 4px 0; }
  .tabela-cartoes td { border: 0; padding: 3px 0; text-align: left; }
  .tabela-cartoes td.num { text-align: left; }
  .tabela-cartoes td:empty { display: none; }
  .tabela-cartoes td[data-rotulo]:not(:empty)::before { content: attr(data-rotulo); display: inline-block; min-width: 90px; margin-right: 8px; color: var(--suave); font-size: 12px; font-weight: 400; }
  .tabela-cartoes tr.folha-dia td::before { display: none; }
  .btn, select.entrada, input.entrada, .menu-contexto button, .mes-contagem { min-height: 40px; }
  .btn.pequeno { min-height: 40px; padding-left: 12px; padding-right: 12px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  label.verificar { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
}

/* Botões oficiais de início de sessão (ver marcas/LEIA-ME.txt). */
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(marcas/google-sans-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
.botoes-sociais { display: flex; flex-direction: column; gap: 10px; }
.botoes-sociais.estreito { max-width: 328px; }
.btn-apple { display: block; width: 100%; padding: 0; border: 0; border-radius: 4px; background: none; cursor: pointer; line-height: 0; }
.btn-apple picture, .btn-apple img { display: block; width: 100%; height: auto; border-radius: 4px; }
.btn-apple:hover img { opacity: .9; }
/* Google (Sign in with Google Branding Guidelines): 40 px, 12 px | G 20 px | 10 px | texto | 12 px. */
.btn-google { display: flex; align-items: center; justify-content: center; width: 100%; height: 40px; box-sizing: border-box;
  padding: 0 12px; border: 1px solid #747775; border-radius: 4px; background: #fff; color: #1f1f1f; cursor: pointer;
  font: 500 14px/20px 'Google Sans', Roboto, Arial, sans-serif; letter-spacing: .25px; }
.btn-google img { width: 20px; height: 20px; margin-right: 10px; flex: none; }
.btn-google:hover { background: #f8f8f8; box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); }
@media (prefers-color-scheme: dark) {
  .btn-google { background: #131314; border-color: #8e918f; color: #e3e3e3; }
  .btn-google:hover { background: #1f1f20; }
}

/* Selos das lojas (margem livre de 1/4 da altura: 10 px num selo de 40 px). */
.lojas { margin-top: 14px; text-align: center; }
.lojas .selos { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 10px 0; }
.selo-loja { display: block; line-height: 0; }
.selo-loja img { display: block; height: 40px; width: auto; }
.marcas-lojas { font-size: 10px; margin: 0; }
