/*
 * ReKoSA - look of the EBA-Converter: white header with a coloured bottom edge, cards with a coloured left edge,
 * coloured buttons with a light shadow and a lift on hover, light table headers.
 * The colours are NOT written here: /tenant.css (generated per tenant) defines --brand, --brand-dark, --brand-light,
 * --accent, --on-brand and --on-accent. The values below only apply on a page that does not load /tenant.css.
 */
:root {
	--brand: #2C95A2;
	--brand-dark: #1E6B75;
	--brand-light: #E6F4F5;
	--accent: #C46A10;
	--on-brand: #FFFFFF;
	--on-accent: #FFFFFF;
	--danger: #B3261E;
	--text: #1d2a2c;
	--line: #d6e3e5;
	--line-strong: #b7cdd1;
	--bg: #f3f7f8;
	--surface: #fff;
	--surface-2: #f6fafa;
	--muted: #5b6f73;
	--ok-bg: #e6f4ea;
	--bad-bg: #fdecea;
	--warn-bg: #fff6ec;
	--ok-text: #1d6b34;
	--warn-text: #9a5300;
	color-scheme: light;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: Roboto, "Segoe UI", Arial, sans-serif;
	color: var(--text);
	background: var(--bg);
	font-size: 16px;
}

/* header: logo, name, user and navigation; stays visible while scrolling */
.top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .6rem 1rem;
	padding: .6rem 1.2rem;
	background: var(--surface);
	border-bottom: 4px solid var(--brand);
	position: sticky;
	top: 0;
	z-index: 10;
}
.top .logo { height: 44px; width: auto; max-width: 220px; }
.top .title { flex: 1 1 12rem; }
.top .title h1 { margin: 0; font-size: 1.4rem; color: var(--brand-dark); }
.top .title small { display: block; font-size: .75rem; color: var(--muted); }
.top .who { color: var(--brand-dark); font-weight: 600; }
.top nav { flex: 1 1 100%; }
.top nav ul { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.top nav form { margin: 0; display: inline; }

/* links in the header look like the small buttons of the EBA-Converter */
a.browse-btn, .top nav a {
	display: inline-block;
	padding: .45rem .9rem;
	border: 1px solid var(--brand);
	border-radius: 4px;
	color: var(--brand-dark);
	text-decoration: none;
	font-weight: 600;
	background: var(--surface);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
	transition: background .15s, box-shadow .15s, transform .15s;
}
a.browse-btn:hover, .top nav a:hover {
	background: var(--brand-light);
	box-shadow: 0 3px 8px rgba(0, 0, 0, .24);
	transform: translateY(-1px);
}

/* page content: one card with a coloured left edge */
main {
	max-width: 80rem;
	margin: 1.2rem auto;
	padding: 1rem 1.4rem 1.4rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-left: 6px solid var(--brand);
	border-radius: 6px;
}
@media (max-width: 760px) {
	main { margin: .6rem; padding: .8rem 1rem 1rem; }
}
main > h1 { margin: 0 0 .8rem; font-size: 1.4rem; color: var(--brand-dark); }
h2 { margin: 1.4rem 0 .6rem; font-size: 1.15rem; color: var(--brand-dark); }
h3 { margin: 1.1rem 0 .5rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: 1rem; color: var(--brand-dark); }
h4 { margin: .9rem 0 .3rem; font-size: .95rem; color: var(--muted); }
.doc ul, .doc ol { margin: .4rem 0 .9rem; }
.doc li { margin: .35rem 0; line-height: 1.5; }
a { color: var(--brand-dark); }
p { line-height: 1.45; }
code { background: var(--brand-light); padding: 0 .3rem; border-radius: 3px; overflow-wrap: anywhere; }
small, .hint { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); }

details > summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); }
details[open] > summary { margin-bottom: .6rem; }

