/* e-kurz Tools – zentrales Design (Startseite, Login, Admin) */
:root{
	--bg:#f5f6f8; --card:#fff; --ink:#1b2430; --muted:#6b7280; --line:#e5e7eb;
	--accent:#2f6f4f; --accent-ink:#fff; --danger:#c0392b; --ok:#2f6f4f;
	--radius:12px;
}
*{box-sizing:border-box}
body {
	background: var(--bg);
	color: var(--ink);
	text-align: left;
	line-height: 1.5;
	margin: 0;
	font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	min-height: 100vh;
	position: relative;
}

a:link, a:visited {
	color: var(--accent);
	text-decoration: none;
}

a:hover, a:active {
	text-decoration: underline;
}

#container {
	color: var(--ink);
	text-align: left;
	line-height: 1.5;
	margin: 0;
	font-family: inherit;
	font-size: 14px;
}

.wrapper {
	width: 90%;
	max-width: 1200px;
	margin: auto;
}

/* Header */
.main-header {
	background: var(--card);
	padding: 0;
	border-bottom: 1px solid var(--line);
}

.main-header .container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.header-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 60px;
	gap: 16px;
}

.logo img {
	display: block; /* sonst reserviert das <img> als Inline-Element unten etwas Platz für Zeilenabstand -> Logo wirkt oben/unten ungleich zentriert */
	height: 36px;
	width: auto;
}

/* Burger-Menü: auf dem Desktop unsichtbar/wirkungslos - .nav-panel ist nur
   ein Wrapper, seine Kinder (.main-nav, .user-menu) bleiben ganz normale
   Flex-Kinder von .header-content wie eh und je (display:contents nimmt
   den Wrapper selbst komplett aus dem Layout raus). Erst die mobile Regel
   weiter unten macht daraus ein echtes auf-/zuklappbares Panel. */
.mobile-menu-toggle {
	display: none;
}

.nav-panel {
	display: contents;
}

.main-nav {
	display: flex;
	gap: 6px;
	margin: 0 0 0 auto; /* nach rechts, direkt neben Profil und Logout */
	padding: 0;
	list-style: none;
	align-items: center;
}

/* Am PC ist das Tools-Menü überflüssig: die Startseite zeigt alle freigegebenen
   Tools ohnehin. Nur auf dem Handy bleibt es (im Burger-Menü, siehe unten). */
@media (min-width: 769px) {
	.main-nav {
		display: none;
	}
}

.nav-link {
	margin: 0;
	display: inline-block;
	padding: 8px 14px;
	background: transparent;
	color: var(--ink);
	text-decoration: none;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	transition: background 0.15s ease, border-color 0.15s ease;
	font-family: inherit;
}

.nav-link:hover {
	background: #f1f5f4;
	border-color: var(--line);
	color: var(--ink);
	text-decoration: none;
}

/* Dropdown */
.nav-dropdown {
	position: relative;
	display: inline-block;
}

.dropdown-toggle {
	cursor: pointer;
}

.dropdown-toggle:after {
	content: " ▾";
	font-size: 11px;
	margin-left: 3px;
}

.dropdown-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 10px;
	min-width: 220px;
	z-index: 1000;
	box-shadow: 0 8px 24px rgba(0,0,0,.08);
	padding: 6px;
	margin-top: 4px;
}

.nav-dropdown:hover .dropdown-menu {
	display: block;
}

.dropdown-item {
	display: block;
	padding: 8px 10px;
	color: var(--ink);
	text-decoration: none;
	font-size: 14px;
	border-radius: 6px;
	transition: background 0.15s ease;
}

.dropdown-item:hover {
	background: #f1f5f4;
	color: var(--accent);
	text-decoration: none;
}

.user-menu {
	display: flex;
	align-items: center;
	gap: 12px;
}

.username {
	color: var(--ink);
	font-weight: 600;
	font-size: 14px;
	text-shadow: none;
}

