/* linda: design draft 1b (Obsidian: linda – Wireframes Web). Light and dark via prefers-color-scheme. */

:root {
	--bg: #f6f7f9;
	--panel: #ffffff;
	--text: #111827;
	--muted: #6b7280;
	--border: #e5e7eb;
	--line: #f1f2f4;
	--accent: #4f46e5;
	--accent-soft: #eef2ff;
	--accent-line: #c7d2fe;
	--accent-text: #ffffff;
	--shadow: 0 1px 2px rgb(17 24 39 / 0.05), 0 2px 6px rgb(17 24 39 / 0.04);
	--mark: #fef3c7;
	--error-bg: #fef2f2;
	--error: #b91c1c;

	--draft-bg: #f3e8ff;
	--draft: #7e22ce;
	--open-bg: #fef3c7;
	--open: #b45309;
	--progress-bg: #dbeafe;
	--progress: #1d4ed8;
	--done-bg: #dcfce7;
	--done: #15803d;
	--discarded-bg: #f3f4f6;
	--discarded: #6b7280;
	--bug-bg: #fee2e2;
	--bug: #b91c1c;
	--task-bg: #f3f4f6;
	--task: #374151;

	--tone-accent: #4f46e5;
	--tone-draft: #9333ea;
	--tone-decision: #0d9488;
	--tone-mention: #db2777;

	font-family:
		ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	line-height: 1.5;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1115;
		--panel: #171a21;
		--text: #e5e7eb;
		--muted: #9ca3af;
		--border: #262b36;
		--line: #1f2430;
		--accent: #818cf8;
		--accent-soft: #1e1b4b;
		--accent-line: #3730a3;
		--accent-text: #0b0d12;
		--shadow: none;
		--mark: #422006;
		--error-bg: #3b0d0d;
		--error: #fecaca;

		--draft-bg: #3b0764;
		--draft: #e9d5ff;
		--open-bg: #422006;
		--open: #fcd34d;
		--progress-bg: #1e3a8a;
		--progress: #bfdbfe;
		--done-bg: #14532d;
		--done: #bbf7d0;
		--discarded-bg: #1f2937;
		--discarded: #9ca3af;
		--bug-bg: #450a0a;
		--bug: #fecaca;
		--task-bg: #1f2937;
		--task: #d1d5db;

		--tone-accent: #818cf8;
		--tone-draft: #c084fc;
		--tone-decision: #2dd4bf;
		--tone-mention: #f472b6;
	}
}

* {
	box-sizing: border-box;
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
}
main {
	max-width: 80rem;
	margin: 0 auto;
	padding: 1.5rem 1rem 3rem;
}
a {
	color: var(--accent);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
h1 {
	font-size: 1.6rem;
	font-weight: 600;
	margin: 0.25rem 0 1rem;
	letter-spacing: -0.01em;
}
h2 {
	font-size: 1.05rem;
	font-weight: 600;
	margin: 1.25rem 0 0.5rem;
}
h3 {
	font-size: 1rem;
	margin: 0 0 0.25rem;
}

/* --- Top bar --- */

.top {
	display: flex;
	gap: 1.5rem;
	align-items: center;
	padding: 0.6rem 1.5rem;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
	flex-wrap: wrap;
}
.brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 600;
	font-size: 1.2rem;
	color: var(--text);
}
.brand:hover {
	text-decoration: none;
}
.logo {
	display: inline-grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	border-radius: 8px;
	background: var(--accent);
	color: var(--accent-text);
	font-size: 1.05rem;
}
.top nav {
	display: flex;
	gap: 0.25rem;
	flex: 1;
	flex-wrap: wrap;
}
.top nav a {
	color: var(--muted);
	padding: 0.4rem 0.85rem;
	border-radius: 8px;
	font-size: 0.95rem;
}
.top nav a:hover {
	color: var(--text);
	text-decoration: none;
}
.top nav a[aria-current="page"] {
	color: var(--accent);
	background: var(--accent-soft);
	font-weight: 500;
}
.who {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	color: var(--text);
	font-size: 0.9rem;
}

