/* =============================================================================
   Painel Administrativo — Sistema de Gestão de Resíduos
   Tokens: superfície clara e neutra, acento verde-petróleo (rastreabilidade
   ambiental sem cair no clichê), números/códigos em monoespaçada — reforça a
   ideia de rastreio preciso (placas, números de OS, MTR, CDF) que é o cerne
   do negócio.
   ============================================================================= */

:root {
    --bg:            #F6F7F5;
    --surface:       #FFFFFF;
    --surface-hover: #EFF2EF;
    --border:        #E1E5E1;
    --text:          #1B211E;
    --text-muted:    #5C6A63;
    --accent:        #2F6F5E;
    --accent-hover:  #24594B;
    --accent-soft:   #E6EFEC;

    --cor-agendada:  #6B7570;
    --cor-em_rota:   #2F6F5E;
    --cor-coletada:  #2563EB;
    --cor-destinada: #15803D;
    --cor-cancelada: #B3261E;
    --cor-reagendada:#A15C00;

    --radius: 8px;
    --sombra: 0 1px 2px rgba(27, 33, 30, 0.06), 0 1px 6px rgba(27, 33, 30, 0.04);

    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- Login ---------- */
.tela-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.cartao-login {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
}

.cartao-login h1 {
    font-size: 20px;
    margin: 0 0 4px;
}

.cartao-login .subtitulo {
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 13px;
}

/* ---------- Formulários ---------- */
label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    margin-bottom: 16px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.campo-erro {
    color: var(--cor-cancelada);
    font-size: 13px;
    margin: -10px 0 16px;
    display: none;
}

button, .botao {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.botao-primario {
    background: var(--accent);
    color: #fff;
    width: 100%;
}
.botao-primario:hover { background: var(--accent-hover); }
.botao-primario:disabled { opacity: 0.6; cursor: not-allowed; }

.botao-secundario {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
.botao-secundario:hover { background: var(--surface-hover); }

/* ---------- Layout do painel ---------- */
.painel {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.barra-lateral {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
}

.marca {
    font-weight: 700;
    font-size: 15px;
    padding: 0 8px 20px;
    color: var(--text);
}
.marca span { color: var(--accent); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.ativo { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.desabilitado { opacity: 0.45; cursor: default; }
.nav-item.desabilitado:hover { background: none; color: var(--text-muted); }

.rodape-lateral {
    margin-top: auto;
    padding: 12px 10px 0;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
}
.rodape-lateral .nome { color: var(--text); font-weight: 600; }

.area-principal {
    padding: 28px 32px;
    max-width: 1100px;
}

.cabecalho-pagina {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
}
.cabecalho-pagina h1 { font-size: 20px; margin: 0 0 4px; }
.cabecalho-pagina p { color: var(--text-muted); margin: 0; font-size: 13px; }

/* ---------- Tabela ---------- */
.cartao {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
}

.estado-vazio {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.carregando { padding: 24px; color: var(--text-muted); font-size: 13px; }

/* ---------- Modal ---------- */
.sobreposicao {
    position: fixed; inset: 0;
    background: rgba(27, 33, 30, 0.35);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    z-index: 50;
}
.sobreposicao[hidden] { display: none; }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(27,33,30,0.2);
    width: 100%; max-width: 440px;
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal { max-width: 440px; }
.modal.modal-largo { max-width: 620px; }
.modal h2 { font-size: 17px; margin: 0 0 20px; }
.modal-secao {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent);
    font-weight: 700;
    margin: 20px 0 10px;
}
.modal-secao:first-of-type { margin-top: 0; }
.linha-campos {
    display: grid;
    gap: 12px;
}
.linha-campos.col-2 { grid-template-columns: 1fr 1fr; }
.linha-campos.col-3 { grid-template-columns: 2fr 1fr 1fr; }
.linha-campos > div { margin-bottom: 0; }
.campo-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.campo-checkbox input { width: auto; margin: 0; }
.campo-checkbox label { margin: 0; text-transform: none; font-size: 13.5px; font-weight: 500; color: var(--text); }
.modal-acoes { display: flex; gap: 10px; margin-top: 4px; }
.modal-acoes button { flex: 1; justify-content: center; }

.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 13.5px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.toast.visivel { opacity: 1; }
.toast.erro { background: var(--cor-cancelada); }

/* ---------- Responsivo (celular) ---------- */
@media (max-width: 720px) {
    .painel { grid-template-columns: 1fr; }
    .barra-lateral {
        position: fixed; bottom: 0; left: 0; right: 0; top: auto;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        padding: 8px;
        overflow-x: auto;
        z-index: 40;
    }
    .marca, .rodape-lateral { display: none; }
    .nav-item { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 10px; white-space: nowrap; }
    .area-principal { padding: 20px 16px 90px; }
    .cabecalho-pagina { flex-direction: column; gap: 12px; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    .cartao tr { border-bottom: 1px solid var(--border); padding: 12px 16px; }
    .cartao td { border: none; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
    .cartao td::before { content: attr(data-rotulo); color: var(--text-muted); font-weight: 600; font-size: 11.5px; }
}

/* Ordenação de tabelas por clique no cabeçalho */
th.th-ordenavel {
    cursor: pointer;
    user-select: none;
}
th.th-ordenavel:hover {
    background: var(--bg-hover, rgba(0,0,0,0.04));
}
.seta-ordenacao {
    font-size: 10px;
    color: var(--text-muted, #888);
}
