/* ── Dark mode overrides ───────────────────────────────────────── */

/* Base */
html.dark body { background-color: #0f0f1a !important; color: #e5e7eb; }

/* Fundos sólidos Tailwind */
html.dark .bg-blue-100   { background-color: rgba(26, 26, 60, 0.9) !important; }
html.dark .bg-blue-50    { background-color: rgba(20, 25, 55, 0.4) !important; }
html.dark .bg-indigo-50  { background-color: rgba(25, 20, 55, 0.4) !important; }
html.dark .bg-gray-50    { background-color: rgba(18, 18, 35, 0.9) !important; }
html.dark .bg-gray-100   { background-color: rgba(22, 22, 42, 0.9) !important; }
html.dark .bg-slate-50   { background-color: rgba(18, 18, 35, 0.9) !important; }
html.dark .bg-purple-50  { background-color: rgba(25, 15, 50, 0.4) !important; }
html.dark .bg-green-50   { background-color: rgba(6, 30, 20, 0.4) !important; }
html.dark .bg-red-50     { background-color: rgba(40, 10, 10, 0.4) !important; }
html.dark .bg-pink-50    { background-color: rgba(40, 10, 25, 0.4) !important; }
html.dark .bg-emerald-50 { background-color: rgba(5, 30, 20, 0.4) !important; }
html.dark .bg-rose-50    { background-color: rgba(40, 10, 15, 0.4) !important; }

/* Variáveis de gradiente Tailwind (from-* / to-*) */
html.dark .from-gray-50    { --tw-gradient-from: #111827 !important; }
html.dark .from-blue-50    { --tw-gradient-from: #0f172a !important; }
html.dark .from-slate-50   { --tw-gradient-from: #0f172a !important; }
html.dark .from-indigo-50  { --tw-gradient-from: #1e1b4b !important; }
html.dark .from-purple-50  { --tw-gradient-from: #1e1b4b !important; }
html.dark .from-green-50   { --tw-gradient-from: #022c22 !important; }
html.dark .from-red-50     { --tw-gradient-from: #450a0a !important; }
html.dark .from-pink-50    { --tw-gradient-from: #3b0764 !important; }
html.dark .from-rose-50    { --tw-gradient-from: #450a0a !important; }
html.dark .from-emerald-50 { --tw-gradient-from: #022c22 !important; }
html.dark .to-blue-50      { --tw-gradient-to: #0f172a !important; }
html.dark .to-blue-100     { --tw-gradient-to: #0f172a !important; }
html.dark .to-indigo-50    { --tw-gradient-to: #1e1b4b !important; }
html.dark .to-gray-100     { --tw-gradient-to: #111827 !important; }
html.dark .to-pink-50      { --tw-gradient-to: #3b0764 !important; }
html.dark .to-emerald-50   { --tw-gradient-to: #022c22 !important; }
html.dark .to-rose-50      { --tw-gradient-to: #450a0a !important; }
html.dark .to-green-100    { --tw-gradient-to: #022c22 !important; }
html.dark .to-red-100      { --tw-gradient-to: #450a0a !important; }

/* Textos Tailwind adicionais */
html.dark .text-gray-900  { color: #f9fafb !important; }
html.dark .text-blue-700  { color: #93c5fd !important; }
html.dark .text-blue-900  { color: #bfdbfe !important; }
html.dark .text-indigo-900 { color: #c7d2fe !important; }
html.dark .text-indigo-600 { color: #a5b4fc !important; }
html.dark .text-blue-600  { color: #93c5fd !important; }

/* Bordas claras Tailwind */
html.dark .border-blue-100   { border-color: rgba(59, 130, 246, 0.2) !important; }
html.dark .border-blue-200   { border-color: rgba(59, 130, 246, 0.3) !important; }
html.dark .border-indigo-100 { border-color: rgba(99, 102, 241, 0.2) !important; }
html.dark .border-indigo-200 { border-color: rgba(99, 102, 241, 0.3) !important; }
html.dark .border-green-100  { border-color: rgba(34, 197, 94, 0.2) !important; }
html.dark .border-purple-100 { border-color: rgba(168, 85, 247, 0.2) !important; }
html.dark .border-red-100    { border-color: rgba(239, 68, 68, 0.2) !important; }

html.dark .gradient-bg {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
}

html.dark .glass-effect {
    background: rgba(15, 15, 30, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark .floating-card {
    background: rgba(20, 20, 40, 0.97);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.4);
}

html.dark .filter-section {
    background: rgba(20, 20, 40, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark .modal-modern {
    background: rgba(20, 20, 40, 0.98);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark .input-modern {
    background: rgba(30, 30, 55, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e5e7eb;
}

html.dark .input-modern:focus {
    background: rgba(40, 40, 70, 1);
    border-color: #667eea;
}

/* Cor base dos containers — cobre células sem classe de cor */
html.dark .floating-card,
html.dark .filter-section,
html.dark .modal-modern,
html.dark .stats-card { color: #e5e7eb; }

/* Stats cards (financeiro) */
html.dark .stats-card {
    background: rgba(20, 20, 40, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4) !important;
}

/* Tabela */
html.dark .table-row {
    background: rgba(25, 25, 45, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: #e5e7eb;
}

html.dark .table-row:hover {
    background: rgba(35, 35, 60, 0.95) !important;
    filter: brightness(1.1);
}

/* Textos Tailwind */
html.dark .text-gray-800 { color: #f3f4f6 !important; }
html.dark .text-gray-700 { color: #e5e7eb !important; }
html.dark .text-gray-600 { color: #9ca3af !important; }
html.dark .text-gray-500 { color: #6b7280 !important; }
html.dark .text-gray-400 { color: #6b7280 !important; }

/* Fundos Tailwind */
html.dark .bg-white       { background-color: rgba(20, 20, 40, 0.97) !important; }
html.dark .bg-indigo-100  { background-color: rgba(99, 102, 241, 0.25) !important; }
html.dark .bg-white\/20   { background: rgba(255, 255, 255, 0.08) !important; }

/* Cores de destaque */
html.dark .text-indigo-700 { color: #a5b4fc !important; }

/* Bordas */
html.dark .border-gray-100 { border-color: rgba(255, 255, 255, 0.07) !important; }
html.dark .border-gray-300 { border-color: rgba(255, 255, 255, 0.15) !important; }

/* Select options */
html.dark select option { background: #1a1a2e; color: #e5e7eb; }

/* Combustível - formulário de abastecimento */
html.dark .bg-amber-50    { background-color: rgba(40, 28, 5, 0.85) !important; }
html.dark .border-amber-200 { border-color: rgba(180, 120, 20, 0.35) !important; }

/* ── KPI Cards ────────────────────────────────────────────────── */
html.dark .kpi-card {
    background: rgba(20, 20, 40, 0.97) !important;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35) !important;
    color: #e5e7eb;
}
html.dark .kpi-info h3 { color: #6b7280 !important; }
html.dark .kpi-info p  { color: #f3f4f6 !important; }

/* ── Paginação ────────────────────────────────────────────────── */
html.dark .pagination-info { color: #6b7280 !important; }
html.dark .page-btn {
    background: rgba(30,30,55,0.9) !important;
    border-color: rgba(102,126,234,0.2) !important;
    color: #e5e7eb !important;
}
html.dark .page-btn.active {
    background: linear-gradient(135deg,#667eea,#764ba2) !important;
    color: white !important;
}

/* ── Formulários ───────────────────────────────────────────────── */
html.dark .floating-card input,
html.dark .floating-card input:focus,
html.dark .floating-card input:active,
html.dark .floating-card select,
html.dark .floating-card select:focus,
html.dark .floating-card textarea,
html.dark .floating-card textarea:focus,
html.dark .floating-card .form-control,
html.dark .floating-card .form-control:focus,
html.dark .floating-card .form-control:active {
    background: rgba(30, 30, 55, 0.9) !important;
    background-color: rgba(30, 30, 55, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e5e7eb !important;
    box-shadow: none !important;
}

/* Autofill do browser (Chrome/Edge/Safari) */
html.dark .floating-card input:-webkit-autofill,
html.dark .floating-card input:-webkit-autofill:hover,
html.dark .floating-card input:-webkit-autofill:focus,
html.dark .floating-card input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0px 1000px rgba(30, 30, 55, 0.95) inset !important;
    -webkit-text-fill-color: #e5e7eb !important;
    caret-color: #e5e7eb;
    transition: background-color 9999s ease-in-out 0s;
}

html.dark .floating-card input::placeholder,
html.dark .floating-card textarea::placeholder,
html.dark .floating-card .form-control::placeholder { color: #6b7280 !important; }

html.dark .floating-card label,
html.dark .floating-card .form-label { color: #d1d5db !important; }

html.dark .bg-yellow-100 {
    background-color: rgba(120, 80, 0, 0.25) !important;
    border-color: rgba(217, 119, 6, 0.5) !important;
    color: #fcd34d !important;
}
html.dark .text-yellow-700 { color: #fcd34d !important; }

html.dark .bg-red-100 {
    background-color: rgba(127, 29, 29, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
}
html.dark .text-red-700 { color: #fca5a5 !important; }

html.dark .bg-green-100 {
    background-color: rgba(6, 78, 59, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #6ee7b7 !important;
}
html.dark .text-green-700 { color: #6ee7b7 !important; }

/* ── Orçamento — botões ────────────────────────────────────────── */
html.dark .btn-modern {
    background: linear-gradient(135deg, rgba(102,126,234,0.65) 0%, rgba(118,75,162,0.65) 100%) !important;
    box-shadow: 0 4px 12px rgba(102,126,234,0.2) !important;
}

/* Botão de Fatura — cores dinâmicas respeitadas */
/* Removido: o botão de fatura precisa dos estilos inline para verde/vermelho */
html.dark .btn-success-modern {
    background: linear-gradient(135deg, rgba(16,185,129,0.65) 0%, rgba(5,150,105,0.65) 100%) !important;
    box-shadow: 0 4px 12px rgba(16,185,129,0.2) !important;
}
html.dark #gerarPDF {
    background: linear-gradient(135deg, rgba(219,39,119,0.65) 0%, rgba(190,24,93,0.65) 100%) !important;
}
html.dark .btn-modern:disabled {
    opacity: 0.3 !important;
}

/* ── Orçamento — caixa de resultado ───────────────────────────── */
html.dark #resultado {
    background: rgba(12, 28, 18, 0.97) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
    color: #a7f3d0 !important;
}
html.dark #resultado .alert-success {
    background: rgba(12, 28, 18, 0.97) !important;
    background-color: rgba(12, 28, 18, 0.97) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
    color: #a7f3d0 !important;
}
html.dark #resultado .alert-heading,
html.dark #resultado strong,
html.dark #resultado .fw-bold { color: #6ee7b7 !important; }
html.dark #resultado hr { border-color: rgba(16, 185, 129, 0.2) !important; }
html.dark #resultado .bg-yellow-50 {
    background-color: rgba(30, 22, 5, 0.85) !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
    color: #fcd34d !important;
}
html.dark #resultado .border-yellow-200 { border-color: rgba(245,158,11,0.25) !important; }

/* Toast dark */
html.dark .toast-success {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.92) 0%, rgba(5, 150, 105, 0.85) 100%);
    border-color: rgba(16, 185, 129, 0.45);
    color: #a7f3d0;
}
html.dark .toast-error {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.92) 0%, rgba(220, 38, 38, 0.85) 100%);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

/* ── Dashboard Timeline ─────────────────────────────────────── */
html.dark .toolbar {
    background: rgba(20, 20, 42, 0.98) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4) !important;
}
html.dark .toolbar label { color: #9ca3af !important; }
html.dark .toolbar input[type=date] {
    background: rgba(30, 30, 56, 0.9) !important;
    border-color: rgba(255,255,255,0.14) !important;
    color: #e5e7eb !important;
    color-scheme: dark;
}
html.dark .kpi {
    background: rgba(20, 20, 42, 0.98) !important;
    box-shadow: 0 4px 18px rgba(0,0,0,0.4) !important;
}
html.dark .kpi-lbl { color: #6b7280 !important; }

html.dark .legend {
    background: rgba(20, 20, 42, 0.98) !important;
    color: #9ca3af !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4) !important;
}
html.dark .legend strong { color: #6b7280 !important; }
html.dark .legend-item   { color: #9ca3af !important; }

html.dark .gantt-wrap {
    background: rgba(12, 12, 28, 1) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5) !important;
}
html.dark .gantt-head {
    border-bottom-color: rgba(255,255,255,0.07) !important;
}
html.dark .head-label {
    background: rgba(10, 10, 25, 1) !important;
    border-right-color: rgba(255,255,255,0.09) !important;
    color: #64748b !important;
}
html.dark .head-slots { background: rgba(10, 10, 25, 1) !important; }
html.dark .hour-tick.hora { color: #818cf8 !important; }
html.dark .hour-tick.meia { color: #4b5563 !important; }

/* Alternância de linhas — dark */
html.dark .gantt-row {
    border-bottom-color: rgba(255,255,255,0.04) !important;
}
html.dark .gantt-row.row-odd  { background: rgba(28, 28, 58, 0.97) !important; }
html.dark .gantt-row.row-even { background: rgba(16, 16, 38, 0.97) !important; }
html.dark .gantt-row.row-odd:hover  { background: rgba(42, 42, 78, 1) !important; }
html.dark .gantt-row.row-even:hover { background: rgba(32, 32, 64, 1) !important; }

html.dark .gantt-row.row-odd  .row-label { background: rgba(22, 22, 50, 1) !important; }
html.dark .gantt-row.row-even .row-label { background: rgba(12, 12, 30, 1) !important; }

html.dark .row-label {
    border-right-color: rgba(255,255,255,0.07) !important;
}
html.dark .row-label .name  { color: #f1f5f9 !important; }
html.dark .row-label .route { color: #64748b !important; }
html.dark .row-label .meta  { color: #475569 !important; }

html.dark .tooltip {
    background: #0f172a !important;
    box-shadow: 0 4px 28px rgba(0,0,0,0.65) !important;
}

/* ── Análise de Conflitos ───────────────────────────────────── */
html.dark .status-bar {
    background: rgba(20,20,42,0.98) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4) !important;
}
html.dark .conflict-panel {
    background: rgba(20,20,42,0.98) !important;
    box-shadow: 0 4px 18px rgba(0,0,0,0.4) !important;
}
html.dark .conflict-panel-header { background: rgba(20,20,42,0.98) !important; border-bottom-color: rgba(255,255,255,0.06) !important; }
html.dark .conflict-panel-header h2 { color: #f1f5f9 !important; }
html.dark .conflict-panel-header span[style*="color:#94a3b8"] { color: #64748b !important; }
html.dark .conflict-item { border-bottom-color: rgba(239,68,68,0.12) !important; }
html.dark .section-red    { background: rgba(127,29,29,0.18) !important; color: #fca5a5 !important; border-bottom-color: rgba(239,68,68,0.18) !important; }
html.dark .section-orange { background: rgba(120,53,15,0.18) !important; color: #fcd34d !important; border-bottom-color: rgba(245,158,11,0.18) !important; }
html.dark .conflict-desc { color: #94a3b8 !important; }
html.dark .conflict-time { background: rgba(127,29,29,0.4) !important; color: #fca5a5 !important; }
html.dark .conflict-time.gap { background: rgba(120,53,15,0.4) !important; color: #fcd34d !important; }
html.dark .no-conflict { color: #34d399 !important; }
html.dark .gantt-row.has-conflict { outline-color: rgba(239,68,68,0.4) !important; }
html.dark .gantt-row.has-gap      { outline-color: rgba(245,158,11,0.4) !important; }
html.dark .row-label .conflict-tag { color: #f87171 !important; }
html.dark .row-label .gap-tag      { color: #fbbf24 !important; }
html.dark .conflict-item.gap-item  { border-bottom-color: rgba(245,158,11,0.15) !important; }
