/* === VARIÁVEIS E TEMA PREMIUM AUTOMOTIVO === */
:root {
    --bg-gelo: #f8fafc;
    --white: #ffffff;
    --red-neon: #e60000;
    --red-dark: #cc0000;
    --text-dark: #0f172a;
    --text-gray: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* === DARK MODE (ESTILO PAINEL ESPORTIVO) === */
[data-theme="dark"] {
    --bg-gelo: #0b0f19;
    --white: #161e2e;
    --text-dark: #f8fafc;
    --text-gray: #94a3b8;
    --border: #273142;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 10px 30px rgba(230, 0, 0, 0.15);
    --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #05070a 100%);
}

/* RESET E BASE */
html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* SCROLLBAR CUSTOMIZADA E FINA */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-gray);
}

/* === TELA DE LOGIN — LIGHT PREMIUM (SPLIT SCREEN) === */
#login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;              /* navegadores antigos */
    height: 100dvh;             /* iPhone/Safari: só a área visível, sem contar o que fica atrás das barras */
    overflow-y: auto;           /* se não couber (celular pequeno, teclado aberto), rola em vez de cortar */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: row;
    z-index: 9999;
    background: #ffffff;
    animation: loginFadeIn 0.6s ease;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------- Lado Visual (Esquerdo) ---------- */
.login-visual {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, #e60000 0%, #cc0000 40%, #a80000 100%);
    position: relative;
    overflow: hidden;
}

.login-visual-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
    animation: slideUp 0.8s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shapes decorativas animadas */
.login-visual-shapes {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    animation: floatShape 14s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -80px;
    left: -60px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: -40px;
    right: -30px;
    animation-delay: -5s;
}

.shape-3 {
    width: 140px;
    height: 140px;
    top: 40%;
    left: 60%;
    animation-delay: -9s;
}

@keyframes floatShape {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-25px) scale(1.06);
    }
}

/* Marca */
.login-brand-name {
    font-family: 'Racing Sans One', sans-serif;
    font-size: 40px;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.login-brand-name span {
    color: #fff;
    opacity: .85;
}

.login-brand-tagline {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    margin-top: 8px;
    letter-spacing: 0.3px;
}

/* Mini stats */
.login-visual-stats {
    display: flex;
    gap: 28px;
    justify-content: center;
    margin-top: 40px;
}

.login-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 600;
}

.login-stat i {
    font-size: 22px;
    color: #fff;
}

/* ---------- Lado Formulário (Direito) ---------- */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 32px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    margin: auto;               /* centraliza quando sobra espaço; encosta no topo quando não cabe (nada fica inalcançável) */
    background: #ffffff;
    border-radius: 20px;
    padding: 42px 36px 36px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    text-align: left;
    position: relative;
    animation: formEntrance 0.7s ease 0.2s both;
}

@keyframes formEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-greeting h2 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
}

.login-greeting p {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
    margin: 0 0 28px;
}

/* Grupos de Input */
.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.login-input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-input-group label i {
    color: #94a3b8;
    font-size: 13px;
}

.login-box input {
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    outline: none;
    background: #f8fafc;
    color: #0f172a;
    width: 100%;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
    -webkit-appearance: none;
}

.login-box input::placeholder {
    color: #94a3b8;
}

.login-box input:focus {
    border-color: #e60000;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.08);
}

/* Autopreenchimento */
.login-box input:-webkit-autofill,
.login-box input:-webkit-autofill:hover,
.login-box input:-webkit-autofill:focus,
.login-box input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #f8fafc inset !important;
    -webkit-text-fill-color: #0f172a !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Botão principal */
.login-box button#btn-fazer-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #e60000, #cc0000);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(230, 0, 0, 0.25);
    transition: all 0.3s ease;
}

.login-box button#btn-fazer-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(230, 0, 0, 0.35);
}

.login-box button#btn-fazer-login:active {
    transform: translateY(0);
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
}

.login-divider hr {
    flex: 1;
    border: none;
    border-top: 1px solid #e2e8f0;
}

.login-divider span {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
    text-transform: lowercase;
}

/* Google */
.login-box button.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
}

.login-box button.btn-google:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.login-error {
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    display: none;
    margin-top: 8px;
}

#link-esqueci-senha:hover {
    opacity: 0.7 !important;
}

.login-footer-text {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 24px;
    font-weight: 500;
}

.login-footer-text strong {
    color: #64748b;
}

/* === CRÉDITO AVORY (login + rodapé de todas as telas) === */
.rodape-sistema {
    margin-top: auto;           /* .main-content é flex em coluna: o rodapé vai para o fim da tela */
    padding-top: 32px;
    width: 100%;
}

.rodape-sistema .credito-avory {
    max-width: 1150px;
    margin: 0 auto;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Linha fina e sóbria: DESENVOLVIDO POR │ AVORY */
.credito-avory {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--text-gray);
    opacity: 0.9;
}

.credito-avory-sep {
    width: 1px;
    height: 10px;
    background: currentColor;
    opacity: 0.35;
}

.credito-avory-link {
    position: relative;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 3.5px;
    margin-right: -3.5px;       /* compensa o espaçamento da última letra */
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.25s ease;
}

