:root {
    --primary: #0f172a; --accent: #2563eb; --bg-page: #f1f5f9; --bg-column: #f2f2f2;
    --subpraca-bg: #334155; --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-page); 
    color: #334155; 
    letter-spacing: -0.01em; 
    margin: 0; 
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow-x: hidden; /* ISSO MATA O SCROLL LATERAL DA PÁGINA */
}

#global-loader { 
    position: fixed; inset: 0; background: white; 
    z-index: 99999 !important; 
    display: flex; align-items: center; justify-content: center; flex-direction: column;
}

.loading-overlay { 
    position: fixed; inset: 0; 
    background: rgba(255, 255, 255, 0.85); 
    backdrop-filter: blur(2px); 
    z-index: 9000; 
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 1rem; 
}

/* ============================================================
   HEADER E NAVEGAÇÃO
   ============================================================ */
header { background: #fff; }

.nav-btn { 
    font-size: 11px; 
    font-weight: 800; 
    color: #64748b; 
    /* Fundo azul fica pequeno no mobile */
    padding: 8px 12px; 
    border-radius: 10px; 
    transition: all 0.2s ease; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    text-align: left; 
    width: 100%;
}

@media (min-width: 768px) { 
    .nav-btn { 
        text-align: center; 
        font-size: 13px; /* Aumenta a letra */
        font-weight: 800;
        width: auto;
        letter-spacing: 0.05em;

        /* --- A MÁGICA ESTÁ NESTAS DUAS LINHAS --- */
        /* 1. Padding fino: garante que o fundo azul fique pequeno, igual ao SAIR */
        padding: 8px 16px; 

        /* 2. Margin grande: cria espaço invisível em cima e embaixo, 
              fazendo a nav ficar com a altura que você queria (larga) */
        margin: 12px 6px; 
    } 
}

.nav-btn:hover { 
    background: #f1f5f9; 
    color: #1e293b; 
}
.nav-btn.active { 
    color: var(--accent); 
    background: #eff6ff; 
}

/* Botão SAIR intacto */
.btn-sair { 
    font-size: 10px; 
    font-weight: 800; 
    padding: 8px 12px; 
    color: #ef4444; 
    border: 1px solid #fee2e2; 
    border-radius: 8px; 
    transition: 0.2s; 
    text-transform: uppercase; 
}
.btn-sair:hover { 
    background: #fef2f2; 
    border-color: #fecaca; 
}

/* ============================================================
   MOBILE-FIRST ESCALAS (CARROSSEL) E FILTROS
   ============================================================ */
.filter-bar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 8px 1rem; flex-wrap: wrap; gap: 10px; min-height: 60px; position: relative; z-index: 10; transition: opacity 0.3s; }

.filter-select { 
        height: 40px; 
        font-size: 11px; 
        font-weight: 800; 
        border: 1px solid #e2e8f0; 
        background: #f8fafc; 
        border-radius: 10px; 
        padding: 0 12px; 
        text-transform: uppercase; 
        outline: none; 
        cursor: pointer; 
        transition: 0.2s;
        appearance: none; 
        
        /* --- MOBILE: Divide o espaço por igual e respeita o botão --- */
        flex: 1 1 120px;
        min-width: 120px;
        
        /* Proteção do texto (não quebra linha, mostra ...) */
        white-space: nowrap; 
        overflow: hidden;    
        text-overflow: ellipsis; 
    }

    /* --- DESKTOP: Trava nos 220px definitivos --- */
    @media (min-width: 768px) {
        .filter-select {
            flex: none; /* Desativa a divisão do mobile */
            width: 220px; /* Crava a largura */
        }
    }
