:root {
	--color-primary: #2563b8;
	--color-primary-dark: #143f6b;
	--color-primary-light: #4f8fd6;
	--color-accent-light: #86c8f0;
	--color-bg: #eef2f7;
	--color-surface: #ffffff;
	--color-surface-alt: #f7f9fc;
	--color-text: #1c2733;
	--color-text-muted: #64748b;
	--color-border: #e2e8f0;
	--color-success: #2e7d32;
	--color-danger: #c62828;
	--radius: 14px;
	--radius-sm: 8px;
	--shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
	--shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
	--shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.16);
	--sidebar-width: 250px;
	--topbar-height: 56px;
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: radial-gradient(circle at top left, #f4f8fd 0%, var(--color-bg) 45%);
	background-attachment: fixed;
	color: var(--color-text);
	line-height: 1.55;
	font-size: 15px;
}

h1, h2, h3 {
	color: var(--color-primary-dark);
	font-weight: 700;
	letter-spacing: -0.01em;
}

h1 {
	font-size: 1.5rem;
	margin: 0 0 1.25rem 0;
	padding-bottom: 0.6rem;
	border-bottom: 3px solid var(--color-accent-light);
	display: inline-block;
}

h2 {
	font-size: 1.05rem;
	margin: 1.75rem 0 0.85rem 0;
	padding-left: 0.7rem;
	border-left: 4px solid var(--color-primary-light);
}

a {
	color: var(--color-primary);
	text-decoration: none;
	transition: color 0.15s ease;
}

a:hover {
	color: var(--color-primary-dark);
	text-decoration: underline;
}

/* Top-Bar */
.topbar {
	height: var(--topbar-height);
	background: linear-gradient(120deg, var(--color-primary-dark), var(--color-primary));
	display: flex;
	align-items: center;
	padding: 0 1.5rem;
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.25);
	position: sticky;
	top: 0;
	z-index: 20;
}

.topbar-brand {
	color: #fff;
	font-weight: 700;
	font-size: 1.05rem;
	letter-spacing: 0.01em;
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.topbar-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.18);
	font-weight: 800;
	backdrop-filter: blur(4px);
}

/* App-Layout */
.app-shell {
	display: grid;
	grid-template-columns: var(--sidebar-width) 1fr;
	align-items: start;
	min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
	background: linear-gradient(180deg, var(--color-primary), var(--color-primary-dark));
	color: #fff;
	padding: 1.5rem 1rem;
	position: sticky;
	top: var(--topbar-height);
	height: calc(100vh - var(--topbar-height));
	overflow-y: auto;
	box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.sidebar h2 {
	color: rgba(255, 255, 255, 0.65);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin: 1.5rem 0 0.6rem 0.75rem;
	border-left: none;
	padding-left: 0;
}

.sidebar h2:first-child {
	margin-top: 0;
}

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

.sidebar li {
	margin: 0.15rem 0;
}

.sidebar a {
	display: flex;
	align-items: center;
	color: rgba(255, 255, 255, 0.88);
	padding: 0.55rem 0.75rem;
	border-radius: var(--radius-sm);
	font-size: 0.92rem;
	transition: background-color 0.15s ease, padding-left 0.15s ease;
}

.sidebar a::before {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	margin-right: 0.6rem;
	flex-shrink: 0;
}

.extern-tag {
	margin-left: auto;
	padding: 0.1rem 0.45rem;
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	background: rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	color: rgba(255, 255, 255, 0.9);
}

.sidebar a:hover {
	background-color: rgba(255, 255, 255, 0.14);
	text-decoration: none;
	color: #fff;
	padding-left: 1rem;
}

/* Mobile-Menütoggle per Checkbox-Trick (reines CSS) */
.menu-toggle-checkbox {
	display: none;
}

.menu-toggle-label {
	display: none;
	cursor: pointer;
	font-weight: 600;
	font-size: 1.05rem;
	color: #fff;
	padding: 0.4rem 0;
}

.menu-content {
	display: block;
}

/* Content-Bereich als "erhobene" Fläche statt direkt auf dem Seitenhintergrund */
.content-area {
	padding: 1.75rem 2rem 3rem 2rem;
	max-width: 100%;
	background: var(--color-surface);
	margin: 1.25rem;
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	min-height: calc(100vh - var(--topbar-height) - 2.5rem);
}

.content-area > * {
	max-width: 1050px;
}

/* Tabellen: Wrapper-Div (per JS injiziert, siehe app.js) übernimmt das horizontale Scrollen.
   overflow-x direkt auf <table> ist über Browser hinweg nicht zuverlässig. */
.table-scroll {
	overflow-x: auto;
	max-width: 100%;
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
	margin: 0.6rem 0 1.5rem 0;
}

table {
	border-collapse: separate;
	border-spacing: 0;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	width: 100%;
}

.table-scroll table {
	border-radius: var(--radius-sm);
	box-shadow: none;
	margin: 0;
}

table tr {
	border-bottom: 1px solid var(--color-border);
}

table tr:last-child {
	border-bottom: none;
}

table tr:not(:first-child):hover {
	background-color: var(--color-surface-alt);
}

table td, table th {
	padding: 0.7rem 1rem;
	text-align: left;
	white-space: normal;
}

table tr:first-child td, table th {
	background: var(--color-surface-alt);
	font-weight: 700;
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-text-muted);
	white-space: nowrap;
}