/* sublinhado fino que surge no hover */
.credito-avory-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 3.5px;
    bottom: -3px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.credito-avory-link:hover,
.credito-avory-link:focus-visible {
    color: var(--red-neon);
    outline: none;
}

.credito-avory-link:hover::after,
.credito-avory-link:focus-visible::after {
    transform: scaleX(1);
}

/* Tela de login é sempre clara */
.credito-avory--login {
    margin-top: 10px;
    color: #94a3b8;
}

.credito-avory--login .credito-avory-link {
    color: #334155;
}

/* ============================================================
   === INDICADORES DE CARREGAMENTO (funcionais, sempre animados) ===
   O Font Awesome zera .fa-spin/.fa-bounce quando o sistema está com
   "reduzir movimento"; indicadores de progresso são informação, não
   enfeite, então mantêm a animação (mais lenta) nesse caso.
   ============================================================ */
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes varrer { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
@keyframes pontinhos { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes pulsarPonto { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .45; } }
@keyframes progressoIndeterminado { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

@media (prefers-reduced-motion: reduce) {
    .fa-spin { animation: fa-spin 1.4s linear infinite !important; }
}

.mini-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(100, 116, 139, 0.25);
    border-top-color: var(--red-neon);
    animation: girar 0.75s linear infinite;
    vertical-align: -2px;
    flex-shrink: 0;
}

.mini-spinner.claro {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}

/* Botão de anexo lendo o documento */
.btn-attach.carregando {
    position: relative;
    color: transparent !important;
    background: var(--border) !important;
    pointer-events: none;
}

.btn-attach.carregando::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(100, 116, 139, 0.25);
    border-top-color: var(--red-neon);
    animation: girar 0.75s linear infinite;
}

/* Linha fina varrendo o campo enquanto a IA lê */
.input-with-icon.processando {
    position: relative;
    overflow: hidden;
    border-color: rgba(16, 185, 129, 0.5);
}

.input-with-icon.processando::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 40%;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    animation: varrer 1.3s ease-in-out infinite;
}

.ia-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #059669;
}

.ia-pontos {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.ia-pontos i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #10b981;
    animation: pontinhos 1.2s ease-in-out infinite;
}

.ia-pontos i:nth-child(2) { animation-delay: 0.15s; }
.ia-pontos i:nth-child(3) { animation-delay: 0.3s; }

/* ============================================================
   === CONSULTA INTEGRADA — PROGRESSO, ABAS, HISTÓRICO ===
   ============================================================ */
.consulta-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.consulta-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: -1px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-gray);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.consulta-tab-btn:hover { color: var(--text-dark); }

.consulta-tab-btn.active {
    color: var(--red-neon);
    border-bottom-color: var(--red-neon);
}

.consulta-tab-btn .tab-contador {
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    font-size: 10px;
    text-align: center;
}

.consulta-tab-btn .tab-contador:empty { display: none; }

/* barra de progresso indeterminada */
.consulta-progresso {
    height: 3px;
    margin: 0 0 14px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}

.consulta-progresso .barra {
    height: 100%;
    width: 35%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--red-neon), #ff6b6b);
    animation: progressoIndeterminado 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.consulta-progresso.concluida .barra,
.consulta-progresso.erro .barra {
    width: 100%;
    animation: none;
    transform: none;
    transition: width 0.4s ease;
}

