:root,
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e8edf4;
    --border: #d8e0ea;
    --text-primary: #1a2332;
    --text-secondary: #5a6d85;
    --text-muted: #8b9cb3;
    --accent: #e09510;
    --accent-hover: #c87f00;
    --accent-glow: rgba(224, 149, 16, 0.12);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(26, 35, 50, 0.08);
    --sidebar-width: 260px;
    --transition: 0.2s ease;
    --chart-grid: rgba(216, 224, 234, 0.9);
    --chart-ticks: #5a6d85;
    --overlay-bg: rgba(240, 242, 245, 0.85);
}

[data-theme="dark"] {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-card: #1e2a3a;
    --bg-hover: #253447;
    --border: #2d3f56;
    --text-primary: #e8edf4;
    --text-secondary: #8b9cb3;
    --text-muted: #5a6d85;
    --accent: #f5a623;
    --accent-hover: #e09510;
    --accent-glow: rgba(245, 166, 35, 0.15);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --chart-grid: rgba(45, 63, 86, 0.5);
    --chart-ticks: #8b9cb3;
    --overlay-bg: rgba(15, 20, 25, 0.7);
}

@media (prefers-color-scheme: light) {
    [data-theme="system"] {
        --bg-primary: #f0f2f5;
        --bg-secondary: #ffffff;
        --bg-card: #ffffff;
        --bg-hover: #e8edf4;
        --border: #d8e0ea;
        --text-primary: #1a2332;
        --text-secondary: #5a6d85;
        --text-muted: #8b9cb3;
        --accent: #e09510;
        --accent-hover: #c87f00;
        --accent-glow: rgba(224, 149, 16, 0.12);
        --shadow: 0 4px 20px rgba(26, 35, 50, 0.08);
        --chart-grid: rgba(216, 224, 234, 0.9);
        --chart-ticks: #5a6d85;
        --overlay-bg: rgba(240, 242, 245, 0.85);
    }
}

