* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f2f2f2;
    color: #111;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.login-box {
    background: #fff;
    width: 100%;
    max-width: 380px;
    padding: 40px 32px;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.login-box .brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-box .brand strong {
    display: block;
    font-size: 28px;
    letter-spacing: 2px;
}

.login-box .brand span {
    display: block;
    font-size: 12px;
    letter-spacing: 3px;
    color: #555;
    margin-top: 4px;
}

.login-box label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    margin-top: 16px;
    color: #333;
}

.login-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #000;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #000;
}

.login-box button {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
}

.login-box button:hover {
    background: #222;
}

.erro {
    background: #000;
    color: #fff;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 16px;
    text-align: center;
    border: 1px solid #fff;
}

/* ===== App layout ===== */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    background: #000;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
}

.sidebar-brand {
    padding: 24px 20px;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 2px;
    border-bottom: 1px solid #333;
}

.sidebar-brand span {
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    color: #aaa;
    font-weight: normal;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav a {
    display: block;
    padding: 14px 20px;
    color: #ccc;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: #1a1a1a;
    color: #fff;
}

.sidebar-nav a.active {
    background: #fff;
    color: #000;
    border-left: 3px solid #fff;
    font-weight: bold;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #333;
    font-size: 12px;
}

.sidebar-user {
    display: block;
    color: #999;
    margin-bottom: 10px;
    word-break: break-all;
}

.btn-logout {
    display: inline-block;
    background: #fff;
    color: #000;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 13px;
}

.btn-logout:hover {
    background: #ccc;
}

.content {
    margin-left: 230px;
    padding: 32px;
    width: 100%;
}

.page-title {
    margin: 0;
    font-size: 24px;
    letter-spacing: 1px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.btn-imprimir {
    background: #000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.btn-imprimir:hover {
    background: #333;
}

/* ===== Cards ===== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.card {
    background: #fff;
    border: 1px solid #000;
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card h3 {
    margin: 0 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555;
}

.card .valor {
    font-size: 26px;
    font-weight: bold;
}

.card.saldo-positivo .valor { color: #1b5e20; }
.card.saldo-negativo .valor { color: #b71c1c; }

/* ===== Filtro de mês/ano ===== */
.filtro-periodo {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #000;
    padding: 12px 16px;
    border-radius: 6px;
    flex-wrap: wrap;
}

.filtro-periodo select {
    padding: 8px 10px;
    border: 1px solid #000;
    border-radius: 4px;
    background: #fff;
}

.filtro-periodo button {
    padding: 8px 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* ===== Tabelas ===== */
.tabela-wrapper {
    background: #fff;
    border: 1px solid #000;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 28px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #000;
    color: #fff;
}

th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #f7f7f7;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid #000;
}

.tag-empresa { background: #000; color: #fff; }
.tag-pessoal { background: #fff; color: #000; }

/* Botões de status pago/não pago */
.btn-status {
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
}

.btn-pago {
    background: #2e7d32;
}

.btn-pago:hover {
    background: #276829;
}

.btn-pendente {
    background: #c62828;
}

.btn-pendente:hover {
    background: #a82121;
}

.btn-excluir {
    color: #b71c1c;
    font-size: 13px;
    border: 1px solid #b71c1c;
    background: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-excluir:hover {
    background: #b71c1c;
    color: #fff;
}

.btn-editar {
    color: #000;
    font-size: 13px;
    border: 1px solid #000;
    background: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-editar:hover {
    background: #000;
    color: #fff;
}

.acoes-tabela {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Formulário adicionar ===== */
.form-adicionar {
    background: #fff;
    border: 1px solid #000;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 28px;
}

.form-adicionar h2 {
    font-size: 16px;
    margin: 0 0 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
}

.form-grid label {
    display: block;
    font-size: 12px;
    color: #555;
    margin-bottom: 6px;
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #000;
    border-radius: 4px;
}

.form-grid button {
    padding: 10px 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.form-grid button:hover {
    background: #222;
}

/* ===== Gráfico ===== */
.grafico-box {
    background: #fff;
    border: 1px solid #000;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 28px;
}

.grafico-box h2 {
    font-size: 16px;
    margin: 0 0 16px;
}

/* ===== Relatórios ===== */
.total-row {
    font-weight: bold;
    background: #eee;
}

/* ===== Modal de edição ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-overlay.aberto {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal-box h2 {
    margin: 0 0 16px;
    font-size: 16px;
}

.modal-acoes {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
}

.btn-cancelar {
    padding: 10px 16px;
    background: #fff;
    color: #000;
    border: 1px solid #000;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-cancelar:hover {
    background: #eee;
}

/* ===== Barra mobile / menu hambúrguer ===== */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 14px;
    background: #000;
    color: #fff;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 80;
}

.btn-hamburguer {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.mobile-brand {
    font-weight: bold;
    letter-spacing: 1px;
    font-size: 13px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 60;
}

.sidebar-overlay.ativo {
    display: block;
}

@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
    }

    .app {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 260px;
        max-width: 80%;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 70;
    }

    .sidebar.aberta {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .filtro-periodo {
        flex-direction: column;
        align-items: stretch;
    }

    .filtro-periodo select,
    .filtro-periodo button {
        width: 100%;
    }
}

/* ===== Impressão ===== */
@media print {
    .mobile-topbar,
    .sidebar-overlay,
    .sidebar,
    .filtro-periodo,
    .form-adicionar,
    .btn-imprimir,
    .btn-editar,
    .btn-excluir,
    .modal-overlay,
    .sidebar-footer,
    .col-acoes {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card,
    .tabela-wrapper,
    .grafico-box {
        box-shadow: none !important;
        break-inside: avoid;
    }

    table {
        font-size: 12px;
    }

    .btn-status {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        cursor: default;
    }
}
