﻿:root {
    --bg: #f2f5f9;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #0f766e;
    --primary-hover: #115e59;
    --secondary: #374151;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top, #e0f2fe 0%, var(--bg) 55%);
}

main {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
}

.container {
    width: min(980px, 100%);
    background: var(--panel);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    padding: 32px;
}

#telaResultados.container {
    width: 100%;
}

.tela {
    display: none;
}

.tela.ativa {
    display: block;
}

h1 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: clamp(1.6rem, 2.8vw, 2rem);
}

h2 {
    margin: 24px 0 10px;
    font-size: 1.2rem;
}

ol {
    margin: 0;
    padding-left: 20px;
    color: #374151;
}

li + li {
    margin-top: 6px;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 24px 0;
}

input[type="file"] {
    display: block;
    width: 100%;
    margin: 8px 0 4px;
}

.dica-multiplos-arquivos {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: #374151;
    background: #eff6ff;
    border-left: 3px solid var(--primary);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
}

.dica-multiplos-arquivos kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.82rem;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    background: #f9fafb;
    font-family: monospace;
}

.acoes-upload,
.acoes-resultado {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="file"]::file-selector-button,
button {
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

input[type="file"]::file-selector-button:hover,
button:hover {
    background: var(--primary-hover);
}

.btn-secundario {
    background: var(--secondary);
}

.btn-secundario:hover {
    background: #111827;
}

.feedback {
    min-height: 22px;
    margin: 10px 0 0;
    color: #b91c1c;
    font-weight: 600;
}

.instrucao-motorista {
    margin-top: 0;
    margin-bottom: 16px;
    color: #374151;
}

.form-motorista {
    display: grid;
    gap: 8px;
    max-width: 520px;
}

.form-motorista input {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
}

.btn-remover {
    background: #b91c1c;
}

.btn-remover:hover {
    background: #991b1b;
}

.disclaimer {
    margin-top: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}

.cabecalho-resultado {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

.subtitulo-resultado {
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.resumo {
    margin-top: 10px;
    padding: 14px 16px;
    background: linear-gradient(120deg, #f0fdfa 0%, #ecfeff 100%);
    border: 1px solid #99f6e4;
    border-radius: 12px;
    font-weight: 600;
}

.secao-resultado {
    margin-top: 18px;
    border: 1px solid #dbe7f5;
    border-radius: 14px;
    padding: 14px;
    background: #f8fafc;
}

.secao-resultado h2 {
    margin-top: 0;
}

.secao-destaque {
    background: #fffdf8;
    border-color: #f3d9ac;
}

.tabela-wrapper {
    overflow-x: auto;
}

.tabela-wrapper-uso-viatura {
    max-width: 720px;
}

.tabs-viatura {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tab-viatura {
    background: #f1f5f9;
    color: var(--secondary);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.88rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
}

.tab-viatura:hover {
    background: #e2e8f0;
    color: var(--secondary);
}

.tab-viatura.ativa {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tab-viatura.ativa:hover {
    background: var(--primary-hover);
}

.lista-pendencias {
    margin-top: 6px;
    display: grid;
    gap: 14px;
}

.sem-pendencias {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 600;
}

.pendencia-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    padding: 12px;
}

.pendencia-cabecalho {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pendencia-cabecalho h3 {
    margin: 0;
    font-size: 1rem;
}

.pendencia-total {
    font-size: 0.85rem;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 700;
}

.diferenca-km {
    font-weight: 700;
    color: #991b1b;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th,
td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

th {
    color: #111827;
    background: #f9fafb;
}

@media (max-width: 640px) {
    main {
        padding: 12px;
    }

    .container {
        padding: 20px;
    }

    th,
    td {
        font-size: 0.88rem;
        padding: 8px;
    }
}

.rodape-github {
    text-align: center;
    padding: 16px;
    font-size: 0.9rem;
}

.link-github {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 14px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.link-github:hover {
    background: #f3f4f6;
    border-color: #6b7280;
    color: var(--primary);
}

/* ── Pendências / gap layout ──────────────────────────────────────────── */
.pendencia-lista-gaps {
    display: grid;
    gap: 10px;
}

.gap-item {
    display: flex;
    align-items: stretch;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    background: #f8fafc;
}

.reg-mini {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    background: #fff;
}

/* Linha 1: data + horário + rota */
.reg-mini-topo {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.reg-mini-data {
    font-size: 0.75rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0c4a6e;
    border-radius: 999px;
    padding: 1px 7px;
    white-space: nowrap;
}

.reg-mini-horario {
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.reg-mini-rota {
    font-size: 0.80rem;
    color: #6b7280;
    overflow-wrap: anywhere;
}

/* Linha 2: motorista + finalidade + km */
.reg-mini-rodape {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.reg-mini-motorista {
    font-size: 0.78rem;
    color: #374151;
    font-weight: 500;
}

.reg-mini-finalidade {
    font-size: 0.72rem;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 0px 7px;
    font-weight: 600;
    white-space: nowrap;
}

.reg-mini-km {
    font-size: 0.78rem;
    color: #4b5563;
    margin-left: auto;
    white-space: nowrap;
}

.gap-separador {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: linear-gradient(180deg, #fff7ed 0%, #fef3c7 100%);
    border-left: 1px solid #fde68a;
    border-right: 1px solid #fde68a;
    gap: 6px;
    min-width: 90px;
}

.gap-icone {
    width: 20px;
    height: 20px;
    color: #b45309;
    flex-shrink: 0;
}

.gap-badge-diferenca {
    font-size: 0.75rem;
    font-weight: 700;
    color: #92400e;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 680px) {
    .gap-item {
        flex-direction: column;
    }

    .gap-separador {
        flex-direction: row;
        min-width: unset;
        border-left: none;
        border-right: none;
        border-top: 1px solid #fde68a;
        border-bottom: 1px solid #fde68a;
        padding: 8px 14px;
    }
}
