/* ==========================================================================
   Turn 8 — Modal NOVO APONTAMENTO (Ficha de Apontamento Digital)
   Paleta: laranja (produtividade padrão) + verde (produtividade efetiva)
   ========================================================================== */

/* Backdrop + Shell */
.apv2-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  overflow-y: auto;
}
.apv2-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  width: min(1040px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px 24px 24px;
}
.dark .apv2-modal { background: #0f172a; color: #e2e8f0; }

/* Header */
.apv2-header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px; margin-bottom: 16px;
}
.dark .apv2-header { border-color: #1e293b; }
.apv2-title {
  font-size: 15px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #0f172a;
  display: flex; align-items: center; gap: 8px;
}
.dark .apv2-title { color: #e2e8f0; }
.apv2-title .fa-chart-column { color: #f97316; }
.apv2-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 20px; color: #64748b; padding: 4px 8px;
}
.apv2-close:hover { color: #ef4444; }

/* Layout grid: linhas do formulário */
.apv2-row {
  display: grid; gap: 10px;
  margin-bottom: 10px;
}
.apv2-row-1 { grid-template-columns: 1fr 110px 150px 44px; }
.apv2-row-2 { grid-template-columns: 1fr 180px 1fr 44px; }
.apv2-row-3 { grid-template-columns: 1fr 44px 140px 140px 140px; }
.apv2-row-obs { grid-template-columns: 1fr; }

@media (max-width: 760px) {
  .apv2-row-1, .apv2-row-2, .apv2-row-3 { grid-template-columns: 1fr; }
}

/* Campos "float label" (rótulo em cima do input) */
.apv2-field {
  position: relative;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 10px 4px;
  background: #fff;
  min-height: 44px;
  display: flex; flex-direction: column; justify-content: center;
}
.dark .apv2-field { background: #1e293b; border-color: #334155; }
.apv2-field.error { border-color: #ef4444; }
.apv2-field-lbl {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.02em;
  color: #94a3b8; font-weight: 600;
  padding-top: 2px;
}
.dark .apv2-field-lbl { color: #64748b; }
.apv2-field input,
.apv2-field select {
  border: none; outline: none; background: transparent;
  font-size: 13px; color: #0f172a;
  padding: 2px 0; width: 100%;
}
.dark .apv2-field input, .dark .apv2-field select { color: #e2e8f0; }
.apv2-field input[type="date"] { color: #0f172a; }
.dark .apv2-field input[type="date"] { color: #e2e8f0; color-scheme: dark; }

/* Turn 12 — dropdown de Horário: legibilidade em ambos os temas + estado disabled */
.apv2-field select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3e%3cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='2' fill='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 10px 7px;
  padding-right: 14px;
}
/* garante contraste das <option> tanto em light quanto em dark
   (por padrão o browser herda cor do <select>, mas em alguns dark themes
    as options ficam invisíveis se background não for definido) */
.apv2-field select option {
  background: #ffffff;
  color: #0f172a;
}
.dark .apv2-field select option {
  background: #1e293b;
  color: #e2e8f0;
}
.apv2-field select option:disabled {
  color: #94a3b8;
  font-style: italic;
}
.apv2-field select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.apv2-field.disabled { opacity: 0.6; }
/* highlight sutil quando o campo está pronto pra receber input mas ainda vazio */
.apv2-field select:not(:disabled):focus {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
  border-radius: 6px;
}

.apv2-btn-icon {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  min-height: 44px;
}
.apv2-btn-icon:hover { background: #dc2626; }
.apv2-btn-icon.info { background: #f97316; }
.apv2-btn-icon.info:hover { background: #ea580c; }

/* Cards de produtividade */
.apv2-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
@media (max-width: 900px) {
  .apv2-cards { grid-template-columns: 1fr; }
}

.apv2-card {
  border-radius: 10px;
  padding: 12px 14px 14px;
  border: 1px solid transparent;
  background: #f8fafc;
}
.dark .apv2-card { background: #1e293b; }

.apv2-card-padrao {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fed7aa;
}
.apv2-card-efetiva {
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
}
.dark .apv2-card-padrao {
  background: linear-gradient(180deg, rgba(249,115,22,0.15) 0%, rgba(249,115,22,0.08) 100%);
  border-color: rgba(249,115,22,0.3);
}
.dark .apv2-card-efetiva {
  background: linear-gradient(180deg, rgba(16,185,129,0.15) 0%, rgba(16,185,129,0.08) 100%);
  border-color: rgba(16,185,129,0.3);
}

.apv2-card-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  text-align: center;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.apv2-card-padrao .apv2-card-title { color: #c2410c; }
.apv2-card-efetiva .apv2-card-title { color: #047857; }
.dark .apv2-card-padrao .apv2-card-title { color: #fdba74; }
.dark .apv2-card-efetiva .apv2-card-title { color: #6ee7b7; }

/* Inputs dentro dos cards */
.apv2-card-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.apv2-card-inputs.two { grid-template-columns: repeat(3, 1fr); }
.apv2-mini-field {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  background: #fff;
  min-height: 42px;
  display: flex; flex-direction: column; justify-content: center;
}
.dark .apv2-mini-field { background: #0f172a; border-color: #334155; }
.apv2-mini-lbl {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.02em;
  color: #94a3b8; font-weight: 700;
  line-height: 1;
}
.apv2-mini-field input {
  border: none; outline: none; background: transparent;
  font-size: 13px; padding: 2px 0; width: 100%;
  color: #0f172a;
}
.dark .apv2-mini-field input { color: #e2e8f0; }

/* Pílula readonly (Tempo trabalhado / efetivo) */
.apv2-mini-field.pill-warn { background: #fed7aa; border-color: #fdba74; }
.apv2-mini-field.pill-ok { background: #a7f3d0; border-color: #6ee7b7; }
.apv2-mini-field.pill-warn input, .apv2-mini-field.pill-ok input {
  font-weight: 700;
  color: #0f172a;
}
.dark .apv2-mini-field.pill-warn { background: rgba(249,115,22,0.35); border-color: rgba(249,115,22,0.5); }
.dark .apv2-mini-field.pill-ok    { background: rgba(16,185,129,0.35); border-color: rgba(16,185,129,0.5); }
.dark .apv2-mini-field.pill-warn input,
.dark .apv2-mini-field.pill-ok input { color: #f1f5f9; }

/* Donut charts (canvas) */
.apv2-donuts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
}
.apv2-card-efetiva .apv2-donuts { grid-template-columns: repeat(3, 1fr); }
.apv2-donut {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.apv2-donut-lbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
}
.apv2-card-padrao .apv2-donut-lbl { color: #c2410c; }
.apv2-card-efetiva .apv2-donut-lbl { color: #047857; }
.dark .apv2-card-padrao .apv2-donut-lbl { color: #fdba74; }
.dark .apv2-card-efetiva .apv2-donut-lbl { color: #6ee7b7; }
.apv2-donut-canvas {
  width: 90px; height: 90px; position: relative;
}
.apv2-donut-value {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #0f172a;
}
.dark .apv2-donut-value { color: #f1f5f9; }

/* Footer com botão Salvar */
.apv2-footer {
  display: flex; justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.apv2-btn-save {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.15s;
}
.apv2-btn-save:hover:not(:disabled) { background: #dc2626; }
.apv2-btn-save:disabled { background: #94a3b8; cursor: not-allowed; }
.apv2-btn-save.saved { background: #10b981; }

/* §25 Botão secundário (Fechar após sucesso) */
.apv2-btn-secondary {
  background: transparent;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.apv2-btn-secondary:hover { background: #f1f5f9; border-color: #94a3b8; }
.dark .apv2-btn-secondary { color: #cbd5e1; border-color: #334155; }
.dark .apv2-btn-secondary:hover { background: #1e293b; border-color: #475569; }

/* §25 Confirmação de salvamento (dentro do footer) */
.apv2-save-ok {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  color: #065f46;
  background: #d1fae5;
  border-left: 4px solid #10b981;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.apv2-save-ok i { color: #10b981; }
.dark .apv2-save-ok {
  color: #a7f3d0;
  background: rgba(16,185,129,0.12);
}

/* Alerta inline (erros de validação) */
.apv2-alert {
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  border-left: 4px solid #ef4444;
  background: #fef2f2;
  color: #991b1b;
  display: none;
}
.apv2-alert.show { display: block; }
.dark .apv2-alert { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* Sub-label indicando origem do valor (motor canonical) */
.apv2-sub {
  font-size: 9px; color: #64748b; margin-top: 2px;
  display: block;
}
.dark .apv2-sub { color: #94a3b8; }

/* Botão especial (turno=abre selector) */
.apv2-btn-icon.tick { background: #f97316; }
