:root {
	--bg: #f5f3ee;
	--card: #ffffff;
	--ink: #23302e;
	--muted: #6b7773;
	--line: #e3dfd6;
	--accent: #2f6f68;
	--accent-2: #e7f1ef;
	--accent-ink: #ffffff;
	--warn: #a4561c;
	--warn-bg: #fdf1e5;
	--ok: #2d7a45;
	--ok-bg: #e8f4ec;
	--err: #a33a3a;
	--err-bg: #fbeaea;
	--radius: 14px;
	--shadow: 0 1px 2px rgba(35, 48, 46, .06), 0 4px 16px rgba(35, 48, 46, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.55 "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 700; }
code { background: var(--accent-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.right { text-align: right; }
.center { text-align: center; }
.spacer { flex: 1; }
.ok-text { color: var(--ok); font-weight: 600; }

/* ---------- Kopfzeile ---------- */
.topbar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; gap: 1rem;
	padding: .55rem 1.25rem;
	background: var(--accent);
	color: var(--accent-ink);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.brand { color: #fff; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { margin-right: .2rem; }
.mainnav { display: flex; gap: .15rem; flex-wrap: wrap; margin-left: auto; }
.mainnav a {
	color: rgba(255, 255, 255, .88); padding: .4rem .75rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
}
.mainnav a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; color: #fff; }
.mainnav a.active { background: #fff; color: var(--accent); }
.navtoggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
.sm-only { display: none; }

/* ---------- Seite ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.pagehead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.pagehead h1 { margin: 0; }
.actions { display: flex; gap: .5rem; align-items: center; margin-left: auto; flex-wrap: wrap; }

.card {
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 1.2rem 1.35rem; box-shadow: var(--shadow); margin-bottom: 1.2rem;
}
.stack { display: flex; flex-direction: column; gap: .85rem; }
.stack-s { display: flex; flex-direction: column; gap: .5rem; margin-top: .8rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.grid-2.wide-left { grid-template-columns: 3fr 2fr; }
.grid-2 > .card, .grid-2 > .stack > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + section { margin-top: 1.2rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 0 0 auto; }
.row > .grow { flex: 1 1 14rem; }
.empty { text-align: center; padding: 2.2rem 1rem; }
.empty p { color: var(--muted); max-width: 36rem; margin: 0 auto 1rem; }
h2.section { margin-top: .8rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- Formulare ---------- */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; font-weight: 700; color: #4b5754; }
input, select, textarea {
	font: inherit; font-weight: 400; color: var(--ink);
	background: #fbfaf7; border: 1px solid #d9d4c8; border-radius: 10px; padding: .55rem .7rem; width: 100%;
	transition: border-color .15s, box-shadow .15s, background .6s;
}
input[type="color"] { padding: .15rem; height: 2.4rem; width: 3.2rem; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); transform: scale(1.15); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 104, .15); background: #fff; }
textarea { resize: vertical; min-height: 2.6rem; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem 1rem; margin: 0; }
legend { font-weight: 800; font-size: .9rem; padding: 0 .4rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 600; cursor: pointer; }
label.check.strong { font-weight: 800; font-size: 1rem; color: var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; }
.checks .check { font-weight: 500; color: var(--ink); }
.hint { font-size: .86rem; color: var(--muted); margin: 0; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.flash-in { background: #fff8d9 !important; }

.btn, .btn-ghost, .btn-outline, .btn-soft {
	display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
	font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.2;
	border-radius: 999px; padding: .6rem 1.15rem; cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn { background: var(--accent); color: #fff; }
.btn:hover { background: #255b55; text-decoration: none; }
.btn.btn-soft, .btn-soft { background: var(--accent-2); color: var(--accent); }
.btn.btn-soft:hover { background: #d7e9e5; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-2); text-decoration: none; }
.btn-outline { background: #fff; color: #8a2d2d; border-color: #b85a5a; }
.btn-outline:hover { background: #fbeeee; }
.btn-ghost.small, .btn.small { padding: .35rem .75rem; font-size: .85rem; }
.danger { color: var(--err); }
.btn.wide { width: 100%; }
button:disabled { opacity: .55; cursor: default; }
.spin {
	width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
	display: inline-block; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.toast {
	position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 30px); opacity: 0; z-index: 50;
	background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 12px; box-shadow: var(--shadow);
	transition: all .25s; max-width: min(90vw, 36rem); font-weight: 600;
}
.toast.err { background: var(--err); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.test-out:empty { display: none; }
.test-out { padding: .6rem .9rem; border-radius: 10px; font-size: .9rem; font-weight: 600; }
.test-out.ok { background: var(--ok-bg); color: var(--ok); }
.test-out.err { background: var(--err-bg); color: var(--err); }

/* ---------- Marken & Tags ---------- */
.badge {
	--c: var(--accent);
	display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .03em;
	padding: .12rem .5rem; border-radius: 6px; color: #fff; background: var(--c); vertical-align: .12em;
}
.tag { display: inline-block; font-size: .8rem; padding: .08rem .55rem; border-radius: 999px; background: #efece5; color: #4b5754; font-weight: 600; }
.tag-p { background: #e9eef8; color: #36507e; }
.tag-g { background: #f3eadf; color: #7c5220; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.rate { font-size: .8rem; margin-right: .3rem; font-weight: 700; }
.rate.up { color: var(--ok); }
.rate.down { color: var(--err); }

.filterbar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; align-items: center; }
.chip {
	--c: var(--accent);
	padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; font-size: .88rem;
}
.chip:hover { text-decoration: none; border-color: var(--c); }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; }
input.filter { width: 14rem; border-radius: 999px; }

/* ---------- Tabellen ---------- */
.tbl { width: 100%; border-collapse: collapse; }
table.card { padding: 0; overflow: hidden; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem .8rem; border-bottom: 1px solid #efece5; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; width: 3.5rem; }
.tbl .clip { color: var(--muted); font-size: .9rem; }
tr.inactive, .inactive { opacity: .55; }
.bereiche-tbl input { padding: .4rem .5rem; }

/* ---------- Kacheln ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.cards-wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.cards > .card { margin: 0; }
.tile { color: var(--ink); display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 22px rgba(35, 48, 46, .1); }
.tile p { margin: 0 0 .6rem; flex: 1; }
.tile-img { width: calc(100% + 2.7rem); margin: -1.2rem -1.35rem .9rem; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.tile-foot { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--muted); border-top: 1px solid #efece5; padding-top: .55rem; }
.ue-img { width: 100%; border-radius: 10px; display: block; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid #efece5; }
ul.plain li:last-child { border: 0; }
.quick li { display: flex; align-items: center; gap: .5rem; }
.quick-act { margin-left: auto; display: flex; gap: .3rem; }
.quick-act a { padding: .15rem .45rem; border-radius: 8px; }
.quick-act a:hover { background: var(--accent-2); text-decoration: none; }

/* ---------- Übersicht ---------- */
.hero { background: linear-gradient(135deg, #2f6f68, #3f8a7f); color: #fff; border-radius: 20px; padding: 1.6rem 1.6rem 1.4rem; margin-bottom: 1.2rem; box-shadow: var(--shadow); }
.hero h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.hero-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.big-action {
	display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1rem .6rem;
	background: rgba(255, 255, 255, .13); color: #fff; border-radius: 14px; font-weight: 700; text-align: center;
	transition: background .15s;
}
.big-action span { font-size: 1.7rem; }
.big-action:hover { background: rgba(255, 255, 255, .24); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
.stats a { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem; color: var(--muted); font-size: .9rem; }
.stats a:hover { text-decoration: none; border-color: var(--accent); }
.stats strong { display: block; font-size: 1.6rem; color: var(--ink); line-height: 1.1; }

/* ---------- Verlauf ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 6.8rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid #efece5; }
.tl-item:last-child { border-bottom: 0; }
.tl-date { display: flex; flex-direction: column; font-size: .9rem; }
.tl-date span { color: var(--muted); font-size: .8rem; }
.tl-head { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .3rem; }
.tl-edit { margin-left: auto; color: var(--muted); padding: 0 .4rem; border-radius: 6px; }
.tl-edit:hover { background: var(--accent-2); text-decoration: none; }
.ue-list { margin: .2rem 0 .3rem; padding-left: 1.1rem; }
.ue-list li { margin: .1rem 0; }
.tl-note { background: #faf8f3; border-left: 3px solid #d9d4c8; padding: .45rem .7rem; border-radius: 0 8px 8px 0; font-size: .92rem; margin-top: .4rem; }
.monthnav { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.monthnav strong { font-size: 1.1rem; min-width: 10rem; text-align: center; }

/* ---------- Einheit erfassen ---------- */
.ue-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 9.5rem minmax(0, 1.5fr) auto; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.ue-hint { grid-column: 1 / -1; font-size: .83rem; margin-top: -.25rem; }
.ue-hint:empty { display: none; }
.ue-hint.warn { color: var(--warn); background: var(--warn-bg); padding: .25rem .6rem; border-radius: 8px; font-weight: 600; }
.ue-hint.fresh { color: var(--ok); }
.ue-hint.neutral { color: var(--muted); }

/* ---------- Vorschläge ---------- */
.vs-card { display: flex; flex-direction: column; gap: .5rem; border-top: 4px solid var(--accent); transition: box-shadow .15s, border-color .15s; }
.vs-card.picked { border-color: #e2a23b; box-shadow: 0 0 0 2px #f1d29a, var(--shadow); }
.vs-card h3 { margin: 0; }
.vs-card p { margin: 0; }
.vs-card footer { display: flex; align-items: center; gap: .5rem; margin-top: auto; padding-top: .6rem; border-top: 1px solid #efece5; }
.vs-warum { font-style: italic; color: #4b5754; }
.vs-warn { background: var(--warn-bg); color: var(--warn); padding: .35rem .65rem; border-radius: 8px; font-weight: 700; font-size: .88rem; }
.vs-ablauf { background: #faf8f3; padding: .6rem .8rem; border-radius: 10px; font-size: .94rem; }
.vs-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; position: sticky; bottom: .8rem; margin: 0; }

/* ---------- Anmeldung ---------- */
.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login-mark { font-size: 3rem; }
.login form { text-align: left; display: flex; flex-direction: column; gap: 1rem; }

/* ---------- Handy ---------- */
@media (max-width: 860px) {
	.grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
	.hero-actions, .stats { grid-template-columns: repeat(2, 1fr); }
	.navtoggle { display: block; }
	.mainnav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--accent); flex-direction: column; padding: .5rem 1rem 1rem; }
	.nav-open .mainnav { display: flex; }
	.sm-only { display: inline; }
	.ue-row { grid-template-columns: 1fr auto; }
	.ue-row > input[name="ue_titel[]"] { grid-column: 1 / -1; }
	.tl-item { grid-template-columns: 1fr; gap: .2rem; }
	.tl-date { flex-direction: row; gap: .5rem; align-items: baseline; }
	input.filter { width: 100%; }
	.page { padding: 1rem .9rem 3rem; }
	.cards-wide { grid-template-columns: 1fr; }
	.bereiche-tbl { display: block; overflow-x: auto; }
}

@media print {
	.topbar, .form-actions, .actions, .stack > .card:last-child { display: none !important; }
	body { background: #fff; }
	.card { box-shadow: none; border: 0; }
	textarea, input, select { border: 0; background: none; resize: none; }
	.grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Textbausteine ---------- */
.bausteine { display: flex; flex-direction: column; gap: .45rem; margin-top: -.3rem; padding: .7rem .9rem; background: #faf8f3; border-radius: 12px; }
.bs-group { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.bs-kat { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); min-width: 7.5rem; }
.bs-chip {
	font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
	padding: .28rem .7rem; border-radius: 999px; border: 1px solid #d9d4c8; background: #fff; color: var(--ink);
}
.bs-chip:hover { border-color: var(--accent); }
.bs-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bs-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.bs-edit textarea { font-size: .9rem; }
@media (max-width: 860px) { .bs-kat { min-width: 100%; } }
