:root {
	/* Dalp.ch Palette */
	--bg-app: #121212;
	/* var(--bg-color) */
	--bg-panel: #1e1e1e;
	/* var(--bg-secondary) */
	--bg-glass: rgba(30, 30, 30, 0.85);
	/* Based on var(--nav-bg) but slightly more trans for glass */

	/* Text */
	--text-main: #e0e0e0;
	/* var(--text-color) */
	--text-muted: #a0a0a0;
	--text-dim: #666666;

	/* Accents */
	--accent-color: #ffffff;
	/* var(--accent-color) */
	--accent-hover: #333333;
	--brand-primary: #ffffff;
	/* Replaced purple with White for high contrast */
	--brand-bg-active: rgba(255, 255, 255, 0.1);
	/* Subtle white overlay for active states */
	--brand-glow: rgba(255, 255, 255, 0.2);

	/* Borders */
	--border-subtle: rgba(255, 255, 255, 0.1);
	--border-glass: rgba(255, 255, 255, 0.15);

	/* Spacing & Radius */
	--radius-lg: 16px;
	--radius-md: 12px;
	--radius-sm: 8px;

	--header-height: 70px;
	--sidebar-width: 260px;

	--font-main: 'Inter', sans-serif;
	/* var(--font-main) */
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: var(--font-main);
	background-color: var(--bg-app);
	color: var(--text-main);
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

/* App-like feel only when in the inbox/app area */
.app-container {
	display: grid;
	grid-template-columns: var(--sidebar-width) 1fr;
	grid-template-rows: 1fr;
	height: 100vh;
	height: 100dvh;
	width: 100vw;
	background: var(--bg-app);
	overflow: hidden;
	/* Only the app container handles overflow */
}

/* Sidebar */
.app-sidebar {
	background-color: var(--bg-glass);
	backdrop-filter: blur(15px);
	-webkit-backdrop-filter: blur(15px);
	border-right: 1px solid var(--border-subtle);
	display: flex;
	flex-direction: column;
	padding: 24px;
	gap: 20px;
	/* Reduced gap since we have specific sections */
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

.sidebar-header {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.brand-logo {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--text-main);
	letter-spacing: -0.5px;
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 10px;
}

.brand-logo span {
	color: var(--accent-color);
}

.compose-btn {
	background: var(--text-main);
	color: var(--bg-app);
	border: none;
	border-radius: var(--radius-md);
	padding: 14px 20px;
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	transition: transform 0.2s, box-shadow 0.2s;
	text-decoration: none;
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

.compose-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
	background: white;
	color: black;
}

.nav-static {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nav-scrollable-container {
	flex: 1;
	overflow-y: auto;
	position: relative;
	/* Hide scrollbar visually but allow scroll */
	scrollbar-width: none;
	/* Firefox */
	-ms-overflow-style: none;
	/* IE and Edge */
	padding-right: 0;
	margin-right: 0;
}

/* Fade effect at bottom of scroll area */
.scroll-fade {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 60px;
	background: linear-gradient(to bottom, transparent, var(--bg-glass));
	pointer-events: none;
	z-index: 10;
}

/* Hide scrollbar by default for cleaner look, show on hover? 
   Or just style it very thin/dark */
.nav-scrollable-container::-webkit-scrollbar {
	display: none;
}

.nav-scrollable-container::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.1);
	border-radius: 4px;
}

.nav-menu {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nav-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	color: var(--text-muted);
	text-decoration: none;
	border-radius: var(--radius-sm);
	transition: all 0.2s;
	font-weight: 500;
}

.nav-item:hover {
	background-color: rgba(255, 255, 255, 0.05);
	color: var(--text-main);
}

.nav-item.active {
	background-color: var(--brand-bg-active);
	color: var(--accent-color);
	border-left: 3px solid var(--accent-color);
	/* Add border to make active state clear in monochrome */
}

.user-profile {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 12px;
	padding-top: 20px;
	border-top: none;
	margin-top: 0;
	/* handled by flex gap/ordering */
}

.sidebar-separator {
	height: 1px;
	background-color: var(--border-subtle);
	margin: 10px 16px;
	opacity: 0.5;
}

.avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--bg-panel);
	border: 1px solid var(--border-subtle);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	color: var(--text-main);
	font-size: 1rem;
}

.user-info {
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.user-name {
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.user-action {
	font-size: 0.8rem;
	color: var(--text-muted);
	text-decoration: none;
}

.user-action:hover {
	color: var(--text-main);
}

/* Main Content Area */
.app-main {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	position: relative;
	background-color: var(--bg-app);
}

/* Top Bar (inside main) */
.top-bar {
	min-height: var(--header-height);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 30px;
	border-bottom: 1px solid var(--border-subtle);
	background-color: var(--bg-glass);
	backdrop-filter: blur(10px);
}

.page-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--accent-color);
}