/* Abwesend-Übersicht: kompakte Jahres-Kalendertabelle pro Mitarbeiter */
.abwesend-tabelle {
	width: auto;
	font-size: 0.72rem;
}

.abwesend-tabelle td {
	padding: 0.3rem 0.35rem;
	text-align: center;
	min-width: 1.7rem;
	border: 1px solid var(--color-border);
}

.abwesend-tabelle tr:first-child td {
	background: var(--color-surface-alt);
	font-weight: 700;
	font-size: 0.7rem;
	color: var(--color-text-muted);
}

.abwesend-tabelle tr td:first-child {
	text-align: left;
	font-weight: 600;
	white-space: nowrap;
	background: var(--color-surface-alt);
	position: sticky;
	left: 0;
	padding-left: 0.75rem;
	padding-right: 0.75rem;
}

.tag-frei {
	background-color: #bfe6c9;
}

.tag-kein-arbeitstag {
	background-color: #cfdcec;
}

.tag-urlaub {
	background-color: #ffcc80;
	font-weight: 700;
	color: #7a4a00;
}

.tag-krank {
	background-color: #ef9a9a;
	font-weight: 700;
	color: #7a1212;
}

.tag-leer {
	background-color: transparent;
}

.legende-kasten {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 3px;
	vertical-align: middle;
	margin-right: 0.3rem;
}

.abwesend-summary {
	font-size: 0.85rem;
	color: var(--color-text-muted);
	background: var(--color-surface-alt);
	display: inline-block;
	padding: 0.5rem 0.9rem;
	border-radius: var(--radius-sm);
	margin-top: 0.4rem;
}

.abwesend-summary strong {
	color: var(--color-text);
}