/* Profil-Link im Kopfmenü: Profilbild (oder Initiale) + "Hallo, Name" */
.profile-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.profile-avatar {
	display: block;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--line);
	flex-shrink: 0;
}

.profile-avatar.is-empty {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #eaf1fb;
	color: #1d4ed8;
	font-size: 13px;
	font-weight: 700;
}

/* Main content */
.main-content {
	background: transparent;
	width: auto !important;
	padding: 28px 10px;
	overflow: visible;
	max-width: 1200px;
	margin: 0 auto;
	padding-bottom: 80px;
}

/* Dashboard header */
.dashboard-header {
	margin-bottom: 24px;
}

.dashboard-header h1 {
	color: var(--ink);
	margin-bottom: 6px;
	font-size: 26px;
	font-weight: 700;
}

.dashboard-header p {
	color: var(--muted);
	margin-bottom: 0;
	font-size: 14px;
}

/* Tools section */
.tools-section {
	margin-bottom: 32px;
}

.section-title {
	color: var(--ink);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .06em;
	font-weight: 700;
	margin-bottom: 14px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

/* Tools grid */
.tools-grid {
	display: grid;
	gap: 16px;
	margin-top: 15px;
}

.tools-grid.view-grid {
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.tools-grid.view-medium {
	grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

.tools-grid.view-list {
	grid-template-columns: 1fr;
}

/* Tool cards */
.tool-card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 18px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
	text-decoration: none;
	color: inherit;
	display: block;
	position: relative;
}

.tool-card:hover {
	border-color: var(--accent);
	box-shadow: 0 6px 18px rgba(0,0,0,.06);
	text-decoration: none;
}

.tool-icon {
	font-size: 22px;
	margin-bottom: 10px;
	display: block;
	color: var(--accent);
}

.tool-card h3 {
	color: var(--ink);
	margin-bottom: 6px;
	font-size: 16px;
	font-weight: 700;
}

.tool-description {
	color: var(--muted);
	margin-bottom: 12px;
	font-size: 13px;
	line-height: 1.5;
}

.tool-meta {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.tool-status {
	display: inline-block;
	padding: 3px 10px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border: none;
	border-radius: 999px;
}

.tool-status.active {
	background-color: #e8f6ee;
	color: #1a7a44;
}

.tool-status.external {
	background-color: #eef2f7;
	color: #475569;
}

.permission-badge {
	display: inline-block;
	padding: 3px 10px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border: none;
	border-radius: 999px;
}

.permission-badge.admin {
	background: #fdecea;
	color: #a52a1f;
}

.permission-badge.user {
	background: #eaf1fb;
	color: #1d4ed8;
}

.permission-badge.guest {
	background: #f1f5f4;
	color: #475569;
}

.permission-badge.custom {
	background: #f3e8ff;
	color: #7c3aed;
}

/* Welcome / Login */
.welcome-section {
	text-align: center;
	padding: 56px 20px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	margin-bottom: 20px;
}

.welcome-content h1 {
	color: var(--ink);
	margin-bottom: 12px;
	font-size: 30px;
	font-weight: 700;
}

.welcome-content p {
	color: var(--muted);
	margin-bottom: 25px;
	font-size: 16px;
	max-width: 600px;
	margin-left: auto;
	margin-right: auto;
}

.login-options {
	margin-bottom: 30px;
}

.login-options .btn {
	margin: 0 6px;
	padding: 10px 22px;
	font-size: 14px;
}

.guest-tools {
	padding: 20px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 10px;
	max-width: 500px;
	margin: 0 auto;
}

.guest-tools h3 {
	color: var(--ink);
	margin-bottom: 8px;
	font-size: 16px;
}

.guest-tools p {
	color: var(--muted);
	margin: 0;
}

/* Login page */
.login-container {
	display: flex;
	justify-content: center;
	padding: 40px 16px;
}

.login-box {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 32px;
	max-width: 420px;
	width: 100%;
}

.login-header {
	text-align: center;
	margin-bottom: 20px;
}

.login-header h1 {
	font-size: 24px;
	margin: 0 0 6px;
	color: var(--ink);
}

.login-header p {
	color: var(--muted);
	margin: 0;
	font-size: 14px;
}

.login-form .form-actions {
	margin-top: 20px;
}

.form-actions .btn {
	width: 100%;
	text-align: center;
	padding: 10px 18px;
}

.login-footer {
	text-align: center;
	margin-top: 18px;
	font-size: 13px;
	color: var(--muted);
}

/* Login-Seite auf dem Handy: bildschirmfüllend, mittig, nicht scrollbar.
   position:fixed statt nur min-height, weil mobile Browser sonst trotz
   exakt passendem Inhalt noch ein kleines "Rubber-Band"-Scrollen/Wippen
   erlauben (auch ohne echten Überlauf). overflow-y:auto NUR innen auf
   .main-content ist die Sicherheitsleine: falls durch eine Fehlermeldung
   auf einem sehr kleinen/queren Display doch mehr Inhalt reinpasst als
   Platz ist, bleibt der Anmelden-Button dort noch per Scroll erreichbar,
   statt unerreichbar abgeschnitten zu sein - die Seite selbst wippt/
   scrollt davon aber nicht. */
@media (max-width: 768px) {
	body.login-page {
		position: fixed;
		inset: 0;
		width: 100%;
		overflow: hidden;
		overscroll-behavior: none;
	}

	body.login-page .main-footer {
		display: none;
	}

	body.login-page .main-content {
		height: 100%;
		max-width: none;
		margin: 0;
		padding: 16px;
		display: flex;
		align-items: center;
		justify-content: center;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	body.login-page .main-content > .container {
		width: 100%;
	}

	body.login-page .login-container {
		padding: 0;
		width: 100%;
	}
}

/* Forms */
.form-container {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 24px;
	max-width: 600px;
	margin: 20px auto;
}

.form-group {
	margin-bottom: 16px;
}

.form-group label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	color: #374151;
	font-size: 13px;
}

.form-group input,
.form-group textarea,
.form-group select {
	width: 100%;
	padding: 9px 10px;
	border: 1px solid var(--line);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: var(--ink);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
	outline: none;
	border-color: var(--accent);
}

/* Passwortfeld mit "anzeigen"-Auge (Login-Seite) */
.pw-wrap {
	position: relative;
}

.pw-wrap input {
	padding-right: 42px;
}

.pw-toggle {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 40px;
	padding: 0;
	border: 0;
	background: none;
	color: #4b5563;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pw-toggle:hover,
.pw-toggle.is-on {
	color: var(--accent);
}

.pw-toggle .pw-slash {
	display: none;
}

.pw-toggle.is-on .pw-slash {
	display: inline;
}

.form-group textarea {
	min-height: 120px;
	resize: vertical;
	line-height: 1.5;
}

/* Buttons */
.btn {
	display: inline-block;
	padding: 9px 18px;
	background: var(--card);
	border: 1px solid var(--line);
	color: var(--ink);
	text-decoration: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s ease;
	font-family: inherit;
}

.btn:hover {
	border-color: #c7cdd6;
	background: #f8fafc;
	text-decoration: none;
}

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

.btn-primary:hover {
	opacity: .92;
	background: var(--accent);
}

.btn-secondary {
	background: var(--card);
	color: var(--ink);
	border-color: var(--line);
}

.btn-secondary:hover {
	background: #f8fafc;
}

/* Messages */
.message {
	padding: 12px 14px;
	margin-bottom: 15px;
	border: 1px solid;
	border-radius: 10px;
	font-size: 14px;
}

.message.success {
	background-color: #f3fbf6;
	color: #1a7a44;
	border-color: #bfe3cc;
}

.message.error {
	background-color: #fdf3f1;
	color: #a52a1f;
	border-color: #f2c4bd;
}

/* Tool Interface */
.tool-interface {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px;
	min-height: 500px;
}

.tool-response {
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 12px;
	margin-top: 15px;
	white-space: pre-wrap;
	font-family: inherit;
	max-height: 400px;
	overflow-y: auto;
	font-size: 13px;
}

/* Footer */
.main-footer {
	clear: both;
	background: var(--card);
	border-top: 1px solid var(--line);
	padding: 12px 0;
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	width: 100%;
}

.footer-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.footer-links a {
	color: var(--muted);
	text-decoration: none;
	margin-right: 15px;
	font-size: 12px;
}

.footer-links a:hover {
	color: var(--accent);
}

.footer-info {
	color: var(--muted);
	font-size: 12px;
}

/* Tables */
table {
	color: var(--ink);
	font-size: 14px;
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 20px;
}

.tborder {
	background: var(--card);
	width: 100%;
	margin: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1px;
	overflow: hidden;
}

.thead {
	background: var(--ink);
	color: #ffffff;
	border-bottom: none;
	padding: 10px 12px;
}

.thead a:link,
.thead a:visited {
	color: #ffffff;
	text-decoration: none;
}

.thead a:hover,
.thead a:active {
	color: #ffffff;
	text-decoration: underline;
}

.tcat {
	background: #f1f5f4;
	color: var(--ink);
	border-top: none;
	border-bottom: 1px solid var(--line);
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 700;
}

.tcat a:link,
.tcat a:visited,
.tcat a:hover,
.tcat a:active {
	color: var(--ink);
}

.trow1 {
	background: var(--card);
	border: none;
	border-bottom: 1px solid var(--line);
}

.trow2 {
	background: #fafbfc;
	border: none;
	border-bottom: 1px solid var(--line);
}

.trow1:hover,
.trow2:hover {
	background: #f1f5f4;
}

.tfoot {
	border-top: 1px solid var(--line);
	padding: 8px 12px;
	background: var(--bg);
	color: var(--muted);
}

/* Admin styles */
.admin-nav {
	display: flex;
	gap: 4px;
	margin-top: 15px;
	border-bottom: none;
	padding-bottom: 0;
	border: none;
	overflow: hidden;
}

.admin-nav-link {
	padding: 9px 18px;
	text-decoration: none;
	color: var(--ink);
	transition: all 0.15s ease;
	font-weight: 600;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 8px;
	font-size: 13px;
}

.admin-nav-link:last-child {
	border-right: 1px solid var(--line);
}

.admin-nav-link:hover {
	color: var(--ink);
	background: #f1f5f4;
}

.admin-nav-link.active {
	color: #fff;
	background: var(--accent);
	border-color: var(--accent);
}

.admin-header {
	margin-bottom: 20px;
}

.admin-header h1 {
	color: var(--ink);
	margin-bottom: 8px;
	font-size: 22px;
}

/* No Tools state */
.no-tools {
	text-align: center;
	padding: 30px 20px;
}

.no-tools-content {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 24px;
	max-width: 400px;
	margin: 0 auto;
}

.no-tools-content h3 {
	color: var(--ink);
	margin-bottom: 10px;
	font-size: 16px;
}

.no-tools-content p {
	color: var(--muted);
	margin-bottom: 15px;
	font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
	/* Kopfzeile auf dem Handy: nur noch Logo links und Burger-Icon rechts.
	   Alles andere (Forum, Tools, Login-Status) klappt erst per Tap auf
	   dem Burger darunter auf - siehe .mobile-menu-toggle/.nav-panel. */
	.header-content {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 18px 0;
		min-height: 64px;
	}

	.mobile-menu-toggle {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 5px;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 1px solid var(--line);
		border-radius: 8px;
		background: var(--card);
		cursor: pointer;
		flex-shrink: 0;
	}

	.mobile-menu-toggle span {
		display: block;
		width: 18px;
		height: 2px;
		background: var(--ink);
		border-radius: 1px;
		transition: transform .15s ease, opacity .15s ease;
	}

	/* X-Animation, wenn das Panel offen ist */
	.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
		transform: translateY(7px) rotate(45deg);
	}
	.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
		opacity: 0;
	}
	.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
		transform: translateY(-7px) rotate(-45deg);
	}

	/* Eingeklappt: das Panel (Forum/Tools/Login-Status) ist komplett weg -
	   nicht nur unsichtbar, sondern kein display:contents mehr, damit es
	   als eigener Block erscheint sobald .open gesetzt ist. */
	.nav-panel {
		display: none;
		flex-basis: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		width: 100%;
		padding-top: 12px;
		margin-top: 4px;
		border-top: 1px solid var(--line);
		text-align: center;
	}

	.nav-panel.open {
		display: flex;
	}

	/* Forum und alle Tools als EINE flache Liste zeigen - kein zweiter Tap
	   auf einen extra Menüpunkt "Tools (N)" mehr nötig. Die Zwischen-Ebenen
	   .nav-dropdown/.dropdown-menu werden dafür mit display:contents aus
	   dem Layout genommen, ihre Links (.dropdown-item) rutschen dadurch als
	   ganz normale Listenzeilen direkt unter "Forum" in .main-nav. */
	.main-nav {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 2px;
		width: 100%;
		margin-left: 0;
	}

	.nav-dropdown,
	.dropdown-menu {
		display: contents;
	}

	/* Die Beschriftung "Tools (N)" selbst wird nicht mehr gebraucht - ihre
	   Einträge stehen ja jetzt direkt in der Liste. (Spezifischerer
	   Selektor als .nav-link, damit das unten sicher gewinnt.) */
	.nav-link.dropdown-toggle {
		display: none;
	}

	.nav-link,
	.dropdown-item {
		display: block;
		width: 100%;
		padding: 12px 16px;
		text-align: left;
		border-radius: 8px;
		font-weight: 400; /* Forum soll optisch wie ein ganz normaler Listeneintrag wirken, nicht fett hervorgehoben */
	}

	.nav-link:hover,
	.dropdown-item:hover {
		background: #f1f5f4;
	}

	/* "Hallo, NAME" raus (Logout allein reicht), und als eigene, klar
	   abgesetzte letzte Zeile ans Ende des Menüs - keine unter mehreren
	   Tools versteckte Nebenaktion. */
	.username {
		display: none;
	}

	.user-menu {
		display: flex;
		justify-content: center;
		width: 100%;
		padding-top: 14px;
		margin-top: 10px;
		border-top: 1px solid var(--line);
	}

	/* Logout als eigener, deutlich sichtbarer Button - mittig, nicht nur
	   eine schmale Textzeile wie die übrigen Listeneinträge. */
	.user-menu .nav-link {
		display: inline-block;
		width: auto;
		text-align: center;
		font-weight: 600;
		font-size: 15px;
		padding: 12px 40px;
		border: 1px solid var(--line);
		border-radius: 10px;
		background: var(--card);
	}

	.user-menu .nav-link:hover {
		background: #f1f5f4;
	}

	/* Profil (mit Bild und Name) und Logout nebeneinander, bei wenig Platz untereinander */
	.user-menu {
		flex-wrap: wrap;
		gap: 10px;
	}

	.user-menu .profile-link {
		display: inline-flex;
		justify-content: center;
		padding: 12px 24px;
	}

	.profile-link .username {
		display: inline;
	}

	.tools-grid {
		grid-template-columns: 1fr;
	}

	.footer-container {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}

	.admin-nav {
		flex-direction: column;
		gap: 4px;
	}

	.admin-nav-link {
		text-align: center;
	}
}

/* Extra small devices */
@media (max-width: 480px) {
	.main-header .container {
		padding: 0 10px;
	}

	.header-content {
		gap: 10px;
	}

	.logo img {
		height: 30px;
	}

	.nav-link {
		padding: 8px 15px;
		font-size: 13px;
	}

	.main-content {
		padding: 0 10px;
	}

	.tools-grid.view-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.tool-card {
		padding: 14px;
	}

	.tool-card h3 {
		font-size: 14px;
	}

	.tool-description {
		font-size: 12px;
	}
}
