:root {
	--bg: #f3f2ef;
	--panel: #ffffff;
	--ink: #1e272e;
	--muted: #5f6c72;
	--line: #d6dcdf;
	--brand: #c00000;
	--brand-dark: #8f0000;
	--brand-soft: #fce8e8;
	--blue: #134074;
	--blue-soft: #d7e3f1;
	--danger: #8f1d14;
	--danger-soft: #f7dedb;
	--warn: #7a4800;
	--warn-soft: #fff3cd;
	--ok: #1b5e20;
	--ok-soft: #d9efdb;
}

* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: "Segoe UI", Tahoma, sans-serif;
	background: var(--bg);
	color: var(--ink);
	line-height: 1.5;
}

/* ── TOPBAR ── */
.topbar {
	display: flex;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.2rem;
	height: 52px;
	background: linear-gradient(120deg, #1a0000, #3a0000);
	color: #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.brand a {
	color: #fff;
	text-decoration: none;
	font-weight: 700;
	font-size: 1rem;
	letter-spacing: 0.02em;
}
.main-nav { display: flex; gap: 0.2rem; }
.main-nav a {
	color: rgba(255,255,255,0.82);
	text-decoration: none;
	padding: 0.4rem 0.75rem;
	border-radius: 6px;
	font-size: 0.92rem;
	transition: background 0.15s, color 0.15s;
}
.main-nav a:hover, .main-nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.logout-form button { font-size: 0.85rem; }

/* ── LAYOUT ── */
.container { max-width: 1200px; margin: 1.4rem auto; padding: 0 1.2rem 3rem; }
.panel, .card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 1.1rem 1.2rem;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.panel-header h2 { margin: 0; }

.page-header { margin-bottom: 1.2rem; }
.page-header h1 { margin: 0 0 0.2rem; font-size: 1.5rem; }
.page-header p { margin: 0; color: var(--muted); }
.page-header.split { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

/* ── BOEKHOUDER BADGE ── */
.role-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	background: var(--blue-soft);
	color: var(--blue);
	border: 1px solid #b0c8e8;
	border-radius: 20px;
	padding: 0.25rem 0.75rem;
	font-size: 0.82rem;
	font-weight: 600;
}

/* ── GRIDS ── */
.grid { display: grid; gap: 0.9rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ── STATS ── */
.stats .card { text-align: center; }
.stats .card h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.4rem; }
.stats .stat { font-size: 1.65rem; margin: 0; font-weight: 700; color: var(--brand); }
.stats .stat-warn { color: var(--warn); }

/* ── STACK ── */
.stack { display: grid; gap: 0.9rem; }
.actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.full { grid-column: 1 / -1; }

/* ── FORMS ── */
label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 0.5rem 0.65rem;
	background: #fff;
	transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(192,0,0,0.12);
}

/* ── BUTTONS ── */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
	background: var(--brand);
	color: #fff;
	border: 1px solid transparent;
	border-radius: 8px;
	text-decoration: none;
	padding: 0.55rem 1rem;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	transition: background 0.15s;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: var(--blue); }
