/* GYMprove — Theme-System (Einstellungs-Slice, AGENTS.md O11): drei
   Designs wie der Bestand, serverseitig als data-theme am <html>
   (FOUC-frei). Paletten portiert aus dem Bestand (v1.26): Hell =
   Grau-100/Weiß mit Teal-700-Akzent, Dunkel = #0a0a0a/#141414 mit
   Neon-Cyan, Twilight (Bestands-Code „mix") = Slate-Flächen mit
   Amber-Akzent. */

:root,
[data-theme="light"] {
	--bg: #f3f4f6; /* gray-100 */
	--surface: #ffffff;
	--text: #111827; /* gray-900 */
	--muted: #6b7280; /* gray-500 */
	--primary: #0f766e; /* teal-700 */
	--primary-ink: #ffffff;
	--danger: #dc2626; /* red-600 */
	--border: #e5e7eb; /* gray-200 */
}

[data-theme="dark"] {
	--bg: #0a0a0a;
	--surface: #141414;
	--text: #f5f5f5;
	--muted: #8c8c8c;
	--primary: #00e5c7; /* Neon-Cyan des Bestands */
	--primary-ink: #0a0a0a;
	--danger: #f87171;
	--border: #222222;
}

[data-theme="mix"] {
	--bg: #1e293b; /* slate-800 */
	--surface: #334155; /* slate-700 */
	--text: #f1f5f9; /* slate-100 */
	--muted: #94a3b8; /* slate-400 */
	--primary: #f59e0b; /* amber-500 */
	--primary-ink: #1e1a0a;
	--danger: #fca5a5;
	--border: #404f68;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.5;
}

.center-wrap {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 2rem;
	width: 100%;
	max-width: 24rem;
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1.25rem;
	border-bottom: 1px solid var(--border);
}

.user-menu {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.user-name {
	color: var(--muted);
}

.brand {
	font-weight: 800;
	letter-spacing: 0.02em;
}

.brand-accent {
	color: var(--primary);
}

label {
	display: block;
	margin: 0.75rem 0 0.25rem;
	color: var(--muted);
	font-size: 0.875rem;
}

input {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 1rem;
}

button {
	margin-top: 1.25rem;
	width: 100%;
	padding: 0.65rem 1rem;
	border: none;
	border-radius: 8px;
	background: var(--primary);
	color: var(--primary-ink);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}

button.ghost {
	margin-top: 0;
	width: auto;
	background: transparent;
	color: var(--muted);
	border: 1px solid var(--border);
	padding: 0.35rem 0.75rem;
	font-size: 0.875rem;
}

.error {
	color: var(--danger);
	background: color-mix(in srgb, var(--danger) 12%, transparent);
	border: 1px solid var(--danger);
	border-radius: 8px;
	padding: 0.5rem 0.75rem;
}

.muted {
	color: var(--muted);
}

/* --- Navigation & Seitenrahmen (Slice 3) --- */

.topbar-left {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.nav {
	display: flex;
	gap: 1rem;
}

.nav a {
	color: var(--muted);
	text-decoration: none;
	font-size: 0.95rem;
}

.nav a:hover {
	color: var(--text);
}

.content {
	max-width: 64rem;
	margin: 0 auto;
	padding: 1.5rem 1rem 3rem;
}

.ghost-link {
	color: var(--primary);
	text-decoration: none;
	font-size: 0.9rem;
	align-self: center;
}

/* --- Übungsliste --- */

.filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 0.75rem 1rem;
	margin-bottom: 1.25rem;
}

.filter-bar label {
	margin: 0;
	font-size: 0.8rem;
}

.filter-bar input,
.filter-bar select {
	width: auto;
	min-width: 8rem;
	padding: 0.45rem 0.6rem;
	font-size: 0.9rem;
}

.filter-bar input[type="search"] {
	min-width: 14rem;
}

.filter-bar button {
	margin-top: 0;
	width: auto;
}

.ex-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
}

.ex-table th,
.ex-table td {
	text-align: left;
	padding: 0.55rem 0.75rem;
	border-bottom: 1px solid var(--border);
	font-size: 0.95rem;
}

