:root {
    --fundo: #f3f4f6;
    --papel: #ffffff;
    --tinta: #1f2937;
    --suave: #6b7280;
    --linha: #e5e7eb;
    --primaria: #1d4e89;
    --primaria-escura: #16324f;
    --destaque: #e06b12;
    --whatsapp: #1fa855;
    --sombra: 0 1px 2px rgba(22, 50, 79, 0.06), 0 8px 24px rgba(22, 50, 79, 0.06);
    --raio: 8px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--tinta);
    background: var(--fundo);
    line-height: 1.5;
}

.topo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    background: var(--primaria-escura);
    color: #f8fafc;
    padding: 0.5rem 1rem;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.menu a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.7rem;
    border-radius: var(--raio);
    color: #f8fafc;
    font-weight: 600;
    text-decoration: none;
}

.menu a.ativo {
    background: rgba(255, 255, 255, 0.16);
}

.menu a.sair {
    color: #fdba74;
}

.aviso-contagem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #fde68a;
    color: #1a2433;
    font-size: 0.75rem;
    line-height: 1;
}

.ativar-avisos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.confirmacoes {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
}

.confirmacao {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.confirmacao p {
    margin: 0;
}

.marca {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
    font-size: 1.05rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.conteudo {
    flex: 1;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 2.5rem;
}

.rodape {
    border-top: 1px solid var(--linha);
    color: var(--suave);
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

.rodape .link-instalar {
    display: block;
    margin: 0.35rem auto 0;
    color: var(--primaria);
}

h1 {
    font-size: 1.5rem;
    line-height: 1.25;
    margin: 0 0 0.75rem;
}

h2 {
    font-size: 1.05rem;
    margin: 0 0 0.75rem;
}

p {
    margin: 0 0 0.75rem;
}

a {
    color: var(--primaria);
}

button,
.botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.625rem 1rem;
    border: 0;
    border-radius: var(--raio);
    background: var(--primaria);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.botao:hover,
button:hover {
    filter: brightness(1.05);
}

.botao-bloco {
    width: 100%;
}

.botao-gigante {
    width: 100%;
    min-height: 4.25rem;
    font-size: 1.15rem;
}

button.link-cancelar {
    display: inline-block;
    width: auto;
    min-height: 0;
    margin-top: 1.25rem;
    padding: 0;
    border: 0;
    background: none;
    color: #b46a6a;
    font-size: 0.875rem;
    font-weight: 600;
}

dialog {
    width: min(28rem, calc(100% - 2rem));
    border: 0;
    border-radius: var(--raio);
    padding: 1.25rem;
}

dialog::backdrop {
    background: rgba(22, 50, 79, 0.45);
}

.botao-linha,
.botao-perigo {
    background: transparent;
}

.botao-linha {
    color: var(--primaria);
    border: 1px solid #bfd0e4;
}

.botao-perigo {
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.botao-destaque {
    background: var(--destaque);
}

.botao-whatsapp {
    background: var(--whatsapp);
}

.campo {
    margin-bottom: 1rem;
}

details {
    margin-top: 1rem;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.campo label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.campo input,
.campo select,
.campo textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: var(--raio);
    background: #fff;
    font: inherit;
    font-size: 1rem;
}

.campo textarea {
    min-height: 6rem;
    resize: vertical;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    outline: none;
    border-color: var(--primaria);
    box-shadow: 0 0 0 3px rgba(29, 78, 137, 0.18);
}

.alerta {
    padding: 0.75rem 1rem;
    border-radius: var(--raio);
    margin: 0 0 1rem;
}

.alerta-ok {
    background: #e7f5ec;
    color: #14532d;
}

.alerta-erro,
.erro-campo {
    color: #7f1d1d;
}

.alerta-erro {
    background: #fde8e4;
}

.erro-campo {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
}

.cartao {
    background: var(--papel);
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 1rem;
}

.cartao + .cartao,
.bloco {
    margin-top: 1rem;
}

.dados p {
    margin: 0 0 0.35rem;
}

.rotulo-feito {
    margin: 0.85rem 0 0.2rem;
    color: var(--suave);
    font-size: 0.8125rem;
    font-weight: 700;
}

.feito {
    margin: 0.15rem 0 0;
    padding-left: 1.15rem;
}

.feito li {
    margin: 0.15rem 0;
}

.metricas {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.metrica-rotulo {
    margin: 0;
    color: var(--suave);
    font-size: 0.875rem;
    font-weight: 600;
}

.metrica-valor {
    margin: 0.25rem 0 0;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.selo {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.1rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    background: #e5e7eb;
    color: #374151;
}

.selo-em_analise {
    background: #e5e7eb;
    color: #374151;
}

.selo-diagnostico {
    background: #dbeafe;
    color: #1e40af;
}

.selo-aguardando_aprovacao {
    background: #fef3c7;
    color: #92400e;
}

.selo-aprovado {
    background: #dcfce7;
    color: #166534;
}

.selo-aguardando_peca {
    background: #ffedd5;
    color: #9a3412;
}

.selo-em_execucao {
    background: #ede9fe;
    color: #5b21b6;
}

.selo-pronto {
    background: #bbf7d0;
    color: #14532d;
}

.selo-entregue {
    background: #d1d5db;
    color: #1f2937;
}

.selo-cancelado {
    background: #fee2e2;
    color: #991b1b;
}

.tabela {
    width: 100%;
    border-collapse: collapse;
    background: var(--papel);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

.tabela th,
.tabela td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--linha);
    vertical-align: middle;
}

.tabela th {
    font-size: 0.8125rem;
    color: var(--suave);
    font-weight: 700;
}

.tabela tbody tr:hover {
    background: #f8fafc;
}

.tabela tbody tr:last-child td {
    border-bottom: 0;
}

.linha-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--linha);
}

.linha-item p {
    margin: 0;
}

.total {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.75rem 0 0;
}

.total-aviso {
    color: var(--suave);
    font-size: 0.875rem;
}

.via-os h1 {
    margin-bottom: 0.25rem;
}

@media print {
    body {
        background: #fff;
    }

    .topo,
    .rodape,
    .no-print,
    .aviso-contagem {
        display: none !important;
    }

    .conteudo {
        padding: 0;
    }

    .via-os {
        box-shadow: none;
        border: 0;
    }
}

.link-publico {
    word-break: break-all;
}

.acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.acoes form {
    margin: 0;
}

.acoes-empilhadas {
    flex-direction: column;
}

.acoes-empilhadas .botao,
.acoes-empilhadas form,
.acoes-empilhadas form .botao {
    width: 100%;
}

.proposta-kicker {
    margin: 0 0 0.25rem;
    color: var(--destaque);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.proposta-total {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--raio);
    background: #16324f;
    color: #f8fafc;
}

.proposta-total span {
    display: block;
    color: #cbd5e1;
    font-size: 0.875rem;
}

.proposta-total strong {
    display: block;
    font-size: 2rem;
    line-height: 1.2;
}

body.publico .conteudo {
    max-width: 32rem;
}

body.publico .topo {
    background: var(--papel);
    color: var(--primaria-escura);
    border-bottom: 1px solid var(--linha);
    box-shadow: var(--sombra);
}

@media (min-width: 40rem) {
    .metricas {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 64rem) {
    .metricas {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 40rem) {
    .tabela thead {
        display: none;
    }

    .tabela,
    .tabela tbody,
    .tabela tr,
    .tabela td {
        display: block;
        width: 100%;
    }

    .tabela {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    .tabela tr {
        background: var(--papel);
        border: 1px solid var(--linha);
        border-radius: var(--raio);
        box-shadow: var(--sombra);
        margin-bottom: 0.75rem;
        padding: 0.35rem 0.85rem 0.75rem;
    }

    .tabela td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.45rem 0;
        border-bottom: 1px solid var(--linha);
    }

    .tabela td:last-child {
        border-bottom: 0;
        padding-top: 0.75rem;
    }

    .tabela td::before {
        content: attr(data-rotulo);
        color: var(--suave);
        font-weight: 700;
        font-size: 0.8125rem;
    }

    .tabela td[data-rotulo=""]::before {
        content: none;
    }

    .tabela tbody tr:hover {
        background: var(--papel);
    }
}

.cadastro-link {
    margin-top: 1.25rem;
}
