<style> :root {
    --bg-main: #f5f7fb;
    --bg-dark: #020617;
    --bg-card: #ffffff;
    --border-soft: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --positive: #16a34a;
    --negative: #dc2626;
    --radius: 0.9rem;
    --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

/* Highlight van de geselecteerde maand in het maandoverzicht */
.month-summary-active td {
  background: #eef2ff !important;
  font-weight: 600;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: radial-gradient(circle at top, #ffffff, var(--bg-main));
    color: var(--text-main);
}

header {
    background: linear-gradient(135deg, #020617, #111827);
    color: white;
    padding: 0.9rem 1.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

header small {
    opacity: 0.7;
    font-size: 0.8rem;
}

main {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: calc(100vh - 56px);
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }

    aside {
        order: 2;
    }

    section.content {
        order: 1;
    }
}

aside {
    background: linear-gradient(180deg, #020617, #020617);
    color: #e5e7eb;
    padding: 1.2rem;
    border-right: 1px solid #1f2937;
}

aside h2 {
    font-size: 0.95rem;
    margin: 0.2rem 0 0.6rem 0;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    opacity: 0.85;
}

aside label {
    display: block;
    font-size: 0.8rem;
    margin: 0.6rem 0 0.3rem;
    color: #cbd5f5;
}

aside select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 0.55rem;
    border: 1px solid #1f2937;
    background: #020617;
    color: #e5e7eb;
    font-size: 0.85rem;
}

.status {
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.status.error {
    color: #fb923c;
}

.month-list {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.month-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-radius: 0.7rem;
    border: 1px solid #1f2937;
    background: #020617;
    color: #e5e7eb;
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.month-item:hover {
    transform: translateX(2px);
    border-color: var(--accent);
}

.month-item.active {
    background: #e5e7eb;
    color: #020617;
    border-color: #e5e7eb;
    box-shadow: var(--shadow-soft);
}

.month-item.positive span.amount {
    color: #4ade80;
}

.month-item.negative span.amount {
    color: #f87171;
}

section.content {
    padding: 1.4rem 1.8rem 2.2rem;
    overflow-x: auto;
}

.period-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.period-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.period-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.2rem;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.kpi-value {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.kpi-delta {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.kpi-delta.positive {
    color: var(--positive);
}

.kpi-delta.negative {
    color: var(--negative);
}

.gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
    margin: 0 0 1.3rem 0;
}

.gauge-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 1rem 1rem 1.3rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
}

.gauge-card h3 {
    margin: 0 0 0.6rem 0;
    font-size: 1rem;
}

.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 1rem 1.1rem 1.2rem;
    margin-bottom: 1.3rem;
    box-shadow: var(--shadow-soft);
}

.panel h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1rem;
}

.panel small {
    font-size: 0.78rem;
    color: var(--text-muted);
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
}

th,
td {
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f1f5ff;
    font-weight: 600;
}

tr:nth-child(even) td {
    background: #fafafa;
}

.chip {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.73rem;
    background: #e5e7eb;
}

.chip.income {
    background: #ecfdf3;
    color: #166534;
}

.chip.expense {
    background: #fef2f2;
    color: #b91c1c;
}

/* NIEUW: klikbare categorie-rijen + highlight */
#categoryTable tbody tr {
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

#categoryTable tbody tr:hover {
    background: #eef2ff;
    transform: translateX(1px);
}

#categoryTable tbody tr.category-active {
    background: #e0ecff;
    font-weight: 600;
}

/* NIEUW: filterbalk boven transactietabel */
.transactions-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: flex-end;
    margin: 0.6rem 0 0.2rem;
    font-size: 0.8rem;
}

.transactions-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.transactions-filters label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.transactions-filters select,
.transactions-filters input[type="number"] {
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.45rem;
    border: 1px solid var(--border-soft);
}

.clear-filters-btn {
    border: none;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
    cursor: pointer;
    background: #eef2ff;
    color: #1e3a8a;
    white-space: nowrap;
}

.clear-filters-btn:hover {
    background: #e0e7ff;
}

#transactionsFilterInfo {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

/* Header rechts: tekst + knop netjes naast elkaar */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Knop voor compacte modus */
.compact-toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  cursor: pointer;
  background: #eef2ff;
  color: #1e3a8a;
  white-space: nowrap;
}

.compact-toggle-btn:hover {
  background: #e0e7ff;
}

/* Compacte modus: kleinere padding / font in tabellen en kaarten */
body.compact-mode table {
  font-size: 0.78rem;
}

body.compact-mode th,
body.compact-mode td {
  padding: 0.3rem 0.4rem;
}

body.compact-mode .kpi-card {
  padding: 0.7rem 0.8rem;
}

body.compact-mode .panel {
  padding: 0.8rem 0.9rem 1rem;
}

/* Op kleine schermen: in compacte modus de kolom "Vast/variabel" verbergen */
@media (max-width: 700px) {
  body.compact-mode #transactionsTable th:nth-child(4),
  body.compact-mode #transactionsTable td:nth-child(4) {
    display: none;
  }
}

</style>