.email-app {
	display: flex;
	flex-direction: column;
	height: 100vh;
	background: var(--surface, #fff);
}

.email-topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.email-topbar-left {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 140px;
}

.email-topbar-left h1 {
	margin: 0;
	font-size: 20px;
}

.email-home-icon {
	font-size: 18px;
	color: var(--muted, #6b7280);
}

.email-topbar-search {
	flex: 1;
}

.email-topbar-search .form-input {
	width: 100%;
	border-radius: 999px;
	padding-left: 16px;
}

.email-topbar-right {
	display: flex;
	align-items: center;
	gap: 10px;
}

.compose-btn {
	background: #7c3aed;
	border-color: #7c3aed;
}

.email-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 10px 20px;
	border-bottom: 1px solid var(--border-color, #e5e7eb);
	background: #fafafa;
}

.email-chip {
	background: #ede9fe;
	color: #6d28d9;
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
}

.mailbox-filter {
	min-width: 200px;
}

.toolbar-search {
	min-width: 180px;
	flex: 1;
}

.sync-filter {
	min-width: 150px;
}

.email-body {
	display: grid;
	grid-template-columns: 200px 340px 1fr;
	flex: 1;
	min-height: 0;
}

.email-sidebar {
	border-right: 1px solid var(--border-color, #e5e7eb);
	padding: 12px 0;
	background: #fcfcfc;
}

.sidebar-section-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted, #6b7280);
	padding: 8px 16px 4px;
}

.sidebar-item {
	padding: 10px 16px;
	cursor: pointer;
	font-size: 14px;
	border-left: 3px solid transparent;
}

.sidebar-item:hover {
	background: #f3f4f6;
}

.sidebar-item.active {
	background: #ede9fe;
	border-left-color: #7c3aed;
	color: #5b21b6;
	font-weight: 600;
}

.sidebar-divider {
	height: 1px;
	background: var(--border-color, #e5e7eb);
	margin: 8px 0;
}

.sidebar-settings {
	margin-top: 8px;
}

.email-list-pane,
.email-preview-pane {
	display: flex;
	flex-direction: column;
	min-height: 0;
	border-right: 1px solid var(--border-color, #e5e7eb);
}

.email-preview-pane {
	border-right: none;
}

.pane-header {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--muted, #6b7280);
	padding: 12px 16px;
	border-bottom: 1px solid var(--border-color, #e5e7eb);
	background: #fafafa;
}

.email-list-rows {
	overflow-y: auto;
	flex: 1;
}

.email-row {
	padding: 12px 16px;
	border-bottom: 1px solid var(--border-color, #eef0f2);
	cursor: pointer;
}

.email-row:hover {
	background: #f9fafb;
}

.email-row.active {
	background: #ede9fe;
	border-left: 3px solid #7c3aed;
}

.email-row-subject {
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.email-row-meta {
	font-size: 12px;
	color: var(--muted, #6b7280);
}

.email-preview-body {
	padding: 20px;
	overflow-y: auto;
	flex: 1;
}

.empty-preview {
	color: var(--muted, #6b7280);
	padding: 40px 16px;
	text-align: center;
}

.preview-badge {
	display: inline-block;
	font-size: 11px;
	text-transform: uppercase;
	background: #e5e7eb;
	color: #374151;
	padding: 3px 8px;
	border-radius: 4px;
	margin-bottom: 10px;
}

.preview-badge.client {
	background: #dbeafe;
	color: #1d4ed8;
}

.preview-subject {
	font-size: 18px;
	font-weight: 700;
	margin: 8px 0 12px;
}

.preview-meta {
	font-size: 13px;
	color: var(--muted, #6b7280);
	margin-bottom: 16px;
}

.preview-body {
	line-height: 1.6;
	font-size: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}

.conversation-thread .thread-message {
	border: 1px solid var(--border-color, #e5e7eb);
	border-radius: 10px;
	padding: 14px;
	margin-bottom: 12px;
	background: #fafafa;
}

.thread-message.incoming {
	border-left: 4px solid #3b82f6;
}

.thread-message.outgoing {
	border-left: 4px solid #7c3aed;
}

.settings-layout {
	max-width: 900px;
	margin: 0 auto;
	padding: 20px;
}

.settings-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.settings-header h2 {
	margin: 0;
	flex: 1;
}

.settings-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

.mailbox-card {
	border: 1px solid var(--border-color, #e5e7eb);
	border-radius: 10px;
	padding: 14px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.mailbox-card-title {
	font-weight: 600;
}

.mailbox-card-sub {
	font-size: 12px;
	color: var(--muted, #6b7280);
	margin-top: 4px;
}

.settings-form {
	border: 1px solid var(--border-color, #e5e7eb);
	border-radius: 12px;
	padding: 18px;
}

.settings-form.hidden {
	display: none;
}

.settings-form-actions {
	display: flex;
	gap: 10px;
	margin-top: 14px;
}

.settings-form-status {
	margin-top: 10px;
	font-size: 13px;
	color: var(--muted, #6b7280);
}

@media (max-width: 960px) {
	.email-body {
		grid-template-columns: 1fr;
	}
	.email-sidebar {
		display: none;
	}
}
