:root {
    --color-page: #eef1f5;
    --color-shell: #f8f8f7;
    --color-surface: #ffffff;
    --color-surface-soft: #fbfbfa;
    --color-text: #131313;
    --color-muted: #8a8f98;
    --color-border: #eceef2;
    --color-border-strong: #dfe3e8;
    --color-green: #21b57c;
    --color-red: #e96d62;
    --shadow-soft: 0 22px 60px rgba(28, 36, 46, 0.08);
    --shadow-card: 0 12px 30px rgba(29, 35, 43, 0.06);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--color-text);
    background:
        radial-gradient(circle at 0 0, rgba(255, 236, 234, 0.7), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(250, 230, 194, 0.9), transparent 30%),
        var(--color-page);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 26px;
    width: min(1560px, calc(100% - 24px));
    min-height: calc(100vh - 24px);
    margin: 12px auto;
    padding: 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 82px);
    padding: 22px 0 10px;
}

.brand {
    padding: 0 18px 54px;
}

.brand h1 {
    margin: 0;
    font-family: "Inter Tight", Inter, "Segoe UI", system-ui, sans-serif;
    font-size: 24px;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 0;
    color: #111111;
}

.sidebar-filters {
    display: grid;
    gap: 0;
    padding: 0 18px;
}

.sidebar-filters .field {
    padding: 14px 0;
    border-bottom: 1px solid rgba(223, 227, 232, 0.9);
}

.sidebar-filters .field:first-child {
    padding-top: 0;
}

.sidebar-filters .field:last-child {
    border-bottom: 0;
}

.sidebar-exports {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 18px;
}

.sidebar-filters strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
}

.sidebar-action {
    width: calc(100% - 36px);
    min-height: 44px;
    margin: auto 18px 0;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #030303;
    font-size: 12px;
    font-weight: 700;
}

.content {
    min-width: 0;
    padding: 20px 14px 0 0;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.topbar h2 {
    margin: 40px 0 8px;
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: 0;
}

.topbar p {
    margin: 0;
    color: var(--color-muted);
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.export-button {
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #030303;
    font-size: 12px;
    font-weight: 800;
}

.export-button + .export-button {
    color: #30343a;
    background: rgba(255, 255, 255, 0.86);
}

.export-button-wide {
    grid-column: 1 / -1;
}

.export-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.export-button.is-loading {
    min-width: 158px;
}

.user-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding-right: 2px;
}

.user-chip::after {
    content: "";
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(255, 210, 120, 0.9), rgba(255, 123, 123, 0.85)),
        url("../images/heads/vanessa-battestin.jpg") center / cover;
    box-shadow: inset 0 0 0 2px #fff;
}

.notification-dot {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #111;
    background: #ffd042;
    font-size: 11px;
    font-weight: 800;
}

.user-chip strong,
.user-chip small {
    display: block;
    white-space: nowrap;
}

.user-chip strong {
    font-size: 13px;
}

.user-chip small {
    color: var(--color-muted);
    font-size: 11px;
}

.field {
    display: block;
}

.compact-field select,
.compact-field input {
    outline: 0;
}

.compact-field select,
.compact-field input {
    width: 100%;
    height: 32px;
    margin-top: 9px;
    padding: 0 9px;
    border: 1px solid rgba(225, 229, 235, 0.9);
    border-radius: 6px;
    color: #30343a;
    background: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.checkbox-list {
    display: grid;
    gap: 7px;
    max-height: 190px;
    margin-top: 9px;
    padding: 8px;
    overflow: auto;
    border: 1px solid rgba(225, 229, 235, 0.9);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.68);
}

.checkbox-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 9px;
}

.checkbox-actions button {
    min-height: 26px;
    padding: 0 7px;
    border: 1px solid rgba(225, 229, 235, 0.9);
    border-radius: 6px;
    color: #30343a;
    background: rgba(255, 255, 255, 0.68);
    font-size: 10px;
    font-weight: 800;
}

.checkbox-actions + .checkbox-list {
    margin-top: 7px;
}

.checkbox-list label {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    align-items: start;
    gap: 7px;
    color: #30343a;
    font-size: 11px;
    line-height: 1.25;
    cursor: pointer;
}