.search-bar {
	background: var(--bg-panel);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 8px 16px;
	width: 300px;
	color: var(--text-main);
	display: flex;
	align-items: center;
}

.search-bar input {
	background: transparent;
	border: none;
	color: inherit;
	width: 100%;
	margin-left: 8px;
	outline: none;
}

/* Email List */
.email-list-container {
	flex: 1;
	overflow-y: auto;
	padding: 20px 30px;
}

.email-card {
	display: grid;
	grid-template-columns: 50px 200px 1fr 100px 40px;
	align-items: center;
	background: var(--bg-panel);
	border: 1px solid var(--border-subtle);
	/* Constant subtle border */
	border-radius: var(--radius-md);
	padding: 16px;
	margin-bottom: 12px;
	text-decoration: none;
	color: inherit;
	transition: all 0.2s ease;
	cursor: pointer;
	position: relative;
}

.email-actions {
	display: flex;
	justify-content: center;
	align-items: center;
}

.btn-icon-delete {
	color: var(--text-muted);
	padding: 8px;
	border-radius: 50%;
	transition: all 0.2s;
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
}

.btn-icon-delete:hover {
	background: rgba(220, 38, 38, 0.15);
	color: #ef4444;
}

.highlight-target {
	animation: highlight-pulse 2s ease-out;
}

@keyframes highlight-pulse {
	0% {
		background-color: rgba(255, 255, 255, 0.2);
	}

	100% {
		background-color: var(--bg-panel);
	}
}

.email-card:hover {
	transform: translateY(-2px);
	border-color: var(--text-muted);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
	z-index: 1;
}

.email-card.unread {
	background: #252525;
	/* Slightly lighter than bg-panel */
	border-left: 3px solid var(--accent-color);
}

.email-card.unread .sender-name,
.email-card.unread .email-subject {
	font-weight: 700;
	color: var(--accent-color);
}

.email-avatar-small {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #2a2a2a;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.85rem;
	font-weight: 600;
	border: 1px solid var(--border-subtle);
}

