* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f5f4;
    color: #1f2933;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: #16351f;
    color: #fff;
    padding: 24px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 34px;
}

.logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #ffffff;
    color: #16351f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
}

.brand span {
    font-size: 12px;
    opacity: .75;
}

.sidebar nav {
    display: grid;
    gap: 10px;
}

.sidebar nav a {
    padding: 14px 16px;
    border-radius: 14px;
    color: #dbe9df;
    text-decoration: none;
    cursor: pointer;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(255,255,255,.12);
}

.content {
    margin-left: 280px;
    padding: 28px;
    width: calc(100% - 280px);
}

.topbar {
    background: linear-gradient(135deg, #16351f, #295e38);
    color: #fff;
    padding: 26px;
    border-radius: 24px;
    margin-bottom: 22px;
}

.topbar h2 {
    margin: 0;
    font-size: 28px;
}

.topbar p {
    margin: 8px 0 0;
    opacity: .85;
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    background: #fff;
    padding: 18px;
    border-radius: 20px;
    box-shadow: 0 8px 22px rgba(0,0,0,.05);
    margin-bottom: 20px;
}

.filters label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

.filters input,
.filters select {
    width: 100%;
    padding: 11px;
    border: 1px solid #d9e0dc;
    border-radius: 12px;
    background: #fff;
}

.filters button {
    border: 0;
    border-radius: 14px;
    background: #16351f;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    padding: 12px;
    align-self: end;
}

.cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    background: #fff;
    padding: 22px;
    border-radius: 22px;
    box-shadow: 0 8px 22px rgba(0,0,0,.05);
}

.card span {
    display: block;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 12px;
}

.card strong {
    font-size: 24px;
    color: #16351f;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

#condicoes {
    grid-template-columns: repeat(3, 1fr);
}

.panel {
    background: #fff;
    padding: 20px;
    border-radius: 22px;
    box-shadow: 0 8px 22px rgba(0,0,0,.05);
    margin-bottom: 20px;
}

.panel h3 {
    margin-top: 0;
    font-size: 18px;
    color: #16351f;
}

.table-panel {
    overflow: hidden;
}

.table-wrap {
    overflow-x: auto;
    max-height: 520px;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
}

#detalhes table {
    min-width: 1400px;
}

th {
    text-align: left;
    background: #bfe8f5;
    color: #000;
    font-size: 13px;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 1;
}

td {
    border-bottom: 1px solid #edf1ef;
    padding: 10px 12px;
    font-size: 13px;
}

tbody tr:hover {
    background: #f8faf9;
}

td.numero,
th.numero {
    text-align: right;
}

.total-row td {
    background: #bfe8f5;
    font-weight: bold;
}

.erro-dashboard {
    background: #fee2e2;
    color: #991b1b;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: bold;
}

@media (max-width: 1200px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters,
    .grid,
    #condicoes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }

    .cards {
        grid-template-columns: 1fr;
    }
}