.consulta-progresso.concluida .barra { background: #10b981; }
.consulta-progresso.erro .barra { background: #f59e0b; }

.consulta-info-bar .info-linha {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.consulta-info-bar .info-linha + .info-linha {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.consulta-timer {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    letter-spacing: 1px;
}

.consulta-dica-tempo {
    font-size: 11px;
    color: var(--text-gray);
    flex: 1 1 100%;
}

.consulta-dica-tempo:empty { display: none; }

.consulta-em-andamento {
    color: var(--red-neon);
    font-weight: 600;
}

/* status por fonte */
.consulta-fontes-status {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.fonte-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-gelo);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
}

.fonte-pill em {
    font-style: normal;
    font-weight: 500;
    opacity: 0.8;
}

.fonte-pill em::before { content: '· '; }

.fonte-pill .ponto {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
}

.fonte-pill.aguardando .ponto { background: var(--red-neon); animation: pulsarPonto 1s ease-in-out infinite; }
.fonte-pill.ok { color: #059669; border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.08); }
.fonte-pill.ok .ponto { background: #10b981; }
.fonte-pill.erro { color: #dc2626; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); }
.fonte-pill.erro .ponto { background: #ef4444; }

.consulta-acoes {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-consulta-acao {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-consulta-acao:hover:not(:disabled) { border-color: var(--red-neon); color: var(--red-neon); }
.btn-consulta-acao.primario { background: var(--text-dark); color: #fff; border-color: var(--text-dark); }
.btn-consulta-acao.primario:hover:not(:disabled) { background: var(--red-neon); border-color: var(--red-neon); color: #fff; }
.btn-consulta-acao:disabled { opacity: 0.45; cursor: not-allowed; }

/* esqueleto dentro dos cards */
.consulta-card-carregando { padding: 4px 0; }
.consulta-card-carregando.compacto { padding: 2px 0 6px; }

.consulta-card-carregando-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
}

.consulta-card-carregando.compacto .consulta-card-carregando-msg { margin-top: 8px; }

.skeleton-line.w-90 { width: 90%; }

/* indicador na navegação enquanto há consulta rodando */
.btn-nav.com-atividade { position: relative; }

.btn-nav.com-atividade::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red-neon);
    box-shadow: 0 0 0 2px var(--white);
    animation: pulsarPonto 1.2s ease-in-out infinite;
}

/* histórico */
.consulta-historico-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.consulta-hist-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 14px 18px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.consulta-hist-item:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.consulta-hist-item.andamento { border-color: rgba(230, 0, 0, 0.35); }

.hist-placa {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-dark);
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
}

.hist-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-info strong { font-size: 13px; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-info span { font-size: 11px; color: var(--text-gray); }
.hist-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.hist-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    color: var(--text-gray);
}

.hist-chip i { font-size: 9px; }
.hist-chip.ok { color: #059669; background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.25); }
.hist-chip.perigo { color: #dc2626; background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.25); }
.hist-chip.alerta { color: #d97706; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); }

.hist-acoes { display: flex; gap: 8px; }
.hist-acoes .btn-action-card { margin: 0; padding: 8px 12px; font-size: 11px; }
.hist-acoes .btn-action-card:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 768px) {
    .consulta-hist-item { grid-template-columns: 1fr auto; }
    .hist-info { grid-column: 1 / -1; }
    .hist-acoes { grid-column: 1 / -1; }
    .hist-acoes .btn-action-card { flex: 1; justify-content: center; }
    .consulta-acoes { margin-left: 0; width: 100%; }
    .btn-consulta-acao { flex: 1; justify-content: center; }
}

[data-theme="dark"] .btn-nav.com-atividade::after { box-shadow: 0 0 0 2px var(--white); }
[data-theme="dark"] .hist-placa { background: rgba(255, 255, 255, 0.04); }

/* ============================================================
   === LOGOS DOS ÓRGÃOS, OPÇÕES DA CONSULTA, AVISOS NEUTROS ===
   ============================================================ */
.fonte-logo {
    display: inline-block;
    height: 14px;
    width: auto;
    vertical-align: -3px;
    margin-right: 6px;
    border-radius: 2px;
}

.consulta-badge-fonte .fonte-logo {
    height: 13px;
    margin-right: 5px;
    vertical-align: -3px;
}

.consulta-badge-fonte .fonte-logo + .fonte-logo { margin-left: -1px; }

.consulta-secao-titulo .fonte-logo {
    height: 16px;
    vertical-align: -4px;
    margin-right: 4px;
}

.fonte-pill .fonte-logo {
    height: 12px;
    vertical-align: -2px;
    margin-right: 2px;
}

.consulta-opcoes {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.consulta-opcao {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    user-select: none;
}

.consulta-opcao input[type="checkbox"] {
    -webkit-appearance: checkbox !important;
    appearance: auto !important;
    flex: 0 0 16px;
    width: 16px !important;
    min-width: 16px;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: var(--red-neon);
    cursor: pointer;
}

.consulta-opcao small {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-gray);
}

.consulta-card-error.neutro i { color: var(--text-gray); opacity: 0.7; }
.consulta-card-error.neutro .error-text { color: var(--text-gray); }

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ---------- LOGIN RESPONSIVO (Mobile) ---------- */
@media (max-width: 900px) {
    #login-container {
        flex-direction: column;
    }

    .login-visual {
        flex: 0 0 auto;
        min-height: 220px;
        padding: 30px 20px;
    }

    .login-brand-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
        border-radius: 14px;
        margin-bottom: 14px;
    }

    .login-brand-name {
        font-size: 28px;
    }

    .login-brand-tagline {
        font-size: 12px;
    }

    .login-visual-stats {
        gap: 20px;
        margin-top: 20px;
    }

    .login-stat i {
        font-size: 18px;
    }

    .login-stat span {
        font-size: 11px;
    }

    .login-form-side {
        flex: 1 0 auto;         /* nunca encolhe abaixo do formulário: o que sobrar vira rolagem */
        padding: 20px;
        /* folga embaixo para o último botão não ficar atrás da barra do Safari */
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    }

    .login-box {
        padding: 28px 24px 24px;
        border-radius: 16px;
    }

    .login-greeting h2 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    /* Celular: topo vermelho mais baixo para o formulário inteiro caber na tela */
    .login-visual {
        min-height: 0;
        padding: 22px 16px 20px;
    }

    .login-visual-content {
        padding: 0 8px;
    }

    .login-visual-stats {
        gap: 14px;
        margin-top: 14px;
    }

    .login-brand-name {
        font-size: 24px;
    }

    .login-form-side {
        padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px));
    }

    .login-box {
        padding: 22px 18px 20px;
    }

    .login-greeting p {
        margin-bottom: 20px;
    }

    .login-input-group {
        margin-bottom: 14px;
    }
}

/* Celular com pouca altura (barra do Safari visível, iPhone SE): esconde os destaques do topo */
@media (max-width: 480px) and (max-height: 700px) {
    .login-visual {
        padding: 16px 16px 14px;
    }

    .login-visual-stats {
        display: none;
    }
}


/* === HEADER MOBILE PREMIUM === */
.mobile-header {
    display: none;
}

/* === SIDEBAR MODERNA === */
#app-container {
    display: none;
    width: 100%;
    min-height: 100vh;
    flex-direction: row;
    position: relative;
}

.sidebar {
    width: 260px;
    height: 100dvh;
    background: var(--white);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 100;
    box-shadow: var(--shadow);
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    will-change: transform;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-logo {
    font-family: 'Racing Sans One', sans-serif;
    font-size: 24px;
    color: var(--text-dark);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

.sidebar-logo span.red-text {
    color: var(--red-neon);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.btn-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    width: 100%;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.btn-nav i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.btn-nav:hover {
    background: var(--bg-gelo);
    color: var(--text-dark);
}

.btn-nav.active {
    background: rgba(230, 0, 0, 0.04);
    border-left: 3px solid var(--red-neon);
    color: var(--red-neon);
    font-weight: 500;
}

.btn-nav.active i {
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dark);
    overflow: hidden;
    flex: 1;
}

.user-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout,
.btn-theme {
    background: var(--bg-gelo);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

.btn-theme:hover {
    background: var(--border);
    color: var(--text-dark);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 40px 5%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.section-view {
    display: none;
    max-width: 1150px;
    width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-view.active {
    display: block;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
}

.header-actions .titulo-secao {
    margin-bottom: 0;
}

.titulo-secao {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 25px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    letter-spacing: -0.3px;
}

.titulo-secao::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: var(--red-neon);
    border-radius: 2px;
    margin-right: 10px;
}

/* === PESQUISA E FILTROS === */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
    width: 100%;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    font-size: 15px;
}

.search-box input {
    width: 100%;
    padding: 15px 18px 15px 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    background: var(--white);
    color: var(--text-dark);
    box-shadow: var(--shadow);
    outline: none;
    font-weight: 400;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--red-neon);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.08);
}

.chips-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.chip {
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-gray);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.chip:hover {
    border-color: var(--text-gray);
    color: var(--text-dark);
    transform: translateY(-1px);
}

.chip.active {
    background: var(--text-dark);
    color: var(--white);
    border-color: var(--text-dark);
}

/* === CARDS AUTOMOTIVOS PREMIUM === */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

.car-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease;
    width: 100%;
    position: relative;
    will-change: transform;
    contain: layout style paint;
}

.car-card:hover {
    transform: translate3d(0, -3px, 0);
    box-shadow: var(--shadow-hover);
    border-color: rgba(230, 0, 0, 0.25);
}

.car-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.badge-status {
    font-size: 9px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-estoque {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.status-preparacao {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.status-reservado {
    background: rgba(139, 92, 246, 0.08);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.status-vendido {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.car-brand {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
}

.car-model {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-dark);
    margin-top: 2px;
    line-height: 1.25;
    overflow-wrap: break-word;
    letter-spacing: -0.3px;
}

/* Placa Mercosul Estilizada */
.car-placa-mercosul {
    display: inline-flex;
    flex-direction: column;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.placa-header {
    background: #002244;
    color: #ffffff;
    font-size: 6px;
    font-weight: 500;
    padding: 1px 6px;
    text-align: center;
    letter-spacing: 1px;
    line-height: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.placa-header span {
    font-size: 5px;
}

.placa-body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    padding: 2px 6px;
    letter-spacing: 0.8px;
    text-align: center;
    line-height: 1;
}

[data-theme="dark"] .car-placa-mercosul {
    border-color: #475569;
}

[data-theme="dark"] .placa-body {
    background: #e2e8f0;
    color: #0f172a;
}

/* Tags de Especificações do Veículo */
.car-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.spec-chip {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-gray);
    background: var(--bg-gelo);
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
}

.spec-chip i {
    font-size: 10px;
    color: var(--text-gray);
    opacity: 0.8;
}

/* Container de Preço */
.car-price-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.price-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-value {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

/* Botões de Ação do Card */
.btn-action-card {
    margin-top: 12px;
    padding: 11px;
    background: var(--bg-gelo);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-family: 'Montserrat';
    font-size: 12px;
    width: 100%;
    transition: all 0.2s;
}

.btn-action-card:hover {
    background: var(--text-dark);
    color: var(--white);
    border-color: var(--text-dark);
}

[data-theme="dark"] .btn-action-card:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #f8fafc;
}

.btn-vender-card {
    background: rgba(22, 163, 74, 0.08);
    color: #16a34a;
    border: 1px solid rgba(22, 163, 74, 0.15);
}

.btn-vender-card:hover {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}

[data-theme="dark"] .btn-vender-card {
    background: rgba(22, 163, 74, 0.12);
    color: #4ade80;
    border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="dark"] .btn-vender-card:hover {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}

/* === FORMULÁRIOS === */
.card-form {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    border: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.input-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    width: 100%;
}

.input-box label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input,
select,
textarea {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    background-color: var(--bg-gelo);
    color: var(--text-dark);
    font-weight: 400;
    width: 100%;
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--red-neon);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.08);
}

@media (min-width: 600px) {
    .span-2 {
        grid-column: span 2;
    }
}

/* Dados da compra: troca (com ou sem volta em dinheiro) e observações */
.compra-negociacao {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.compra-negociacao-titulo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
}

.compra-negociacao-titulo i { color: var(--red-neon); }

.compra-negociacao-campos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.compra-negociacao input,
.compra-negociacao select,
.compra-negociacao textarea {
    background-color: var(--white);
}

.compra-negociacao textarea {
    min-height: 80px;
    resize: vertical;
    font-size: 13px;
}

.btn-salvar {
    padding: 14px 22px;
    background: var(--red-neon);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    font-family: 'Montserrat';
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(230, 0, 0, 0.15);
}

.btn-salvar:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 0, 0, 0.25);
}

.btn-salvar:disabled {
    background: var(--text-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === DRAG & DROP E ANEXOS === */
.input-with-icon {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-gelo);
    padding: 4px 8px;
    transition: 0.2s;
    min-width: 0;
}

.input-with-icon:focus-within {
    border-color: var(--red-neon);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.08);
}

.input-with-icon.drop-zone {
    border: 1.5px dashed var(--text-gray);
    background-color: transparent;
}

.input-with-icon.drop-zone.drag-over {
    border-color: var(--red-neon);
    background: rgba(230, 0, 0, 0.03);
}

.input-with-icon input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 10px 4px !important;
    outline: none;
    flex: 1;
    color: var(--text-dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 400;
    min-width: 0;
}

.attach-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.btn-attach {
    background: var(--border);
    border: none;
    border-radius: 6px;
    width: 38px;
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-dark);
    font-size: 15px;
    transition: all 0.2s;
}

.btn-attach:hover {
    background: var(--text-gray);
    color: #fff;
}

.btn-attach.has-file {
    background: #10b981;
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-preview-anexo,
.btn-wpp {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0284c7;
    border-radius: 6px;
    width: 38px;
    height: 38px;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    font-size: 15px;
}

.btn-wpp {
    background: #25d366;
    color: #fff;
    border: none;
    display: flex;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.15);
}

.btn-wpp:hover {
    background: #1da851;
    transform: translateY(-1px);
}

.btn-refazer-anexo {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #ef4444;
    border-radius: 6px;
    width: 38px;
    height: 38px;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 15px;
}

.attach-menu {
    display: none;
    position: absolute;
    bottom: 48px;
    right: 0;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
    border: 1px solid var(--border);
    min-width: 150px;
    overflow: hidden;
}

.attach-menu.show {
    display: block;
    animation: menuFade 0.15s ease;
}

@keyframes menuFade {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.attach-menu label,
.attach-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
    transition: background 0.2s;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
}

.attach-menu label:hover,
.attach-menu button:hover {
    background: var(--bg-gelo);
    color: var(--red-neon);
}

.attach-menu input[type="file"] {
    display: none;
}

/* === ABAS FIXAS E ELEGANTES === */
.cad-tabs,
.modal-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-bottom: 1px solid var(--border);
    margin-bottom: 25px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 0, 0, 0.4) transparent;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
    padding: 0 5px;
}

.modal-tabs {
    padding: 0 20px;
    background: var(--white);
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
}

.cad-tabs::-webkit-scrollbar,
.modal-tabs::-webkit-scrollbar {
    height: 4px;
}

.cad-tabs::-webkit-scrollbar-thumb,
.modal-tabs::-webkit-scrollbar-thumb {
    background: rgba(230, 0, 0, 0.4);
    border-radius: 4px;
}

.cad-tabs::-webkit-scrollbar-track,
.modal-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.cad-tab-btn,
.tab-btn {
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: var(--text-gray);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    flex: 0 0 auto;
    flex-shrink: 0;
    text-align: center;
    transition: color 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cad-tab-btn:hover,
.tab-btn:hover {
    color: var(--text-dark);
}

.cad-tab-btn.active,
.tab-btn.active {
    color: var(--red-neon);
    border-bottom-color: var(--red-neon);
    font-weight: 700;
}

.cad-tab-content,
.tab-content {
    display: none;
    width: 100%;
    animation: fadeIn 0.25s ease;
}

.cad-tab-content.active,
.tab-content.active {
    display: block;
}

/* === MODAIS PREMIUM === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
    will-change: opacity;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-gelo);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
}

.modal-content.small {
    max-width: 480px;
}

.modal-header {
    background: var(--white);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 18px;
    background: var(--red-neon);
    border-radius: 2px;
}

.close-modal {
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    font-size: 16px;
    cursor: pointer;
    color: var(--text-gray);
    padding: 6px;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.close-modal:hover {
    color: #fff;
    background: var(--red-neon);
    border-color: var(--red-neon);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* === FOOTER DO MODAL === */
.modal-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
    border-radius: 0 0 12px 12px;
}

.footer-left,
.footer-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.btn-group .btn-salvar {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    border: none;
}

.btn-group .btn-salvar:first-child {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    flex: 1;
}

.btn-group .btn-salvar:last-child {
    padding-left: 12px;
    padding-right: 12px;
    width: auto;
}

/* RESUMO DE FINANÇAS E LISTAS */
.resumo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.resumo-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow);
}

