/* PROJETO CANGA TÁTICO - BOEPM 2.0 - ESTILOS REFATORADOS PARA MOBILE NATIVO */

/* === RESET E ESTRUTURA BASE === */
:root {
    /* Cores Canga Tático */
    --canga-dark: #111827;
    --canga-panel: #1F2937;
    --canga-accent: #F97316;
    --canga-red: #DC2626;
    --canga-cream: #FEF3C7;
    --canga-text: #D1D5DB;
    --canga-success: #059669;
    /* Safe Areas para iPhone 14 Pro e superiores */
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100dvh;
    /* Altura dinâmica real do viewport móvel */
    overflow: hidden;
    /* O corpo NUNCA rola, apenas o conteúdo interno */
    overflow-x: hidden !important;
    /* Garante que nunca role horizontalmente */
    background: var(--canga-dark);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overscroll-behavior-y: none;
    /* Previne efeito elástico no iOS */
    position: fixed;
    /* Trava o corpo para evitar o efeito "elástico" do iOS */
}

body {
    width: 100vw !important;
}

/* === PADRÃO TÁTICO DE FUNDO === */
.bg-tactical-pattern {
    background-image: radial-gradient(#374151 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.05;
}

/* === ANIMAÇÕES TÁTICAS === */
@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

.scan-effect {
    position: relative;
    overflow: hidden;
}

.scan-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20%;
    background: linear-gradient(to bottom, transparent, rgba(249, 115, 22, 0.2), transparent);
    animation: scanline 2s linear infinite;
    pointer-events: none;
}

.pulse-red {
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0% {
        box-shadow: inset 0 0 0 0 rgba(220, 38, 38, 0.7);
    }

    50% {
        box-shadow: inset 0 0 50px 10px rgba(220, 38, 38, 0.5);
    }

    100% {
        box-shadow: inset 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spinner {
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === CONTAINER PRINCIPAL === */
.app-container {
    width: 100vw;
    height: 100dvh;
    max-width: 100%;
    position: relative;
    background: white;
    overflow: hidden;
    z-index: 1;
    /* Garante que fica na frente do template PDF */
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .app-container {
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    }

    body {
        background: #1f2937;
        /* Fundo escuro no desktop */
        display: flex;
        justify-content: center;
        align-items: stretch;
    }
}

/* === TELAS (FLEXBOX VERTICAL) === */
/* Esta é a correção mágica para o layout */
.app-screen {
    position: absolute;
    inset: 0;
    /* Top, Right, Bottom, Left = 0 */
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* Organiza: Header -> Conteúdo -> Footer */
    background: var(--canga-dark);
    z-index: 10;
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
    padding-top: var(--safe-top);
    /* Respeita o topo (Dynamic Island) */
    padding-bottom: var(--safe-bottom);
    /* Respeita a barra home */
    overflow: hidden;
    /* O scroll deve ser interno */
}

.app-screen.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* === CABEÇALHOS (TOPO) === */
/* Flex-shrink: 0 impede que o header amasse quando o teclado abre */
.bids-header,
.home-header {
    flex-shrink: 0;
    width: 100%;
    z-index: 20;

    /* CORREÇÃO: calc() SOMA o entalhe + espaço extra (respiro visual) */
    padding-top: calc(var(--safe-top) + 1.5rem);
}

/* Fallback para navegadores antigos que não entendem safe-top */
@supports not (padding-top: env(safe-area-inset-top)) {

    .bids-header,
    .home-header {
        padding-top: 2rem;
    }
}

/* Desktop: não precisa calcular safe-area */
@media (min-width: 768px) {

    .bids-header,
    .home-header {
        padding-top: 1.5rem;
    }
}

.bids-header {
    background: linear-gradient(135deg, var(--canga-panel) 0%, var(--canga-dark) 100%);
    color: var(--canga-cream);
    padding-bottom: 1.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
    border-radius: 0 0 1.5rem 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    position: relative;
    border-bottom: 3px solid var(--canga-accent);
}

.bids-header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bids-header p {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.25rem;
    color: var(--canga-text);
}

.home-header {
    background: linear-gradient(135deg, var(--canga-panel) 0%, var(--canga-dark) 100%);
    color: var(--canga-cream);
    padding-bottom: 0.75rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: 0 0 1.25rem 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid var(--canga-accent);
}

/* Layout do Header Home */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

/* Botões de Ação no Header */
.header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-shrink: 0;
}

.action-btn-sm {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.action-btn-sm:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.action-btn-sm i {
    font-size: 0.85rem;
}

/* Botão de Configurar Equipe com Texto */
.btn-team-config {
    height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.btn-team-config:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.6);
}

.btn-team-config i {
    font-size: 0.85rem;
}

.btn-team-text {
    display: inline;
}

/* Badge de Alerta para Equipe Não Cadastrada */
.team-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid #1F2937;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6), 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-badge 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes pulse-badge {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6), 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    50% {
        box-shadow: 0 2px 12px rgba(239, 68, 68, 0.8), 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.team-badge i {
    font-size: 10px;
    animation: shake-badge 3s ease-in-out infinite;
}

@keyframes shake-badge {

    0%,
    100% {
        transform: rotate(0deg);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: rotate(-10deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: rotate(10deg);
    }
}

/* User Info no Header */
.user-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.6rem;
    font-weight: bold;
    font-size: 0.95rem;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.user-details {
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
}

.user-details h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-details p {
    font-size: 0.7rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Botão Voltar */
.back-btn {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-20%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 36px;
    height: 36px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-20%) scale(0.95);
}

/* Logo no Header */
.logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #F97316;
    font-size: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

/* === CONTEÚDO ROLÁVEL (MEIO) === */
/* Aqui está o segredo: flex: 1 faz ocupar todo espaço sobrando */
.wizard-content,
.bids-form,
#home-bo-list {
    flex: 1;
    overflow-y: auto;
    /* Scroll apenas aqui */
    overflow-x: hidden;
    padding: 1rem;
    padding-bottom: 6rem;
    /* Espaço extra para não cortar conteúdo no fim */

    /* Scroll Suave Nativo iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Scrollbar customizada */
.wizard-content::-webkit-scrollbar,
.bids-form::-webkit-scrollbar,
#home-bo-list::-webkit-scrollbar {
    width: 6px;
}

.wizard-content::-webkit-scrollbar-track,
.bids-form::-webkit-scrollbar-track,
#home-bo-list::-webkit-scrollbar-track {
    background: transparent;
}

.wizard-content::-webkit-scrollbar-thumb,
.bids-form::-webkit-scrollbar-thumb,
#home-bo-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Espaço extra para FAB na home */
#home-bo-list {
    padding-bottom: calc(5rem + var(--safe-bottom));
}

