/* ==========================================================================
   CONCRESERV - Design System
   VERSAO: 11/11/2026 - v5

   PADRAO UNICO E GLOBAL. Sem escopo. Vale para TODAS as paginas.
   Fonte: painel_gerencial.php v17.

   NOVIDADES v5:
   - Larguras de coluna definidas na tabela. A coluna DESCRICAO
     ocupava 70-75% da largura e estourava a tela. Agora a tabela
     usa table-layout com larguras controladas e a descricao tem
     limite de largura com reticencias.
   - .pill-link com max-width e text-overflow.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', Arial, sans-serif;
    background: #F5F6F8;
    color: #1F2937;
}

/* ==========================================================================
   BARRA SUPERIOR
   ========================================================================== */

.topo {
    background: #EE0000;
    border-bottom: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    height: 54px;
    min-height: 54px;
    z-index: 100;
}

.topo-esquerda {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    z-index: 2;
}

.topo h1 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2.5px;
    white-space: nowrap;
    z-index: 1;
    pointer-events: none;
}

.topo .menu-btn {
    background: rgba(255,255,255,.15);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.topo .menu-btn:hover { background: rgba(255,255,255,.28); }

/* ==========================================================================
   MENU DROPDOWN
   ========================================================================== */

.menu-dropdown { position: relative; }

.menu-conteudo {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: #374151;
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    padding: 8px;
    margin-top: 0;
    z-index: 1000;
}
.menu-dropdown.aberto .menu-conteudo { display: block; }

.menu-conteudo a {
    display: block;
    padding: 9px 14px;
    margin-bottom: 4px;
    border-radius: 999px;
    color: #E5E7EB;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.menu-conteudo a:last-child { margin-bottom: 0; }
.menu-conteudo a:hover,
.menu-conteudo a.menu-ativo {
    background: #EE0000;
    color: #fff;
    box-shadow: 0 2px 8px rgba(238,0,0,.28);
}

/* ==========================================================================
   USUARIO NO CANTO DIREITO
   ========================================================================== */

.topo-direita {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    z-index: 2;
}

.user-dropdown { position: relative; }

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 999px;
    padding: 3px 5px 3px 13px;
    cursor: pointer;
    color: #fff;
}
.user-btn:hover { background: rgba(255,255,255,.28); }

.user-nome {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    color: #EE0000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    flex: 0 0 auto;
}

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #374151;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    padding: 8px;
    z-index: 1000;
}
.user-dropdown.aberto .user-menu { display: block; }