.resumo-card i {
    font-size: 20px;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.resumo-card span {
    display: block;
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.resumo-card h3 {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
}

.resumo-card.clickable {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.resumo-card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.08);
    border-color: var(--red-neon);
}

.resumo-card.clickable .card-edit-badge {
    display: block;
    font-size: 10px;
    color: var(--red-neon);
    font-weight: 600;
    margin-top: 6px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.resumo-card.clickable:hover .card-edit-badge {
    opacity: 1;
}

/* Indicador Delicado de Nome de Arquivo Anexado */
.file-name-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #047857;
    max-width: 100%;
    box-sizing: border-box;
    animation: fadeInTag 0.2s ease-out;
}

.file-name-tag i {
    font-size: 12px;
    color: #10b981;
}

.file-name-tag span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes fadeInTag {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.resumo-highlight {
    background: #0f172a;
    color: #fff;
    border: 1px solid #1e293b;
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-around;
    padding: 22px;
    border-radius: 12px;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}

.resumo-highlight .box {
    text-align: center;
    flex: 1;
    min-width: 110px;
}

.resumo-highlight .box h2 {
    font-size: 22px;
    color: var(--red-neon);
    margin: 6px 0 0;
    font-weight: 500;
    letter-spacing: -0.3px;
}

.resumo-highlight .box span {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 1px;
}

[data-theme="dark"] .resumo-highlight {
    background: #161e2e;
    border-color: #273142;
}

.lista-despesas-extras {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.item-despesa {
    background: var(--white);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    position: relative;
}

.item-despesa-info {
    flex: 1;
    min-width: 0;
}

.item-despesa-info strong {
    display: block;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-despesa-info span {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 2px;
    font-weight: 400;
    display: block;
}

.item-despesa-valor {
    font-weight: 500;
    color: var(--red-neon);
    font-size: 15px;
    white-space: nowrap;
}

#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--red-neon);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* === RESPONSIVO PREMIUM E INTELIGENTE === */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(15px);
        z-index: 95;
        padding: 0 15px;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    }

    [data-theme="dark"] .mobile-header {
        background: rgba(11, 15, 25, 0.85);
    }

    .mobile-logo {
        font-family: 'Racing Sans One', sans-serif;
        font-size: 20px;
        color: var(--text-dark);
        text-transform: uppercase;
    }

    .mobile-logo span {
        color: var(--red-neon);
    }

    .btn-hamburger {
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 20px;
        height: 13px;
        padding: 0;
        margin-left: -5px;
        transition: transform 0.3s ease;
    }

    .btn-hamburger span {
        display: block;
        width: 100%;
        height: 1.8px;
        background-color: var(--text-dark);
        border-radius: 1px;
        transition: all 0.3s ease;
    }

    .btn-hamburger span:nth-child(2) {
        width: 75%;
    }

    .btn-hamburger span:nth-child(3) {
        width: 50%;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 270px;
        position: fixed;
        z-index: 101;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 25px 15px;
        border-right: none;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-logo {
        display: none;
    }

    .sidebar-footer {
        padding-bottom: env(safe-area-inset-bottom, 15px);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 85px 15px 25px;
    }

    .titulo-secao {
        font-size: 21px;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .header-actions button {
        width: 100%;
        justify-content: center;
    }

    .cards-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card-form {
        padding: 20px;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-content {
        max-height: 95dvh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .cad-tabs,
    .modal-tabs {
        justify-content: flex-start;
        gap: 4px;
        padding: 0 8px;
    }

    .tab-btn,
    .cad-tab-btn {
        font-size: 11.5px;
        padding: 10px 12px;
        flex: 0 0 auto;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 12px;
    }

    .footer-left,
    .footer-right {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
    }

    .footer-left .btn-salvar,
    .footer-right .btn-salvar,
    .footer-right select {
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        display: flex;
        flex-direction: row !important;
        width: 100%;
    }

    .btn-group .btn-salvar:first-child {
        flex: 1;
    }

    .btn-group .btn-salvar:last-child {
        flex: 0 0 auto;
        width: 50px;
        padding: 0;
    }
}

/* === ESTILOS DASHBOARD PREMIUM === */
.dash-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    transition: all 0.25s;
}

.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.dash-card .dash-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-card .dash-value {
    font-size: 21px;
    font-weight: 500;
    color: var(--text-dark);
    margin-top: 8px;
    transition: color 0.3s;
    letter-spacing: -0.3px;
}

.dash-card .dash-sub {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 4px;
    font-weight: 400;
}

.btn-ocultar {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-gray);
    font-size: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    border: 1px solid var(--border);
    background: var(--white);
}

.btn-ocultar:hover {
    color: var(--red-neon);
    border-color: var(--red-neon);
}

.dash-value.masked {
    color: var(--text-gray) !important;
    letter-spacing: -1px;
}

/* === INLINE FILE ATTACH MENU OVERRIDES === */
.attach-menu-inline.show {
    display: flex !important;
    animation: menuFade 0.12s ease;
}

.attach-menu-inline label {
    padding: 6px 10px !important;
    font-size: 11px !important;
    border-radius: 6px;
    background: var(--bg-gelo);
    border: 1px solid var(--border);
    white-space: nowrap;
}


    /* === CONTROLES DO VISUALIZADOR DE MÍDIA === */
    .btn-vis-control {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        transition: background 0.2s, transform 0.1s;
    }

    .btn-vis-control:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(1.05);
    }

    .btn-vis-control:active {
        transform: scale(0.95);
    }

    .btn-vis-control.close:hover {
        background: #dc2626 !important;

        /* === GRID E ELEMENTOS DA GALERIA DE COMPROVANTES === */
        .card-comprovante-grid {
            position: relative;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--bg-card);
            aspect-ratio: 1 / 1;
            overflow: hidden;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .card-comprovante-grid:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
            border-color: var(--red-neon);
        }

        .card-comprovante-grid img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .card-comprovante-grid:hover img {
            transform: scale(1.05);
        }

        .card-comprovante-actions {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            display: flex;
            justify-content: space-around;
            padding: 6px;
            background: rgba(0, 0, 0, 0.65);
            backdrop-filter: blur(4px);
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .card-comprovante-grid:hover .card-comprovante-actions {
            opacity: 1;
        }

        .btn-action-comprovante {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 13px;
            transition: background 0.2s, transform 0.1s;
        }

        .btn-action-comprovante:hover {
            background: rgba(255, 255, 255, 0.4);
            transform: scale(1.05);
        }

        .btn-action-comprovante:active {
            transform: scale(0.95);
        }

        .btn-action-comprovante.delete:hover {
            background: #ef4444;
        }

/* === PULL TO REFRESH MOBILE NATIVO CENTRALIZADO 100% LARGURA === */
.pull-refresh-wrapper,
.pull-refresh-circle,
.pull-refresh-icon {
    display: none !important;
}
}

        [data-theme="dark"] .card-comprovante-grid {
            background: #1f2937;
            border-color: #374151;
        }

/* ============================================================
   === CONSULTA INTEGRADA — MOTOR DE BUSCA VEICULAR ===
   ============================================================ */

/* --- Painel de Busca --- */
.consulta-search-panel {
    background: var(--white);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.consulta-search-panel .consulta-search-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.consulta-search-panel .consulta-search-subtitle {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 500;
    margin: 0 0 22px 0;
}

.consulta-search-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 16px;
    align-items: flex-end;
}

/* Destaque rápido nos campos preenchidos pela leitura de documento (IA) */
@keyframes campoPreenchidoIA {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); background-color: rgba(16, 185, 129, 0.12); }
    100% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); background-color: transparent; }
}

