@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   Leenheerst BV Admin — Dutch Fintech Ledger Theme
   ============================================================ */

:root {
  /* Palette */
  --primary: #1e3a5f;
  --primary-dark: #152b47;
  --primary-light: #2d5180;
  --secondary: #475569;
  --accent: #1f9d72;
  --accent-dark: #178060;

  --bg: #f6f7f9;
  --bg-alt: #eef1f5;
  --surface: #ffffff;

  --text: #1b2533;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --success: #1f9d72;
  --success-bg: #e7f6ef;
  --warning: #e0a106;
  --warning-bg: #fdf4e0;
  --error: #d64545;
  --error-bg: #fbeaea;
  --info: #2d5180;
  --info-bg: #e8eef6;

  /* Typography */
  --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --heading-weight: 700;
  --body-size: 15px;
  --line-height: 1.55;

  /* Layout */
  --sidebar-w: 248px;
  --topnav-h: 60px;
  --max-width: 1320px;
  --pad: 32px;
  --card-radius: 14px;
  --control-radius: 9px;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.04);
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 4px 16px rgba(16,24,40,0.06);
  --shadow-lg: 0 6px 28px rgba(16,24,40,0.12);
  --focus-ring: 0 0 0 3px rgba(31,157,114,0.28);
  --transition: all 0.18s ease;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--body-size);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--heading-weight);
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }
a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* Tabular numerals for money / data */
.num, .money, td.num, .table td, .table th { font-variant-numeric: tabular-nums; }
.money, .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.money.pos { color: var(--success); }
.money.neg { color: var(--error); }

/* ============================================================
   App shell: sidebar + topbar + content
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topnav-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #cdd8e6;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.sidebar .brand .logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: 0 2px 8px rgba(31,157,114,0.4);
}
.sidebar .nav-group { margin-bottom: 6px; }
.sidebar .nav-group-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #6f88a8;
  padding: 14px 12px 6px;
  font-weight: 700;
}
.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--control-radius);
  color: #c2cfe0;
  font-weight: 500;
  font-size: 0.92rem;
  transition: var(--transition);
}
.sidebar a.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.sidebar a.nav-link.active {
  background: rgba(31,157,114,0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar a.nav-link .icon { width: 18px; text-align: center; opacity: 0.85; }

/* ---------- Topbar ---------- */
.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .company {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--primary);
}
.topbar .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.88rem; color: var(--text-muted);
}
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem;
}

/* Generic top nav bar (non-sidebar pages, e.g. login chrome) */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--topnav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  box-shadow: var(--shadow-sm);
}
.nav .nav-brand { font-weight: 800; color: var(--primary); font-size: 1.1rem; }
.nav ul { display: flex; gap: 6px; }
.nav ul li a {
  padding: 8px 14px; border-radius: var(--control-radius);
  color: var(--secondary); font-weight: 500;
}
.nav ul li a:hover, .nav ul li a.active { background: var(--bg-alt); color: var(--primary); }

/* ---------- Main content ---------- */
.main {
  grid-area: main;
  padding: var(--pad);
  max-width: var(--max-width);
  width: 100%;
}

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.83rem; color: var(--text-muted);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.5; }

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.page-title .subtitle {
  display: block;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0;
}
.page-header .actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: var(--transition);
}
.card.hover:hover, a.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: -22px -22px 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1rem; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }

/* Stat / KPI widget */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
a.stat-card-link { display: block; text-decoration: none; color: inherit; cursor: pointer; }
a.stat-card-link:hover { border-color: var(--primary, var(--accent)); background: var(--bg-subtle, rgba(0,0,0,0.02)); }
.stat-card.is-primary::before { background: var(--primary-light); }
.stat-card.is-warning::before { background: var(--warning); }
.stat-card.is-error::before { background: var(--error); }
.stat-card .stat-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.stat-card .stat-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }

