:root {
    --bg: #f4f7f5;
    --panel: #ffffff;
    --text: #17231d;
    --muted: #66756d;
    --line: #dce5df;
    --accent: #176b43;
    --accent-dark: #0f4f31;
    --danger: #b42318;
    --soft: #e8f4ee;
    --shadow: 0 16px 42px rgba(23, 35, 29, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--accent-dark);
    font-weight: 800;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 18px;
}

.login-card {
    width: min(100%, 420px);
    padding: 26px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.15;
}

.login-card h1 {
    margin-bottom: 22px;
    font-size: 1.7rem;
}

.login-card > p {
    margin: -12px 0 22px;
    color: var(--muted);
}

.login-card .security-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.password-card { width: min(100%, 480px); }
.password-card form > small { display: block; margin: -4px 0 16px; color: var(--muted); line-height: 1.45; }
.secondary-form { margin-top: 10px; }
.secondary-form .secondary-button { width: 100%; background: transparent; color: var(--muted); }

.back-access {
    display: block;
    margin-top: 20px;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: center;
}

label {
    display: block;
    margin-bottom: 14px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 800;
}

input {
    width: 100%;
    min-height: 46px;
    margin-top: 7px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 107, 67, 0.14);
}

button,
.logout {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.alert {
    padding: 11px 12px;
    border-radius: 8px;
    background: #fff0ee;
    color: var(--danger);
    font-weight: 800;
}

.notice {
    padding: 11px 12px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--accent-dark);
    font-weight: 800;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    font-size: clamp(1.25rem, 5vw, 2rem);
}

.dashboard {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 16px;
}

.filters,
.kpis,
.breakdowns,
.chart-grid,
.table-section {
    margin-bottom: 16px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.filters button {
    width: 100%;
}

.filters a {
    align-self: center;
    text-align: center;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kpis article,
.breakdowns article,
.chart-card,
.table-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(23, 35, 29, 0.05);
}

.kpis article {
    padding: 14px;
}

.kpis span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.kpis strong {
    display: block;
    margin-top: 7px;
    font-size: 1.8rem;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    white-space: nowrap;
}

.tabs a.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tabs .export-link {
    margin-left: auto;
    background: var(--soft);
    color: var(--accent-dark);
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.chart-card {
    padding: 14px;
}

.chart-card h2 {
    margin-bottom: 14px;
    font-size: 1.02rem;
}

.bar-chart {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bar-chart li div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
    font-size: 0.88rem;
    font-weight: 800;
}

.bar-chart li span {
    color: var(--muted);
}

.bar-chart li i {
    display: block;
    width: var(--value);
    height: 10px;
    min-width: 10px;
    border-radius: 999px;
    background: var(--accent);
}

.column-chart {
    display: flex;
    align-items: end;
    gap: 12px;
    min-height: 210px;
    padding-top: 12px;
}

.column {
    display: grid;
    grid-template-rows: 24px 1fr 24px;
    align-items: end;
    justify-items: center;
    min-width: 42px;
    flex: 1;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.column i {
    display: block;
    width: 100%;
    height: var(--value);
    min-height: 8px;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

.breakdowns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.breakdowns article {
    padding: 14px;
}

.breakdowns h2,
.section-heading h2 {
    font-size: 1.05rem;
}

.breakdowns ul {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.breakdowns li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    background: var(--soft);
    border-radius: 8px;
    font-weight: 750;
}

.muted,
.section-heading p {
    color: var(--muted);
}

.table-section {
    overflow: hidden;
}

.section-heading {
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.section-heading p {
    margin: 6px 0 0;
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

th {
    background: #f8faf8;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
}

summary {
    color: var(--accent-dark);
    font-weight: 900;
    cursor: pointer;
}

.link-button {
    min-height: auto;
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    font-weight: 900;
    padding: 0;
    text-align: left;
}

dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px 10px;
    min-width: 260px;
    margin: 10px 0 0;
}

dt {
    color: var(--muted);
    font-weight: 850;
}

dd {
    margin: 0;
}

.producer-modal {
    width: min(94vw, 760px);
    max-height: 86vh;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.producer-modal::backdrop {
    background: rgba(15, 31, 24, 0.42);
}

.modal-close {
    float: right;
    min-height: 36px;
    background: #eef3f0;
    color: var(--text);
}

.lgpd-note {
    margin: 12px 0 16px;
    padding: 12px;
    border-radius: 8px;
    background: #fff8e5;
    color: #6f4f00;
    font-weight: 800;
    line-height: 1.4;
}

#modalDetails {
    grid-template-columns: minmax(120px, 190px) 1fr;
    max-height: 56vh;
    overflow: auto;
}

#modalDetails dt,
#modalDetails dd {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

@media (min-width: 760px) {
    .topbar,
    .dashboard {
        padding-left: 28px;
        padding-right: 28px;
    }

    .filters {
        grid-template-columns: 1fr 130px 90px;
        align-items: end;
    }

    .kpis {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .breakdowns {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .chart-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .chart-wide {
        grid-column: span 3;
    }
}