.campo-preenchido-ia {
    animation: campoPreenchidoIA 1.4s ease-out;
}

.consulta-search-fields > div {
    min-width: 0;
}

.consulta-search-fields > div:last-child {
    min-width: 160px;
}

.consulta-search-fields .input-box label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.consulta-search-fields .input-box input {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
}

.btn-consultar {
    padding: 13px 28px;
    background: var(--red-neon);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(230, 0, 0, 0.18);
    min-height: 48px;
    white-space: nowrap;
}

.btn-consultar:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(230, 0, 0, 0.3);
}

.btn-consultar:disabled {
    background: var(--text-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.8;
}

.btn-consultar .spinner-icon {
    animation: spinConsulta 0.8s linear infinite;
    font-size: 14px;
}

@keyframes spinConsulta {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Informação da consulta (timestamp) --- */
.consulta-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--white);
    border-radius: 10px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.consulta-info-bar .consulta-placa-tag {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: 1px;
    background: var(--bg-gelo);
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: 'Montserrat', monospace;
}

.consulta-info-bar .consulta-timestamp {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 500;
}

/* --- Grid de Cards de Resultado --- */
.consulta-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

/* --- Card de Resultado Individual --- */
.consulta-result-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 22px;
    position: relative;
    transition: box-shadow 0.25s ease, transform 0.2s ease;
    overflow: hidden;
}