/* Grid helpers */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--control-radius);
  border: 1px solid transparent;
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--border); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,58,95,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 14px rgba(30,58,95,0.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-alt); border-color: var(--primary-light); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(31,157,114,0.3);
}
.btn-accent:hover { box-shadow: 0 4px 14px rgba(31,157,114,0.4); }

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { background: #bd3838; box-shadow: 0 4px 14px rgba(214,69,69,0.35); }

.btn-ghost { background: transparent; color: var(--secondary); }
.btn-ghost:hover { background: var(--bg-alt); }

.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 7px; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
.form-label .req { color: var(--error); margin-left: 2px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  font-family: var(--font);
  font-size: 0.93rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--control-radius);
  padding: 10px 13px;
  transition: var(--transition);
}
.form-input:hover, .form-textarea:hover, .form-select:hover { border-color: var(--primary-light); }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.form-input::placeholder, .form-textarea::placeholder { color: #9aa7b6; }
.form-input:disabled, .form-select:disabled { background: var(--bg-alt); color: var(--text-muted); cursor: not-allowed; }
.form-input.is-error, .form-select.is-error { border-color: var(--error); }

.form-textarea { resize: vertical; min-height: 96px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

/* Money input — right aligned tabular */
.form-input.money-input { text-align: right; font-variant-numeric: tabular-nums; }

.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row input[type="checkbox"], .checkbox-row input[type="radio"] {
  width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer;
}

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--control-radius);
  border: 1px solid transparent;
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.alert .alert-icon { font-weight: 800; flex-shrink: 0; }
.alert-success { background: var(--success-bg); border-color: #b9e6d3; color: var(--accent-dark); }
.alert-warning { background: var(--warning-bg); border-color: #f3dca0; color: #946c08; }
.alert-error   { background: var(--error-bg);   border-color: #f0c2c2; color: #a83232; }
.alert-info    { background: var(--info-bg);    border-color: #c2d3e8; color: var(--info); }

/* Indicative disclaimer note (loonstroken / tax) */
.disclaimer {
  font-size: 0.8rem;
  color: #946c08;
  background: var(--warning-bg);
  border: 1px dashed #e6c976;
  border-radius: 8px;
  padding: 9px 13px;
  margin: 12px 0;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table thead th {
  background: var(--bg-alt);
  color: var(--secondary);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--primary); }
.table thead th.num, .table td.num { text-align: right; }
.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: #f9fbfc; }
.table tbody tr:last-child td { border-bottom: none; }

/* Striped variant */
.table.striped tbody tr:nth-child(even) { background: #fafbfc; }
.table.striped tbody tr:nth-child(even):hover { background: #f4f7f9; }

.table tfoot td {
  padding: 13px 16px;
  font-weight: 700;
  background: var(--bg-alt);
  border-top: 2px solid var(--border-strong);
}
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.4rem; opacity: 0.4; margin-bottom: 10px; }

/* ============================================================
   Badges / status pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--bg-alt);
  color: var(--secondary);
  border: 1px solid var(--border);
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--success-bg); color: var(--accent-dark); border-color: #b9e6d3; }
.badge-warning { background: var(--warning-bg); color: #946c08; border-color: #f3dca0; }
.badge-error   { background: var(--error-bg);   color: #a83232; border-color: #f0c2c2; }
.badge-info    { background: var(--info-bg);    color: var(--info); border-color: #c2d3e8; }
.badge-neutral { background: var(--bg-alt); color: var(--secondary); }
.badge-primary { background: #e6ecf3; color: var(--primary); border-color: #c8d6e5; }

/* Semantic status aliases (Dutch workflow states) */
.badge.status-draft, .badge.status-open { background: var(--bg-alt); color: var(--secondary); }
.badge.status-sent, .badge.status-submitted { background: var(--info-bg); color: var(--info); border-color: #c2d3e8; }
.badge.status-paid, .badge.status-done, .badge.status-reimbursed { background: var(--success-bg); color: var(--accent-dark); border-color: #b9e6d3; }
.badge.status-partial { background: var(--warning-bg); color: #946c08; border-color: #f3dca0; }
.badge.status-overdue, .badge.status-cancelled { background: var(--error-bg); color: #a83232; border-color: #f0c2c2; }

/* ============================================================
   Misc utilities
   ============================================================ */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .spacer { flex: 1; }
.search-box { position: relative; min-width: 240px; }
.search-box .form-input { padding-left: 36px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs a {
  padding: 11px 16px; font-weight: 600; font-size: 0.9rem; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--accent); }

.divider { height: 1px; background: var(--border); border: none; margin: 22px 0; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.mono { font-family: var(--font-mono); }

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

/* Login screen */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-light) 100%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  padding: 38px 34px;
}
.auth-card .auth-brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 1.25rem; color: var(--primary);
  margin-bottom: 6px;
}
.auth-card .auth-brand .logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: grid; place-items: center; color: #fff; font-weight: 800;
  box-shadow: 0 3px 10px rgba(31,157,114,0.4);
}
.auth-card .auth-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 26px; }

/* ============================================================
   Responsive — 768px breakpoint
   ============================================================ */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topnav-h) auto 1fr;
    grid-template-areas:
      "topbar"
      "sidebar"
      "main";
  }
  .sidebar {
    height: auto;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
  }
  .sidebar .brand { width: 100%; padding-bottom: 10px; }
  .sidebar .nav-group { margin: 0; }
  .sidebar .nav-group-title { display: none; }
  .sidebar a.nav-link { padding: 8px 12px; font-size: 0.85rem; }

  :root { --pad: 18px; }

  .main { padding: var(--pad); }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .actions { width: 100%; }
  .page-header .actions .btn { flex: 1; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .topbar .company .name-full { display: none; }

  /* Tables scroll horizontally on small screens */
  .table-wrap { overflow-x: auto; }
  .table { min-width: 640px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 0; width: 100%; }

  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}