.ex-table thead th {
	color: var(--muted);
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.ex-table tbody tr:last-child td {
	border-bottom: none;
}

.thumb-cell {
	width: 3.5rem;
}

.thumb {
	width: 3rem;
	height: 3rem;
	object-fit: contain;
	border-radius: 6px;
	background: var(--bg);
}

.ex-name {
	color: var(--text);
	font-weight: 600;
	text-decoration: none;
}

.ex-name:hover {
	color: var(--primary);
}

.badge {
	display: inline-block;
	margin-left: 0.4rem;
	padding: 0.1rem 0.5rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
	font-size: 0.75rem;
	white-space: nowrap;
}

.badge-own {
	color: var(--primary);
	border-color: var(--primary);
}

.badge-primary {
	color: var(--primary-ink);
	background: var(--primary);
	border-color: var(--primary);
}

.pagination {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 1rem;
}

.empty {
	padding: 2rem 0;
	text-align: center;
}

/* --- Übungsdetails --- */

.detail-head h1 {
	margin-bottom: 0.25rem;
}

.aka {
	color: var(--muted);
}

.img-pair {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	margin: 1rem 0 1.5rem;
}

.img-pair img {
	width: 18rem;
	max-width: 100%;
	height: auto;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: var(--surface);
}

section {
	margin-top: 1.75rem;
}

section h2 {
	font-size: 1.05rem;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.facts {
	display: grid;
	grid-template-columns: minmax(9rem, auto) 1fr;
	gap: 0.4rem 1.25rem;
	margin: 0;
}

.facts dt {
	color: var(--muted);
}

.facts dd {
	margin: 0;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
	margin: 0.5rem 0;
	color: var(--muted);
}

.chips .badge {
	margin-left: 0;
}

/* --- Eigene Übungen: Formular, Aktionen, Lösch-Dialog (Slice 3C) --- */

.content-narrow {
	max-width: 42rem;
}

.list-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.btn-small {
	display: inline-block;
	padding: 0.4rem 0.9rem;
	border-radius: 8px;
	background: var(--primary);
	color: var(--primary-ink);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
}

.form-card {
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.5rem;
	margin-top: 1rem;
}

.form-card label {
	margin-top: 1rem;
}

.form-card label:first-of-type {
	margin-top: 0;
}

.hint {
	color: var(--muted);
	font-size: 0.8rem;
}

textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 0.95rem;
	font-family: inherit;
	resize: vertical;
}

.errors {
	background: color-mix(in srgb, var(--danger) 12%, transparent);
	border: 1px solid var(--danger);
	border-radius: 8px;
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	color: var(--danger);
}

.errors ul {
	margin: 0.35rem 0 0;
	padding-left: 1.25rem;
}

.actions {
	display: flex;
	gap: 1rem;
	align-items: center;
}

button.danger {
	background: var(--danger);
	color: #1a0505;
}

button.ghost.danger,
.ghost.danger {
	background: transparent;
	color: var(--danger);
	border: 1px solid var(--danger);
}

dialog {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.5rem;
	max-width: 26rem;
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

dialog form button {
	margin-top: 0;
	width: auto;
}

/* --- Pläne (Slice 4) --- */

.plan-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1rem 1.25rem;
	margin-bottom: 0.9rem;
}

.plan-card h2 {
	margin: 0;
	font-size: 1.15rem;
}

.plan-card-head {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.plan-card p {
	margin: 0.4rem 0 0;
}

.day-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1rem 1.25rem;
	margin-top: 1.25rem;
}

.day-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.day-head h2 {
	margin: 0;
	font-size: 1.1rem;
}

.day-head .actions {
	display: flex;
	gap: 0.4rem;
}

.day-head .actions form {
	display: inline;
}

.day-head .actions button {
	margin-top: 0;
	width: auto;
	padding: 0.3rem 0.6rem;
}

.day-rename {
	display: flex;
	gap: 0.6rem;
	align-items: end;
	margin: 0.75rem 0;
}

.day-rename label {
	margin: 0;
	font-size: 0.8rem;
}

.day-rename input {
	width: auto;
	min-width: 12rem;
	padding: 0.4rem 0.6rem;
	font-size: 0.9rem;
}

.day-rename button {
	margin-top: 0;
	width: auto;
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
}

.day-add {
	margin-top: 1.5rem;
}

.day-add button {
	width: auto;
	align-self: flex-start;
}

.dialog-row {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

/* --- Training (Slice 5) --- */

.train-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.25rem;
	margin-top: 1.25rem;
}

.train-card > h2 {
	margin: 0 0 0.5rem;
	font-size: 1.1rem;
}

.open-banner {
	border-color: var(--primary);
}

.open-banner .actions {
	margin-top: 0.75rem;
}

.open-banner .actions form {
	display: inline;
}

.open-banner button {
	margin-top: 0;
	width: auto;
}

.start-form .start-plan {
	margin-top: 0.5rem;
}

.start-form h3 {
	margin: 0.75rem 0 0.25rem;
	font-size: 1rem;
}

.start-form h3 p {
	margin: 0;
}

.start-form .start-plan > p {
	margin: 0.25rem 0;
}

.radio-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.3rem 0;
	color: var(--text);
	cursor: pointer;
}