.consulta-result-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.consulta-result-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.consulta-result-card .card-header .card-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.consulta-result-card .card-header .card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.consulta-result-card .card-header .card-icon.debitos {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.consulta-result-card .card-header .card-icon.fipe {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.consulta-result-card .card-header .card-icon.historico {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.consulta-result-card .card-header .card-icon.restricoes {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.consulta-result-card .card-header .card-icon.prefeitura {
    background: rgba(15, 118, 110, 0.1);
    color: #0f766e;
}

.consulta-result-card .card-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.2;
}

.consulta-result-card .card-header h4 small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-gray);
    margin-top: 2px;
}

/* --- Badge de Fonte (Tag no canto superior direito) --- */
.consulta-badge-fonte {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--bg-gelo);
    color: var(--text-gray);
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
}

.consulta-badge-fonte.detran {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.2);
}

.consulta-badge-fonte.fipe {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.2);
}

.consulta-badge-fonte.base-nacional {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.2);
}

.consulta-badge-fonte.receita {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.2);
}

.consulta-badge-fonte.prefeitura {
    background: rgba(15, 118, 110, 0.08);
    color: #0f766e;
    border-color: rgba(15, 118, 110, 0.2);
}

/* Link discreto para boleto / notificação dentro de um item de multa */
.consulta-link {
    color: var(--red-neon);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.consulta-link:hover { text-decoration: underline; }

.consulta-link i { font-size: 9px; }

/* --- Linha de dado individual --- */
.consulta-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    gap: 12px;
}

