:root {
    /* Cores Itaiquara - extraidas do guia de marca */
    --itq-azul: #2D3366;
    --itq-azul-claro: #3a4080;
    --itq-dourado: #E8A824;
    --itq-dourado-escuro: #D4951E;
    --itq-branco: #FFFFFF;
    --itq-cinza-fundo: #ffffff;
    --itq-cinza-borda: #e0e2eb;

    /* Alertas */
    --cor-perigo: #dc3545;
    --cor-alerta: #e8a824;
    --cor-info: #3a7bd5;
}

body {
    background-color: #fff !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
}

/* Cabecalho do portal e menu lateral: plataforma/static/portal.css */

/* Indicador "Ao vivo" */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 16px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    animation: pulse-live 2s ease-in-out infinite;
}

.live-dot.updating {
    background: var(--itq-dourado);
    animation: pulse-live 0.5s ease-in-out infinite;
}

.live-dot.error {
    background: #dc3545;
    animation: none;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

.live-text {
    color: #22c55e;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.live-text.error { color: #dc3545; }

.live-ts {
    color: rgba(255,255,255,0.5);
    font-size: 0.6rem;
}

/* Grafico de tendencia (barras clicaveis) */
#chartTendencia { cursor: pointer; }
.chart-valor {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--itq-azul);
    font-variant-numeric: tabular-nums;
}

.chart-label {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

.btn-metrica {
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.15s;
}

.btn-metrica:hover {
    border-color: var(--itq-azul);
    color: var(--itq-azul);
}

.btn-metrica.ativo {
    background: var(--itq-azul);
    color: #fff;
    border-color: var(--itq-azul);
}

.btn-metrica-cancel.ativo {
    background: var(--cor-perigo);
    border-color: var(--cor-perigo);
}

/* Wrapper que alinha grafico + tabela na mesma largura fixa */
.radar-wrapper {
    width: 1188px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Radar Cards (containers de tabela) */
.radar-card {
    background: var(--itq-branco);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.radar-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0.6rem;
    background: var(--itq-azul);
    color: var(--itq-branco);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Legenda de cores no cabecalho da tabela (tela Inativos) */
.legenda-cores {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    text-transform: none;
    letter-spacing: 0;
}

.legenda-cores i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    margin-right: 3px;
    vertical-align: -1px;
    border: 1px solid rgba(0,0,0,0.15);
}

/* Tabela estilo Bloomberg */
.radar-table-wrap {
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: auto;
}

.radar-table {
    border-collapse: collapse;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    width: 100%;
    table-layout: fixed;
}

.radar-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.radar-table th {
    background: #e8eaf0;
    color: var(--itq-azul);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 4px 6px;
    cursor: pointer;
    border-bottom: 2px solid var(--itq-cinza-borda);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    text-align: center;
}

.radar-table td {
    padding: 3px 6px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    text-align: center;
}

.radar-table th:hover {
    background: #dce0ea;
}

.radar-table th .sort-arrow {
    font-size: 7px;
    margin-left: 2px;
    opacity: 0.5;
}

.radar-table th.sorted .sort-arrow {
    opacity: 1;
}

.radar-table tbody tr:hover {
    background: #f0f2f8;
}

/* Alertas - bordas por tipo */
.radar-table tbody tr.alerta-danger {
    border-left: 3px solid var(--cor-perigo);
    background-color: #fff8f8;
}

.radar-table tbody tr.alerta-warning {
    border-left: 3px solid var(--cor-alerta);
    background-color: #fffcf0;
}

.radar-table tbody tr.alerta-info {
    border-left: 3px solid var(--cor-info);
    background-color: #f8fbff;
}

.radar-table tbody tr.alerta-danger:hover { background-color: #fff0f0; }
.radar-table tbody tr.alerta-warning:hover { background-color: #fff8e0; }
.radar-table tbody tr.alerta-info:hover { background-color: #f0f5ff; }

/* Grip de redimensionamento */
.col-grip {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
}

.col-grip:hover {
    background: var(--itq-dourado);
}

/* Tabela de detalhe expandida */
.det-scroll {
    max-height: 200px;
    overflow-y: auto;
}

.det-titulo {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 8px;
}

.det-msg {
    font-size: 0.75rem;
    padding: 8px;
}

.det-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5px;
    font-variant-numeric: tabular-nums;
}

.det-table th {
    background: #d8dae5;
    color: var(--itq-azul);
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 6px;
    text-align: center;
    white-space: nowrap;
}

.det-table td {
    padding: 2px 6px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
}

/* Filtros */
.form-control-sm, .form-select-sm {
    font-size: 0.78rem;
}

/* Login */
.login-card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(45,51,102,0.15);
}

.login-card .btn-primary {
    background: var(--itq-azul);
    border-color: var(--itq-azul);
}

.login-card .btn-primary:hover {
    background: var(--itq-azul-claro);
}

/* Cards de tipo (filtros) */
.tipo-card {
    background: #fff;
    border-radius: 5px;
    padding: 4px 8px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    border: 2px solid transparent;
    transition: all 0.15s;
    flex: 1;
}

.tipo-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.tipo-card.tipo-ativo { border-width: 2px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.tipo-icone { font-size: 0.8rem; }
.tipo-label { font-size: 0.55rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.2px; }
.tipo-valor { font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.tipo-vendas { border-left: 3px solid #198754; }
.tipo-vendas .tipo-icone, .tipo-vendas .tipo-valor { color: #198754; }
.tipo-vendas.tipo-ativo { border-color: #198754; background: #e8f5e9; }

.tipo-queda { border-left: 3px solid #dc3545; }
.tipo-queda .tipo-icone, .tipo-queda .tipo-valor { color: #dc3545; }
.tipo-queda.tipo-ativo { border-color: #dc3545; background: #fff5f5; }

.tipo-mix { border-left: 3px solid #3a7bd5; }
.tipo-mix .tipo-icone, .tipo-mix .tipo-valor { color: #3a7bd5; }
.tipo-mix.tipo-ativo { border-color: #3a7bd5; background: #f0f5ff; }

.tipo-sumindo { border-left: 3px solid #e67e22; }
.tipo-sumindo .tipo-icone, .tipo-sumindo .tipo-valor { color: #e67e22; }
.tipo-sumindo.tipo-ativo { border-color: #e67e22; background: #fff5eb; }

.tipo-bonif { border-left: 3px solid #e67e22; }
.tipo-bonif .tipo-icone, .tipo-bonif .tipo-valor { color: #e67e22; }
.tipo-bonif.tipo-ativo { border-color: #e67e22; background: #fff5eb; }

.tipo-preco { border-left: 3px solid #8b5cf6; }
.tipo-preco .tipo-icone, .tipo-preco .tipo-valor { color: #8b5cf6; }
.tipo-preco.tipo-ativo { border-color: #8b5cf6; background: #f5f0ff; }

/* Badge cores */
.badge.bg-danger { background-color: var(--cor-perigo) !important; }
.badge.bg-warning { background-color: var(--cor-alerta) !important; color: #000 !important; }
.badge.bg-info { background-color: var(--cor-info) !important; }

/* =====================================================================
   PAINEL LATERAL DO CLIENTE
   ===================================================================== */

.painel-cliente {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    z-index: 1000;
    transition: right 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.painel-cliente.aberto {
    right: 0;
}

.painel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--itq-azul);
    color: #fff;
    flex-shrink: 0;
}

.painel-titulo {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.painel-fechar {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.8;
}

.painel-fechar:hover { opacity: 1; }

.painel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}

.painel-secao {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.painel-secao:last-child {
    border-bottom: none;
}

.painel-secao-titulo {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--itq-azul);
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.painel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}

.painel-campo {
    display: flex;
    flex-direction: column;
}

.painel-campo.full {
    grid-column: 1 / -1;
}

.painel-label {
    font-size: 0.6rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.painel-valor {
    font-size: 0.75rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.painel-valor.destaque {
    font-weight: 700;
    color: var(--itq-azul);
    font-size: 0.85rem;
}

.painel-valor.alerta {
    color: #dc3545;
    font-weight: 700;
}

.painel-tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.68rem;
}

.painel-tabela th {
    background: #f0f1f5;
    color: var(--itq-azul);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 5px;
    text-align: left;
}

.painel-tabela td {
    padding: 2px 5px;
    border-bottom: 1px solid #f5f5f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Transicao do wrapper quando painel abre */
.radar-wrapper {
    transition: width 0.25s ease;
}

.radar-wrapper.com-painel {
    width: calc(100% - 395px);
    margin-left: 10px;
    margin-right: 0;
}

/* Cliente clicavel na tabela */
.cli-link {
    cursor: pointer;
}

.cli-link .cli-text {
    border-bottom: 1px dashed #999;
}

.cli-link:hover .cli-text {
    color: var(--itq-azul);
    border-bottom-color: var(--itq-azul);
}

/* Tela inicial da plataforma: so o aviso de quem nao tem nenhum modulo (reusa .radar-card / .radar-card-header) */
.inicio-wrap { width: 1188px; max-width: 100%; }
.inicio-cartao-corpo { padding: 0.5rem 0.6rem; font-size: 0.75rem; color: #444; }
.inicio-vazio { width: 420px; border: 1px solid var(--itq-cinza-borda); }