@media (prefers-color-scheme: dark) {
    [data-theme="system"] {
        --bg-primary: #0f1419;
        --bg-secondary: #1a2332;
        --bg-card: #1e2a3a;
        --bg-hover: #253447;
        --border: #2d3f56;
        --text-primary: #e8edf4;
        --text-secondary: #8b9cb3;
        --text-muted: #5a6d85;
        --accent: #f5a623;
        --accent-hover: #e09510;
        --accent-glow: rgba(245, 166, 35, 0.15);
        --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
        --chart-grid: rgba(45, 63, 86, 0.5);
        --chart-ticks: #8b9cb3;
        --overlay-bg: rgba(15, 20, 25, 0.7);
    }
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.brand-icon svg {
    width: 24px;
    height: 24px;
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(245, 166, 35, 0.3);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}

.status-indicator.online .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.offline .status-dot {
    background: var(--danger);
}

.config-link {
    display: block;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.config-link:hover {
    color: var(--accent);
}

/* Tema */
.theme-switcher {
    margin-top: 14px;
}

.theme-switcher-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.theme-switcher-options {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.theme-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-option svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.theme-option:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.theme-option.active {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(245, 166, 35, 0.3);
}

.theme-switcher-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-switcher-inline .theme-switcher-options {
    padding: 2px;
}

.theme-switcher-inline .theme-option {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.theme-switcher-inline .powered-by {
    display: none;
}

.powered-by {
    margin: 10px 0 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

.powered-by a {
    color: var(--text-secondary);
    text-decoration: none;
}

.powered-by a:hover {
    color: var(--accent);
}

/* Main */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.topbar p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.topbar-right {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.last-update-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 150px;
}

.last-update-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.last-update-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.last-update-value.stale-data {
    color: #f59e0b;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.config-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.config-group input {
    width: 120px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent);
    color: #1a1200;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-sm:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.content {
    padding: 24px 32px;
    flex: 1;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Dashboard — navegação por data */
.dashboard-date-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dashboard-date-btn {
    padding: 8px 10px;
    min-width: 36px;
}

.dashboard-date-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.dashboard-date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-date-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.dashboard-date-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-left: auto;
}

.dashboard-date-today {
    margin-left: 4px;
}

.dashboard-historical .stat-card.historical-hidden,
.dashboard-historical .import-period-badge,
.dashboard-historical .monthly-forecast-card,
.dashboard-historical #batterySection {
    display: none !important;
}

/* Balanço energético */
.energy-balance-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.energy-balance-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.energy-balance-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.energy-balance-header p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.energy-balance-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
    white-space: nowrap;
}

.energy-balance-stats {
    margin-bottom: 18px;
}

.energy-balance-card.solar::before {
    background: linear-gradient(135deg, #f5a623, #fbbf24);
}

.energy-balance-card.grid::before {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.energy-balance-card.savings::before {
    background: linear-gradient(135deg, #22c55e, #4ade80);
}

.energy-balance-card.savings .stat-value {
    color: #22c55e;
}

.energy-balance-chart-wrap {
    height: 220px;
    margin-bottom: 12px;
}

.energy-balance-note {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.stat-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px 24px;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-card .card-body {
    height: 300px;
    position: relative;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* Forms */
.search-input,
.select-sm {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
}

.search-input {
    width: 220px;
}

.select-sm {
    min-width: 160px;
}

/* Inverter realtime */
.inverter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.inverter-metric {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.inverter-metric .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.inverter-metric .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Plant details */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.detail-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-item .value {
    font-weight: 600;
}

/* Importação EDA */
/* Bateria */
.battery-section {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.battery-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.battery-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.battery-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.battery-mode-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}

.battery-mode-badge.charging {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.1);
}

.battery-mode-badge.discharging {
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.1);
}

.battery-soc-wrap {
    margin-bottom: 18px;
}

.battery-soc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.battery-soc-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.battery-soc-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.battery-soc-bar {
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.battery-soc-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #22c55e, #84cc16);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.battery-soc-fill.low {
    background: linear-gradient(90deg, #ef4444, #f59e0b);
}

.battery-stats .battery-card::before {
    background: linear-gradient(90deg, #22c55e, #3b82f6);
}

.import-section {
    margin-bottom: 24px;
}

.import-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.import-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.import-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.import-period-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.period-dot,
.period-dot-sm {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.period-dot {
    width: 12px;
    height: 12px;
}

.import-stats .stat-card::before {
    background: linear-gradient(90deg, #ef4444, transparent);
}

.import-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.import-period-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--period-color, var(--border));
    border-radius: var(--radius-sm);
    padding: 16px;
}

.import-period-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.import-period-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.import-period-stats {
    display: grid;
    gap: 8px;
}

.import-period-stats .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.import-period-stats .value {
    font-weight: 600;
    font-size: 0.95rem;
}

.import-period-stats .value.cost {
    color: #ef4444;
}

.import-chart-card .card-body {
    height: 260px;
}

/* Previsão mensal */
.monthly-forecast-card {
    margin-bottom: 20px;
}

.monthly-forecast-card .card-header {
    flex-wrap: wrap;
    gap: 16px;
}

.monthly-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.monthly-progress-wrap {
    min-width: 160px;
}

.monthly-progress-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-align: right;
}

.monthly-progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.monthly-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ef4444);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.monthly-stats {
    margin-bottom: 16px;
}

.monthly-stat.highlight::before {
    background: linear-gradient(90deg, #ef4444, var(--accent));
}

.monthly-stat.highlight .stat-value {
    color: #ef4444;
}

.monthly-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.monthly-detail-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.monthly-detail-item .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.monthly-detail-item .value {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.monthly-breakdown {
    margin-bottom: 20px;
}

.monthly-chart-wrap {
    height: 220px;
    position: relative;
}

/* Config banner */
.config-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius);
    color: var(--text-primary);
}

.config-banner-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.config-banner p {
    margin-top: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.config-banner code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent);
}

.config-group input[type="text"] {
    width: 160px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .import-breakdown {
        grid-template-columns: 1fr;
    }
    .monthly-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .main {
        margin-left: 0;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .topbar-right {
        flex-wrap: wrap;
        width: 100%;
    }
    .last-update-info {
        align-items: flex-start;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .monthly-detail-grid {
        grid-template-columns: 1fr;
    }
    .reports-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .content {
        padding: 16px;
    }
}

/* Relatórios */
.reports-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.reports-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reports-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.reports-summary {
    margin-bottom: 20px;
}

.reports-summary .stat-card.highlight::before {
    background: linear-gradient(135deg, var(--accent), #22c55e);
}

.reports-summary .stat-card.highlight .stat-value {
    color: #22c55e;
}

.reports-chart-card .card-body {
    height: 280px;
}

.reports-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.reports-table th,
.reports-table td {
    white-space: nowrap;
}

.reports-table td strong {
    color: var(--text-primary);
}

.reports-total-row td {
    border-top: 2px solid var(--border);
    background: var(--bg-elevated);
    font-weight: 600;
}

.reports-partial {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 24px !important;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(245, 166, 35, 0.12), transparent 35%),
        var(--bg-primary);
}

.login-shell {
    width: min(100%, 420px);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

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

.login-brand h1 {
    margin: 0;
    font-size: 1.35rem;
}

.login-brand p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.login-hint {
    margin: 0 0 20px;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.login-error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    font-size: 0.875rem;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}

.login-submit {
    width: 100%;
    margin-top: 8px;
    justify-content: center;
}

.login-footer {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.logout-link {
    margin-top: 6px;
}