.consulta-item-row:last-child {
    border-bottom: none;
}

.consulta-item-row .item-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-gray);
    flex-shrink: 0;
}

.consulta-item-row .item-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: right;
}

.consulta-item-row .item-value.danger {
    color: #ef4444;
    font-weight: 700;
}

.consulta-item-row .item-value.success {
    color: #10b981;
    font-weight: 700;
}

.consulta-item-row .item-value.warning {
    color: #f59e0b;
    font-weight: 700;
}

/* --- Status Badge Inline --- */
.consulta-status-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.consulta-status-badge.ok {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.consulta-status-badge.alerta {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.consulta-status-badge.perigo {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.consulta-status-badge.neutro {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

/* --- Seções, notas e restrições (dados reais da Infosimples) --- */
.consulta-secao-titulo {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    margin: 14px 0 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.consulta-secao-titulo:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.consulta-nota {
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-gray);
    padding: 4px 0 6px;
}

.consulta-item-row .item-label small {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-gray);
    margin-top: 2px;
}

.consulta-restricao-detalhe {
    padding: 8px 14px;
    margin: 0 0 6px;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 8px;
    border-left: 3px solid #ef4444;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    word-break: break-word;
}

.consulta-restricao-alerta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
}

.consulta-card-error.compacto {
    padding: 12px 10px;
    gap: 6px;
}

.consulta-card-error.compacto i {
    font-size: 18px;
}

.consulta-card-error .error-code {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-gray);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Totalizador do Card --- */
.consulta-card-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px solid var(--border);
}

.consulta-card-total .total-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.consulta-card-total .total-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

/* --- Multa Item --- */
.consulta-multa-item {
    background: var(--bg-gelo);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.consulta-multa-item:last-child {
    margin-bottom: 0;
}

.consulta-multa-item .multa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.consulta-multa-item .multa-desc {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

/* situação curta ("A vencer", "Vencida") numa linha só; a descrição é que quebra */
.consulta-multa-item .multa-header .consulta-status-badge {
    white-space: nowrap;
    flex-shrink: 0;
}

.consulta-multa-item .multa-detail {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 500;
}

/* --- Proprietário Item --- */
.consulta-proprietario-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-gelo);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.consulta-proprietario-item:last-child {
    margin-bottom: 0;
}

.consulta-proprietario-item .prop-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.consulta-proprietario-item .prop-info {
    flex: 1;
}

.consulta-proprietario-item .prop-info strong {
    font-size: 12px;
    color: var(--text-dark);
    font-weight: 600;
    display: block;
}

.consulta-proprietario-item .prop-info span {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 500;
}

/* --- Card de Erro (quando uma API falha) --- */
.consulta-card-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
    gap: 10px;
}

.consulta-card-error i {
    font-size: 28px;
    color: var(--text-gray);
    opacity: 0.5;
}

.consulta-card-error .error-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-gray);
}