/* messages */
.ok { background: var(--ok-bg); border: 1px solid #b7dfc2; padding: .6rem .9rem; border-radius: 4px; }
.err { background: var(--bad-bg); border: 1px solid #f3b8b3; color: var(--danger); padding: .6rem .9rem; border-radius: 4px; }
.err ul { margin: .3rem 0 0; }

/* buttons: every button in the colours of the tenant, a light shadow and a hover effect */
button {
	font: inherit;
	cursor: pointer;
	border: 0;
	border-radius: 4px;
	padding: .55rem 1rem;
	background: var(--brand);
	color: var(--on-brand);
	min-height: 2.5rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
	transition: background .15s, box-shadow .15s, transform .15s;
}
button:hover { background: var(--brand-dark); box-shadow: 0 3px 8px rgba(0, 0, 0, .28); transform: translateY(-1px); }
button:active { transform: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.top nav button { background: transparent; color: var(--brand-dark); border: 1px solid var(--brand); min-height: 0; padding: .45rem .9rem; }
.top nav button:hover { background: var(--brand-light); color: var(--brand-dark); }
td button { min-height: 2rem; padding: .3rem .7rem; margin: .1rem 0; }

/* forms */
form { margin: .6rem 0; }
label { display: grid; gap: .25rem; font-weight: 600; margin-bottom: .2rem; }
p > label, td > label { display: inline-grid; margin-right: 1rem; vertical-align: top; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: block; font-weight: 600; }
input, select, textarea {
	font: inherit;
	font-weight: 400;
	font-size: 16px;
	padding: .5rem .6rem;
	border: 1px solid var(--line-strong);
	border-radius: 4px;
	background: var(--surface);
	color: var(--text);
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
	width: 100%;
	max-width: 30rem;
}
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; margin: 0 .4rem 0 0; vertical-align: -.2em; }
input[type=color] { padding: 0; height: 2.4rem; width: 4rem; border-radius: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); }

/* tables */
table { width: 100%; border-collapse: collapse; margin: .6rem 0; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { background: var(--brand-light); color: var(--brand-dark); }
tbody tr:hover { background: var(--surface-2); }
@media (max-width: 760px) {
	table { display: block; overflow-x: auto; }
}

/* login page */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card {
	background: var(--surface);
	border-top: 6px solid var(--brand);
	border-radius: 6px;
	padding: 1.6rem;
	width: min(26rem, 94vw);
	display: grid;
	gap: .8rem;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
.login-card .logo { height: 48px; width: auto; max-width: 100%; justify-self: start; }
.login-card h1 { margin: 0; color: var(--brand-dark); font-size: 1.4rem; }
.login-card form { display: grid; gap: .8rem; margin: 0; }
.login-card input:not([type=checkbox]) { max-width: none; }
.login-card p { margin: 0; }

/* ---- tiles (start page) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .8rem; margin: .8rem 0; }
.tile {
	display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: .15rem;
	min-height: 7rem; padding: .9rem 1rem; text-decoration: none; color: var(--text);
	background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .15); transition: box-shadow .15s, transform .15s, background .15s;
}
.tile:hover, .tile:focus-visible { background: var(--brand-light); box-shadow: 0 4px 10px rgba(0, 0, 0, .2); transform: translateY(-2px); }
.tile .ico { font-size: 1.8rem; line-height: 1; }
.tile strong { color: var(--brand-dark); font-size: 1.05rem; }
.tile small { color: var(--muted); }
.tile-main { background: var(--brand); border-color: var(--brand-dark); color: var(--on-brand); grid-column: 1 / -1; }
.tile-main strong, .tile-main small { color: var(--on-brand); }
.tile-main:hover, .tile-main:focus-visible { background: var(--brand-dark); }

/* ---- bottom bar (phone only) ---- */
.bottombar {
	display: flex; justify-content: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
	background: var(--surface); border-top: 2px solid var(--brand); box-shadow: 0 -2px 8px rgba(0, 0, 0, .12);
	padding: 0;
}
body { padding-bottom: 3.6rem; }
.bottombar > a, .bottombar > details > summary {
	flex: 1 1 0; min-width: 0; max-width: 9rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
	min-height: 0; padding: .3rem .1rem; line-height: 1.1; font-size: .68rem; font-weight: 600; text-decoration: none; color: var(--brand-dark); cursor: pointer;
	list-style: none;
}
.bottombar > a span, .bottombar summary span { font-size: 1.15rem; line-height: 1.1; }
.bottombar > a:hover, .bottombar > a:active, .bottombar > details > summary:hover { background: var(--brand-light); }
.bottombar > details { flex: 1 1 0; max-width: 9rem; display: flex; position: relative; }
.bottombar > details > summary { width: 100%; }
.bottombar summary::-webkit-details-marker { display: none; }
.bottombar > details[open] > summary { background: var(--brand-light); }
/* the sheet "Mehr": tiles above the bar */
.more-sheet {
	position: absolute; right: 0; bottom: 100%; width: min(16rem, calc(100vw - 1rem)); max-height: 70vh; overflow-y: auto;
	display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; padding: .8rem;
	background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; box-shadow: 0 -4px 14px rgba(0, 0, 0, .2);
}
.more-sheet a, .more-sheet button {
	display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .2rem; box-sizing: border-box;
	width: 100%; min-height: 4.6rem; padding: .7rem .9rem; text-align: left; text-decoration: none; font: inherit; font-weight: 600;
	color: var(--brand-dark); background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .15); cursor: pointer;
}
.more-sheet a:hover, .more-sheet button:hover { background: var(--brand-light); }
.more-sheet a span, .more-sheet button span { font-size: 1.3rem; line-height: 1; }
.more-sheet form { margin: 0; }

/* ---- cards instead of tables (table.cards, cells carry data-label) ---- */
@media (max-width: 760px) {
	body { font-size: 16px; }
	.top { padding: .5rem .8rem; }
	.top .who { font-size: .8rem; }
	button, a.browse-btn { min-height: 3rem; }
	td button { min-height: 2.6rem; }
	input[type=checkbox], input[type=radio] { width: 1.5rem; height: 1.5rem; }
	input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea { max-width: none; min-height: 3rem; }
	p > label, td > label { display: grid; margin-right: 0; }
	.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
	table.cards, table.cards tbody { display: block; overflow: visible; }
	table.cards thead { display: none; }
	table.cards tr {
		display: block; margin: .6rem 0; padding: .4rem .8rem; background: var(--surface);
		border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: 8px;
		box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
	}
	table.cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem 0; text-align: right; }
	table.cards td::before { content: attr(data-label); font-weight: 600; color: var(--brand-dark); text-align: left; flex: 0 0 auto; }
	table.cards td:empty { display: none; }
}

/* ---- receipt capture page (/receipts/{id}/scan) ---- */
.scan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1rem; align-items: start; }
.scan-photo img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.tiles-values { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.tile-value { min-height: 4.2rem; justify-content: flex-start; }
.tile-value strong { overflow-wrap: anywhere; }
.scan-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; align-items: center; }
.scan-actions form { margin: 0; }
.amount-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.amount-list li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.amount-list label { display: inline-grid; margin: 0; }
.chip {
	display: inline-flex; flex-direction: column; min-width: 7rem; padding: .35rem .7rem; cursor: grab;
	background: var(--brand-light); border: 1px solid var(--brand); border-radius: 8px;
}
.chip.picked, label.picked input { outline: 3px solid var(--accent); }
.grip { cursor: grab; user-select: none; color: var(--brand-dark); font-size: 1.3rem; padding: 0 .3rem; }
.scan-edit label { position: relative; }
@media (max-width: 760px) {
	.scan-grid { grid-template-columns: 1fr; }
}