.sender-name {
	font-weight: 500;
	color: var(--text-main);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.email-subject {
	color: var(--text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.email-time {
	text-align: right;
	font-size: 0.8rem;
	color: var(--text-dim);
}

/* Single View */
.view-container {
	padding: 40px;
	max-width: 900px;
	margin: 0 auto;
	width: 100%;
	overflow-y: auto;
	height: calc(100vh - var(--header-height));
	height: calc(100dvh - var(--header-height));
}

.view-header {
	margin-bottom: 30px;
	border-bottom: 1px solid var(--border-subtle);
	padding-bottom: 20px;
}

.view-subject {
	font-size: 1.8rem;
	font-weight: 700;
	margin-bottom: 15px;
	line-height: 1.3;
	color: var(--accent-color);
}

.view-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: var(--text-muted);
}

.view-sender {
	display: flex;
	align-items: center;
	gap: 12px;
}

.view-body {
	line-height: 1.7;
	font-size: 1.05rem;
	color: var(--text-main);
}

/* Compose */
.compose-container {
	padding: 40px;
	max-width: 95%;
	margin: 0 auto;
	width: 100%;
}

.compose-box {
	background: var(--bg-panel);
	border-radius: var(--radius-lg);
	border: 1px solid var(--border-subtle);
	padding: 30px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.input-group {
	margin-bottom: 20px;
}

.input-label {
	display: block;
	margin-bottom: 8px;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.modern-input {
	width: 100%;
	padding: 12px 16px;
	background: rgba(0, 0, 0, 0.2);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-sm);
	color: white;
	font-family: inherit;
	transition: border 0.2s;
}

.modern-input:focus {
	outline: none;
	border-color: var(--accent-color);
	background: rgba(0, 0, 0, 0.4);
}

.modern-textarea {
	resize: vertical;
	min-height: 300px;
}

.toolbar {
	display: flex;
	justify-content: flex-end;
	gap: 15px;
	margin-top: 20px;
}

/* Login alignment with dalp.ch header/footer */
.login-card-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: calc(100vh - 160px);
	/* Adjusting for header and footer approx height */
	padding: 20px;
}

.login-card {
	background: rgba(30, 30, 30, 0.9);
	backdrop-filter: blur(20px);
	border: 1px solid var(--border-subtle);
	padding: 40px;
	border-radius: 24px;
	width: 100%;
	max-width: 400px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
	text-align: center;
}


.login-logo {
	font-size: 2rem;
	font-weight: 800;
	margin-bottom: 10px;
	color: var(--accent-color);
}

.login-subtitle {
	color: var(--text-muted);
	margin-bottom: 30px;
}

/* Scrollbar */
::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background: #333;
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* Button variants */
.btn-primary {
	background: var(--accent-color);
	color: var(--bg-app);
	/* Black text on White button */
	border: none;
	padding: 12px 24px;
	border-radius: var(--radius-sm);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
}

.btn-primary:hover {
	background: #cccccc;
	box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.btn-ghost {
	background: transparent;
	color: var(--text-muted);
	border: 1px solid var(--border-subtle);
	padding: 10px 20px;
	border-radius: var(--radius-sm);
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s;
}

.btn-ghost:hover {
	color: white;
	border-color: white;
	background: rgba(255, 255, 255, 0.05);
}

/* Alerts */
.action-feedback {
	padding: 15px;
	border-radius: var(--radius-md);
	margin-bottom: 20px;
	text-align: center;
	font-weight: 500;
}

.feedback-error {
	border: 1px solid rgba(220, 38, 38, 0.5);
	background: rgba(220, 38, 38, 0.1);
	color: #f87171;
}

.feedback-success {
	border: 1px solid rgba(22, 163, 74, 0.5);
	background: rgba(22, 163, 74, 0.1);
	color: #4ade80;
}

/* Responsive */
/* Mobile Responsive */
.mobile-menu-btn {
	display: none;
	/* Hidden on desktop */
	background: transparent;
	border: 1px solid var(--border-subtle);
	color: var(--text-main);
	font-size: 1.2rem;
	cursor: pointer;
	margin-right: 15px;
	padding: 8px;
	border-radius: var(--radius-sm);
	line-height: 1;
}

.sidebar-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.7);
	z-index: 998;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s;
	backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
	opacity: 1;
	visibility: visible;
}

.close-sidebar-btn {
	display: none;
	position: absolute;
	top: 15px;
	right: 15px;
	background: transparent;
	border: none;
	color: var(--text-muted);
	font-size: 1.5rem;
	cursor: pointer;
}

@media (max-width: 768px) {
	.app-container {
		display: block;
		/* Stack */
	}

	.mobile-menu-btn {
		display: block;
	}

	/* Sidebar Drawer */
	.app-sidebar {
		display: flex;
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: 85%;
		/* Slightly less than full width */
		max-width: 300px;
		z-index: 999;
		transform: translateX(-100%);
		transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
		border-right: 1px solid var(--border-glass);
	}

	.app-sidebar.active {
		transform: translateX(0);
		box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
	}

	.close-sidebar-btn {
		display: block;
	}

	/* Adjust Main Content */
	.app-main {
		height: 100vh;
		height: 100dvh;
		width: 100%;
	}

	.top-bar {
		padding: 0 15px;
		justify-content: flex-start;
	}

	.page-title {
		font-size: 1.0rem;
		white-space: normal;
		overflow: visible;
		word-break: break-word;
		line-height: 1.2;
		padding: 5px 0;
	}

	.email-card {
		grid-template-columns: 1fr;
		gap: 5px;
		padding: 12px;
		position: relative;
	}

	.email-actions {
		position: absolute;
		top: 10px;
		right: 10px;
	}

	.email-avatar-small {
		display: none;
	}

	.sender-name {
		font-weight: 700;
		font-size: 1rem;
	}

	.email-subject {
		font-size: 0.95rem;
	}

	.email-time {
		text-align: left;
		font-size: 0.75rem;
		margin-top: 5px;
	}

	/* View/Compose specific */
	.view-container,
	.compose-container {
		padding: 20px;
	}

	.toolbar {
		flex-direction: column;
		gap: 10px;
	}

	.toolbar a,
	.toolbar button {
		width: 100%;
		text-align: center;
		justify-content: center;
	}

	.btn-secondary,
	.btn-danger,
	.btn-ghost,
	.btn-primary {
		width: 100%;
		text-align: center;
		display: block;
		box-sizing: border-box;
	}

	/* Hide top pagination on mobile */
	.pagination-top {
		display: none;
	}

	/* Specific override for header button on mobile */
	.top-bar .btn-ghost {
		width: auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 10px 14px;
		font-size: 1.2rem;
		margin-left: auto;
		flex-shrink: 0;
	}
}


.btn-secondary {
	background: #333;
	color: var(--text-main);
	border: 1px solid var(--border-subtle);
	padding: 12px 24px;
	border-radius: var(--radius-sm);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
}

.btn-secondary:hover {
	background: #444;
	border-color: var(--text-muted);
}

.btn-danger {
	background: rgba(220, 38, 38, 0.1);
	color: #f87171;
	border: 1px solid rgba(220, 38, 38, 0.3);
	padding: 12px 24px;
	border-radius: var(--radius-sm);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
}

.btn-danger:hover {
	background: rgba(220, 38, 38, 0.8);
	color: white;
	border-color: #ef4444;
}