/* Kompakte Entscheidungs-Spalte bei Urlaubsanträge verwalten: Buttons untereinander statt nebeneinander */
.uantrag-entscheidung-form {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.uantrag-entscheidung-form textarea {
	width: 100%;
	font-size: 0.85rem;
}

/* Aktionen (Verlängern/Vorzeitig beenden) bei Krankenschein untereinander statt nebeneinander */
.krankenschein-aktion-form {
	display: flex;
	gap: 0.35rem;
	align-items: center;
	margin-bottom: 0.35rem;
}

.krankenschein-aktion-form:last-child {
	margin-bottom: 0;
}

/* Kleines rotes "x" zum Löschen der letzten Verlängerung (Admin) */
.loesche-verlaengerung-btn {
	background: none;
	color: var(--color-danger);
	border: 1px solid var(--color-danger);
	border-radius: 50%;
	width: 1.3rem;
	height: 1.3rem;
	min-height: 0;
	padding: 0;
	line-height: 1;
	font-size: 0.75rem;
	font-weight: 700;
	box-shadow: none;
	margin-left: 0.4rem;
	cursor: pointer;
}

.loesche-verlaengerung-btn:hover {
	background: var(--color-danger);
	color: #fff;
	transform: none;
	box-shadow: none;
}

/* Tabelle bleibt immer auf 100% der verfügbaren Breite statt in einem Scroll-Container zu kapseln;
   Inhalte brechen dafür um statt die Tabelle zu verbreitern (siehe app.js: Klasse "tabelle-fit" wird nicht umwickelt) */
.tabelle-fit {
	width: 100%;
	table-layout: fixed;
}

.tabelle-fit td {
	white-space: normal;
	overflow-wrap: break-word;
	word-break: break-word;
}

.tabelle-fit tr:first-child td {
	white-space: normal;
}

/* Spaltenbreiten für die Anträge-Tabelle in urlaubsantrag_admin.php */
.tabelle-fit tr > td:nth-child(1) { width: 12%; }
.tabelle-fit tr > td:nth-child(2) { width: 7%; }
.tabelle-fit tr > td:nth-child(3) { width: 8%; }
.tabelle-fit tr > td:nth-child(4) { width: 9%; }
.tabelle-fit tr > td:nth-child(5) { width: 9%; }
.tabelle-fit tr > td:nth-child(6) { width: 8%; }
.tabelle-fit tr > td:nth-child(7) { width: 24%; }
.tabelle-fit tr > td:nth-child(8) { width: 23%; }

/* Formulare */
form {
	margin: 0;
}

input[type="text"],
input[type="date"],
input[type="password"],
input[type="number"],
input[type="textarea"],
textarea,
select {
	font-family: inherit;
	font-size: 16px;
	padding: 0.6rem 0.8rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background-color: var(--color-surface-alt);
	color: var(--color-text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: var(--color-primary);
	background-color: var(--color-surface);
	box-shadow: 0 0 0 3px rgba(37, 99, 184, 0.18);
}

input[type="checkbox"] {
	width: 1.15rem;
	height: 1.15rem;
	vertical-align: middle;
	accent-color: var(--color-primary);
}

label {
	font-weight: 500;
}

/* Wochentag-Checkboxen (z.B. Arbeitstage in der Mitarbeiterverwaltung) sauber ausgerichtet statt als Fließtext */
.arbeitstage-liste {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.7rem;
	align-items: center;
}

.arbeitstage-liste label {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	white-space: nowrap;
	font-weight: 400;
}

button, input[type="submit"] {
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 600;
	background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark));
	color: #fff;
	border: none;
	border-radius: var(--radius-sm);
	padding: 0.65rem 1.2rem;
	cursor: pointer;
	min-height: 42px;
	box-shadow: var(--shadow-sm);
	transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

button:hover, input[type="submit"]:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}

button:active, input[type="submit"]:active {
	transform: translateY(0);
}

.agilos_menue {
	background-color: transparent;
}

small {
	color: var(--color-text-muted);
}

/* Mobile */
@media (max-width: 768px) {
	.topbar-brand {
		font-size: 0.95rem;
	}

	.app-shell {
		display: block;
	}

	.sidebar {
		position: static;
		height: auto;
		padding: 0.85rem 1.1rem;
	}

	.menu-toggle-label {
		display: block;
	}

	.menu-content {
		display: none;
	}

	.menu-toggle-checkbox:checked ~ .menu-content {
		display: block;
	}

	.content-area {
		padding: 1rem;
		margin: 0.75rem;
		border-radius: var(--radius-sm);
		min-height: 0;
	}

	.content-area > * {
		max-width: 100%;
	}

	h1 {
		font-size: 1.25rem;
	}

	table td, table th {
		padding: 0.55rem 0.7rem;
		font-size: 0.88rem;
	}

	button, input[type="submit"] {
		width: 100%;
	}
}