/* --- Empty State (antes da consulta) --- */
.consulta-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 14px;
}

.consulta-empty-state .empty-icon {
    font-size: 48px;
    color: var(--border);
    opacity: 0.6;
}

.consulta-empty-state .empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.consulta-empty-state .empty-desc {
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 500;
    max-width: 380px;
    margin: 0;
}

/* ============================================================
   === SKELETON LOADERS ===
   ============================================================ */
.consulta-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}

.skeleton-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 22px;
    overflow: hidden;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-gelo) 25%, var(--border) 50%, var(--bg-gelo) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    margin-bottom: 12px;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-line.w-30 { width: 30%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-100 { width: 100%; }
.skeleton-line.h-20 { height: 20px; }
.skeleton-line.h-16 { height: 16px; }

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.skeleton-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--bg-gelo) 25%, var(--border) 50%, var(--bg-gelo) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   === DARK MODE — CONSULTA INTEGRADA ===
   ============================================================ */
[data-theme="dark"] .consulta-item-row {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .consulta-multa-item,
[data-theme="dark"] .consulta-proprietario-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
}

[data-theme="dark"] .consulta-badge-fonte {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .consulta-badge-fonte.detran {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

[data-theme="dark"] .consulta-badge-fonte.fipe {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .consulta-badge-fonte.base-nacional {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .consulta-badge-fonte.prefeitura {
    background: rgba(45, 212, 191, 0.12);
    border-color: rgba(45, 212, 191, 0.25);
    color: #5eead4;
}

[data-theme="dark"] .consulta-result-card .card-header .card-icon.prefeitura {
    background: rgba(45, 212, 191, 0.12);
    color: #5eead4;
}

[data-theme="dark"] .skeleton-line {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

[data-theme="dark"] .skeleton-avatar {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* ============================================================
   === RESPONSIVIDADE — CONSULTA INTEGRADA ===
   ============================================================ */
@media (max-width: 1280px) {
    .consulta-search-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .consulta-search-fields > div:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .consulta-search-panel {
        padding: 20px;
    }

    .consulta-search-fields {
        grid-template-columns: 1fr;
    }

    .consulta-search-fields > div:last-child {
        min-width: unset;
    }

    .consulta-results-grid,
    .consulta-skeleton-grid {
        grid-template-columns: 1fr;
    }

    .consulta-result-card {
        padding: 18px;
    }

    .consulta-info-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}