:root {
    --ink: #191b1b;
    --paper: #f5f3ed;
    --gold: #f2b705;
    --gold-hover: #ffd03b;
    --muted: #5e635d;
    --line: #d3d0c7;
    --saida: #7d2114;
    --entrada: #146b42;
    --info: #1d4e89;
    --sombra: 0 16px 40px #292d2814;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 17px;
    line-height: 1.45;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

.site {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 10px 16px;
    background: #f5f3edf2;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
    min-width: 0;
    text-decoration: none;
}

.brand-logo {
    height: 48px;
    width: 48px;
    object-fit: cover;
    border-radius: 6px;
}

.brand-name { display: flex; flex-direction: column; gap: 2px; }
.brand-name strong { font-size: 15px; letter-spacing: 0.04em; }
.brand-name small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.menu {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.menu-grupo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 4px 14px 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
}

.menu-rotulo {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.menu-grupo .link.ativo, .menu > .link.ativo { box-shadow: inset 0 -2px 0 var(--gold); }

.painel .folha { width: min(1180px, calc(100% - 32px)); }
.painel-agora {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
    margin-bottom: 28px;
}
.painel-bloco h2 a { text-decoration: none; }
.parado {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}
.parado a {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #ffe3c2;
    text-decoration: none;
    font-weight: 700;
}
.recortes { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0; color: var(--muted); }
.quem { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.cartao header .quem, h2.quem { display: flex; flex: 1; }
.mini {
    width: 40px;
    height: 40px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    flex: none;
    background: #e7e1d6;
}

.site-usuario { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; background: #e7e1d6; }
.site-maquina {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
    padding-left: 8px;
    border-left: 1px solid var(--line);
    color: var(--ink);
    font-weight: 700;
}
.site-maquina img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
    flex: none;
    background: #e7e1d6;
}
.site-maquina .link-discreto { margin-top: 0; font-size: 13px; }
.link { font-weight: 700; text-decoration: none; }

.folha {
    width: min(880px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 64px;
}

.olho {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 { margin: 0; font-size: 32px; line-height: 1.1; }
h2 { margin: 0 0 10px; font-size: 18px; }

.cabeca, .botoes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.cabeca { justify-content: space-between; margin-bottom: 18px; }
.cabeca .acoes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.botoes { margin: 18px 0; }
.botoes form { margin: 0; }

.aviso {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #e7f6ee;
    color: var(--entrada);
    font-weight: 700;
}

.aviso.erro { background: #fde8e4; color: var(--saida); }

.nota { color: var(--muted); }
.vazio {
    padding: 28px 16px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    text-align: center;
    color: var(--muted);
}

.btn, button, .site button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.btn.primario, button.primario {
    background: var(--gold);
    color: var(--ink);
}

.btn.primario:hover { background: var(--gold-hover); }

.btn.secundario, .site button {
    background: transparent;
    border: 1px solid var(--line);
}

.btn.concluir { background: var(--entrada); color: white; }
.btn.perigo { background: transparent; color: var(--saida); border: 1px solid #e3b2aa; }

.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.busca, .filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: flex-end; }
.busca input {
    flex: 1 1 220px;
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
}

.filtros a {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 999px;
    background: white;
    border: 1px solid var(--line);
    text-decoration: none;
    font-size: 14px;
}

.filtros a.ativo { background: var(--ink); color: white; border-color: var(--ink); }

.lista { display: grid; gap: 12px; }

.fila .folha, .trabalhos .folha { width: min(1180px, calc(100% - 32px)); }
.fila .lista, .trabalhos .lista { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }

.cartao {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--line);
    box-shadow: var(--sombra);
    text-decoration: none;
}

.cartao header, .cadastro li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cartao header strong { font-size: 22px; }
.foto-equipamento,
.foto-caminhao {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    background: #e7e1d6;
}
.caminhao-nome { display: grid; gap: 2px; min-width: 0; }
.caminhao-nome .meta { font-size: 15px; font-weight: 600; }
.cliente { margin: 0; font-size: 20px; font-weight: 700; }
.carga { margin: 0; font-size: 18px; }
.meta { margin: 0; color: var(--muted); }

.selo {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eceae4;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status-aguardando_autorizacao { background: #eceae4; }
.status-liberado { background: var(--gold); }
.status-carregando { background: #d7e6f8; color: var(--info); }
.status-aguardando_conferencia { background: #ffe3c2; }
.status-concluido { background: #d8f3e4; color: var(--entrada); }
.status-cancelado { background: #fde8e4; color: var(--saida); }
.status-na_fila { background: var(--gold); }
.status-em_viagem { background: #d7e6f8; color: var(--info); }
.status-retornando { background: #ffe3c2; }

.ficha {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 18px;
}

.ficha div {
    padding: 12px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.ficha dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ficha dd { margin: 4px 0 0; font-size: 18px; }

.linha-tempo { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.linha-tempo li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}
.linha-tempo li.feito { color: var(--ink); }
.linha-tempo span { text-align: right; }

.bloco { margin-top: 22px; }
.texto { white-space: pre-wrap; }

.formulario { display: grid; gap: 14px; }
.grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.campo { display: grid; gap: 6px; font-weight: 700; }
.campo span { font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.campo input, .campo select, .campo textarea {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
}
.campo textarea { min-height: 96px; resize: vertical; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.check input { width: 22px; height: 22px; }

.maquinas { margin: 0; padding: 0; border: 0; display: grid; gap: 10px; }
.maquinas-duas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.maquinas legend {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

.escolha input { position: absolute; opacity: 0; }
.escolha span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 72px;
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: white;
    font-size: 22px;
    font-weight: 700;
}
.escolha small { color: var(--muted); font-size: 14px; font-weight: 600; }
.escolha-maquina span { padding: 0; overflow: hidden; align-items: stretch; }
.escolha-maquina .escolha-texto { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.escolha-maquina .foto-equipamento { height: 160px; border-radius: 0; }
.escolha input:checked + span { border-color: var(--ink); background: var(--gold); }
.escolha input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.resumo { margin-bottom: 18px; }
.entrada { max-width: 420px; margin: 24px auto; }
.entrada-equipe { max-width: none; }
.entrada h1 { margin-bottom: 8px; }
.rostos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
    margin: 20px 0 28px;
}
.rostos form { margin: 0; }
button.rosto {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    min-height: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    text-align: center;
}
button.rosto:hover { border-color: var(--ink); }
button.rosto img,
.rosto-vazio {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    background: #e7e1d6;
}
button.rosto img { object-fit: cover; object-position: center; }
.rosto-vazio {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.rosto-nome { font-size: 15px; line-height: 1.25; }
.entrada-admin { max-width: 420px; }
.entrada-admin h2 { margin-top: 4px; }
.data { color: var(--muted); }

.cadastro { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.cadastro li {
    padding: 8px 8px 8px 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.cadastro a { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; font-size: 18px; }
.cadastro .inativo { opacity: 0.62; }
.cadastro-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cadastro-texto strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cadastro-texto small { color: var(--muted); font-size: 14px; font-weight: 600; }
.miniatura { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; flex: none; background: #e7e1d6; }
.pessoa-foto {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    object-position: center;
    flex: none;
    background: #e7e1d6;
}
.foto-pessoa {
    width: 180px;
    height: 180px;
    object-fit: cover;
    object-position: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #e7e1d6;
}
.enquadro { display: grid; gap: 8px; justify-items: start; }
.enquadro[hidden] { display: none; }
.enquadro-moldura {
    position: relative;
    width: min(240px, 100%);
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #111;
    touch-action: none;
    cursor: grab;
}
.enquadro-moldura img {
    position: absolute;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
}
.enquadro-zoom { display: grid; gap: 6px; width: min(240px, 100%); font-weight: 700; }
.enquadro-zoom span { font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.enquadro-zoom input { width: 100%; }
.foto-atual { width: min(100%, 280px); height: 180px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.dica { color: var(--muted); font-size: 13px; font-weight: 600; }

.enviadas { list-style: none; margin: 0; padding: 0; }
.enviadas li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.enviada { flex: 1; min-width: 0; display: grid; gap: 2px; }
.enviada p { margin: 0; }
.enviada-topo { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.enviada-topo span:not(.selo) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enviada-topo .selo { margin-left: auto; flex: none; }

.patio .folha, .lavra .folha { width: min(720px, calc(100% - 24px)); }
.patio .btn, .lavra .btn { width: 100%; min-height: 64px; font-size: 20px; }
.lavra .espera {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 64px;
    margin: 8px 0 0;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--gold);
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}
.patio .cartao.destaque .btn, .lavra .cartao .btn { margin-top: 8px; }
.patio .cabeca .btn, .patio form.busca .btn, .lavra .cabeca .btn, .lavra form.busca .btn { width: auto; min-height: 48px; font-size: 16px; }
.patio h2, .lavra h2 { margin-top: 22px; }
.ciclo { margin: 0; font-size: 22px; font-weight: 700; }
.link-discreto {
    display: inline-block;
    width: auto;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.retro-escolhida {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 700;
}
.caminhao-nome .link-discreto { display: table; margin-top: 8px; }
.lavra .encerrar { margin: 0 0 4px; }
.lavra .encerrar .link-discreto { display: inline-block; margin: 0; font-size: 14px; }
.lavra button.link-discreto {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: none;
    color: var(--muted);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.lavra button.acao-perigosa {
    display: block;
    width: auto;
    min-height: 0;
    margin: 28px auto 0;
    padding: 8px 4px;
    background: transparent;
    color: var(--saida);
    font-size: 14px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tempos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 16px;
}
.tempos div {
    padding: 12px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.tempos span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.tempos strong { font-size: 20px; }
.tempos-ciclo { margin: 8px 0 0; }

@media (max-width: 980px) {
    .fila .lista, .trabalhos .lista, .painel-agora { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .site { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
    .brand { flex: 1 1 180px; }
    .menu { width: 100%; }
    .brand-name small { display: none; }
    .ficha, .grade { grid-template-columns: 1fr; }
    .tempos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .linha-tempo li { flex-direction: column; }
    .linha-tempo span { text-align: left; }
    h1 { font-size: 28px; }
}
