/* ============================================================
   YVSPORT Finance — Design System v3
   Lichte hybrid look (Stripe/Vercel-stijl)
   Inter Tight, YVSPORT-groen accent
   ============================================================ */

:root {
  /* Achtergronden */
  --bg-base:       #f7f8f5;
  --bg-elevated:   #ffffff;
  --bg-card:       #ffffff;
  --bg-input:      #f4f5f1;
  --bg-subtle:     #fafbf8;
  --bg-tint:       rgba(0, 151, 117, 0.04);

  /* Borders */
  --border:        rgba(15, 23, 28, 0.08);
  --border-strong: rgba(15, 23, 28, 0.14);
  --border-accent: rgba(0, 151, 117, 0.25);

  /* Tekst */
  --text:          #0f1a1f;
  --text-muted:    #5c6670;
  --text-dim:      #8b939a;

  /* YVSPORT accent */
  --accent:        #009775;
  --accent-bright: #00b88e;
  --accent-dim:    #006d54;
  --accent-soft:   #e6f4f0;
  --accent-glow:   rgba(0, 151, 117, 0.12);

  /* Status */
  --success:       #00b88e;
  --success-soft:  #e6f4f0;
  --warning:       #d49542;
  --warning-soft:  #fdf2e0;
  --danger:        #d4564f;
  --danger-soft:   #faeae8;
  --info:          #4a7ba6;
  --info-soft:     #e8f0f7;

  /* Fonts — alles Inter Tight, tabular-nums voor cijfer-uitlijning waar nodig */
  --font-body:     'Inter Tight', system-ui, sans-serif;
  --font-display:  'Inter Tight', system-ui, sans-serif;
  --font-mono:     'Inter Tight', system-ui, sans-serif;

  /* Shadow */
  --shadow-sm:  0 1px 2px rgba(15, 23, 28, 0.04);
  --shadow:     0 1px 3px rgba(15, 23, 28, 0.06), 0 4px 12px rgba(15, 23, 28, 0.04);
  --shadow-md:  0 4px 12px rgba(15, 23, 28, 0.08), 0 2px 4px rgba(15, 23, 28, 0.04);
  --shadow-lg:  0 12px 32px rgba(15, 23, 28, 0.10), 0 4px 12px rgba(15, 23, 28, 0.05);

  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse 60% 30% at 50% 0%, rgba(0, 151, 117, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(106, 152, 197, 0.025) 0%, transparent 60%),
    var(--bg-base);
  background-attachment: fixed;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms var(--ease);
}
a:hover { color: var(--accent-dim); }

button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }

/* Typo */
h1, h2, h3, h4 {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--text);
}
h1 { font-size: clamp(1.65rem, 2.5vw, 2rem); font-weight: 700; letter-spacing: -0.028em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-dim);
  margin-bottom: 0.4rem;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.brand:hover { color: var(--text); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  border-radius: 7px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.brand-logo {
  height: 32px;
  width: auto;
  max-width: 180px;
  display: block;
  object-fit: contain;
}

.brand-text { color: var(--text); }
.brand-finance { font-weight: 400; color: var(--accent); margin-left: 0.3rem; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.1rem;
  flex: 1;
}

.nav-links a {
  display: block;
  padding: 0.45rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 7px;
  transition: all 180ms var(--ease);
}
.nav-links a:hover {
  color: var(--text);
  background: var(--bg-input);
}
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.85rem;
}
.user-name { color: var(--text-muted); }
.logout {
  color: var(--text-dim);
  font-size: 0.82rem;
}
.logout:hover { color: var(--danger); }

/* Layout */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
  animation: fadeUp 500ms var(--ease) backwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header .meta { display: flex; flex-direction: column; gap: 0.2rem; }

.page-controls { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 200ms var(--ease), border-color 200ms var(--ease);
}
.card:hover { box-shadow: var(--shadow); }

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-6 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* KPI Cards */
.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 1.25rem 1.5rem;
}
.kpi-card .label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}
.kpi-card .value {
  font-family: var(--font-body);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.4rem 0 0.2rem;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-card .delta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.kpi-card .delta.positive { color: var(--success); }
.kpi-card .delta.negative { color: var(--danger); }

.kpi-card.accent {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--accent-soft) 100%);
  border-color: var(--border-accent);
}
.kpi-card.accent .value { color: var(--accent-dim); }

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

.data-table th {
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

.data-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  border-bottom: none;
  background: var(--bg-subtle);
  padding: 0.75rem 0.85rem;
}

/* Compacte begroting */
.data-table.compact td { padding: 0.4rem 0.75rem; }
.data-table.compact th { padding: 0.4rem 0.75rem; font-size: 0.65rem; }

.data-table tr.sub-item td:first-child {
  padding-left: 2.5rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.data-table tr.sub-item { background: var(--bg-subtle); }
.data-table tr.section-header { background: rgba(0, 151, 117, 0.025); }
.data-table tr.section-header td:first-child { font-weight: 600; }

.data-table tr.section-collapsed + tr.sub-item { display: none; }

/* Section toggle */
.section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  margin-right: 0.4rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 150ms var(--ease);
}
.section-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.section-toggle.collapsed { transform: rotate(-90deg); }

.variance-positive { color: var(--success); }
.variance-negative { color: var(--danger); }
.variance-neutral  { color: var(--text-muted); }