/* ---- live code scanner on /scan ---- */
.live-video { width: 100%; max-width: 30rem; border-radius: 8px; border: 2px solid var(--brand); background: #000; }
textarea { max-width: 30rem; }

/* ---- documentation pages (/help) ---- */
.doc h2 { margin-top: 2rem; padding-top: 1rem; border-top: 2px solid var(--brand); }
.doc h3 { scroll-margin-top: 5rem; }
.doc ul, .doc ol { line-height: 1.5; }

/* ---- notes to accounting ---- */
.note { margin: .6rem 0; padding: .6rem .9rem; border-radius: 6px; border: 1px solid var(--line); border-left: 6px solid var(--brand); background: var(--surface); }
.note-open { border-color: var(--accent); border-left-color: var(--accent); background: var(--surface)6ec; }
.note-done { opacity: .85; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0; }
.note-banner {
	display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: center;
	padding: .6rem 1rem; background: var(--accent); color: var(--on-accent); font-size: 1.05rem;
}
.note-banner a { color: var(--on-accent); font-weight: 700; }
.bottombar a.note-alert { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tile-alert { border-left-color: var(--accent); background: var(--surface)6ec; }

/* ---- progress bar of long actions (backup, restore, checks) ---- */
.progress-box { margin: 1rem 0; padding: .8rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--brand); background: var(--surface); border-radius: .4rem; }
.progress-box progress { width: 100%; height: 1.1rem; accent-color: var(--brand); }

/* ---- record tiles: every list is a grid of tiles (users, devices, receipts, trips, backups, ...) ---- */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: .9rem; margin: .8rem 0 1.2rem; }
.rec {
	display: flex; flex-direction: column; gap: .55rem; min-width: 0; padding: .9rem 1rem;
	background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .15); transition: box-shadow .15s, transform .15s;
}
.rec:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, .2); }
.rec-off { border-left-color: var(--danger); background: var(--surface)afa; }
.rec h3 { margin: 0; padding: 0; border: 0; font-size: 1.05rem; color: var(--brand-dark); overflow-wrap: anywhere; }
.rec h3 a { text-decoration: none; }
.rec .sub { margin: 0; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.rec dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem .9rem; }
.rec dt { font-weight: 600; color: var(--brand-dark); }
.rec dd { margin: 0; overflow-wrap: anywhere; }
.rec img.tenant-logo { max-height: 3rem; max-width: 100%; align-self: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { padding: .15rem .65rem; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); font-size: .82rem; font-weight: 600; }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); }
.chip-warn { background: var(--surface)3e3; color: var(--warn-text); }
.chip-bad { background: var(--bad-bg); color: var(--danger); }
.rec-actions { display: grid; gap: .6rem; margin-top: auto; }
.rec-actions form { margin: 0; display: grid; gap: .4rem; }
.rec-actions label { display: grid; gap: .25rem; font-weight: 600; color: var(--brand-dark); }
.rec-actions select, .rec-actions input { max-width: none; width: 100%; }
.rec-actions button, .rec-actions a.browse-btn { width: 100%; justify-content: center; text-align: center; box-sizing: border-box; }
.rec-more { margin-top: auto; border-top: 1px solid var(--line); padding-top: .5rem; }
.rec-more > summary {
	display: flex; align-items: center; min-height: 2.8rem; padding: 0 .4rem; list-style: none; cursor: pointer;
	border-radius: 6px; font-weight: 700; color: var(--brand-dark);
}
.rec-more > summary::-webkit-details-marker { display: none; }
.rec-more > summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; line-height: 1; }
.rec-more[open] > summary::after { content: "\2212"; }
.rec-more > summary:hover { background: var(--brand-light); }
.rec-more > .rec-actions { margin-top: .5rem; }