/* === STEPPER (BARRA DE PROGRESSO) === */
.wizard-stepper {
    flex-shrink: 0;
    /* Não encolhe */
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.5rem;
    z-index: 15;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wizard-stepper::-webkit-scrollbar {
    display: none;
}

.wizard-stepper>* {
    flex-shrink: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: pointer;
    position: relative;
    padding: 0 5px;
}

/* Aumenta área de toque */
.step::after {
    content: '';
    position: absolute;
    inset: -10px;
    z-index: 10;
}

.step.active,
.step.completed {
    opacity: 1;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 4px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
}

.step.active .step-number {
    background: linear-gradient(135deg, #F97316, #ea580c);
    color: white;
    border-color: #F97316;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.step.completed .step-number {
    background: linear-gradient(135deg, #10b981, #047857);
    color: white;
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.step-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #6b7280;
    text-align: center;
    max-width: 50px;
    line-height: 1.1;
}

.step.active .step-label {
    color: #F97316;
    font-weight: 700;
}

.step.completed .step-label {
    color: #10b981;
}

.step-line {
    height: 2px;
    width: 18px;
    min-width: 12px;
    max-width: 24px;
    background: #e5e7eb;
    margin: 0 0.15rem;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

.step-line.completed {
    background: linear-gradient(90deg, #10b981, #059669);
}

/* Animação do step ativo */
@keyframes stepPulse {

    0%,
    100% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.2);
    }
}

.step.active .step-number {
    animation: stepPulse 2s ease-in-out infinite;
}

/* === RODAPÉS (FUNDO) === */
.wizard-footer {
    position: sticky !important;
    bottom: 0 !important;
    flex-shrink: 0 !important;
    background: white !important;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    padding-bottom: max(0.75rem, var(--safe-bottom));
    display: flex !important;
    flex-direction: row;
    justify-content: space-between;
    gap: 0.75rem;
    z-index: 30 !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.wizard-footer button,
.wizard-footer .btn {
    flex: 1.5;
    padding: 0.65rem 1.5rem !important;
    min-height: 44px !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    max-width: none;
}

/* === COMPONENTES === */

/* Alerta de validação visual */
.validation-alert {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 2px solid #F59E0B;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    animation: alertPulse 2s ease-in-out infinite;
}

.validation-alert.hidden {
    display: none;
}

.validation-alert i {
    color: #D97706;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.validation-alert span {
    color: #92400E;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.4;
}

@keyframes alertPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
    }
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #374151;
    font-size: 0.9rem;
    letter-spacing: 0.025em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    font-size: 16px;
    /* CRÍTICO: Evita zoom no iPhone */
    background: #f9fafb;
    color: #1f2937;
    min-height: 50px;
    /* Área de toque */
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--canga-accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
    background: white;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.form-checkbox {
    margin-right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--canga-accent);
    transform: scale(1.2);
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f9fafb;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background: #f3f4f6;
}

/* Cards */
.bids-card {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.bids-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.info-card {
    background: linear-gradient(135deg, #FEF3C7, #fef3c7);
    border: 1px solid #fcd34d;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.warning-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.bo-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bo-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.bo-card:active {
    transform: scale(0.98);
    background: #f9fafb;
}

/* Botões */
.btn {
    padding: 0.9rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: scale(0.98);
    filter: brightness(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--canga-accent), #ea580c);
    color: white;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-secondary {
    background: linear-gradient(135deg, #374151, #1f2937);
    color: var(--canga-text);
    border: 1px solid #4b5563;
}

.btn-success {
    background: linear-gradient(135deg, var(--canga-success), #047857);
    color: white;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--canga-red), #b91c1c);
    color: white;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    min-height: 40px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* FAB (Botão Flutuante) */
.fab {
    position: absolute;
    /* Absolute relativo à Screen, não Fixed */
    bottom: calc(1.5rem + var(--safe-bottom));
    right: 1.5rem;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--canga-accent), #ea580c);
    color: white;
    border: 3px solid rgba(249, 115, 22, 0.3);
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.4), 0 0 15px rgba(249, 115, 22, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fab:active {
    transform: scale(0.9);
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(249, 115, 22, 0.6), 0 0 25px rgba(249, 115, 22, 0.4);
}

/* === CORREÇÃO DOS CARDS DO HEADER (STATS) === */

.stats-grid {
    display: grid;
    /* Força sempre 3 colunas de tamanho igual */
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    /* Espaço entre os quadrados */
    margin-top: 0.5rem;
    width: 100%;
}

.stat-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(249, 115, 22, 0.05));
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 12px;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;

    /* Configuração para centralizar o texto perfeitamente */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    /* Força o formato mais quadrado */
    aspect-ratio: 1 / 0.85;
    min-height: 70px;

    /* Padrão tático de fundo */
    background-image: radial-gradient(rgba(249, 115, 22, 0.1) 1px, transparent 1px);
    background-size: 15px 15px;
}

/* Garante que o número fique grande e visível */
.stat-number {
    display: block;
    font-weight: 800;
    font-size: 1.4rem;
    line-height: 1;
    margin-bottom: 0.2rem;
    color: white;
}

/* Ajusta o rótulo (LOCAL, DP, TOTAL) */
.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.9;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.9);
}

/* Estilo específico para o card TOTAL (destaque visual) */
.stat-card.total {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.25), rgba(249, 115, 22, 0.15));
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.2);
}

