@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --border-color: #2a2a2a;
    --primary: #cc0000;
    --primary-hover: #aa0000;
    --text-main: #f1f1f1;
    --text-muted: #888888;
    --text-light: #cccccc;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

/* Header & Navbar */
header {
    background: var(--bg-card);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo-wrapper {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 40px;
    width: auto;
}

nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

nav a:hover {
    color: var(--primary);
}

nav a.ativo {
    color: var(--primary);
    font-weight: 600;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--primary);
    color: #ffffff;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 22px;
    cursor: pointer;
}

/* Main Container */
main {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4 {
    color: var(--text-main);
    font-weight: 600;
}

h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

p.subtitulo, .subtitulo {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ============================================
   CARDS DE INDICADORES (KPIs)
   ============================================ */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    border: 1px solid #1e1e1e;
    border-top: 2px solid var(--primary);
    text-align: center;
    box-shadow:
        0 1px 3px rgba(0,0,0,0.4),
        0 8px 24px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow:
        0 2px 6px rgba(0,0,0,0.5),
        0 16px 36px rgba(0,0,0,0.36);
}

.card h3 {
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

/* Número grande só nos cards de indicador (dashboard/relatórios, dentro de .cards) */
.cards .card p {
    color: var(--text-main);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Parágrafos comuns dentro de cards */
.card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* ============================================
   CARDS DE GRÁFICO / CONTEÚDO
   ============================================ */
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid #1e1e1e;
    box-shadow:
        0 1px 3px rgba(0,0,0,0.4),
        0 8px 24px rgba(0,0,0,0.3);
}

.chart-card-title {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 13px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-card {
    max-width: 550px;
    margin: 40px auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border-top: 3px solid var(--primary);
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
}

/* ============================================
   BOTÕES
   ============================================ */
button, .btn {
    font-family: inherit;
}

button[type="submit"], .btn-primary, .btn-novo {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

button[type="submit"]:hover, .btn-primary:hover, .btn-novo:hover {
    background: var(--primary-hover);
}

.btn-novo {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.btn-editar {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    margin-left: 6px;
    transition: all 0.2s;
}

.btn-editar:hover {
    border-color: var(--text-light);
    color: var(--text-main);
}

.btn-deletar {
    background: transparent;
    border: 1px solid #333;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-left: 6px;
    transition: all 0.2s;
}

.btn-deletar:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(204, 0, 0, 0.08);
}

.btn-ver {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-ver:hover {
    background: var(--primary);
    color: #ffffff;
}

/* Polimento: botões principais com gradiente e leve elevação */
button[type="submit"], .btn-primary, .btn-novo, .enviar, .busca button, .btn-salvar {
    background: linear-gradient(135deg, #e01b1b 0%, #a40d0d 100%);
    box-shadow: 0 6px 18px -6px rgba(204, 0, 0, 0.5);
}

button[type="submit"]:hover, .btn-primary:hover, .btn-novo:hover,
.enviar:hover:not(:disabled), .busca button:hover, .btn-salvar:hover {
    background: linear-gradient(135deg, #e01b1b 0%, #a40d0d 100%);
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -8px rgba(204, 0, 0, 0.65);
}

/* Botão de ação principal (Importar / Enviar / Sincronizar) */
.enviar {
    width: 100%;
    padding: 14px;
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: var(--transition);
}

.enviar:disabled {
    background: #232323;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    filter: none;
    transform: none;
}

/* Área de upload */
input[type="file"] { display: none; }

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 20px;
    margin-top: 20px;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(204, 0, 0, 0.05);
}

.upload-area p { margin: 0; color: var(--text-light); font-size: 15px; }
#nome-arquivo { color: var(--text-muted); font-size: 13px; margin-top: 10px; }
#resultado-sincronizacao { color: var(--text-muted); font-size: 13px; margin-top: 16px; white-space: pre-line; }

/* Cartões de descrição fora do grid */
main > .card { text-align: left; }
main > .card + .card { margin-top: 20px; }

/* ============================================
   TABELAS
   ============================================ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

thead th {
    background: linear-gradient(180deg, #b81616 0%, #8f0f0f 100%);
    color: #f4f4f4;
    padding: 13px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

tbody tr {
    border-bottom: 1px solid #1e1e1e;
    transition: background 0.18s;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody td {
    padding: 13px 16px;
    font-size: 14px;
    color: var(--text-light);
    word-break: break-word;
}

/* Nota com badge vermelho/cinza dentro da tabela do dashboard */
.nota-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    color: var(--primary);
    background: rgba(204, 0, 0, 0.12);
}

.nota-semnota {
    color: var(--text-muted);
    background: rgba(136,136,136,0.1);
}

/* ============================================
   STATUS BADGES
   ============================================ */
.badge {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-block;
}

.badge-success {
    color: var(--primary);
    background: rgba(204, 0, 0, 0.1);
}

.badge-warning {
    color: var(--text-muted);
    background: rgba(136,136,136,0.1);
}

.badge-info {
    color: var(--text-light);
    background: rgba(255,255,255,0.08);
}

.badge-danger {
    color: var(--primary);
    background: rgba(204, 0, 0, 0.12);
}

/* ============================================
   MODAIS
   ============================================ */
.modal-fundo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-fundo.ativo, .modal-fundo.ativa {
    display: flex;
}

.modal-caixa {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

/* ============================================
   RESPONSIVO
   ============================================ */
@media (max-width: 768px) {
    header { padding: 14px 20px; }

    nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        flex-direction: column;
        padding: 16px 20px;
        border-bottom: 3px solid var(--primary);
    }

    nav.aberto { display: flex; }
    .mobile-toggle { display: block; }
    main { padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr; }
}