/* --- Avatars, pills, counts --- */

.avatar {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	color: #fff;
	font-size: 0.65rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	vertical-align: middle;
}
.avatar.large {
	width: 2.1rem;
	height: 2.1rem;
	font-size: 0.8rem;
}
.av-0 {
	background: #4f46e5;
}
.av-1 {
	background: #0d9488;
}
.av-2 {
	background: #d97706;
}
.av-3 {
	background: #db2777;
}
.av-4 {
	background: #2563eb;
}
.av-5 {
	background: #7c3aed;
}
.av-6 {
	background: #059669;
}
.av-7 {
	background: #6b7280;
}

.pill {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.4;
	padding: 0.1rem 0.55rem;
	border-radius: 6px;
	white-space: nowrap;
	vertical-align: middle;
}
.status-draft {
	background: var(--draft-bg);
	color: var(--draft);
}
.status-open {
	background: var(--open-bg);
	color: var(--open);
}
.status-in_progress {
	background: var(--progress-bg);
	color: var(--progress);
}
.status-done {
	background: var(--done-bg);
	color: var(--done);
}
.status-discarded {
	background: var(--discarded-bg);
	color: var(--discarded);
}
.type-bug {
	background: var(--bug-bg);
	color: var(--bug);
}
.type-task {
	background: var(--task-bg);
	color: var(--task);
}
.count {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 500;
	color: var(--muted);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0 0.4rem;
	margin-left: 0.35rem;
	vertical-align: middle;
}

/* --- Generic panels and text --- */

.panel,
.card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow);
}
.panel {
	padding: 1rem 1.25rem;
	margin: 1rem 0;
}
.heading {
	display: flex;
	justify-content: space-between;
	align-items: end;
	gap: 1rem;
	flex-wrap: wrap;
}
.muted {
	color: var(--muted);
}
.small {
	font-size: 0.85rem;
}
/* Long texts, rendered from Markdown (#D4, src/web/markdown.tsx). */
.body {
	overflow-wrap: anywhere;
}
.body > :first-child {
	margin-top: 0;
}
.body > :last-child {
	margin-bottom: 0;
}
.body p,
.body ul,
.body ol,
.body pre,
.body blockquote,
.body table {
	margin: 0 0 0.6rem;
}
.body ul,
.body ol {
	padding-left: 1.4rem;
}
.body li > ul,
.body li > ol {
	margin: 0.15rem 0;
}
.body h3,
.body h4,
.body h5,
.body h6 {
	margin: 0.9rem 0 0.35rem;
	font-size: 1rem;
	line-height: 1.3;
}
.body h3 {
	font-size: 1.1rem;
}
.body code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.88em;
	background: var(--line);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 0.05rem 0.3rem;
	overflow-wrap: break-word;
}
.body pre {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.6rem 0.8rem;
	overflow-x: auto;
	line-height: 1.45;
}
.body pre code {
	background: none;
	border: 0;
	padding: 0;
	font-size: 0.85rem;
	overflow-wrap: normal;
	white-space: pre;
}
.body blockquote {
	border-left: 3px solid var(--border);
	padding-left: 0.75rem;
	color: var(--muted);
}
.body table {
	border-collapse: collapse;
	display: block;
	max-width: 100%;
	overflow-x: auto;
}
.body th,
.body td {
	border: 1px solid var(--border);
	padding: 0.25rem 0.5rem;
	text-align: left;
}
.body th {
	background: var(--bg);
}
.body hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 0.9rem 0;
}
.reason-label {
	margin-bottom: 0.2rem;
}
.hint {
	background: var(--draft-bg);
	color: var(--draft);
	border-radius: 8px;
	padding: 0.5rem 0.8rem;
	font-size: 0.9rem;
}
.error {
	background: var(--error-bg);
	color: var(--error);
	padding: 0.6rem 0.8rem;
	border-radius: 8px;
}
#flash:not(:empty) {
	max-width: 80rem;
	margin: 1rem auto 0;
	padding: 0 1rem;
}