.filter-select:focus { border-color: var(--accent); background: white; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* --- BOTÃO DO OLHO --- */
    .eye-btn {
        height: 40px; 
        width: 40px; 
        display: flex; 
        align-items: center; 
        justify-content: center;
        border-radius: 10px; 
        border: 1px solid #e2e8f0; 
        background: white; 
        color: #64748b; 
        transition: 0.2s;
        flex-shrink: 0; /* Isso impede que ele amasse e perca o formato quadrado */
    }
    .eye-btn.active { 
        color: var(--accent); 
        background: #eff6ff; 
        border-color: #dbeafe; 
    }

/* --- BARRA DE ESTADOS (Mesma altura dos outros elementos) --- */
    .region-toggle { 
        display: flex; 
        background: #f1f5f9; 
        padding: 4px; 
        border-radius: 10px; /* Igual ao olho e select */
        border: 1px solid #e2e8f0; 
        height: 40px;        /* CRAVADO: Mesma altura exata do olho */
        align-items: center;
    }

    /* --- BOTÕES DE CADA ESTADO --- */
    .region-btn { 
        height: 100%; /* Estica para preencher a altura da barra */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 10px;     /* Menos largo no celular */
        font-size: 11px;     /* Letra levemente maior */
        font-weight: 800; 
        border-radius: 6px; 
        transition: 0.2s; 
    }

    /* No desktop, ganha mais respiro lateral */
    @media (min-width: 640px) { 
        .region-btn { 
            padding: 0 16px; 
            font-size: 12px; 
        } 
    }

    .region-btn.active { 
        background: #fff; 
        box-shadow: 0 1px 2px rgba(0,0,0,0.1); 
        color: var(--accent); 
    }

/* Lógica do Grid: Swipe no Mobile e Rolagem Oculta */
.week-grid::-webkit-scrollbar { display: none; }
.week-grid { 
    display: flex; 
    overflow-x: auto; 
    overflow-y: hidden;
    scroll-snap-type: x mandatory; 
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none; /* IE e Edge */
    scrollbar-width: none; /* Firefox */
    gap: 16px; 
    padding: 16px; 
    height: 100%;
}

.day-column { 
    flex: 0 0 85vw; 
    scroll-snap-align: center; 
    background: #f8fafc; 
    display: flex; 
    flex-direction: column; 
    border-radius: 16px; 
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    max-height: calc(100vh - 180px); /* Garante que caiba na tela do celular */
    overflow: hidden; /* Corta o que sobrar nas bordas arredondadas */
}

/* Header Fixo da Coluna do Dia */
.day-header { 
    padding: 12px; 
    text-align: center; 
    background: white; 
    border-bottom: 1px solid #e2e8f0; 
    display: flex; flex-direction: column; gap: 4px; 
    flex-shrink: 0; 
    z-index: 10;
}
.day-header.today { background: #eff6ff; border-bottom: 2px solid #3b82f6; }

/* Área de Rolagem Interna do Dia */
.day-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Grid Lógica para Desktop (Acima de 1024px) */
@media (min-width: 1024px) {
    .week-grid { 
        display: grid; 
        grid-template-columns: repeat(7, minmax(250px, 1fr)); 
        gap: 1px; 
        background: #e2e8f0; 
        border: 1px solid #e2e8f0; 
        padding: 0; 
        scroll-snap-type: none; 
        height: auto;
        overflow-x: visible;
    }
    .day-column { 
        flex: unset;
        border-radius: 0; 
        border: none;
        box-shadow: none;
        background: var(--bg-column);
        max-height: 85vh; /* Limita a altura no PC para gerar a rolagem interna */
    }
    .day-header { border-radius: 0; }
}

/* ============================================================
   CARDS DA ESCALA E MÉTRICAS
   ============================================================ */
.praca-badge { background: var(--subpraca-bg); color: #fff; margin: 16px 10px 6px 10px; padding: 6px 10px; border-radius: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.praca-badge svg { width: 12px !important; height: 12px !important; min-width: 12px; opacity: 0.8; }

.card-entry { 
    background: #fff; 
    margin: 12px 12px 0 12px; 
    padding: 16px; 
    border-radius: 12px; 
    border: 1px solid #e2e8f0; 
    box-shadow: 0 2px 4px -1px rgba(0,0,0,0.05); 
    transition: all 0.2s; 
}
.card-entry.is-dimmed { opacity: 0.4; filter: grayscale(1); border: 1px dashed #cbd5e1; }

.label-micro { font-size: 9px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; }
.value-main { font-size: 13px; font-weight: 700; color: #1e293b; text-align: center; }

.internal-metrics { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    margin-top: 14px; 
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}
.metric-box { display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; }

.guaranteed-footer { margin: 14px -16px -16px -16px; padding: 12px 16px; background: #f8fafc; border-top: 1px solid #e2e8f0; border-radius: 0 0 12px 12px; display: flex; justify-content: space-between; align-items: center; }
.guaranteed-val { font-size: 14px; font-weight: 800; color: #16a34a; }

/* Outros Globais Genéricos */
.desktop-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hidden { display: none !important; }

/* Scroll customizado fina (aplicado na .day-content e popups) */
.custom-scroll::-webkit-scrollbar { width: 4px; }
.custom-scroll::-webkit-scrollbar-track { background: #f1f5f9; }
.custom-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-container { background: #f8fafc; padding: 1.5rem; }
.dash-wide-container { width: 95%; max-width: 95%; margin: 0 auto; }
.dash-card { background: #fff; padding: 2rem; border-radius: 1rem; border: 1px solid #e2e8f0; box-shadow: var(--card-shadow); display: flex; flex-direction: column; justify-content: space-between; height: 100%; transition: 0.3s; }
.dash-card:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.dash-title { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; color: #64748b; margin-bottom: 8px; }
.dash-value { font-size: 2rem; font-weight: 900; color: #0f172a; letter-spacing: -0.03em; }
.chart-container { background: #fff; padding: 24px; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: var(--card-shadow); height: 500px; margin-top: 32px; position: relative; }

/* ============================================================
   CALENDÁRIO FLATPICKR
   ============================================================ */
.flatpickr-calendar {
    font-family: 'Inter', sans-serif;
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    padding: 12px !important;
    width: 320px !important;
}
.flatpickr-months { align-items: center; margin-bottom: 10px; }
.flatpickr-months .flatpickr-month { height: 40px; overflow: visible; }
.flatpickr-current-month { font-size: 110%; display: flex; justify-content: center; align-items: center; padding-top: 0; }
.flatpickr-current-month .flatpickr-monthDropdown-months { appearance: none; -webkit-appearance: none; font-weight: 800 !important; font-size: 15px; color: #1e293b; background: transparent; border: none; padding: 0 5px; cursor: pointer; }
.flatpickr-current-month .flatpickr-monthDropdown-months:hover { background: #f1f5f9; border-radius: 4px; }
.flatpickr-current-month input.cur-year { font-weight: 600 !important; color: #64748b; font-size: 15px; }
.flatpickr-current-month input.cur-year::-webkit-inner-spin-button, .flatpickr-current-month input.cur-year::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { top: 0px; padding: 10px; position: static; height: 30px; width: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: #f1f5f9; color: #2563eb; }
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { width: 12px; height: 12px; fill: #64748b; }
span.flatpickr-weekday { font-size: 10px; font-weight: 800; text-transform: uppercase; color: #94a3b8 !important; margin-bottom: 4px; }
.flatpickr-day { border-radius: 8px !important; font-weight: 600; color: #334155; border: 1px solid transparent !important; margin-top: 4px; }
.flatpickr-day:hover, .flatpickr-day:focus { background: #eff6ff !important; border-color: #dbeafe !important; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: #2563eb !important; border-color: #2563eb !important; color: white !important; font-weight: 800; box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3); }
.flatpickr-day.flatpickr-disabled { color: #cbd5e1 !important; cursor: not-allowed; }

/* ============================================================
   ESTILOS DA SIDEBAR (Faturas/Documentos)
   ============================================================ */
.sidebar-item { padding: 10px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: 0.2s; }
.sidebar-item:hover { background: #f8fafc; }
.sidebar-group-title { font-size: 11px; font-weight: 800; color: #334155; text-transform: uppercase; margin-bottom: 4px; }
.sidebar-file-link { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #64748b; padding: 6px 0; text-decoration: none; border-top: 1px solid #f8fafc; }
.sidebar-file-link:hover { color: var(--accent); }
.sidebar-file-link.is-cancelled { text-decoration: line-through; opacity: 0.5; color: #94a3b8; pointer-events: none; }
.invoice-count-badge { background: #e2e8f0; color: #475569; font-size: 9px; padding: 1px 6px; border-radius: 99px; }

/* ============================================================
   MAPA E LEAFLET
   ============================================================ */
#map-container { background: #e2e8f0; }

.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    padding: 0 !important;
    overflow: hidden;
}
.leaflet-popup-content { margin: 0 !important; width: 260px !important; }
.leaflet-popup-tip { background: white; }
.map-popup-header { background: #f8fafc; padding: 10px 14px; border-bottom: 1px solid #e2e8f0; }
.map-popup-coords { font-size: 9px; font-weight: 800; color: #94a3b8; letter-spacing: 0.05em; margin-bottom: 2px; }
.map-popup-count { font-size: 10px; font-weight: 700; color: #2563eb; background: #eff6ff; padding: 2px 6px; border-radius: 4px; display: inline-block; }
.map-popup-list { max-height: 150px; overflow-y: auto; padding: 0; }
.map-popup-item { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.map-popup-item:last-child { border-bottom: none; }
.map-item-name { font-size: 12px; font-weight: 700; color: #1e293b; line-height: 1.2; }
.map-item-group { font-size: 9px; font-weight: 600; color: #64748b; text-transform: uppercase; margin-top: 2px; }
.map-item-status { font-size: 8px; font-weight: 800; text-transform: uppercase; padding: 1px 4px; border-radius: 3px; margin-top: 4px; display: inline-block; }
.status-ativo { background: #dcfce7; color: #166534; }
.status-inativo { background: #fee2e2; color: #991b1b; }

.custom-pin { background: transparent; border: none; }
.pin-body {
    background-color: #ef4444; 
    width: 36px; height: 36px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
    position: relative;
    top: -15px; left: -5px;
}
.pin-icon { transform: rotate(45deg); color: white; width: 18px; height: 18px; }
.pin-body::after {
    content: ''; width: 10px; height: 4px;
    background: rgba(0,0,0,0.2);
    position: absolute; bottom: -6px; left: 2px;
    border-radius: 50%; transform: rotate(45deg); filter: blur(2px);
}

.popup-simple-header { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.popup-title-lg { font-size: 16px; font-weight: 900; color: #1e293b; margin-bottom: 4px; display: flex; align-items: center; }
.popup-addr { font-size: 12px; color: #64748b; font-weight: 600; line-height: 1.4; }
.popup-list-item { padding: 10px 16px; border-bottom: 1px solid #f8fafc; font-size: 13px; font-weight: 700; color: #334155; display: flex; align-items: center; gap: 8px; }
.popup-list-item::before { content: ''; width: 4px; height: 4px; background: #ef4444; border-radius: 50%; }

.map-list-card { padding: 12px; border: 1px solid #f1f5f9; border-radius: 8px; background: #fff; cursor: pointer; transition: all 0.2s; border-left: 3px solid transparent; }
.map-list-card:hover { background: #f8fafc; border-color: #e2e8f0; transform: translateX(2px); }
.map-list-card.active-pin { border-left-color: #ef4444; background: #fef2f2; }
.ml-title { font-size: 13px; font-weight: 800; color: #1e293b; margin-bottom: 3px; line-height: 1.2; }
.ml-sub { font-size: 11px; color: #64748b; font-weight: 600; }
.ml-tag { display: inline-block; font-size: 10px; font-weight: 800; color: #94a3b8; background: #f1f5f9; padding: 3px 8px; border-radius: 4px; margin-top: 6px; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin-anim { animation: spin 1s linear infinite; }

/* ============================================================
   GARANTIDO: LAYOUT "AUDITORIA DE ESCALA"
   ============================================================ */
#sec-garantido { height: 100% !important; overflow-y: auto !important; padding: 20px; background-color: #f1f5f9; }

.garantido-wrapper { background: #ffffff !important; border-radius: 16px; border: 1px solid #cbd5e1; margin-bottom: 40px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); display: flex; flex-direction: column; overflow: visible !important; }
.garantido-header { background: #0f172a; padding: 12px 24px; border-radius: 15px 15px 0 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #334155; }
.garantido-header h2 { color: #fff; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }
.date-badge { background: #2563eb; color: #fff; padding: 4px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; border: 1px solid rgba(255, 255, 255, 0.2); }

.shift-section { border-bottom: 4px solid #f1f5f9; display: flex; flex-direction: column; }
.shift-section:last-child { border-bottom: none; border-radius: 0 0 16px 16px; }

.shift-rules-bar { background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.shift-identity { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.shift-name-tag { background: #2563eb; color: #fff; font-size: 11px; font-weight: 900; text-transform: uppercase; padding: 6px 12px; border-radius: 6px; box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2); }
.shift-time { font-size: 12px; font-weight: 700; color: #475569; background: #e2e8f0; padding: 5px 10px; border-radius: 4px; }
.shift-metas-container { display: flex; align-items: center; justify-content: flex-end; gap: 24px; flex-wrap: wrap; }

.meta-box { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 16px; border-right: 1px solid #e2e8f0; border-left: none; }
.meta-box:last-child { border-right: none; }
.meta-box[style*="border-left"] { padding-left: 16px !important; padding-right: 16px !important; text-align: center !important; align-items: center !important; }
.mb-label { font-size: 9px; font-weight: 800; color: #94a3b8; text-transform: uppercase; margin-bottom: 2px; letter-spacing: 0.05em; }
.mb-value { font-size: 13px; font-weight: 800; color: #1e293b; }
.text-money { color: #16a34a; font-size: 14px; }

.courier-grid { padding: 15px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; background: #fff; }

.courier-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px; background: #fff; display: flex; flex-direction: column; gap: 8px; position: relative; }
.courier-card.status-ok { border-left: 4px solid #22c55e; }
.courier-card.status-err { border-left: 4px solid #ef4444; }
.courier-card.status-nv { border-left: 4px solid #94a3b8; }

.cc-header { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.cc-name { font-size: 13px; font-weight: 900; color: #1e293b; text-transform: uppercase; line-height: 1.3; }
.cc-cpf { font-size: 11px; color: #94a3b8; font-family: monospace; font-weight: 700; }

.cc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid #f1f5f9; }
.cm-box { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cm-l { font-size: 9px; font-weight: 800; color: #64748b; margin-bottom: 2px; }
.cm-v { font-size: 15px; font-weight: 900; }

.v-gr { color: #16a34a; } .v-rd { color: #dc2626; } .v-or { color: #f97316; } .v-bl { color: #2563eb; } .v-yw { color: #eab308; } 

.cc-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #f1f5f9; padding-top: 6px; }
.res-badge { font-size: 9px; font-weight: 900; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; }
.res-ok { background: #dcfce7; color: #15803d; } .res-err { background: #fee2e2; color: #991b1b; } .res-nv { background: #f1f5f9; color: #475569; }
.res-money { font-size: 16px; font-weight: 900; color: #0f172a; }

.diagnostic-row { margin-bottom: 8px; display: flex; justify-content: flex-start; }
.alert-pill { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em; width: 100%; text-align: center; }
.alert-red { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }  
.alert-orange { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; } 
.alert-purple { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; } 
.alert-blue { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }  
.alert-green { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; } 
.alert-gray { background: #f1f5f9; color: #64748b; }

.garantido-wrapper * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ============================================================
   SEGURANÇA E BLOQUEIOS
   ============================================================ */
#watermark-container { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9998; pointer-events: none; opacity: 0.08; display: none; }
.security-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: white; z-index: 1000000; align-items: center; justify-content: center; color: #000; }
.overlay-box { border: 3px solid #000; padding: 40px; text-align: center; max-width: 600px; }
.overlay-info { text-align: left; margin: 20px 0; padding: 15px; background: #f0f0f0; border-radius: 8px; font-family: monospace; }
.audit-msg { color: #d32f2f; font-weight: bold; text-transform: uppercase; }
.security-toast { position: fixed; top: -100px; left: 50%; transform: translateX(-50%); background-color: #d32f2f; color: white; padding: 12px 24px; border-radius: 4px; font-weight: bold; z-index: 10001; transition: top 0.4s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.security-toast.show { top: 20px; }

@media print { body { display: none !important; } }

/* ============================================================
   LAYOUT SIMÉTRICO DA BARRA DE FILTROS
   ============================================================ */
.filter-bar-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 
        "states actions"
        "date date"
        "selects selects";
    gap: 12px;
    align-items: center;
    width: 100%;
}

.fb-states { grid-area: states; display: flex; width: 100%; }
.fb-actions { grid-area: actions; display: flex; gap: 8px; justify-content: flex-end; }
.fb-date { grid-area: date; display: flex; justify-content: center; width: 100%; }
.fb-selects { grid-area: selects; display: flex; gap: 8px; width: 100%; }

/* Mobile: Força os botões de estado a dividirem o espaço igualitário */
.fb-states .region-toggle button { flex: 1; }

/* Desktop (Acima de 1024px) */
@media (min-width: 1024px) {
    .filter-bar-wrapper {
        display: flex;
        flex-direction: row;
        position: relative;
        justify-content: space-between;
    }
    
    .fb-states { order: 1; width: auto; }
    .fb-states .region-toggle { width: auto; justify-content: flex-start; }
    .fb-states .region-toggle button { flex: none; }
    
    /* MÁGICA: O Calendário sai do fluxo flex e fica cravado no meio da tela */
    .fb-date {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
    }
    
    /* MÁGICA 2: Selects empurrados para a direita, colados nas ações */
    .fb-selects { order: 2; margin-left: auto; width: auto; }
    .fb-actions { order: 3; }
}
@media (max-width: 767px) {
          #map-sidebar {
            height: 80vh;
            z-index: 100;
            box-shadow: 0 -15px 40px -15px rgba(0,0,0,0.3);
          }
        }
        /* ============================================================
   ANIMAÇÕES E ESTILOS DO LOGIN
   ============================================================ */
.animated-bg {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}
.animate-blob {
    animation: blob 7s infinite;
}
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.animate-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

input.edit-input-small::-webkit-outer-spin-button,
input.edit-input-small::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none; /* Adicionado para tirar o erro */
  margin: 0;
}

input.edit-input-small[type=number] {
  -moz-appearance: textfield;
  appearance: textfield; /* Adicionado para tirar o erro */
}

/* Classes dinâmicas para o fundo dos cards */
.weather-card {
    transition: all 0.5s ease;
    background-size: 200% 200%;
    color: white !important; /* Força o texto para branco para dar contraste */
    text-shadow: 0px 1px 3px rgba(0,0,0,0.5); /* Sombra no texto para leitura fácil */
}

/* ☀️ DIA LIMPO: Azul claro com animação sutil */
.w-clear-day {
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    animation: drift 10s ease infinite;
}
/* 🌙 NOITE LIMPA: Azul escuro profundo */
.w-clear-night {
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

/* ☁️ NUBLADO DIA: Tons de cinza claro/azulado */
.w-clouds-day {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    animation: drift 8s ease infinite;
}
/* ☁️ NUBLADO NOITE: Cinza bem escuro */
.w-clouds-night {
    background: linear-gradient(135deg, #334155, #1e293b);
}

/* 🌧️ CHUVA DIA/NOITE: Adiciona animação de chuva caindo no fundo */
@keyframes rainDropBg {
    0% { background-position: 0% 0%; }
    100% { background-position: 20% 100%; }
}
.w-rain-day {
    background: linear-gradient(to bottom, rgba(71, 85, 105, 0.9), rgba(51, 65, 85, 0.9)), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="20" opacity="0.2"><line x1="5" y1="0" x2="0" y2="20" stroke="white" stroke-width="1"/></svg>');
    animation: rainDropBg 0.5s linear infinite;
}
.w-rain-night {
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.9)), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="20" opacity="0.15"><line x1="5" y1="0" x2="0" y2="20" stroke="white" stroke-width="1"/></svg>');
    animation: rainDropBg 0.5s linear infinite;
}

@keyframes drift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animação para o pino do mapa */
@keyframes pulseRain {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}
.pin-chuva-animado {
    animation: pulseRain 2s infinite;
}

/* Animação para o card na listagem lateral */
@keyframes rainDrop {
    0% { transform: translateY(-2px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(4px); opacity: 0; }
}
.icone-gota {
    animation: rainDrop 1.5s infinite linear;
}