.checkbox-list span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-list input {
    width: 14px;
    height: 14px;
    margin: 1px 0 0;
    accent-color: #030303;
}

.checkbox-group {
    display: grid;
    gap: 7px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(225, 229, 235, 0.9);
}

.checkbox-group:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.checkbox-group h4 {
    margin: 0;
    overflow: hidden;
    color: #111;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-group-items {
    display: grid;
    gap: 7px;
}

.compact-period {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.main-column {
    min-width: 0;
}

.summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.metric-card,
.panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-card);
}

.metric-card {
    min-height: 112px;
    padding: 18px 16px;
}

.summary-label {
    display: block;
    margin-bottom: 14px;
    color: #20242a;
    font-size: 13px;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    font-size: 25px;
    line-height: 1;
    letter-spacing: 0;
}

.metric-card small {
    display: block;
    margin-top: 12px;
    color: var(--color-green);
    font-size: 11px;
}

.panel {
    overflow: hidden;
}

.chart-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 420px);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 6px;
}

.panel-header h3 {
    margin: 0 0 6px;
    font-size: 17px;
    letter-spacing: 0;
}

.panel-header p {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
}

.view-mode {
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0;
    border: 0;
}

.view-mode label {
    display: grid;
    place-items: center;
    height: 34px;
    min-width: 70px;
    border-radius: 999px;
    color: #777d86;
    background: #f8f8f7;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.view-mode input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.view-mode label:has(input:checked) {
    color: #fff;
    background: #030303;
}

.tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px 8px;
}

.tabs[hidden] {
    display: none;
}

#generalPanel {
    flex: 1;
    min-height: 0;
}

.tab-button {
    width: auto;
    min-height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    color: #7a8089;
    background: #f7f8f8;
    font-size: 12px;
    font-weight: 700;
}

.tab-button.is-active {
    color: #fff;
    background: #030303;
}

.chart-wrap {
    display: grid;
    gap: 20px;
    height: auto;
    padding: 8px 24px 22px;
}

.section-charts {
    display: grid;
    gap: 20px;
}

.chart-wrap[hidden],
.table-wrap[hidden],
[hidden] {
    display: none !important;
}

#yearChart {
    min-height: 285px;
}

.chart-block {
    position: relative;
    min-height: 285px;
    height: 285px;
    overflow: hidden;
}

.section-chart-block {
    min-height: 190px;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
}

.chart-subheader {
    margin-bottom: 12px;
}

.chart-block canvas {
    display: block;
    width: 100% !important;
    height: calc(100% - 58px) !important;
    max-height: 100% !important;
}

.chart-subheader h4 {
    margin: 0 0 5px;
    font-size: 14px;
    letter-spacing: 0;
}

.chart-subheader p {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
}

.table-wrap {
    height: 100%;
    max-height: calc(100vh - 505px);
    min-height: 420px;
    overflow: auto;
    padding: 0 4px 12px 24px;
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

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

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #747a84;
    background: #fff;
    font-weight: 800;
}

td {
    color: #353a41;
}

td:nth-child(4),
th:nth-child(4) {
    width: 80px;
}

.detail-table table {
    min-width: 520px;
}

.detail-table th:nth-child(2),
.detail-table td:nth-child(2) {
    width: 140px;
    text-align: right;
}

.empty-state {
    margin: 24px;
    padding: 26px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    color: var(--color-muted);
    background: var(--color-surface-soft);
    text-align: center;
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 300px minmax(0, 1fr);
        width: calc(100% - 24px);
        margin: 12px;
    }

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

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

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 14px;
        border-radius: 16px;
    }

    .sidebar {
        min-height: 0;
        padding: 0;
    }

    .brand {
        padding: 0 0 16px;
    }

    .sidebar-filters {
        padding: 0;
    }

    .sidebar-action {
        width: 100%;
        margin: 16px 0 0;
    }

    .content {
        padding: 0;
    }

    .topbar,
    .topbar-actions {
        display: grid;
    }

    .topbar h2 {
        margin-top: 8px;
    }

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

    .panel-header {
        display: grid;
    }

    .chart-wrap,
    .table-wrap {
        max-height: none;
        height: auto;
    }
}