/* filter above a list: one tile, fields stacked on a phone */
form.filter {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .6rem .9rem; align-items: end;
	padding: .8rem 1rem; margin: .8rem 0; background: var(--brand-light); border-radius: 10px;
}
form.filter p { display: contents; }
form.filter label { display: grid; gap: .25rem; font-weight: 600; color: var(--brand-dark); }
form.filter select { width: 100%; max-width: none; }
form.filter button { width: 100%; }

@media (max-width: 760px) {
	.rec-grid { grid-template-columns: 1fr; }
	.rec-actions button, .rec-actions a.browse-btn { min-height: 3rem; }
	.rec-more > summary { min-height: 3.2rem; }
	.rec dl { grid-template-columns: 1fr; gap: 0; }
	.rec dd { margin-bottom: .35rem; }
}

/* more tiles: compact ones for long lists, big numbers, totals, long text in a tile */
.rec-compact { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
@media (min-width: 761px) { .rec-compact dl { grid-template-columns: 5.5rem minmax(0, 1fr); } }
.rec .big { font-size: 2rem; line-height: 1; color: var(--brand-dark); }
.rec dt.total, .rec dd.total { font-weight: 700; font-size: 1.1rem; color: var(--brand-dark); border-top: 1px solid var(--line); padding-top: .4rem; }
.rec pre { margin: .3rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; background: var(--brand-light); padding: .5rem; border-radius: 6px; }
@media (max-width: 760px) {
	.rec-compact { grid-template-columns: 1fr; }
}

/* ---- sections of a page as panels; forms inside a panel are entry boxes, so lists, entry and actions are clearly apart ---- */
section.panel {
	margin: 1.6rem 0; padding: 1rem 1.1rem 1.2rem; background: var(--surface-2); border: 1px solid var(--line);
	border-top: 4px solid var(--brand); border-radius: 12px;
}
section.panel > h2 { margin: 0 0 .8rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
section.panel h3 { margin: 1.2rem 0 .5rem; padding-top: 0; border-top: 0; }
section.panel > form, section.panel > .entry-box {
	margin: .6rem 0 1rem; padding: .9rem 1rem; background: var(--surface); border: 2px dashed var(--line-strong); border-radius: 10px;
}
section.panel > form.filter { border: 0; background: var(--brand-light); }
section.panel > form p:last-child { margin-bottom: 0; }
.rec-wide { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
@media (max-width: 760px) {
	section.panel { padding: .8rem .8rem 1rem; margin: 1.2rem 0; }
	.rec-wide { grid-template-columns: 1fr; }
}

/* way back, at the top and at the bottom of a page */
p.back { margin: 0 0 1rem; }
main > p.back:last-child { margin: 1.6rem 0 0; }
p.back a {
	display: inline-flex; align-items: center; gap: .4rem; min-height: 2.7rem; padding: 0 1.1rem; box-sizing: border-box;
	border: 1px solid var(--brand); border-radius: 6px; background: var(--surface); color: var(--brand-dark); font-weight: 600; text-decoration: none;
}
p.back a:hover { background: var(--brand-light); }
@media (max-width: 760px) {
	p.back a { display: flex; justify-content: center; min-height: 3rem; }
}

/* tiles: equal size, never wider than their column (long words break), also on a phone */
.tile { min-width: 0; box-sizing: border-box; }
.tile strong, .tile small { overflow-wrap: anywhere; hyphens: auto; }
.tiles { grid-auto-rows: 1fr; }
.rec-grid > .rec, .tiles > .tile { min-width: 0; }
@media (max-width: 760px) {
	.rec-grid, .rec-compact, .rec-wide { grid-template-columns: minmax(0, 1fr); }
	.tile { min-height: 6.5rem; padding: .8rem .8rem; }
	.tile strong { font-size: 1rem; }
}


/* the test tenant is marked on every page */
.test-banner {
	margin: 0; padding: .35rem .8rem; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .85rem; text-align: center;
	letter-spacing: .03em;
}
.login-card .test-banner { border-radius: 6px; }

/* the bar looks the same on every page: the scroll bar always takes its place (a page without one would be wider), and the entries have one
   fixed height and never wrap */
html { overflow-y: scroll; }
.bottombar { height: calc(2.9rem + 2px); box-sizing: border-box; }
.bottombar > a, .bottombar > details > summary { height: 100%; box-sizing: border-box; }
.bottombar > a, .bottombar > details > summary > span, .bottombar > a > span { max-width: 100%; }

/* equal columns, the same on every page; on a wide screen the entries stay together in the middle */
.bottombar {
	display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: stretch;
	padding: 0 calc((100% - min(100%, 40rem)) / 2);
}
.bottombar > a, .bottombar > details { max-width: none; min-width: 0; }

/* ---- the ReKoSA logo (badge and lettering in colour), top right, with the version below ---- */
.brand { display: grid; justify-items: end; gap: .1rem; margin-left: auto; flex: 0 0 auto; }
.brand-logo { height: 2.6rem; width: auto; display: block; }
.brand-version { color: var(--muted); font-size: .7rem; line-height: 1; }
.top .brand { order: 99; }
.login-card { position: relative; }
.login-card > .brand { position: absolute; top: .9rem; right: 1rem; margin: 0; }
main > .brand { float: right; margin: 0 0 .5rem .6rem; }
@media (max-width: 520px) {
	.brand-logo { height: 2.1rem; }
}

/* users grouped by tenant (platform address): every tenant can be folded away */
details.tenant-group { margin: 1rem 0; border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 12px; background: var(--surface-2); }
details.tenant-group > summary {
	display: flex; align-items: center; gap: .6rem; min-height: 3rem; padding: 0 1rem; list-style: none; cursor: pointer;
	font-size: 1.05rem; font-weight: 700; color: var(--brand-dark);
}
details.tenant-group > summary::-webkit-details-marker { display: none; }
details.tenant-group > summary::before { content: "\25B8"; transition: transform .15s; }
details.tenant-group[open] > summary::before { transform: rotate(90deg); }
details.tenant-group > .rec-grid { padding: 0 1rem 1rem; margin: 0; }

/* the sheet "Mehr": heading above the tenants to change to; the tenants of a user as check boxes */
.more-title { margin: .2rem 0 0; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
fieldset.tenant-choice { display: grid; gap: .4rem; margin: 0; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; }
fieldset.tenant-choice legend { font-weight: 700; color: var(--brand-dark); padding: 0 .3rem; }
fieldset.tenant-choice label { display: flex; align-items: center; gap: .5rem; margin: 0; }

/* ---- dark mode: the values replace the light ones; chosen with the button at the bottom right (data-theme on <html>), without a choice the setting of the device applies ---- */
html[data-theme="dark"] {
	--brand-dark: #3aa9b6;
	--brand-light: #1f3a3e;
	--danger: #ff8a80;
	--text: #e3eeef;
	--line: #2f4246;
	--line-strong: #40595e;
	--bg: #11191b;
	--surface: #192326;
	--surface-2: #1e2b2e;
	--muted: #a3b6b9;
	--ok-bg: #16301f;
	--bad-bg: #3a1a18;
	--warn-bg: #3a2a14;
	--ok-text: #7fd99a;
	--warn-text: #f0b266;
	color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) {
		--brand-dark: #3aa9b6;
		--brand-light: #1f3a3e;
		--danger: #ff8a80;
		--text: #e3eeef;
		--line: #2f4246;
		--line-strong: #40595e;
		--bg: #11191b;
		--surface: #192326;
		--surface-2: #1e2b2e;
		--muted: #a3b6b9;
		--ok-bg: #16301f;
		--bad-bg: #3a1a18;
		--warn-bg: #3a2a14;
		--ok-text: #7fd99a;
		--warn-text: #f0b266;
		color-scheme: dark;
	}
}

/* ---- the button for light and dark mode: bottom right, above the bar of the phone ---- */
.theme-toggle {
	position: fixed; right: .7rem; bottom: .7rem; z-index: 30; width: 2.8rem; height: 2.8rem; min-height: 0; padding: 0;
	display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.35rem; line-height: 1;
	background: var(--surface); color: var(--brand-dark); border: 2px solid var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.theme-toggle:hover { background: var(--brand-light); color: var(--brand-dark); }
.bottombar ~ .theme-toggle { bottom: 4.4rem; transition: bottom .22s ease; }

/* a section whose heading is the summary of a details element: heading next to the marker, whole line clickable */
details > summary > h2 { display: inline; }
details > summary:has(> h2) { cursor: pointer; }

/* a statement that the user took back (or accounting returned): greyed out in the lists of accounting until it is released again */
.rec-withdrawn { opacity: .55; filter: grayscale(1); }
.rec-withdrawn:hover, .rec-withdrawn:focus-within { opacity: .9; }

/* no zoom on a phone, except the receipts: the page cannot be pinched or double-tapped (iOS ignores the viewport rule), fields have 16 px so the browser does not zoom into them, and a receipt opens as the plain file where the browser zooms freely */
html, body, body * { touch-action: pan-x pan-y; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 760px) { input, select, textarea { font-size: 16px; } }

/* the button for light and dark: on a phone it is an entry of the sheet "Mehr" (not floating, so nothing is cut off at the edge) */
.theme-in-sheet { display: none; }
.more-sheet .theme-toggle {
	position: static; width: 100%; height: auto; min-height: 4.6rem; border-radius: 8px; justify-content: center; align-items: flex-start;
	flex-direction: column; font-size: inherit; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); border: 1px solid var(--line); border-left: 5px solid var(--brand);
	padding: .7rem .9rem; text-align: left;
}
.more-sheet .theme-toggle .theme-icon { font-size: 1.3rem; line-height: 1; }
@media (max-width: 760px) {
	.theme-in-sheet { display: flex; }
	.bottombar ~ .theme-float { display: none; }
}

/* header: the name (or the tenant) at the top left with the logged-in user below, only the logo at the top right */
.top .title .who { display: block; font-size: .8rem; overflow-wrap: anywhere; }
.top .wordmark { height: 1.9rem; width: auto; display: block; }
.top .title .tenant-name { font-weight: 700; color: var(--brand-dark); font-size: .85rem; }

/* the sheet "Mehr" closes when anything beside it is tapped, without a script: while it is open, the entry "Mehr" carries a transparent layer over the whole screen
   (a tap on it is a tap on the entry, which closes the sheet). Layer < sheet < the links of the bar, so the sheet and the other entries stay usable (the summary has no z-index of its own, or the layer would sit above the sheet). */
.bottombar > details[open] > summary::after { content: ""; position: fixed; inset: 0; z-index: 1; background: transparent; cursor: default; }
.bottombar > details[open] > .more-sheet { z-index: 2; }
.bottombar > a { position: relative; z-index: 3; }

/* nothing may be wider than the screen (no sideways scrolling on a phone, ever): file fields and all other fields stay inside their box, long unbroken text wraps */
input, select, textarea { min-width: 0; }
input[type=file] { max-width: 100%; width: 100%; box-sizing: border-box; }
main, section.panel, details, form, .rec, .note { min-width: 0; }
main { overflow-wrap: anywhere; }
body { overflow-x: clip; }

/* the bar has one fixed row: opening "Mehr" must not make the entries taller (they were pushed 6 px out of the bar) */
.bottombar { grid-template-rows: minmax(0, 1fr); }
.bottombar > a, .bottombar > details { min-height: 0; overflow: visible; }

/* help: a way back to the table of contents between the topics (not in print and not in the PDF) */
.toc-back { margin: 1.4rem 0 0; font-size: .85rem; text-align: right; }
@media print { .toc-back { display: none; } }

/* help: all contents (the lists of the editions) stand at the top, the chapters below are closed and open one at a time (a click on a content entry opens exactly that chapter) */
main.doc { display: flex; flex-direction: column; }
main.doc > [data-part] { display: contents; }
main.doc .help-toc { order: 1; }
main.doc .help-chapters { order: 2; }
main.doc > .back:last-child { order: 3; }
.help-chapter { margin: .6rem 0; padding: .1rem .9rem; border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 6px; background: var(--surface); }
.help-chapter > summary { cursor: pointer; padding: .55rem 0; scroll-margin-top: 5rem; }
.help-chapter > summary > h3 { display: inline; margin: 0; font-size: 1.1rem; color: var(--brand-dark); }
.help-chapter[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: .6rem; }

/* phone: the header keeps everything (lettering and description at the left, badge and version at the right); long texts wrap instead of disappearing */
.top { flex-wrap: nowrap; align-items: flex-start; }
.top .title { flex: 1 1 auto; min-width: 0; }
.top .title small { overflow-wrap: anywhere; }
.top .brand { flex: 0 0 auto; }

/* login pages: the lettering at the left, only the badge with the version at the right (like the header) */
.login-card .login-title { margin: 0; line-height: 1; }
.login-card .wordmark { height: 1.9rem; width: auto; display: block; }
.login-card .tenant-name { font-weight: 700; color: var(--brand-dark); font-size: .85rem; }

/* the version with its date stands at the bottom right of every page (above the bar on a phone, beside the floating button elsewhere) */
body { position: relative; min-height: 100vh; }
.version-foot { position: absolute; right: 4.2rem; bottom: 3.9rem; font-size: .7rem; line-height: 1; color: var(--muted); }
body.login .version-foot { bottom: .9rem; }
@media (max-width: 760px) { body:not(.login) .version-foot { right: .8rem; } }