/* --- Forms and buttons --- */

form {
	margin: 0;
}
.stack {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}
.row {
	display: flex;
	gap: 0.6rem;
	align-items: end;
	flex-wrap: wrap;
}
.grow {
	flex: 1;
	min-width: 12rem;
}
label {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.85rem;
	color: var(--muted);
}
input,
select,
textarea,
button,
.button {
	font: inherit;
	font-size: 0.92rem;
	color: var(--text);
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.45rem 0.7rem;
}
input:focus,
select:focus,
textarea:focus {
	outline: 2px solid var(--accent-line);
	outline-offset: 0;
	border-color: var(--accent);
}
textarea {
	width: 100%;
	resize: vertical;
}
button,
.button {
	display: inline-block;
	background: var(--accent);
	color: var(--accent-text);
	border-color: var(--accent);
	cursor: pointer;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}
.button:hover {
	text-decoration: none;
}
button.secondary {
	background: var(--panel);
	color: var(--text);
	border-color: var(--border);
}
button.link {
	background: none;
	border: none;
	color: var(--accent);
	padding: 0;
	font-weight: normal;
}
.small-button {
	font-size: 0.8rem;
	padding: 0.2rem 0.65rem;
	background: var(--panel);
	color: var(--accent);
	border-color: var(--accent-line);
}
.small-button.release {
	color: var(--draft);
	border-color: var(--draft-bg);
}
summary {
	cursor: pointer;
	font-weight: 600;
}
details[open] > summary {
	margin-bottom: 0.75rem;
}

/* --- Dashboard --- */

