/* Postvak */

:root {
	--bg: #f4f5f7;
	--panel: #ffffff;
	--panel-2: #f9fafb;
	--text: #1c2230;
	--muted: #687083;
	--border: #e2e5ea;
	--border-strong: #cfd4dc;
	--hover: #eef1f5;
	--selected: #e6efff;
	--accent: #2563d9;
	--accent-hover: #1e54bb;
	--accent-ink: #ffffff;
	--accent-soft: #e7eefc;
	--danger: #c2332f;
	--danger-soft: #fdecec;
	--ok: #1d7f4a;
	--ok-soft: #e6f5ec;
	--warn: #9a6300;
	--warn-soft: #fff5df;
	--flag: #e0a100;
	--shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
	--radius: 10px;
	--topbar: 54px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #13161c;
		--panel: #1b1f27;
		--panel-2: #20252e;
		--text: #e6e9ef;
		--muted: #9aa3b2;
		--border: #2c323d;
		--border-strong: #3a414e;
		--hover: #252b35;
		--selected: #1e3157;
		--accent: #5b8ff0;
		--accent-hover: #74a1f3;
		--accent-ink: #0d1424;
		--accent-soft: #1d2b46;
		--danger: #f07a75;
		--danger-soft: #3a1f21;
		--ok: #5fcf8f;
		--ok-soft: #173326;
		--warn: #f0c060;
		--warn-soft: #362c14;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3);
		color-scheme: dark;
	}
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.45;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; margin-top: 1.4em; }
p { margin: 0 0 .8em; }

code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
pre { margin: 0 0 1em; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.55; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.warn-text { color: var(--warn); }

.sprite { display: none; }

.icon {
	width: 18px;
	height: 18px;
	flex: none;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	vertical-align: middle;
}

.icon.tiny { width: 14px; height: 14px; }
.icon.big { width: 40px; height: 40px; stroke-width: 1.5; color: var(--muted); }

/* Knoppen */

.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	background: var(--panel);
	color: var(--text);
	font: inherit;
	font-weight: 550;
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none;
}

.btn:hover { background: var(--hover); text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.small .icon { width: 16px; height: 16px; }
.btn.block { width: 100%; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.on { color: var(--flag); border-color: var(--flag); }
.btn.on .icon { fill: var(--flag); }
.btn[disabled] { opacity: .5; cursor: default; }

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: inherit;
	cursor: pointer;
}

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

button.link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
button.link.small { font-size: 12.5px; }

/* Bovenbalk */

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 14px;
	height: var(--topbar);
	padding: 0 16px;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }

.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { display: flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.topnav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }

.usermenu { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.usermenu form { margin: 0; }
.usermenu .who { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-toggle { display: none; }

/* Meldingen */

.flash-stack { position: fixed; z-index: 50; right: 16px; top: calc(var(--topbar) + 12px); display: flex; flex-direction: column; gap: 8px; max-width: min(460px, calc(100vw - 32px)); }
body.minimal .flash-stack { top: 16px; }

.flash {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 11px 12px;
	border-radius: 10px;
	background: var(--panel);
	border: 1px solid var(--border);
	box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
}

.flash.ok .icon:first-child { color: var(--ok); }
.flash.error .icon:first-child { color: var(--danger); }
.flash span { flex: 1; }
.flash-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }

.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--text); }
.alert.ok { background: var(--ok-soft); }

/* Webmail-indeling */

.app {
	display: grid;
	grid-template-columns: 250px minmax(0, 1fr);
	height: calc(100vh - var(--topbar));
	height: calc(100dvh - var(--topbar));
}

.sidebar {
	overflow-y: auto;
	padding: 14px 10px 24px;
	background: var(--panel-2);
	border-right: 1px solid var(--border);
}

.compose-btn { margin-bottom: 16px; height: 38px; }

.side-section { margin-bottom: 18px; }
.side-section h2 { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 8px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-link {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 6px 8px;
	border-radius: 7px;
	color: var(--text);
	min-height: 32px;
}

.side-link:hover { background: var(--hover); text-decoration: none; }
.side-link.active { background: var(--selected); color: var(--accent); font-weight: 600; }
.side-link.disabled { color: var(--muted); }
.side-link .icon { width: 17px; height: 17px; color: var(--muted); }
.side-link.active .icon { color: var(--accent); }
.side-link .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link.depth-1 { padding-left: 24px; }
.side-link.depth-2 { padding-left: 40px; }
.side-link.depth-3 { padding-left: 56px; }
.side-link.depth-4, .side-link.depth-5 { padding-left: 72px; }

.badge { font-size: 11.5px; font-weight: 650; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 1px 7px; }

.sidebar-backdrop { display: none; }

.content { overflow-y: auto; min-width: 0; background: var(--panel); }

/* Lijst */

.list-head {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	padding: 14px 18px 10px;
}

.list-head h1 { margin: 0; flex: 1; min-width: 160px; }
.list-head .count { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }

.search { display: flex; gap: 8px; align-items: center; }
.search-box { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); min-width: 240px; }
.search-box .icon { width: 16px; height: 16px; color: var(--muted); }
.search-box input { border: 0; outline: none; background: none; font: inherit; color: inherit; width: 100%; padding: 0; }
.search select { height: 34px; }

