:root {
    --preto:            #000000;
    --caqui:            #A08F63;
    --vermelho:         #AB2328;
    --branco:           #FFFFFF;
    --fundo:            #F5F3EE;
    --linha:            #D8D2C5;
    --texto-secundario: #666666;
    --verde-sucesso:    #2A7A3B;
    --radius-card:      18px;
    --radius-btn:       14px;
    --radius-input:     12px;
    --sombra:           0 4px 16px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--fundo);
    color: var(--preto);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 40px;
}

/* ── HEADER ──────────────────────────────────────────────────── */
.header {
    background: var(--preto);
    color: var(--branco);
    padding: 20px 20px 28px;
    border-radius: 0 0 24px 24px;
    text-align: center;
    margin-bottom: 20px;
}
.header-badge {
    display: inline-block;
    background: var(--vermelho);
    color: var(--branco);
    font-size: 0.68rem;
    font-weight: bold;
    letter-spacing: 1.2px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.header h1 { font-size: 1.3rem; margin: 0; letter-spacing: 0.5px; }
.header p  { font-size: 0.78rem; color: #bbb; margin: 5px 0 0; }

/* ── VISIBILIDADE ────────────────────────────────────────────── */
.oculto { display: none !important; }

/* ── PROGRESSO ───────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--linha);
    border-radius: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 25%;
    background: var(--vermelho);
    border-radius: 20px;
    transition: width 0.4s ease;
}

/* ── STEP LABEL ──────────────────────────────────────────────── */
.step-label {
    color: var(--vermelho);
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

/* ── TELA / ANIMAÇÃO ─────────────────────────────────────────── */
.tela {
    padding: 0 16px;
    animation: fadeIn 0.22s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* ── CARD ────────────────────────────────────────────────────── */
.card {
    background: var(--branco);
    border: 1px solid var(--linha);
    border-radius: var(--radius-card);
    padding: 20px;
    margin-top: 16px;
    box-shadow: var(--sombra);
}
.card-titulo { font-size: 1.05rem; margin: 6px 0 4px; }

/* ── FOTO ────────────────────────────────────────────────────── */
.card-identidade { text-align: center; }
.foto-militar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 8px auto 12px;
    border: 3px solid var(--caqui);
    background: var(--linha);
}
.identidade-info .id-nr-policia {
    font-size: 0.78rem;
    color: var(--texto-secundario);
    margin-bottom: 2px;
}
.identidade-info .id-nome   { font-size: 1.05rem; font-weight: bold; line-height: 1.3; }
.identidade-info .id-funcao { font-size: 0.82rem; color: var(--vermelho); margin-top: 3px; font-weight: 600; }

/* ── DADOS EXIBIDOS ──────────────────────────────────────────── */
.dado-linha {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--linha);
    gap: 8px;
}
.dado-label { font-size: 0.82rem; color: var(--texto-secundario); flex-shrink: 0; padding-top: 1px; }
.dado-valor { font-size: 0.92rem; font-weight: 600; text-align: right; flex: 1; word-break: break-word; }

/* ── RADIO CARDS ─────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border: 2px solid var(--linha);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.radio-card input[type="radio"] { width: 18px; height: 18px; accent-color: var(--vermelho); flex-shrink: 0; }
.radio-card:has(input:checked) { border-color: var(--vermelho); background: #fdf5f5; }
.radio-texto { font-size: 0.9rem; font-weight: 500; }

/* ── CAMPOS ──────────────────────────────────────────────────── */
.campo-grupo { margin-bottom: 14px; }
.campo-grupo label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 5px;
}
.label-opcional { font-weight: 400; color: var(--texto-secundario); font-size: 0.8rem; }
.label-obrigatorio { color: var(--vermelho); }

input[type="text"],
input[type="number"],
select {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--linha);
    border-radius: var(--radius-input);
    padding: 0 14px;
    font-size: 1rem;
    background: var(--branco);
    color: var(--preto);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
input:focus, select:focus {
    border-color: var(--vermelho);
    box-shadow: 0 0 0 3px rgba(171,35,40,0.12);
}
/* seta no select */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M6 7L0 0h12z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.btn-link {
    background: none;
    border: none;
    color: var(--caqui);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 0;
    font-weight: 600;
    display: block;
    margin-top: 6px;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.btn-link:active { opacity: 0.7; }

/* ── BOTÕES ──────────────────────────────────────────────────── */
.btn {
    display: block;
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.btn:active  { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.btn-primary   { background: var(--vermelho); color: var(--branco); }
.btn-secondary { background: var(--caqui);    color: var(--preto); }
.btn-outline   { background: transparent;     color: var(--preto); border: 1.5px solid var(--linha); }

/* Loading spinner */
.btn.carregando { color: transparent !important; pointer-events: none; }
.btn.carregando::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%) rotate(0deg);
    animation: spin 0.65s linear infinite;
}
.btn-outline.carregando::after {
    border-color: rgba(0,0,0,0.2);
    border-top-color: #000;
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* ── ERROS ───────────────────────────────────────────────────── */
.mensagem-erro {
    background: #fdf0f0;
    border: 1px solid #f5b5b5;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #c0392b;
    margin: 10px 0 4px;
    line-height: 1.4;
}

/* ── INFO TEXT ───────────────────────────────────────────────── */
.info-text { color: var(--texto-secundario); font-size: 0.85rem; margin: 4px 0; line-height: 1.5; }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.modal-overlay.oculto { display: none !important; }

.modal-sheet {
    background: var(--branco);
    width: 100%;
    max-width: 480px;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0));
    max-height: 92vh;
    overflow-y: auto;
    animation: slideUp 0.28s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── RESUMO NO MODAL ─────────────────────────────────────────── */
.resumo-bloco {
    border: 1px solid var(--linha);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.resumo-titulo {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--texto-secundario);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.resumo-linha {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid var(--linha);
    gap: 8px;
    font-size: 0.9rem;
}
.resumo-linha:last-child { border-bottom: none; padding-bottom: 0; }
.resumo-label { color: var(--texto-secundario); flex-shrink: 0; }
.resumo-val   { font-weight: 600; text-align: right; flex: 1; word-break: break-word; }

/* ── BANNER MODO TESTE ───────────────────────────────────────── */
.banner-teste {
    background: #fff3cd;
    border: 1.5px solid #e6a817;
    color: #7a5300;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 10px 16px;
    text-align: center;
    line-height: 1.4;
}
.banner-teste strong { color: #c0392b; }

/* ── SUCESSO ─────────────────────────────────────────────────── */
.sucesso-icone {
    width: 64px;
    height: 64px;
    background: var(--verde-sucesso);
    color: var(--branco);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto;
    line-height: 1;
}