.user-menu .user-cabecalho {
    padding: 8px 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 8px;
}
.user-menu .user-cabecalho .nm { font-size: 13px; font-weight: 700; color: #fff; }
.user-menu .user-cabecalho .pf { font-size: 11px; color: #9CA3AF; margin-top: 1px; }

.user-menu a {
    display: block;
    padding: 9px 14px;
    margin-bottom: 4px;
    border-radius: 999px;
    color: #E5E7EB;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.user-menu a:last-child { margin-bottom: 0; }
.user-menu a:hover {
    background: #EE0000;
    color: #fff;
    box-shadow: 0 2px 8px rgba(238,0,0,.28);
}

/* ==========================================================================
   CONTEUDO E CARDS
   ========================================================================== */

.conteudo { max-width: 1100px; margin: 28px auto; padding: 0 20px; }

.card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.card h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

/* ==========================================================================
   KPIs
   ========================================================================== */

.indicadores {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 14px;
    align-items: stretch;
}

.indicadores .ind {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.indicadores .ind .rotulo {
    font-size: 10px;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #6B7280;
    font-weight: 700;
}

.indicadores .ind .valor {
    font-size: 20px;
    line-height: 1.15;
    font-weight: 800;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.rotulo-linha {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
    line-height: 1.2;
}
.rotulo-linha .rotulo { margin: 0; line-height: 1.2; }
.rotulo-linha select {
    font-size: 9px;
    font-weight: 700;
    padding: 0 2px;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    flex: 0 0 auto;
    line-height: 1.2;
    height: 15px;
    vertical-align: baseline;
}
.rotulo-linha select:hover { border-color: #EE0000; color: #EE0000; }

/* ==========================================================================
   FILTROS
   ========================================================================== */

.filtros {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
}

.filtros > div {
    flex: 1 1 0;
    min-width: 0;
}

.filtros > div.acoes {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
}

.filtros label {
    font-size: 11px;
    margin-bottom: 2px;
    display: block;
    color: #374151;
    font-weight: 500;
}

.filtros input,
.filtros select {
    font-size: 12px;
    padding: 5px 7px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    color: #1F2937;
    background: #fff;
}

.filtros input:focus,
.filtros select:focus {
    outline: none;
    border-color: #EE0000;
    box-shadow: 0 0 0 2px rgba(238,0,0,.12);
}

.filtros .btn {
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
}

/* ==========================================================================
   TABELAS
   ========================================================================== */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    table-layout: fixed;
}

.card table thead th {
    background: #4B5563;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-size: 11px;
    padding: 9px 10px;
    border-bottom: none;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card table tbody td {
    padding: 4px 8px;
    vertical-align: middle;
    text-align: center;
    border-bottom: 1px solid #F3F4F6;
    color: #1F2937;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card table tbody td.num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.card table tbody tr:hover td { background: #F9FAFB; }
.card table tbody tr.linha-clicavel { cursor: pointer; }
.card table tbody tr.linha-revisao { background: #FFF7ED; }

/* Larguras das colunas da tabela de tracos */
.card table th.col-descricao,
.card table td.col-descricao { width: 34%; }
.card table th.col-tipo,
.card table td.col-tipo { width: 13%; }
.card table th.col-preco,
.card table td.col-preco { width: 13%; }
.card table th.col-usinas,
.card table td.col-usinas { width: 8%; }
.card table th.col-data,
.card table td.col-data { width: 11%; }
.card table th.col-status,
.card table td.col-status { width: 10%; }

/* Cabecalho fixo da tabela */
.tabela-wrap {
    max-height: calc(100vh - 300px);
    overflow: auto;
    border-radius: 8px;
}

.tabela-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ==========================================================================
   PILULA DA DESCRICAO
   ========================================================================== */

.pill-wrap {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.pill-link {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 3px 14px;
    border-radius: 999px;
    background: transparent;
    color: #111827;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.pill-link > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pill-link .p-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.pill-link .p-vend { font-weight: 600; }
.pill-link .p-sep { opacity: .45; font-weight: 400; padding: 0 6px; }
.pill-link .p-num-val { font-variant-numeric: tabular-nums; }

.pill-link:hover {
    background: #EE0000;
    color: #fff;
    box-shadow: 0 2px 8px rgba(238,0,0,.28);
}
.pill-link:hover .p-sep { opacity: .7; }

.pill-dica {
    position: absolute;
    left: 14px;
    top: 100%;
    margin-top: 0;
    font-size: 9px;
    line-height: 1.1;
    color: #EE0000;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
    white-space: nowrap;
}
.pill-wrap:hover .pill-dica { opacity: 1; }

/* ==========================================================================
   BOTOES
   ========================================================================== */

.btn {
    background: #EE0000;
    color: #FFFFFF;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: #D00000; }
.btn:active { transform: scale(0.98); }
.btn-verde { background: #16A34A; }
.btn-verde:hover { background: #15803D; }
.btn-laranja { background: #F97316; }
.btn-laranja:hover { background: #EA580C; }
.btn-voltar { background: #6B7280; }
.btn-voltar:hover { background: #4B5563; }
.btn-limpar { background: #9CA3AF; }
.btn-limpar:hover { background: #6B7280; }
.btn-vermelho { background: #DC2626; }
.btn-vermelho:hover { background: #B91C1C; }

.contador {
    background: #FFFFFF;
    color: #EE0000;
    font-weight: 700;
    border-radius: 12px;
    padding: 1px 9px;
    font-size: 13px;
}

/* ==========================================================================
   STATUS
   ========================================================================== */

.status {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.st-pendente { background: #FEF3C7; color: #92400E; }
.st-aprovada { background: #DCFCE7; color: #166534; }
.st-alteracoes { background: #FEE2E2; color: #991B1B; }
.st-outro { background: #F3F4F6; color: #4B5563; }
.st-ativo { background: #DCFCE7; color: #166534; }
.st-inativo { background: #F3F4F6; color: #4B5563; }

.status-aprovador {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 3px 9px;
    border-radius: 10px;
    line-height: 1.1;
}
.status-aprovador .st-nome { font-size: 10px; font-weight: 700; }
.status-aprovador .st-quem {
    font-size: 8px;
    font-weight: 600;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .2px;
}

/* ==========================================================================
   MENSAGENS
   ========================================================================== */

.sucesso {
    background: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}
.erro {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}
.aviso {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */

@media (max-width: 900px) {
    .indicadores,
    .filtros { flex-wrap: wrap; }
    .indicadores .ind { flex: 1 1 45%; }
    .filtros > div { flex: 1 1 45%; }
    .topo h1 { font-size: 16px; letter-spacing: 1.2px; }
    .user-nome { display: none; }
    .tabela-wrap { max-height: none; }
    table { table-layout: auto; }
}