.hello {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}
.hello h1 {
	margin: 0;
}
.hello p {
	margin: 0.2rem 0 0;
}
.hello-actions {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
}
.kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
	margin-bottom: 1.25rem;
}
.kpi {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow);
	padding: 0.9rem 1rem 0.9rem 1.4rem;
	position: relative;
	display: flex;
	flex-direction: column;
}
.kpi::before {
	content: "";
	position: absolute;
	left: 0.8rem;
	top: 1rem;
	bottom: 1rem;
	width: 4px;
	border-radius: 4px;
	background: var(--tone, var(--accent));
}
.kpi > * {
	padding-left: 0.5rem;
}
.tone-accent {
	--tone: var(--tone-accent);
}
.tone-draft {
	--tone: var(--tone-draft);
}
.tone-decision {
	--tone: var(--tone-decision);
}
.tone-mention {
	--tone: var(--tone-mention);
}
.kpi-label {
	color: var(--muted);
	font-size: 0.85rem;
}
.kpi-value {
	font-size: 1.9rem;
	font-weight: 500;
	line-height: 1.2;
}
.kpi-sub {
	font-size: 0.8rem;
	color: var(--muted);
	font-weight: 400;
	margin-left: 0.3rem;
}
.dash-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.25rem;
	align-items: start;
}
.dash-col {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}
.card {
	padding: 0 0 0.6rem;
	overflow: hidden;
}
.card-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.9rem 1.25rem;
	border-bottom: 1px solid var(--border);
	margin-bottom: 0.4rem;
}
.card-head h2 {
	margin: 0;
	font-size: 1.05rem;
}
.card .card-head a {
	font-size: 0.88rem;
}
.empty {
	padding: 0 1.25rem;
	margin: 0.4rem 0;
}
.task-section {
	padding: 0.4rem 0 0.3rem;
}
.section-label {
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	padding: 0 1.25rem;
	margin: 0.3rem 0 0.2rem;
}
.more {
	display: block;
	padding: 0.2rem 1.25rem 0;
}
.task-rows,
.rows {
	list-style: none;
	margin: 0;
	padding: 0 0.6rem;
}
.task-rows li,
.rows li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.45rem 0.65rem;
	border-bottom: 1px solid var(--line);
	border-radius: 8px;
	min-height: 2.6rem;
}
.task-rows li:last-child,
.rows li:last-child {
	border-bottom: none;
}
.task-rows .num,
.rows .num {
	color: var(--muted);
	font-size: 0.85rem;
	min-width: 2.6rem;
}
.task-rows .title,
.rows .title {
	flex: 1;
	min-width: 0;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.row-end {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex: none;
}
.rows li.is-new .num::before {
	content: "";
	display: inline-block;
	width: 0.45rem;
	height: 0.45rem;
	margin: 0 0.35rem 0.1rem -0.8rem;
	border-radius: 50%;
	background: var(--accent);
}
.rows li.for-me {
	background: var(--accent-soft);
}
.for-me-pill {
	background: var(--panel);
	color: var(--accent);
	border: 1px solid var(--accent-line);
}

@media (max-width: 60rem) {
	.kpis {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.dash-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}
@media (max-width: 40rem) {
	.top {
		gap: 0.4rem 1rem;
		padding: 0.6rem 1rem;
	}
	/* The menu gets its own line below logo and user. */
	.top nav {
		order: 3;
		flex-basis: 100%;
	}
	.who {
		margin-left: auto;
	}
}
@media (max-width: 30rem) {
	.kpis {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --- Task list and detail --- */

table.tasks {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow);
	overflow: hidden;
}
table.tasks th,
table.tasks td {
	text-align: left;
	padding: 0.6rem 0.8rem;
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
}
table.tasks tr:last-child td {
	border-bottom: none;
}
table.tasks th {
	font-size: 0.75rem;
	color: var(--muted);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: var(--bg);
	border-bottom: 1px solid var(--border);
}
td.num {
	color: var(--muted);
	white-space: nowrap;
}
.who-cell {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}
.meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.2rem 1rem;
	margin: 0 0 1rem;
}
.meta dt {
	color: var(--muted);
}
.meta dd {
	margin: 0;
}
.result {
	overflow-wrap: anywhere;
}
.actions {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin: 1rem 0;
}
.timeline {
	list-style: none;
	padding: 0;
	margin: 1rem 0 0;
}
.timeline li {
	padding: 0.5rem 0;
	border-top: 1px solid var(--line);
}
.timeline li.change {
	color: var(--muted);
	font-size: 0.9rem;
}
.timeline li.comment .body {
	margin-top: 0.25rem;
}

/* --- Decisions and notes --- */

.decision,
.note {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow);
	padding: 0.9rem 1.15rem;
	margin: 0.75rem 0;
}
.decision p,
.note p {
	margin: 0.3rem 0;
}
.superseded {
	background: var(--bg);
	border-style: dashed;
}
.superseded h3 {
	text-decoration: line-through;
	color: var(--muted);
}
.note.for-me {
	background: var(--accent-soft);
	border-color: var(--accent-line);
}
.note-head {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}
.note-head .ref {
	color: var(--muted);
	margin-right: 0.2rem;
}
mark {
	background: var(--mark);
	color: inherit;
}
.mention {
	color: var(--accent);
	font-weight: 600;
}
.mention.me {
	background: var(--mark);
	border-radius: 3px;
	padding: 0 0.15rem;
}
.mentions {
	list-style: none;
	padding: 0;
}
.mentions li {
	padding: 0.4rem 0;
	border-top: 1px solid var(--line);
}
input[type="search"] {
	min-width: 18rem;
}
.login {
	max-width: 28rem;
	margin: 3rem auto;
}

/* --- Tasks: list with preview (2a) and task page (2b), decision 25 --- */

/* hidden must win over .row { display: flex } and .panel. */
.bug-fields[hidden],
.new-task-panel[hidden] {
	display: none;
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
kbd {
	display: inline-block;
	font: inherit;
	font-size: 0.75rem;
	line-height: 1.3;
	padding: 0.05rem 0.4rem;
	border: 1px solid var(--border);
	border-bottom-width: 2px;
	border-radius: 5px;
	background: var(--panel);
	color: var(--text);
}
.tasks-heading {
	align-items: center;
	margin-bottom: 0.5rem;
}
.tasks-heading h1 {
	margin: 0;
}
.tasks-heading .filters {
	flex: 1;
	align-items: center;
}
label.inline {
	flex-direction: row;
}
/* "Status: [aktiv ▾]": the label stands in front of the dropdown. */
.filter-field {
	align-items: center;
	gap: 0.4rem;
	color: var(--muted);
	font-size: 0.9rem;
}
.new-task-panel .panel-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.new-task-panel h2 {
	margin: 0;
	font-size: 1.05rem;
}
.filters input[type="search"] {
	min-width: 12rem;
	flex: 1;
	max-width: 18rem;
}
.segmented {
	display: inline-flex;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 2px;
	margin: 0;
	background: var(--panel);
}
.segmented label {
	cursor: pointer;
}
.segmented input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.segmented span {
	display: block;
	padding: 0.25rem 0.75rem;
	border-radius: 6px;
	color: var(--muted);
	font-size: 0.88rem;
}
.segmented input:checked + span {
	background: var(--accent-soft);
	color: var(--accent);
}
.segmented input:focus-visible + span {
	outline: 2px solid var(--accent-line);
}

.tasks-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
	gap: 1.25rem;
	align-items: start;
	margin-top: 1rem;
}
#task-list tbody tr {
	cursor: pointer;
}
#task-list tbody tr:hover {
	background: var(--bg);
}
#task-list tbody tr.selected {
	background: var(--accent-soft);
	box-shadow: inset 4px 0 0 var(--accent);
}
.row-link {
	color: var(--text);
}
td.num .row-link {
	color: var(--muted);
}
.title-cell {
	overflow-wrap: anywhere;
}
.empty-list {
	padding: 1rem;
}
.keys-hint {
	margin-top: 0.75rem;
}

