/* ══════════════════════════════════════════════════════════════
   INPUTS v14 — força legibilidade em todos os campos
   ════════════════════════════════════════════════════════════
   Resolve "texto branco sobre fundo branco" especialmente em
   mobile (iOS Safari, Chrome Android), onde o browser pode
   forçar autofill com cores próprias ou onde o modo escuro
   do SO interfere com inputs em janelas modais claras.

   Regra: fundo claro → texto sempre escuro.
   Aplica-se a TODOS os tipos de input/select/textarea, em todos
   os contextos, exceto onde explicitamente queremos fundo escuro
   (login screen, sidebar dropdowns).
   ══════════════════════════════════════════════════════════════ */

/* ── Base: todos os inputs em fundo claro têm texto escuro ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input:not([type]),
select,
textarea {
  color: #0c1a27 !important;        /* preto suave, legível */
  background-color: #ffffff !important;
  -webkit-text-fill-color: #0c1a27 !important;  /* iOS Safari */
  caret-color: #15569e;
}

/* ── Placeholder ── */
input::placeholder,
textarea::placeholder {
  color: #6b8aa3 !important;
  opacity: 1 !important;
}

/* ── Autofill (Chrome/Safari pintam o fundo amarelo+texto branco) ── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #0c1a27 !important;
  caret-color: #15569e;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Excepção: apenas topbar-search continua com texto claro
   (login agora usa o esquema universal: texto escuro em fundo branco
   para máxima legibilidade — corrige "letras invisíveis"). ──
   Forçamos explicitamente os inputs do login a usar texto escuro
   sobre fundo branco para sobrepor qualquer regra anterior. */
#login-screen input[type="text"],
#login-screen input[type="email"],
#login-screen input[type="password"],
#login-screen input[type="tel"],
#login-screen input[type="number"],
#login-screen input:not([type]) {
  color: #0c1a27 !important;
  -webkit-text-fill-color: #0c1a27 !important;
  background-color: #ffffff !important;
  caret-color: #15569e !important;
}
#login-screen input::placeholder {
  color: #6b8aa3 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #6b8aa3 !important;
}
#login-screen input:-webkit-autofill,
#login-screen input:-webkit-autofill:hover,
#login-screen input:-webkit-autofill:focus,
#login-screen input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #0c1a27 !important;
  caret-color: #15569e !important;
}

.topbar-search-input {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background-color: rgba(255,255,255,.10) !important;
}
.topbar-search-input::placeholder {
  color: rgba(255,255,255,.55) !important;
}

/* ── Modo escuro do SO: respeita, mas garante visibilidade ── */
@media (prefers-color-scheme: dark) {
  /* Em modais e formulários da app que mantém o tema claro,
     forçamos os inputs a continuar legíveis com texto escuro. */
  .modal-box input,
  .modal-box select,
  .modal-box textarea,
  .form-input,
  .form-select,
  .form-textarea,
  .field-input {
    color: #0c1a27 !important;
    -webkit-text-fill-color: #0c1a27 !important;
    background-color: #f7fafc !important;
  }
  .modal-box input::placeholder,
  .form-input::placeholder,
  .form-textarea::placeholder,
  .field-input::placeholder {
    color: #6b8aa3 !important;
  }
}

/* ── Editor de portal (contenteditable em modo edição) ── */
body.edit [data-edit] {
  color: inherit;
  background-color: rgba(249,115,22,.04);
}

/* ── Disabled / readonly: cinza claro mas texto ainda visível ── */
input:disabled,
textarea:disabled,
select:disabled,
input:read-only,
textarea:read-only {
  color: #4a6378 !important;
  -webkit-text-fill-color: #4a6378 !important;
  background-color: #f0f4f9 !important;
  cursor: not-allowed;
  opacity: 1;
}

/* ── checkbox/radio: garante a marca visível ── */
input[type="checkbox"],
input[type="radio"] {
  accent-color: #15569e;
}