.radio-row input {
	width: auto;
	margin: 0;
}

.start-free {
	border-top: 1px dashed var(--border);
	margin-top: 0.9rem;
	padding-top: 0.4rem;
}

.deload-fieldset {
	border: 1px solid var(--border);
	border-radius: 8px;
	margin: 1.25rem 0 0;
	padding: 0.75rem 1rem;
}

.deload-fieldset legend {
	color: var(--muted);
	font-size: 0.85rem;
	padding: 0 0.4rem;
}

.preset-row {
	display: flex;
	gap: 1.25rem;
	flex-wrap: wrap;
}

.start-form > button {
	width: auto;
	align-self: flex-start;
	padding: 0.65rem 1.75rem;
}

.start-form > p {
	margin-bottom: 0.5rem;
}

.session-list {
	list-style: none;
	margin: 0.75rem 0 0;
	padding: 0;
}

.session-list li {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.7rem 0;
	border-bottom: 1px solid var(--border);
}

.session-list li:last-child {
	border-bottom: none;
}

.session-list .muted {
	font-size: 0.9rem;
}

.badges {
	display: flex;
	gap: 0.3rem;
}

.badges .badge {
	margin-left: 0;
}

.overrun {
	color: var(--danger);
	margin-left: 0.35rem;
}

.banner-info {
	background: color-mix(in srgb, var(--primary) 10%, transparent);
	border: 1px solid var(--primary);
	border-radius: 8px;
	padding: 0.75rem 1rem;
	margin-top: 1rem;
	font-size: 0.9rem;
}

.block-card h2 {
	margin: 0;
	font-size: 1.05rem;
}

.block-card p {
	margin: 0.35rem 0 0;
}

.plan-note {
	color: var(--muted);
	font-size: 0.9rem;
	font-style: italic;
}

/* --- Übungs-Karten der Session-Seite (Slice 5B) --- */

.block-details {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	margin-top: 1rem;
}

.block-details[open] {
	border-color: var(--primary);
}

.block-details > summary {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	padding: 0.9rem 1.1rem;
	cursor: pointer;
	list-style: none;
}

.block-details > summary::-webkit-details-marker {
	display: none;
}

.block-details > summary::before {
	content: "▸";
	color: var(--muted);
	transition: transform 0.15s ease;
}

.block-details[open] > summary::before {
	transform: rotate(90deg);
}

.block-title {
	font-weight: 600;
}

.block-count {
	font-size: 0.85rem;
}

.badge-done {
	color: var(--primary-ink);
	background: var(--primary);
	border-color: var(--primary);
}

.block-body {
	padding: 0.25rem 1.1rem 1.1rem;
}

.block-target {
	margin: 0.25rem 0 0;
}

.last-values {
	margin: 0.6rem 0 0;
	padding: 0.5rem 0.75rem;
	background: var(--bg);
	border: 1px dashed var(--border);
	border-radius: 8px;
	font-size: 0.9rem;
}

.set-list {
	list-style: none;
	margin: 0.75rem 0 0;
	padding: 0;
}