.color-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Progress bars */
.variance-bar {
  position: relative;
  height: 5px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.variance-bar .fill {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 800ms var(--ease);
  animation: fillGrow 800ms var(--ease) backwards;
}

@keyframes fillGrow { from { width: 0; } }

.variance-bar.over .fill { background: var(--danger); }
.variance-bar.under .fill { background: var(--success); }

/* Formulieren */
.form-group { margin-bottom: 1.1rem; }

label {
  display: block;
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=file],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: all 180ms var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input.amount {
  font-family: var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.input-prefix {
  position: relative;
}
.input-prefix::before {
  content: '€';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-family: var(--font-mono);
  pointer-events: none;
  font-size: 0.85rem;
}
.input-prefix input { padding-left: 1.85rem; }

/* Knoppen */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 180ms var(--ease);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-dim);
  box-shadow: var(--shadow);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,151,117,0.15);
}
.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,151,117,0.25);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--bg-subtle); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }

/* Flash messages */
.flash-container {
  position: fixed;
  top: 5rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
}

.flash {
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  animation: slideIn 400ms var(--ease-spring), fadeOut 400ms var(--ease) 5s forwards;
}
.flash-success { border-left-color: var(--success); background: var(--success-soft); }
.flash-error   { border-left-color: var(--danger); background: var(--danger-soft); }
.flash-info    { border-left-color: var(--info); background: var(--info-soft); }

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

/* Signalen */
.signal {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border-radius: 8px;
  border-left: 3px solid;
  margin-bottom: 0.5rem;
  transition: transform 200ms var(--ease);
  border: 1px solid var(--border);
}
.signal:hover { transform: translateX(3px); }
.signal-icon {
  width: 22px; height: 22px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 50%;
}
.signal-warning {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}
.signal-warning .signal-icon { background: var(--warning); color: #fff; }
.signal-info {
  border-left-color: var(--info);
  background: var(--info-soft);
}
.signal-info .signal-icon { background: var(--info); color: #fff; }
.signal-text { font-size: 0.9rem; color: var(--text); }

/* Month type badge */
.month-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 18px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.month-normal {
  background: var(--info-soft);
  color: var(--info);
}
.month-quarterly {
  background: var(--success-soft);
  color: var(--success);
}
.month-august_double {
  background: var(--accent-soft);
  color: var(--accent-dim);
  font-weight: 700;
}

/* Explanation box */
.explanation-box {
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.95rem 1.2rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.explanation-box strong { color: var(--text); font-weight: 600; }
.explanation-box code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(0, 151, 117, 0.12);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  color: var(--accent-dim);
}

/* Chart container */
.chart-container {
  position: relative;
  height: 300px;
  margin-top: 0.5rem;
}
.chart-container.large { height: 380px; }
.chart-container.small { height: 180px; }
.chart-container.tiny  { height: 60px; }

/* Login */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 500ms var(--ease-spring) backwards;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 1.75rem;
}

.auth-card h1 {
  text-align: center;
  font-size: 1.45rem;
  margin-bottom: 0.35rem;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 2rem;
}

/* Stagger */
.stagger > * { animation: fadeUp 450ms var(--ease) backwards; }
.stagger > *:nth-child(1) { animation-delay: 40ms; }
.stagger > *:nth-child(2) { animation-delay: 80ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 160ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 240ms; }
.stagger > *:nth-child(7) { animation-delay: 280ms; }
.stagger > *:nth-child(8) { animation-delay: 320ms; }

/* Tag pills */
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 11px;
  font-size: 0.72rem;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 500;
}
.tag-pill.income { background: var(--success-soft); color: var(--success); }
.tag-pill.expense { background: var(--bg-input); color: var(--text-muted); }
.tag-pill.unallocated {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Sparkline mini chart */
.sparkline-row {
  display: grid;
  grid-template-columns: 1fr 110px 100px;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.sparkline-row:last-child { border-bottom: none; }
.sparkline-name { font-size: 0.88rem; }
.sparkline-svg { width: 100%; height: 32px; }
.sparkline-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Horizontale bar (begroot vs werkelijk per categorie) */
.hbar-row {
  display: grid;
  grid-template-columns: 140px 1fr 100px;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0;
  font-size: 0.86rem;
}
.hbar-name { color: var(--text-muted); font-size: 0.85rem; }
.hbar-track {
  position: relative;
  height: 22px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.hbar-bar {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent-dim) 0%, var(--accent) 100%);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
  font-size: 0.72rem;
  color: #fff;
  font-weight: 600;
  font-family: var(--font-mono);
  transition: width 900ms var(--ease);
}
.hbar-bar.over { background: linear-gradient(90deg, #b04640 0%, var(--danger) 100%); }
.hbar-budget-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--text-muted);
  z-index: 2;
}
.hbar-value {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
}

/* Responsive */
@media (max-width: 880px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
  }
  .nav-links { width: 100%; order: 3; overflow-x: auto; }
  .nav-links a { white-space: nowrap; }
  .main-content { padding: 1.5rem 1rem 4rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .hbar-row { grid-template-columns: 100px 1fr 80px; gap: 0.5rem; }
  .sparkline-row { grid-template-columns: 1fr 80px 75px; gap: 0.5rem; }
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