.preview {
	position: sticky;
	top: 1rem;
	padding: 1rem 1.25rem 1.25rem;
	max-height: calc(100vh - 2rem);
	overflow: auto;
}
.empty-preview {
	padding: 2rem 1.25rem;
	text-align: center;
}
.preview-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.head-buttons {
	display: flex;
	gap: 0.4rem;
}
.preview-title {
	font-size: 1.3rem;
	margin: 0.3rem 0 0.5rem;
}
.preview .preview-title a {
	color: var(--accent);
}
.pills {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	flex-wrap: wrap;
	margin: 0 0 0.75rem;
}
.preview-section {
	border-top: 1px solid var(--line);
	padding-top: 0.6rem;
	margin-top: 0.6rem;
}
.preview .section-label,
.task-side .section-label {
	padding: 0;
	margin: 0 0 0.3rem;
}
.preview .task-rows {
	padding: 0;
}
.preview .actions {
	margin: 0.75rem 0;
}

.icon-expand,
.icon-copy {
	display: inline-block;
	position: relative;
	width: 0.8rem;
	height: 0.8rem;
	vertical-align: -0.05rem;
}
.icon-expand {
	border: 1.5px solid currentColor;
	border-radius: 2px;
}
.icon-expand::after {
	content: "";
	position: absolute;
	right: -3px;
	top: -3px;
	width: 6px;
	height: 6px;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	background: var(--panel);
}
.icon-copy {
	border: 1.5px solid currentColor;
	border-radius: 2px;
	transform: translate(2px, 2px);
}
.icon-copy::before {
	content: "";
	position: absolute;
	left: -4px;
	top: -4px;
	width: 100%;
	height: 100%;
	border: 1.5px solid currentColor;
	border-radius: 2px;
	border-right-color: transparent;
	border-bottom-color: transparent;
}
/* A pencil: slanted bar with a pointed tip. */
.icon-edit {
	display: inline-block;
	width: 0.3rem;
	height: 0.8rem;
	border: 1.5px solid currentColor;
	border-bottom-width: 3px;
	border-radius: 1px 1px 0 0;
	transform: rotate(40deg);
	vertical-align: -0.05rem;
}
a.small-button,
button.copy,
button[data-edit] {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	text-decoration: none;
}
button.small-button.secondary,
a.small-button.secondary {
	color: var(--muted);
	border-color: var(--border);
}