.content > .alert { margin: 0 18px 14px; }

.bulkbar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 18px;
	background: var(--panel);
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}

.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bulk-form:not(.has-selection) .bulk-actions { opacity: .45; pointer-events: none; }
.move-group { display: inline-flex; gap: 6px; align-items: center; }
.move-group select { height: 30px; max-width: 180px; }
.selected-count { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.check-all { display: flex; align-items: center; padding: 0 4px; }

.msglist { list-style: none; margin: 0; padding: 0; }

.msg { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.msg:hover { background: var(--hover); }
.msg.selected { background: var(--selected); }
.msg-check { display: flex; align-items: center; padding: 0 4px 0 22px; cursor: pointer; }

.msg-link {
	flex: 1;
	min-width: 0;
	display: grid;
	grid-template-columns: minmax(120px, 230px) minmax(0, 1fr) auto;
	gap: 14px;
	align-items: center;
	padding: 10px 18px 10px 8px;
	color: var(--text);
}

.msg-link:hover { text-decoration: none; }
.msg-from, .msg-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-subject { color: var(--muted); }
.msg.unread .msg-from, .msg.unread .msg-subject { font-weight: 650; color: var(--text); }
.msg.unread .msg-from::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }
.msg-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.msg-meta .flag .icon { color: var(--flag); fill: var(--flag); }
.msg-meta time { min-width: 52px; text-align: right; }

.empty-list { padding: 60px 20px; text-align: center; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px 24px; }
.pager .muted { margin-right: auto; }

/* Bericht */

.message-view { display: flex; flex-direction: column; }

.message-toolbar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
}

.message-toolbar form { margin: 0; }
.toolbar-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.message { display: flex; flex-direction: column; flex: 1; padding: 18px 22px 22px; min-height: 0; }
.message-subject { font-size: 21px; margin-bottom: 12px; word-break: break-word; }

.message-headers { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0 0 14px; font-size: 13px; }
.message-headers dt { color: var(--muted); }
.message-headers dd { margin: 0; word-break: break-word; }

.attachments { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; }
.attachments a { display: flex; align-items: center; gap: 8px; max-width: 320px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--panel-2); }
.attachments a:hover { border-color: var(--accent); text-decoration: none; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: var(--muted); font-size: 12px; white-space: nowrap; }

.remote-notice { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border-radius: 8px; background: var(--warn-soft); font-size: 13px; }
.remote-notice span { flex: 1; }

.mail-body { flex: 1; width: 100%; min-height: 60vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.mail-text { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.55; padding: 4px 2px; }
.mail-text .quoted { color: var(--muted); }

/* Opstellen */

.page { max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px; }
.page.narrow { max-width: 560px; }
.compose-page { max-width: 900px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.compose { padding: 0; overflow: hidden; }
.compose-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.compose-head h1 { margin: 0; font-size: 17px; }
.compose .alert { margin: 12px 18px 0; }

.compose-row { display: flex; align-items: center; gap: 10px; padding: 0 18px; min-height: 44px; border-bottom: 1px solid var(--border); }
.compose-label { width: 76px; flex: none; color: var(--muted); }
.compose-row input { flex: 1; border: 0; background: none; font: inherit; color: inherit; height: 42px; outline: none; min-width: 0; }
.compose-from { flex: 1; }

.compose-body { display: block; width: 100%; border: 0; resize: vertical; padding: 16px 18px; font: inherit; font-size: 14.5px; line-height: 1.55; background: var(--panel); color: inherit; outline: none; min-height: 320px; }
.compose > .check { padding: 10px 18px; border-top: 1px solid var(--border); }

.compose-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--panel-2); }
.file-pick { position: relative; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); cursor: pointer; font-weight: 550; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Formulieren */

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
	font: inherit;
	color: inherit;
}