/* === MODAL (Estilo Bottom Sheet iOS/Android) === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    /* Alinha no fundo no mobile */
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 100%;
    border-radius: 1.5rem 1.5rem 0 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.2);
}

/* Puxador visual (gaveta) */
.modal-handle {
    width: 40px;
    height: 5px;
    background: #e5e7eb;
    border-radius: 100px;
    margin: 12px auto 5px auto;
    display: block;
}

/* Desktop: modal centralizado */
@media (min-width: 768px) {
    .modal {
        align-items: center;
    }

    .modal-content {
        max-width: 400px;
        border-radius: 1.5rem;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    }

    .modal-handle {
        display: none;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.close-btn {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    font-size: 1.25rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.modal-body-scroll,
.natureza-grid,
.unidade-grid {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    display: grid;
    gap: 0.5rem;
    min-height: 0;
}

.natureza-btn,
.unidade-btn {
    text-align: left;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Títulos de Grupos de Crimes */
.crime-category-title {
    grid-column: 1 / -1;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #1F2937, #111827);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crime-category-title:first-child {
    margin-top: 0;
}

.crime-category-title i {
    font-size: 1rem;
}

.natureza-btn:hover,
.unidade-btn:hover {
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    border-color: #F97316;
    transform: translateY(-1px);
}

.natureza-btn:active,
.unidade-btn:active {
    transform: scale(0.98);
    background: #ffedd5;
    border-color: #F97316;
    color: #ea580c;
}

/* Modal Footer */
.modal-footer {
    flex-shrink: 0;
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* === UTILITÁRIOS === */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.space-y-2>*+* {
    margin-top: 0.5rem;
}

.space-y-3>*+* {
    margin-top: 0.75rem;
}

.space-y-4>*+* {
    margin-top: 1rem;
}

/* Grid */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.auto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

/* Posicionamento */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

/* Texto */
.text-xs {
    font-size: 0.8rem;
    line-height: 1.125rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-base {
    font-size: 1rem;
    line-height: 1.5rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.italic {
    font-style: italic;
}

.uppercase {
    text-transform: uppercase;
}

/* Cores de texto */
.text-white {
    color: #ffffff;
}

.text-gray-400 {
    color: #9ca3af;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-800 {
    color: #1f2937;
}

.text-gray-900 {
    color: #111827;
}

.text-orange-600 {
    color: #ea580c;
}

.text-orange-700 {
    color: #F97316;
}

.text-green-600 {
    color: #059669;
}

.text-green-800 {
    color: #065f46;
}

.text-red-500 {
    color: #ef4444;
}

.text-red-600 {
    color: #dc2626;
}

.text-yellow-800 {
    color: #92400e;
}

/* Cores de fundo */
.bg-white {
    background-color: white;
}

.bg-gray-50 {
    background-color: #f9fafb;
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.bg-green-50 {
    background-color: #ecfdf5;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.bg-green-50 {
    background-color: #ecfdf5;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.bg-red-50 {
    background-color: #fef2f2;
}

.bg-orange-50 {
    background-color: #fff7ed;
}

.bg-orange-100 {
    background-color: #ffedd5;
}

.bg-orange-600 {
    background-color: #ea580c;
}

.border {
    border: 1px solid #e5e7eb;
}

.border-gray-100 {
    border-color: #f3f4f6;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.border-red-50 {
    border-color: #fef2f2;
}

.rounded {
    border-radius: 0.25rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-2xl {
    border-radius: 1rem;
}

.rounded-full {
    border-radius: 9999px;
}

/* Espaçamento */
.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-5 {
    padding: 1.25rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.pt-2 {
    padding-top: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

/* Opacidade */
.opacity-90 {
    opacity: 0.9;
}

.opacity-75 {
    opacity: 0.75;
}

/* Sombras */
.shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Largura */
.w-full {
    width: 100%;
}

.w-10 {
    width: 2.5rem;
}

.w-11\/12 {
    width: 91.666667%;
}

.h-10 {
    height: 2.5rem;
}

.max-w-sm {
    max-width: 24rem;
}

/* Transições */
.transition-all {
    transition-property: all;
    transition-duration: 200ms;
}

.transition-transform {
    transition-property: transform;
    transition-duration: 200ms;
}

.transition-colors {
    transition-property: background-color, border-color, color;
    transition-duration: 200ms;
}

.duration-300 {
    transition-duration: 300ms;
}

/* Transformações */
.transform {
    transform: translateX(0);
}

.scale-95 {
    transform: scale(0.95);
}

/* Overflow */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overflow-hidden {
    overflow: hidden;
}

/* Scrollbar escondida */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* === ANIMAÇÕES === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.bids-card,
.info-card,
.warning-card,
.bo-card {
    animation: fadeIn 0.3s ease-out;
}

/* === TOAST NOTIFICATION === */
#mobile-toast {
    position: fixed;
    top: max(1rem, var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    font-weight: 500;
    letter-spacing: 0.025em;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-green-600 {
    background: linear-gradient(135deg, #10b981, #047857) !important;
}

.bg-red-600 {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

.bg-gray-800 {
    background: linear-gradient(135deg, #1f2937, #111827) !important;
}

/* === COMPORTAMENTO DE TECLADO === */
/* Quando teclado abre, mantemos wizard-footer visível para facilitar navegação */
body.keyboard-open .wizard-footer {
    position: sticky;
    bottom: 0;
}

body.keyboard-open .fab {
    display: none;
}

body.keyboard-open .stats-grid {
    display: none;
}

body.keyboard-open .bids-header {
    padding-bottom: 1rem;
    border-radius: 0;
}

body.keyboard-open .home-header {
    padding-bottom: 0.5rem;
    border-radius: 0;
}

/* === RESPONSIVIDADE === */

/* Telas muito pequenas (iPhone SE) */
@media (max-width: 360px) {
    .header-actions {
        gap: 0.2rem;
    }

    .action-btn-sm {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
    }

    .action-btn-sm i {
        font-size: 0.75rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        min-width: 32px;
        margin-right: 0.4rem;
    }

    .user-details h3 {
        font-size: 0.85rem;
    }

    .user-details p {
        font-size: 0.65rem;
    }

    .stat-number {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.55rem;
    }

    .step {
        min-width: 48px;
    }

    .step-number {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }

    .step-label {
        font-size: 0.45rem;
    }

    .step-line {
        width: 10px;
    }
}

/* Telas pequenas */
@media (max-width: 400px) {

    .bids-form,
    .wizard-content {
        padding: 0.75rem;
    }

    /* wizard-footer mantém lado a lado em todas as telas */
    .wizard-footer {
        flex-direction: row !important;
        padding: 0.4rem 0.5rem;
    }

    /* stats-grid mantém 3 colunas em todas as telas */
}

/* Landscape */
@media (max-height: 450px) and (orientation: landscape) {
    .modal-content {
        max-height: 95dvh;
    }

    .bids-header,
    .home-header {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        border-radius: 0;
    }

    .stats-grid {
        display: none;
    }
}

/* Altura reduzida (teclado aberto) */
@media (max-height: 500px) {
    .home-header {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        border-radius: 0;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .stats-grid {
        display: none !important;
    }

    .fab {
        bottom: 1rem;
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
}

/* === ACTIVE STATES PARA TOUCH === */
.btn:active,
.bo-card:active,
.natureza-btn:active,
.unidade-btn:active,
.action-btn-sm:active,
.back-btn:active,
.fab:active {
    transform: scale(0.95);
}

/* === FOCUS STATES PARA ACESSIBILIDADE === */
.btn:focus-visible,
.form-input:focus-visible,
/* === FOCUS STATES PARA ACESSIBILIDADE === */
.btn:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
    outline: 2px solid var(--canga-accent);
    outline-offset: 2px;
}

/* Custom scrollbar styles */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* === FORÇAR CORREÇÃO DE LAYOUT (OVERRIDE FINAL) === */

/* 1. Corrige o topo cortado no iPhone/Android */
.bids-header,
.home-header {
    /* Garante espaço seguro + um extra para não colar no relógio */
    padding-top: calc(env(safe-area-inset-top) + 25px) !important;
    min-height: 100px;
    /* Garante altura mínima */
}

/* 2. Corrige os quadrados verticalizados (Força bruta) */
.home-header .stats-grid {
    display: grid !important;
    /* Divide em 3 colunas IGUAIS obrigatóriamente */
    grid-template-columns: 1fr 1fr 1fr !important;
    width: 100% !important;
    gap: 8px !important;
    margin-top: 10px !important;
}

/* Garante que o cartão seja um quadrado/retângulo em pé */
.home-header .stat-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: 82px !important;
    /* 50% maior que 55px */
    height: 75px !important;
    /* 50% maior que 50px */
    aspect-ratio: 1 / 0.9 !important;
    padding: 0.4rem !important;
}

/* Ajuste do tamanho da fonte para caber */
.home-header .stat-number {
    font-size: 1.35rem !important;
    /* 50% maior que 0.9rem */
    margin-bottom: 2px !important;
}

.home-header .stat-label {
    font-size: 0.68rem !important;
    /* 50% maior que 0.45rem */
}

/* ==========================================================================
   ESTILOS DO PDF - COPIADO EXATAMENTE DO HIPOTETICAOCORRENCIA.HTML
   ========================================================================== */

/* Header do PDF */
.pdf-header {
    background: #1e293b;
    color: white;
    padding: 25px 20px;
    border-bottom: 4px solid #f97316;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 20px;
    align-items: center;
}

.pdf-logo-container {
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pdf-title-section {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.pdf-title-section h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
    overflow-wrap: anywhere;
}

.pdf-title-section p {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 2px;
    overflow-wrap: anywhere;
}

.pdf-header-right {
    text-align: right;
    border-left: 1px solid #475569;
    padding-left: 20px;
    min-width: max-content;
}

.pdf-content {
    padding: 25px;
    background: white;
}

.pdf-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    box-sizing: border-box;
    width: 100%;
}

.pdf-info-item {
    flex: 1;
    min-width: 150px;
}

.pdf-info-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.pdf-info-value {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Grid para linha superior (Mike, Data, Viatura, Status) — deve ser 4 colunas */
.info-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Linha divisoria tracejada */
.info-divider {
    border-top: 1px dashed #cbd5e1;
    margin: 20px 0;
    width: 100%;
}

/* Classes de cor */
.text-orange {
    color: #f97316 !important;
}

.text-red {
    color: #dc2626 !important;
}

.pdf-section-title {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.pdf-section-title::before {
    content: '';
    background: #f97316;
    width: 6px;
    height: 18px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 2px;
}

.pdf-envolvido-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
    page-break-inside: avoid;
}

.pdf-envolvido-nome {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.pdf-envolvido-tipo {
    background: #1e293b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
}

.pdf-envolvido-info {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.pdf-objeto-item {
    border: 1px dashed #cbd5e1;
    padding: 10px;
    border-radius: 6px;
    background: #f8fafc;
    page-break-inside: avoid;
}

.pdf-objeto-tipo {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.pdf-objeto-desc {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.pdf-objeto-detalhe {
    font-size: 11px;
    color: #64748b;
}

.pdf-relato-box {
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    background: #fff;
    text-align: justify;
    font-size: 12px;
    line-height: 1.7;
    color: #334155;
}

.pdf-efetivo-item {
    padding: 6px 0;
    border-bottom: 1px dotted #e2e8f0;
    page-break-inside: avoid;
}

.pdf-footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 12px 20px;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 3px solid #f97316;
}

/* === CONTROLE DE QUEBRA DE PAGINA PARA PDF === */
.no-break {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    display: block !important;
}

/* Forcar background e cores na impressao */
@media print {

    .pdf-header,
    .pdf-footer,
    .pdf-info-box {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-content {
        background-color: #ffffff !important;
        color: #000000 !important;
    }

    .no-break {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}

/* === CLASSE DE FORCA BRUTA PARA O PDF === */
.pdf-force-light-mode {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 999999 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    width: 794px !important;
    height: auto !important;
    transform: none !important;
    margin: 0 !important;
    padding: 20px !important;
    box-shadow: none !important;
    overflow: visible !important;
}

/* Forca TODOS os textos dentro do PDF a serem pretos */
.pdf-force-light-mode * {
    color: #1e293b !important;
    visibility: visible !important;
}

/* Mantem apenas os elementos laranjas (destaques) */
.pdf-force-light-mode span[style*="color: #f97316"],
.pdf-force-light-mode strong[style*="color: #f97316"],
.pdf-force-light-mode i[style*="color: #f97316"],
.pdf-force-light-mode .text-orange {
    color: #f97316 !important;
}

/* Mantem os textos vermelhos de alertas */
.pdf-force-light-mode span[style*="color: red"],
.pdf-force-light-mode span[style*="color: #dc2626"],
.pdf-force-light-mode .text-red {
    color: #dc2626 !important;
}

/* Mantem o texto branco APENAS dentro do cabecalho escuro */
.pdf-force-light-mode .pdf-header,
.pdf-force-light-mode .pdf-header * {
    color: #ffffff !important;
    background-color: #1e293b !important;
}

.pdf-force-light-mode .pdf-header h2 span {
    color: #f97316 !important;
}

/* Mantem o footer com texto claro */
.pdf-force-light-mode .pdf-footer,
.pdf-force-light-mode .pdf-footer * {
    color: #94a3b8 !important;
    background-color: #1e293b !important;
}

.pdf-force-light-mode .pdf-footer span {
    color: #ffffff !important;
}

/* Garante que as bordas e fundos dos boxes aparecam */
.pdf-force-light-mode .pdf-info-box,
.pdf-force-light-mode table,
.pdf-force-light-mode .pdf-relato-box {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
}

/* Mantem os badges/tags com fundo escuro */
.pdf-force-light-mode .pdf-envolvido-tipo {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

/* === CLASSES ADICIONAIS PARA O TEMPLATE PDF === */

/* Paper Preview - Container principal do PDF */
.paper-preview {
    background: white;
    font-family: 'Inter', sans-serif;
    color: #1f2937;
    width: 794px;
    min-width: 794px;
    max-width: 794px;
    margin: 0 auto;
    position: relative;
    overflow: visible;
    box-sizing: border-box;
}

/* Marca d'água */
.pdf-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
}

.pdf-watermark img {
    width: 500px;
    filter: grayscale(100%);
}

/* Textos do header */
.pdf-header-label {
    display: block;
    font-size: 16px;
    font-weight: 400;
    color: #94a3b8;
}

.pdf-header-title {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: white;
    line-height: 1;
}

/* Texto branco */
.text-white {
    color: white !important;
    font-weight: bold;
}

/* Marcadores de seção */
.section-marker {
    width: 6px;
    height: 18px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 2px;
}

.section-marker.orange {
    background: #f97316;
}

.section-marker.dark {
    background: #1e293b;
}

/* Tabela dentro do PDF */
.pdf-table-label {
    padding: 4px 0;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.pdf-table-value {
    padding: 4px 0;
    color: #1e293b;
    font-size: 12px;
    font-weight: 700;
}

/* Grid de responsáveis */
.pdf-responsaveis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Override para pdf-section-title - remover pseudo element e usar marker */
.pdf-section-title::before {
    display: none;
}

/* Força 4 colunas na linha superior de informações */
.info-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
    width: 100%;
}

/* ==========================================================================
   IMPRESSÃO DO PREVIEW (CORREÇÃO FINAL - BASEADO EM hipoteticaocorrencia.html)
   ========================================================================== */

/* 1. Estilo do Papel na Tela (Visualização) - RESPONSIVE ZOOM */
#pdf-preview-content {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: black;
    background: white;
    width: 794px;
    /* Largura fixa A4 */
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform-origin: top center;
    transition: transform 0.3s ease;
    /* Transição suave ao redimensionar */

    /* Desktop Grande - Zoom 55% */
    transform: scale(0.55);
    margin-bottom: -45%;
    /* Compensa espaço vazio (794px * 0.45) */
}

/* Laptop/Tablet Landscape - Zoom 45% */
@media (max-width: 1199px) {
    #pdf-preview-content {
        transform: scale(0.45);
        margin-bottom: -55%;
        /* Compensa espaço vazio (794px * 0.55) */
    }
}

/* Tablet Portrait - Zoom 38% */
@media (max-width: 899px) {
    #pdf-preview-content {
        transform: scale(0.38);
        margin-bottom: -62%;
        /* Compensa espaço vazio (794px * 0.62) */
    }
}

/* Mobile - Zoom 33% */
@media (max-width: 599px) {
    #pdf-preview-content {
        transform: scale(0.33);
        margin-bottom: -67%;
        /* Compensa espaço vazio (794px * 0.67) */
    }
}

/* Mobile Muito Pequeno - Zoom 30% */
@media (max-width: 400px) {
    #pdf-preview-content {
        transform: scale(0.30);
        margin-bottom: -70%;
        /* Compensa espaço vazio (794px * 0.70) */
    }
}

/* 1.1. Classe para forçar captura limpa (usado pelo html2pdf.js) */
.pdf-force-export {
    background-color: #ffffff !important;
    color: #000000 !important;
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    /* A4 width em pixels (96dpi) */
    height: auto !important;

    /* REMOVE o zoom de 50% para gerar PDF em tamanho REAL (100%) */
    transform: none !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.pdf-force-export * {
    color: #1e293b !important;
    /* Texto escuro padrão */
}

/* Exceções - mantém cores específicas */
.pdf-force-export .pdf-header,
.pdf-force-export .pdf-header * {
    color: #ffffff !important;
    background-color: #1e293b !important;
}

.pdf-force-export .pdf-header h2 span {
    color: #f97316 !important;
}

.pdf-force-export span[style*="color: #f97316"],
.pdf-force-export strong[style*="color: #f97316"] {
    color: #f97316 !important;
}

.pdf-force-export span[style*="color: red"],
.pdf-force-export span[style*="color: #dc2626"] {
    color: #dc2626 !important;
}

/* 2. Configuração de Página A4 */
@page {
    size: A4;
    margin: 0;
}

/* 3. REGRAS DE IMPRESSÃO (CTRL+P) - Baseadas no arquivo funcional */
@media print {

    /* 1. RESET GERAL - Remove flexbox e fixed que travam o layout */
    html,
    body {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background-color: white !important;
        display: block !important;
        /* CRÍTICO: Remove display:flex */
        position: static !important;
        /* CRÍTICO: Remove position:fixed */
    }

    /* 2. Esconde elementos de UI (mas NÃO esconde o modal) */
    body>*:not(#modal-pdf-preview) {
        display: none !important;
    }

    /* 3. RESETAR O MODAL - Transformá-lo no container principal */
    #modal-pdf-preview {
        display: block !important;
        position: static !important;
        /* Remove fixed */
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background-color: white !important;
        overflow: visible !important;
        z-index: auto !important;
        inset: auto !important;
        /* Remove inset-0 do Tailwind */
    }

    /* 4. Esconde a barra do topo do modal */
    #modal-pdf-preview>div:first-child {
        display: none !important;
    }

    /* 5. Reseta o container interno (flex-1) */
    #modal-pdf-preview .flex-1 {
        display: block !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        height: auto !important;
        width: 100% !important;
    }

    /* 6. CONFIGURAR A FOLHA A4 */
    #pdf-preview-content {
        width: 210mm !important;
        min-height: 297mm !important;
        margin: 0 auto !important;
        padding: 15mm !important;
        /* Margem interna de segurança */
        background-color: white !important;

        /* Garante renderização */
        position: relative !important;
        display: block !important;
        visibility: visible !important;

        /* Remove efeitos de tela */
        box-shadow: none !important;
        transform: none !important;
        border: none !important;
        max-width: none !important;

        /* Força cores exatas */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 7. Garante visibilidade de todo conteúdo interno */
    #pdf-preview-content * {
        visibility: visible !important;
    }

    /* 8. Força impressão de cores de fundo */
    .pdf-header,
    .pdf-footer,
    .pdf-info-box {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 9. Evita quebras de página ruins */
    .pdf-info-box,
    .pdf-header,
    table,
    img,
    .item-card,
    .no-break {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}

/* ==========================================================================
   CORREÇÃO DEFINITIVA DE PDF EM BRANCO (SANDBOX DE IMPRESSÃO)
   ========================================================================== */

/* Container temporário onde o PDF é montado antes de baixar */
#pdf-generator-sandbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 794px !important;
    /* Largura A4 Fixa (210mm @ 96dpi) */
    z-index: -9999 !important;
    /* Invisível para o usuário */
    background-color: #ffffff !important;
    color: #000000 !important;
    visibility: visible !important;
    /* O motor precisa ver para renderizar */
    overflow: visible !important;
    padding: 20px !important;
    /* Margem interna do documento */
}

/* Força TODOS os textos a serem pretos dentro do gerador */
#pdf-generator-sandbox * {
    color: #1e293b !important;
    /* Cinza escuro/Preto */
    background-color: transparent;
    /* Remove fundos escuros */
}

/* === EXCEÇÕES: Mantém as cores importantes === */

/* 1. Cabeçalho Azul Escuro */
#pdf-generator-sandbox .pdf-header,
#pdf-generator-sandbox .pdf-header * {
    background-color: #1e293b !important;
    color: #ffffff !important;
    /* Texto branco no header */
}

#pdf-generator-sandbox .pdf-header h2 span {
    color: #f97316 !important;
    /* Laranja do título */
}

/* 2. Rodapé Escuro */
#pdf-generator-sandbox .pdf-footer,
#pdf-generator-sandbox .pdf-footer * {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
}

/* 3. Badges e Etiquetas */
#pdf-generator-sandbox .pdf-envolvido-tipo {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

/* 4. Textos de Alerta (Vermelho/Laranja) */
#pdf-generator-sandbox .text-orange,
#pdf-generator-sandbox span[style*="color: #f97316"] {
    color: #f97316 !important;
}

#pdf-generator-sandbox .text-red,
#pdf-generator-sandbox span[style*="color: #dc2626"] {
    color: #dc2626 !important;
}

/* 5. Caixas de Fundo Claro */
#pdf-generator-sandbox .pdf-info-box {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
}

/* ============================================================================ */
/* CORREÇÃO CRÍTICA: SANDBOX DO PDF (IMPEDE QUE ESTOURE A LARGURA NO MOBILE) */
/* ============================================================================ */
/* FIREFOX FIX: html2canvas nao renderiza elementos fora do viewport no Firefox.
   Manter o sandbox em left:0 com opacity:0 — invisivel mas renderizavel. */
#pdf-sandbox-container,
#pdf-generator-sandbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 794px !important;
    height: 1123px !important;
    z-index: -9999 !important;
    background: white !important;
    visibility: visible !important;
    pointer-events: none !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* ============================================================================ */
/* CORREÇÃO PARA GERAÇÃO DE PDF NA SANDBOX (REMOVE ZOOM E PERMITE OVERFLOW)   */
/* ============================================================================ */
#pdf-sandbox-temp .paper-preview,
#pdf-sandbox-temp .pdf-content {
    overflow: visible !important;
    /* Permite que o conteúdo flua para a próxima página */
    height: auto !important;
    transform: none !important;
    /* Remove qualquer zoom/scale aplicado */
    margin: 0 !important;
}

/* Garante que imagens não quebrem no meio da página se possível */
#pdf-sandbox-temp img {
    max-width: 100%;
    page-break-inside: avoid;
}

/* Remove qualquer transform scale do clone */
#pdf-sandbox-temp * {
    transform: none !important;
}

/* ==========================================================================
   CORREÇÃO FINAL PARA PDF EM BRANCO/CORTADO (SANDBOX FIXED)
   ========================================================================== */

/* Container para captura do clone — posicionado em 0,0 com opacity:0 */
#pdf-sandbox-fixed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 794px !important;
    z-index: -9999 !important;
    background: #ffffff !important;
    visibility: visible !important;
    pointer-events: none !important;
    overflow: visible !important;
    opacity: 0 !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* Trava largura A4 real e remove qualquer miniaturização responsiva */
#pdf-sandbox-fixed .paper-preview {
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* Clone usado pelo gerador: geometria fixa para impedir corte lateral */
#pdf-sandbox-fixed #pdf-template-clone {
    display: block !important;
    position: static !important;
    inset: auto !important;
    top: 0 !important;
    left: 0 !important;
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Garante que o clone dentro da sandbox seja visível e expansível */
#pdf-sandbox-fixed .paper-preview,
#pdf-sandbox-fixed .pdf-content,
#pdf-sandbox-fixed .pdf-info-box {
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    transform: none !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Força imagens a aparecerem */
#pdf-sandbox-fixed img {
    display: block !important;
    visibility: visible !important;
    max-width: 100% !important;
}

/* Garante fundo branco e texto preto na impressão */
#pdf-sandbox-fixed * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}