.btn.secondary:hover { background: #0f2d52; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── ALERTS ── */
.alert {
	padding: 0.8rem 1rem;
	border-radius: 8px;
	border: 1px solid;
	margin-bottom: 0.9rem;
	font-size: 0.92rem;
}
.alert.error { background: var(--danger-soft); border-color: #e9b8b2; color: var(--danger); }
.alert.success { background: var(--ok-soft); border-color: #b9dcbf; color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: #f5c542; color: var(--warn); }

/* ── TABLES ── */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 0.55rem 0.65rem; vertical-align: middle; }
th { background: #f7f8fa; font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tbody tr:hover { background: #fcfcfc; }

/* ── STATUS BADGES ── */
.badge {
	display: inline-block;
	padding: 0.15rem 0.6rem;
	border-radius: 20px;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.badge-concept { background: var(--blue-soft); color: var(--blue); }
.badge-finalized { background: #e8f0e8; color: #1a5c1a; }
.badge-paid { background: var(--ok-soft); color: var(--ok); }
.badge-partially_paid { background: #fff3cd; color: var(--warn); }
.badge-cancelled { background: #f0f0f0; color: #666; }
.badge-credited { background: #e8e0f5; color: #4a0080; }
.badge-pay-unpaid { background: var(--danger-soft); color: var(--danger); }
.badge-pay-partially_paid { background: var(--warn-soft); color: var(--warn); }
.badge-pay-paid { background: var(--ok-soft); color: var(--ok); }
.badge-error { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-role-admin { background: #fce8e8; color: var(--brand); }
.badge-role-medewerker { background: var(--blue-soft); color: var(--blue); }
.badge-role-boekhouder { background: #e8f0e8; color: var(--ok); }

/* ── LINE ROWS (invoice form) ── */
.line-row {
	border: 1px solid var(--line);
	border-radius: 10px;
	background: #fcfcfc;
	padding: 0.7rem;
	display: grid;
	gap: 0.6rem;
	grid-template-columns: 1.2fr 2fr 0.7fr 1fr 0.8fr auto;
	align-items: end;
}
.line-row:hover { border-color: #bbb; }

/* ── FILTER ── */
.filter-row { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-row input, .filter-row select { flex: 1; min-width: 120px; }
.filter-grid { margin-bottom: 1rem; }

/* ── MISC ── */
.inline-input { display: flex; gap: 0.45rem; }
.inline-input input { flex: 1; }
.muted { color: var(--muted); font-size: 0.85rem; }
.list { margin: 0; padding-left: 1rem; display: grid; gap: 0.35rem; }
.error-page { max-width: 600px; margin: 4rem auto; text-align: center; }
.login-shell { max-width: 420px; margin: 5rem auto; }
.card.login-card { padding: 2rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.checkbox-row input { width: auto; }
.bordered { border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem; }
code { background: #f0f0f0; border-radius: 4px; padding: 0.1em 0.4em; font-size: 0.88em; }
details > summary { padding: 0.4rem 0; }
details[open] > summary { margin-bottom: 0.5rem; }

/* ── INVOICE DETAIL STATUS BANNER ── */
.invoice-status-bar {
	display: flex; align-items: center; gap: 1rem;
	background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px;
	padding: 0.6rem 1rem; margin-bottom: 0.8rem; flex-wrap: wrap;
}
.invoice-status-bar .status-label { font-weight: 700; font-size: 0.9rem; color: var(--muted); }

@media (max-width: 900px) {
	.grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
	.page-header.split { flex-direction: column; align-items: flex-start; }
	.main-nav { flex-wrap: wrap; }
	.line-row { grid-template-columns: 1fr; }
}


* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: "Segoe UI", Tahoma, sans-serif;
	background: radial-gradient(circle at 20% -20%, #ffffff 0%, var(--bg) 50%);
	color: var(--ink);
}

.topbar {
	display: flex;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
	padding: 0.9rem 1.2rem;
	background: linear-gradient(120deg, #0f2d52, #134074);
	color: #fff;
}
.brand a, .main-nav a { color: #fff; text-decoration: none; }
.main-nav { display: flex; gap: 0.9rem; }

.container { max-width: 1200px; margin: 1.2rem auto; padding: 0 1rem 2rem; }
.panel, .card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 1rem;
}
.page-header { margin-bottom: 1rem; }
.page-header.split { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.grid { display: grid; gap: 0.8rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats .stat { font-size: 1.5rem; margin: 0.3rem 0 0; font-weight: 700; }

.stack { display: grid; gap: 0.8rem; }
.actions { display: flex; gap: 0.6rem; align-items: center; }
.actions.wrap { flex-wrap: wrap; }
.full { grid-column: 1 / -1; }

label { display: grid; gap: 0.35rem; font-weight: 600; }
input, select, textarea, button {
	font: inherit;
}
input, select, textarea {
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 0.52rem 0.65rem;
	background: #fff;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--brand);
	color: #fff;
	border: 1px solid transparent;
	border-radius: 8px;
	text-decoration: none;
	padding: 0.55rem 0.9rem;
	cursor: pointer;
}
.btn.secondary { background: #2e5a87; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }

.alert {
	padding: 0.75rem;
	border-radius: 8px;
	border: 1px solid;
	margin-bottom: 1rem;
}
.alert.error { background: var(--danger-soft); border-color: #e9b8b2; color: var(--danger); }
.alert.success { background: var(--ok-soft); border-color: #b9dcbf; color: var(--ok); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 0.52rem; }
th { background: #f9fafb; }

.line-row {
	border: 1px solid var(--line);
	border-radius: 10px;
	background: #fcfcfc;
	padding: 0.7rem;
	display: grid;
	gap: 0.6rem;
	grid-template-columns: 1.2fr 2fr 0.7fr 1fr 0.8fr auto;
}

.filter-row { display: flex; gap: 0.6rem; margin-bottom: 1rem; }
.filter-row input { flex: 1; }
.filter-grid { margin-bottom: 1rem; }
.inline-input { display: flex; gap: 0.45rem; }
.inline-input input { flex: 1; }
.muted { color: var(--muted); }
.list { margin: 0; padding-left: 1rem; display: grid; gap: 0.35rem; }
.error-page { max-width: 600px; margin: 4rem auto; text-align: center; }
.login-shell { max-width: 420px; margin: 5rem auto; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.checkbox-row input { width: auto; }
.bordered { border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem; }

@media (max-width: 900px) {
	.grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
	.page-header.split { flex-direction: column; align-items: flex-start; }
	.main-nav { flex-wrap: wrap; }
	.line-row { grid-template-columns: 1fr; }
}