.set-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.45rem 0.25rem;
	border-bottom: 1px solid var(--border);
	font-size: 0.95rem;
}

.set-row:last-child {
	border-bottom: none;
}

.set-row .row-actions {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.set-row .row-actions form {
	display: inline;
}

.set-row .row-actions button {
	margin-top: 0;
	width: auto;
	padding: 0.2rem 0.5rem;
	font-size: 0.8rem;
}

.set-edit-form {
	display: flex;
	gap: 0.6rem;
	align-items: center;
	flex-wrap: wrap;
	width: 100%;
}

.set-edit-form button {
	margin-top: 0;
	width: auto;
	padding: 0.35rem 0.8rem;
	font-size: 0.85rem;
}

.set-form {
	margin-top: 0.9rem;
}

.set-fields {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.field-label {
	display: inline-flex;
	flex-direction: column;
	gap: 0.25rem;
	margin: 0;
	color: var(--muted);
	font-size: 0.8rem;
}

.field-label input {
	width: 6.5rem;
	padding: 0.5rem 0.6rem;
	font-size: 1rem;
}

.form-row {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	margin-top: 0.9rem;
	flex-wrap: wrap;
}

.form-row button {
	margin-top: 0;
	width: auto;
	padding: 0.55rem 1.1rem;
}

.form-row button.ghost {
	padding: 0.5rem 0.9rem;
}

/* --- Pausen-Timer (Slice 5C) --- */

.rest-timer {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	background: color-mix(in srgb, var(--primary) 8%, var(--surface));
	border: 1px solid var(--primary);
	border-radius: 12px;
	padding: 0.6rem 1rem;
	margin-top: 1rem;
	position: sticky;
	top: 0.5rem;
	z-index: 10;
}

.rest-timer[hidden] {
	display: none;
}

.timer-display {
	font-size: 1.6rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--primary);
	min-width: 4.5rem;
}

.timer-actions,
.timer-pills {
	display: flex;
	gap: 0.4rem;
	align-items: center;
}

.timer-actions button,
.timer-pills button {
	margin-top: 0;
	width: auto;
	padding: 0.3rem 0.7rem;
	font-size: 0.85rem;
}

/* --- Auswertungen: Dashboard & Übungs-Verlauf (Slice 6) --- */

/* Auswertungs-Karten folgen dem Plan-Seiten-Muster: volle Breite (nicht
   die 24-rem-Formularkarte) — Diagramme und Tabellen brauchen die Fläche. */
.card-wide {
	max-width: none;
	padding: 1.25rem 1.5rem;
	margin-bottom: 0.9rem;
}

.chart-box {
	position: relative;
	height: 240px;
	margin-top: 0.75rem;
}

.chart-box-tall {
	height: 300px;
}

.chart-links {
	display: flex;
	gap: 0.4rem 1rem;
	flex-wrap: wrap;
	margin-top: 0.75rem;
}

.range-switch {
	display: flex;
	gap: 0.4rem;
	margin: 0.75rem 0;
}

.range-link {
	padding: 0.3rem 0.8rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
	font-size: 0.85rem;
}

.range-link:hover {
	color: var(--text);
	border-color: var(--muted);
}

.range-link.active {
	color: var(--primary-ink);
	background: var(--primary);
	border-color: var(--primary);
}

.table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 0.5rem;
}

.table th,
.table td {
	text-align: left;
	vertical-align: top;
	padding: 0.45rem 0.6rem 0.45rem 0;
	border-bottom: 1px solid var(--border);
}

.table th {
	color: var(--muted);
	font-weight: 600;
}

.table .nowrap {
	white-space: nowrap;
}

/* --- Export (Slice 7) --- */

.export-form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	align-items: flex-end;
	margin-top: 0.5rem;
}

.export-row {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.export-row label {
	font-size: 0.85rem;
	color: var(--muted);
}

.export-row select,
.export-row input {
	min-width: 8rem;
}

.export-dates {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.export-dates[hidden] {
	display: none;
}

.export-form button {
	margin-top: 0;
	width: auto;
	padding: 0.55rem 1.1rem;
}