.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > span:first-child, .field legend { font-weight: 600; font-size: 13px; }
.field legend { margin-bottom: 6px; padding: 0; }
.field input, .field select, .field textarea, .search select, .move-group select {
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	background: var(--panel);
	color: var(--text);
	width: 100%;
}

.move-group select, .search select { width: auto; }
.field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.field input[disabled] { background: var(--panel-2); color: var(--muted); }
.field .hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.field-error { color: var(--danger); font-size: 12.5px; }
.field-row { display: flex; gap: 12px; }
.field.grow { flex: 1; }
.field.port { width: 110px; flex: none; }
.narrow-field { max-width: 260px; }

.check { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 9px; cursor: pointer; }
.check input { margin: 2px 0 0; flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.indent { padding-left: 25px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.form-card { padding: 18px 20px 6px; }
.form-card h2 { margin-bottom: 14px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.danger-zone { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-zone p { margin: 0; }

/* Beheer */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .icon { width: 16px; height: 16px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head > div { flex: 1; min-width: 260px; }
.page-head form { margin: 0; }

.table-wrap { overflow-x: auto; margin-bottom: 18px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .55; }
.table tr.warn td { background: var(--warn-soft); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions form { display: inline; margin: 0; }
.table td.detail { max-width: 420px; word-break: break-word; }
.table.compact td, .table.compact th { padding: 6px 10px; }

.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.token-reveal { padding: 18px 20px; margin-bottom: 18px; border-color: var(--ok); }
.token-reveal h2 { display: flex; align-items: center; gap: 8px; }
.copy-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
code.token { font-size: 13px; padding: 7px 10px; word-break: break-all; user-select: all; }
.token-form { max-width: 640px; }

.empty-state { padding: 36px 28px; text-align: center; }

/* Aanmelden en toestemming */

.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px 26px 22px; }
.auth-card.consent { max-width: 480px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand img { margin-bottom: 8px; }
.auth-brand h1 { font-size: 20px; margin-bottom: 4px; }
.consent-icon { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.consent-icon .icon { width: 24px; height: 24px; }
.consent-actions { display: flex; gap: 10px; justify-content: flex-end; margin: 6px 0 12px; }

/* Documentatie */

.docs-toc { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; margin-bottom: 16px; }
.docs-toc a { padding: 6px 10px; border-radius: 7px; font-weight: 550; }
.docs-toc a:hover { background: var(--hover); text-decoration: none; }
.doc-section { padding: 20px 22px 8px; margin-bottom: 16px; scroll-margin-top: calc(var(--topbar) + 12px); }
.doc-section .table { margin-bottom: 16px; }
.method { display: inline-block; min-width: 56px; text-align: center; font-family: var(--mono); font-size: 11.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--hover); }
.method.get { color: var(--ok); }
.method.post { color: var(--accent); }
.method.patch { color: var(--warn); }
.method.delete { color: var(--danger); }
.endpoints td:nth-child(2) { white-space: nowrap; }

/* Gsm en tablet */

@media (max-width: 900px) {
	.msg-link { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "from meta" "subject subject"; gap: 2px 10px; }
	.msg-from { grid-area: from; }
	.msg-subject { grid-area: subject; }
	.msg-meta { grid-area: meta; }
	.search-box { min-width: 0; flex: 1; }
	.search { flex: 1 1 100%; }
}

@media (max-width: 760px) {
	.nav-toggle { display: inline-flex; }
	.topbar { gap: 8px; padding: 0 10px; }
	.brand span { display: none; }
	.topnav { margin-left: 0; }
	.topnav a span { display: none; }
	.usermenu .who { display: none; }

	.app { grid-template-columns: minmax(0, 1fr); }

	.sidebar {
		position: fixed;
		z-index: 30;
		top: var(--topbar);
		bottom: 0;
		left: 0;
		width: min(290px, 85vw);
		transform: translateX(-100%);
		transition: transform .18s ease;
	}

	body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 32px rgba(0, 0, 0, .2); }
	body.sidebar-open .sidebar-backdrop { display: block; position: fixed; z-index: 25; inset: var(--topbar) 0 0 0; background: rgba(0, 0, 0, .3); }

	.bulk-actions .btn span, .message-toolbar .btn span { display: none; }
	.msg-check { padding-left: 12px; }
	.list-head, .bulkbar, .message-toolbar { padding-left: 12px; padding-right: 12px; }
	.message { padding: 14px 12px; }
	.page { padding: 16px 12px 40px; }
	.compose-label { width: 64px; }
	.field-row { flex-direction: column; gap: 0; }
	.field.port { width: 100%; }
	.table th, .table td { padding: 8px 10px; }
}