.task-page .crumbs-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-bottom: 0.5rem;
}
.pager {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.pager-button {
	display: inline-grid;
	place-items: center;
	width: 1.9rem;
	height: 1.8rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--panel);
	color: var(--text);
	font-size: 1.1rem;
	line-height: 1;
}
.pager-button:hover {
	text-decoration: none;
	border-color: var(--accent-line);
}
.pager-button.disabled {
	color: var(--border);
}
.task-head {
	margin-bottom: 1rem;
}
.task-title {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	flex-wrap: wrap;
}
.task-title h1 {
	margin: 0;
}
.task-head .actions {
	margin: 0.5rem 0 0;
}
.done-form {
	display: flex;
	gap: 0.4rem;
}
.done-form input {
	min-width: 16rem;
}
.task-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
	gap: 1.25rem;
	align-items: start;
}
.task-main,
.task-side {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}
.card-body {
	padding: 0.6rem 1.25rem 0.75rem;
}
.card .task-rows {
	padding: 0 0.6rem;
}
details.edit,
details.add-subtask {
	margin-top: 0.75rem;
}
/* The editor opens from the "Bearbeiten" button in the card head. */
details.edit > summary {
	display: none;
}
#description:has(details.edit[open]) .read-only,
#description:has(details.edit[open]) [data-edit] {
	display: none;
}
details.edit[open] {
	margin-top: 0;
}
details.add-subtask > summary {
	color: var(--accent);
	font-weight: 500;
	font-size: 0.9rem;
}
.details {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.55rem 1rem;
	margin: 0;
	padding: 0.6rem 1.25rem 0.75rem;
	align-items: center;
}
.details dt {
	color: var(--muted);
	font-size: 0.85rem;
}
.details dd {
	margin: 0;
}
.task-side .section-label {
	padding: 0.4rem 1.25rem 0;
}
.refs {
	list-style: none;
	margin: 0;
	padding: 0.2rem 1.25rem 0.4rem;
}
.refs li {
	padding: 0.35rem 0;
}
.refs .ref {
	font-weight: 500;
}
.refs .where {
	display: block;
	margin-top: 0.05rem;
}
.footnote {
	padding: 0.3rem 1.25rem 0;
	margin: 0;
}

.tabs {
	display: flex;
	gap: 0.2rem;
	border: 0;
	margin: 0;
	padding: 0;
}
.tab {
	background: none;
	border: none;
	color: var(--muted);
	font-size: 0.85rem;
	padding: 0.25rem 0.6rem;
	border-radius: 6px;
	font-weight: 400;
}
.tab.active {
	background: var(--accent-soft);
	color: var(--accent);
}
.timeline li {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	border-top: none;
	padding: 0.35rem 0;
}
.timeline li.change {
	align-items: center;
	font-size: 0.85rem;
}
.timeline li.change .when {
	margin-left: auto;
}
.timeline li.comment {
	padding: 0.6rem 0;
}
.comment-main {
	flex: 1;
	min-width: 0;
}
.comment-head {
	margin: 0 0 0.25rem;
	font-size: 0.9rem;
}
.bubble {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 0.55rem 0.8rem;
}
.comment-form {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	border-top: 1px solid var(--line);
	padding-top: 0.75rem;
	margin-top: 0.5rem;
}
.form-end {
	display: flex;
	justify-content: flex-end;
}
:target {
	scroll-margin-top: 1rem;
}
.timeline li:target .bubble,
#description:target {
	animation: highlight 2.5s ease-out;
}
@keyframes highlight {
	from {
		box-shadow: 0 0 0 3px var(--accent-line);
		background: var(--accent-soft);
	}
}

.key-help {
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--panel);
	color: var(--text);
	padding: 1.25rem 1.5rem;
	max-width: 26rem;
}
.key-help::backdrop {
	background: rgb(0 0 0 / 0.3);
}
.key-help h2 {
	margin-top: 0;
}
.key-help dl {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.4rem 1rem;
}
.key-help dt {
	display: flex;
	gap: 0.25rem;
}
.key-help dd {
	margin: 0;
}

@media (max-width: 60rem) {
	.tasks-layout,
	.task-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	#preview,
	.keys-hint {
		display: none;
	}
	.done-form input {
		min-width: 0;
	}
}

/* Activity filter; after the timeline rules so it wins. */
#activity[data-filter="comments"] .timeline li.change,
#activity[data-filter="history"] .timeline li.comment {
	display: none;
}

/* Project name and switcher next to the brand (decision 26). */
.top .project-name,
.top .project-switch summary {
	font-weight: 500;
	padding: 0.3rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	font-size: 0.9rem;
	color: var(--text);
}
.top .project-switch {
	position: relative;
}
.top .project-switch summary {
	margin-bottom: 0;
	cursor: pointer;
	list-style: none;
}
.top .project-switch summary::-webkit-details-marker {
	display: none;
}
.top .project-switch summary::after {
	content: " ▾";
	color: var(--muted);
}
.top .project-switch[open] summary {
	margin-bottom: 0;
	background: var(--accent-soft);
	border-color: var(--accent-line);
}
.top .project-switch ul {
	position: absolute;
	z-index: 20;
	top: calc(100% + 0.3rem);
	left: 0;
	min-width: 14rem;
	margin: 0;
	padding: 0.3rem;
	list-style: none;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: var(--shadow);
}
.top .project-switch a {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.45rem 0.7rem;
	border-radius: 6px;
	color: var(--text);
}
.top .project-switch a:hover {
	background: var(--line);
	text-decoration: none;
}
.top .project-switch a[aria-current] {
	color: var(--accent);
	font-weight: 500;
}

.site-footer {
	padding: 1.5rem;
	text-align: center;
}

/* Header search with area chip (decision 27). */
.top .global-search {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	min-width: 16rem;
	max-width: 22rem;
	flex: 0 1 22rem;
	padding: 0.25rem 0.4rem 0.25rem 0.6rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 8px;
}
.top .global-search:focus-within {
	border-color: var(--accent-line);
	background: var(--panel);
}
.top .global-search input[type="search"] {
	flex: 1;
	min-width: 0;
	border: none;
	background: transparent;
	padding: 0.2rem 0;
	box-shadow: none;
	outline: none;
	font-size: 0.9rem;
}
.top .scope-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.15rem;
	padding: 0.05rem 0.2rem 0.05rem 0.5rem;
	border-radius: 6px;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 500;
	white-space: nowrap;
}
.top .chip-x {
	border: none;
	background: transparent;
	color: inherit;
	padding: 0 0.25rem;
	font-size: 0.95rem;
	line-height: 1;
	cursor: pointer;
}
.top .search-kbd {
	color: var(--muted);
	white-space: nowrap;
}

/* Search results: tabs and one card per area. */
.tabs {
	display: flex;
	gap: 0.25rem;
	margin: 0 0 1rem;
	border-bottom: 1px solid var(--border);
}
.tab {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.8rem;
	color: var(--muted);
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}
.tab:hover {
	color: var(--text);
	text-decoration: none;
}
.tab[aria-current="page"] {
	color: var(--accent);
	border-bottom-color: var(--accent);
	font-weight: 500;
}
.search-results {
	display: grid;
	gap: 1rem;
}
.search-hit .hit-main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}
.search-hit .excerpt mark {
	background: var(--mark);
	color: inherit;
	border-radius: 2px;
}

@media (max-width: 60rem) {
	.top .global-search {
		order: 10;
		flex: 1 1 100%;
		max-width: none;
	}
	.top .search-kbd {
		display: none;
	}
}
