@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700&display=swap");

* {
	box-sizing: border-box;
	font-family: "Lexend", system-ui, -apple-system, sans-serif;
}

:root {
	--bg: #18181b;
	--surface: #18181b;
	--surface-2: #1e1e24;
	--border: #2a2a32;
	--text: #e4e4e7;
	--text-muted: #71717a;
	--accent: #a78bfa;
	--accent-dim: rgba(167, 139, 250, 0.12);
	--accent-glow: rgba(167, 139, 250, 0.2);
}

body {
	margin: 0;
	font-family: "Lexend", system-ui, -apple-system, sans-serif;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	line-height: 1.5;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background: radial-gradient(80% 50% at 50% -20%, var(--accent-glow), transparent);
	pointer-events: none;
	z-index: 0;
}

.noscript-content {
	max-width: 700px;
	margin: 2rem auto;
	padding: 1.5rem 1.25rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
}

.noscript-content h1 { font-size: 1.5rem; margin: 0 0 0.75rem; color: var(--text); }
.noscript-content h2 { font-size: 1.125rem; margin: 1.25rem 0 0.5rem; color: var(--text); }
.noscript-content h3 { font-size: 1rem; margin: 1rem 0 0.375rem; color: var(--text); }
.noscript-content p, .noscript-content ul, .noscript-content ol { margin: 0 0 0.75rem; font-size: 0.9375rem; color: var(--text-muted); }
.noscript-content ul, .noscript-content ol { padding-left: 1.5rem; }
.noscript-content li { margin-bottom: 0.25rem; }

#app {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--border);
	background: var(--bg);
}

.logo {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
	font-size: 1.125rem;
	color: var(--text);
	text-decoration: none;
}

.nav .logo-icon {
	width: 1.75rem;
	height: 1.75rem;
	color: var(--accent);
	flex-shrink: 0;
}

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

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

.nav-link:hover {
	color: var(--accent);
}

.nav-link-with-icon {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.nav-link-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.inbox-page .nav,
.inbox-page .footer {
	display: none;
}

#main {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 2rem 1rem;
}

#main:has(.inbox-layout) {
	align-items: stretch;
	justify-content: flex-start;
	padding: 0;
	min-height: 0;
	overflow: hidden;
}

.hero {
	text-align: center;
	margin-bottom: 2.5rem;
}

.hero h1 {
	font-size: clamp(1.5rem, 4vw, 2.25rem);
	font-weight: 700;
	margin: 0 0 0.5rem;
	letter-spacing: -0.02em;
}

.hero h1 .highlight { color: var(--accent); }
.hero p { margin: 0; font-size: 0.9375rem; color: var(--text-muted); }

/* Create inbox form (Scalar-style) */
.inbox-form {
	width: 100%;
	max-width: 32rem;
}

.inbox-form-card {
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	padding: 1.5rem 1.75rem;
}

.inbox-form-title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 0.25rem;
	color: var(--text);
}

.inbox-form-desc {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin: 0 0 1.25rem;
	line-height: 1.45;
}

.inbox-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	margin-bottom: 1rem;
}

.inbox-form-group {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.inbox-form-group-full {
	grid-column: 1 / -1;
	margin-bottom: 0;
}

.inbox-form-label {
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--text-muted);
}

.inbox-form-input-wrap {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.inbox-form-input {
	flex: 1;
	min-width: 0;
	height: 2.5rem;
	padding: 0 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 0.875rem;
	font-family: ui-monospace, monospace;
}

.inbox-form-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent-dim);
}

.inbox-form-select-wrap {
	position: relative;
}

.inbox-form-select {
	width: 100%;
	height: 2.5rem;
	padding: 0 2rem 0 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 0.875rem;
	font-family: ui-monospace, monospace;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
}

.inbox-form-select:focus {
	outline: none;
	border-color: var(--accent);
}

.inbox-form-email {
	flex: 1;
	min-width: 0;
	height: 2.5rem;
	padding: 0 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-2);
	color: var(--text);
	font-size: 0.875rem;
	font-family: ui-monospace, monospace;
	display: flex;
	align-items: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.inbox-form-icon-btn {
	width: 2.5rem;
	height: 2.5rem;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-2);
	color: var(--text-muted);
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.inbox-form-icon-btn:hover {
	border-color: var(--accent);
	color: var(--accent);
}

@keyframes icon-spin {
	to { transform: rotate(360deg); }
}
.inbox-form-icon-btn.icon-refresh-spin svg {
	display: inline-block;
	animation: icon-spin 0.6s linear infinite;
}

.inbox-form-icon-btn-accent {
	background: var(--accent-dim);
	border-color: var(--accent-dim);
	color: var(--accent);
}

.inbox-form-icon-btn-accent:hover {
	background: rgba(167, 139, 250, 0.22);
	border-color: var(--accent);
}

/* Copy success: green check (no alert/toast) */
.inbox-form-icon-btn.copy-success,
.btn-icon.copy-success,
.btn-icon-sidebar.copy-success {
	color: #22c55e;
	border-color: #22c55e;
	background: rgba(34, 197, 94, 0.15);
	animation: copy-blink 0.4s ease;
}
.inbox-form-icon-btn.copy-success:hover,
.btn-icon.copy-success:hover,
.btn-icon-sidebar.copy-success:hover {
	color: #22c55e;
	border-color: #22c55e;
}
@keyframes copy-blink {
	0% { opacity: 0.7; transform: scale(0.95); }
	50% { opacity: 1; transform: scale(1.05); }
	100% { opacity: 1; transform: scale(1); }
}

.inbox-form-actions {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.75rem;
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--border);
	align-items: center;
}

.inbox-form-actions .inbox-form-btn {
	white-space: nowrap;
	flex: 1 1 0;
	min-width: 0;
}

.inbox-form-actions .inbox-form-btn svg {
	flex-shrink: 0;
}

.inbox-form-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	height: 2.5rem;
	padding: 0 1rem;
	box-sizing: border-box;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.inbox-form-btn-primary {
	background: var(--accent);
	color: #fff;
}

.inbox-form-btn-primary:hover {
	background: #8b5cf6;
}

.inbox-form-btn-secondary {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
}

.inbox-form-btn-secondary:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.inbox-form-btn.copy-success {
	color: #22c55e;
	border-color: #22c55e;
	background: rgba(34, 197, 94, 0.15);
}

/* Modal: janela para adicionar domínio */
.modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	opacity: 1;
	visibility: visible;
	transition: opacity 0.2s, visibility 0.2s;
}

.modal.modal--hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

.modal-box {
	position: relative;
	width: 100%;
	max-width: 32rem;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.25rem 1.5rem;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 1rem;
	color: var(--text);
}

.modal-body {
	margin-bottom: 1.25rem;
}

.modal-body.inbox-form-card-fields .inbox-form-grid {
	gap: 0.75rem;
}

.modal-body.inbox-form-card-fields .inbox-form-subdomain-wrap {
	margin-top: 0.75rem;
}

.modal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: flex-end;
}

/* Shared button/input styles (used elsewhere) */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.625rem 1.25rem;
	font-size: 0.9375rem;
	font-weight: 500;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
	background: linear-gradient(180deg, var(--accent), #8b5cf6);
	color: #fff;
}

.btn-primary:hover {
	background: linear-gradient(180deg, #a78bfa, var(--accent));
}

.btn-secondary {
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid var(--border);
}

.btn-secondary:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.btn-outline {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
}

.btn-outline:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.btn-icon {
	width: 2.75rem;
	height: 2.75rem;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-2);
	color: var(--text-muted);
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s;
}

.btn-icon:hover {
	color: var(--accent);
	border-color: var(--accent);
}

.loading, .error {
	text-align: center;
	padding: 2rem;
	color: var(--text-muted);
}

.error { color: #f87171; }

.api-offline-card {
	width: 100%;
	max-width: 100%;
	min-height: min(70vh, 480px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 3rem 2rem;
	background: rgba(185, 28, 28, 0.18);
	border: 1px solid #dc2626;
	border-radius: 16px;
	text-align: center;
	box-sizing: border-box;
}
.api-offline-header {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-bottom: 1rem;
}
.api-offline-header .api-offline-icon-svg {
	width: 48px;
	height: 48px;
	color: #dc2626;
	flex-shrink: 0;
}
.api-offline-title {
	margin: 0;
	font-size: clamp(1.25rem, 3vw, 1.75rem);
	font-weight: 600;
	color: #dc2626;
}
.api-offline-desc {
	margin: 0 0 2rem;
	max-width: 32rem;
	font-size: clamp(0.9375rem, 2vw, 1.125rem);
	line-height: 1.6;
	color: var(--text);
}
.api-offline-btn {
	padding: 0.75rem 2rem;
	font-size: 1rem;
	font-family: inherit;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-2);
	color: var(--text);
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}
.api-offline-btn:hover {
	background: var(--surface);
	border-color: var(--text-muted);
}

/* Container do card ocupa a área disponível (inbox) */
#inbox-content:has(.api-offline-card) {
	flex: 1;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	min-height: 0;
	padding: 1.5rem;
}
#inbox-content:has(.api-offline-card) .api-offline-card {
	flex: 1;
	min-height: 200px;
}

/* Hero na home: card ocupa espaço grande */
.hero:has(.api-offline-card) {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	padding: 2rem 1.5rem;
}
.hero:has(.api-offline-card) .api-offline-card {
	min-height: 320px;
}

/* Inbox layout */
.inbox-layout {
	display: flex;
	width: 100%;
	min-height: 100vh;
	min-width: 0;
	flex: 1;
	align-self: stretch;
}

.inbox-sidebar {
	width: 280px;
	flex-shrink: 0;
	min-height: 100%;
	border-right: 1px solid var(--border);
	background: var(--surface);
	display: flex;
	flex-direction: column;
}

.sidebar-logo-wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.sidebar-body {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	padding: 1rem;
	flex: 1;
	min-height: 0;
}

.sidebar-logo {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
	font-size: 1.125rem;
	color: var(--text);
	text-decoration: none;
	transition: color 0.15s;
}

.sidebar-logo:hover { color: var(--accent); }

.sidebar-logo svg,
.sidebar-logo .logo-box-icon { flex-shrink: 0; }

.sidebar-logo .logo-box-icon { color: var(--accent); }
.sidebar-logo:hover .logo-box-icon { color: var(--accent); }

.logo-box-icon { width: 1.75rem; height: 1.75rem; }

.sidebar-logo-text {
	font-size: 1.125rem;
	line-height: 1;
}

.btn-new-inbox {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.75rem 1.25rem;
	border-radius: 8px;
	font-weight: 600;
	font-size: 0.9375rem;
	color: #fff;
	background: var(--accent);
	border: none;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, filter 0.15s;
}

.btn-new-inbox:hover {
	background: #8b5cf6;
	filter: brightness(1.05);
}

.btn-new-inbox svg { flex-shrink: 0; }

.sidebar-current {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.sidebar-label {
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--text-muted);
}

.sidebar-email-card {
	width: 100%;
	padding: 0.75rem;
	border-radius: 8px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.sidebar-email-block {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	min-width: 0;
}

.sidebar-email {
	flex: 1;
	min-width: 0;
	font-family: ui-monospace, monospace;
	font-size: 0.875rem;
	color: var(--text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sidebar-email-block .btn-icon-sidebar,
.sidebar-email-block .btn-icon {
	flex-shrink: 0;
	width: 2rem;
	height: 2rem;
	border-radius: 6px;
	background: transparent;
	border: none;
	color: var(--text-muted);
}

.sidebar-email-block .btn-icon-sidebar:hover,
.sidebar-email-block .btn-icon:hover { color: var(--accent); }

.sidebar-count {
	font-size: 0.75rem;
	color: var(--text-muted);
	padding-left: 0;
}

.sidebar-email-card .sidebar-count { margin-top: 0; }

.sidebar-actions {
	display: flex;
	flex-direction: row;
	gap: 0.5rem;
}

.sidebar-actions .btn {
	flex: 1;
	min-width: 0;
	justify-content: center;
	padding: 0.5rem 0.75rem;
	font-size: 0.8125rem;
	border-radius: 8px;
	min-height: 2rem;
}

.btn-sidebar {
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid var(--border);
}

.btn-sidebar:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.btn-danger {
	flex: 1;
	min-width: 0;
	justify-content: center;
	border-radius: 8px;
	min-height: 2rem;
	background: rgba(239, 68, 68, 0.25);
	color: #fca5a5;
	border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
	background: rgba(239, 68, 68, 0.35);
	color: #fecaca;
}

.btn-danger:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.btn-danger:disabled:hover {
	background: rgba(239, 68, 68, 0.25);
	color: #fca5a5;
}


.inbox-form-subdomain-wrap {
	margin-top: 0.5rem;
	margin-bottom: 0.25rem;
}

.sidebar-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 1rem;
	cursor: pointer;
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-top: 0.5rem;
	padding-top: 0.5rem;
	padding-bottom: 0.25rem;
}

.sidebar-toggle .toggle-label { user-select: none; }

.sidebar-toggle .toggle-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}

.sidebar-toggle input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-slider {
	width: 36px;
	height: 20px;
	background: var(--border);
	border-radius: 10px;
	position: relative;
	transition: background 0.2s;
	display: block;
}

.toggle-slider::before {
	content: "";
	position: absolute;
	width: 16px;
	height: 16px;
	left: 2px;
	top: 2px;
	background: var(--text-muted);
	border-radius: 50%;
	transition: transform 0.2s, background 0.2s;
}

.sidebar-toggle input:checked + .toggle-slider { background: var(--accent-dim); }
.sidebar-toggle input:checked + .toggle-slider::before {
	transform: translateX(16px);
	background: var(--accent);
}

.sidebar-my-inboxes {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-top: 1rem;
}

.sidebar-my-inboxes .sidebar-label {
	display: block;
	margin-bottom: 0;
}

.sidebar-inbox-card {
	width: 100%;
	padding: 0.5rem 0.75rem;
	border-radius: 8px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	min-height: 2.5rem;
}

.sidebar-inbox-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	max-height: 12rem;
	overflow-y: auto;
}

.sidebar-inbox-list-item {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	min-width: 0;
}

.sidebar-inbox-list-link {
	font-size: 0.75rem;
	color: var(--text-muted);
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	min-width: 0;
	transition: color 0.15s;
}

.sidebar-inbox-list-link:hover {
	color: var(--accent);
}

.sidebar-inbox-list-remove {
	flex-shrink: 0;
	width: 1.25rem;
	height: 1.25rem;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.sidebar-inbox-list-remove svg {
	width: 1rem;
	height: 1rem;
}

.sidebar-inbox-list-remove:hover {
	color: var(--accent);
	background: var(--border);
}

.sidebar-footer {
	margin-top: auto;
	padding: 1rem;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-top: 1px solid var(--border);
	box-sizing: border-box;
	font-size: 0.8125rem;
}

.sidebar-footer-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.sidebar-link {
	font-size: inherit;
	color: var(--text-muted);
	text-decoration: none;
	transition: color 0.15s;
}

.sidebar-link:hover { color: var(--accent); }

.sidebar-link-with-icon {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.sidebar-link-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.sidebar-footer-sep {
	font-size: inherit;
	color: var(--text-muted);
	opacity: 0.6;
}

/* Mobile: header with hamburger + logo (hidden on desktop) */
.inbox-mobile-header {
	display: none;
}

.inbox-sidebar-backdrop {
	display: none;
}

@media (max-width: 640px) {
	.inbox-layout { flex-direction: column; }
	.inbox-mobile-header {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.75rem 1rem;
		border-bottom: 1px solid var(--border);
		background: var(--surface);
		flex-shrink: 0;
	}

	.inbox-mobile-menu-btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.5rem;
		height: 2.5rem;
		padding: 0;
		border: none;
		border-radius: 8px;
		background: transparent;
		color: var(--text);
		cursor: pointer;
		transition: background 0.15s, color 0.15s;
	}

	.inbox-mobile-menu-btn:hover {
		background: var(--surface-2);
		color: var(--accent);
	}

	.inbox-mobile-logo {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		font-weight: 700;
		font-size: 1.125rem;
		color: var(--text);
		text-decoration: none;
	}

	.inbox-mobile-logo .logo-box-icon {
		width: 1.75rem;
		height: 1.75rem;
		color: var(--accent);
	}

	/* Sidebar: off-canvas on mobile, open with class */
	.inbox-sidebar {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		width: 280px;
		max-width: 85vw;
		z-index: 101;
		transform: translateX(-100%);
		transition: transform 0.25s ease-out;
		box-shadow: none;
		flex-direction: column;
		flex-wrap: nowrap;
		border-right: 1px solid var(--border);
	}

	.inbox-layout.sidebar-open .inbox-sidebar {
		transform: translateX(0);
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
	}

	.inbox-sidebar-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: 100;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease-out;
	}

	.inbox-layout.sidebar-open .inbox-sidebar-backdrop {
		opacity: 1;
		pointer-events: auto;
	}

	.sidebar-body { flex-direction: column; flex-wrap: nowrap; }
	.sidebar-current { width: auto; }
	.sidebar-actions { flex-direction: row; width: auto; }
	.sidebar-toggle { width: auto; margin-top: 0.5rem; padding-top: 0.5rem; }
	.sidebar-footer { flex-direction: row; width: auto; }
	.btn-new-inbox { width: 100%; }
}

@media (max-width: 480px) {
	.inbox-form-grid {
		grid-template-columns: 1fr;
	}
}

.inbox-main-wrap {
	flex: 1;
	min-width: 0;
	min-height: 0;
	width: 100%;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.inbox-main-content {
	flex: 1;
	min-height: 0;
	min-width: 0;
	overflow: auto;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
}

#inbox-content {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

#inbox-content:has(.empty-icon-wrap) {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 4rem 2rem;
	min-height: 0;
	box-sizing: border-box;
}

#inbox-content:has(.email-detail) {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding: 0;
	overflow: hidden;
}

#inbox-content:has(.email-list-wrap) {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding: 0;
	overflow: hidden;
}

.inbox-footer {
	flex-shrink: 0;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	text-align: center;
	padding: 1rem;
	border-top: 1px solid var(--border);
	background: var(--bg);
	color: var(--text-muted);
	font-size: 0.8125rem;
}

.inbox-footer p {
	margin: 0;
	max-width: 100%;
}

.inbox-main-header {
	flex-shrink: 0;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
}

@media (min-width: 640px) {
	.inbox-main-header {
		padding: 1.5rem 1.5rem;
	}
}

.inbox-main-wrap:has(.email-detail) .inbox-main-header,
.inbox-main-wrap:has(.email-detail) .inbox-footer {
	display: none;
}

.inbox-main-wrap:has(.email-detail) .inbox-main-content,
.inbox-main-wrap:has(.email-list-wrap) .inbox-main-content {
	padding: 0;
}

.inbox-main-header-top {
	margin-bottom: 1rem;
}

.inbox-main-header h1 {
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0 0 0.125rem;
	letter-spacing: -0.02em;
	color: var(--text);
}

.inbox-subtitle {
	font-size: 0.875rem;
	color: var(--text-muted);
	margin: 0;
}

.inbox-address-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.inbox-address-code {
	flex: 1;
	min-width: 0;
	display: block;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-2);
	color: var(--text);
	font-size: 0.875rem;
	font-family: ui-monospace, monospace;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.inbox-address-row .btn-icon {
	width: 2.25rem;
	height: 2.25rem;
	flex-shrink: 0;
	border-radius: 8px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text-muted);
}

.inbox-address-row .btn-icon:hover {
	background: var(--surface);
	border-color: var(--border);
	color: var(--accent);
}

.inbox-address-row .btn-icon.copy-success {
	color: #22c55e;
	border-color: #22c55e;
	background: rgba(34, 197, 94, 0.15);
}

/* Lista de emails – estilo Driftz: header "X Message(s)" + itens com avatar */
.email-list-wrap {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
}

.email-list-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	color: var(--text-muted);
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.email-list-header-icon {
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
}

.email-list {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: auto;
}

.email-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	width: 100%;
	padding: 0.75rem 1rem;
	text-align: left;
	background: transparent;
	border: none;
	border-bottom: 1px solid var(--border);
	color: var(--text);
	font-family: inherit;
	font-size: inherit;
	cursor: pointer;
	transition: background 0.15s;
}

.email-item:hover {
	background: var(--surface-2);
}

.email-item:focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--accent);
}

.email-item-avatar {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 8px;
	background: var(--accent);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	font-weight: 500;
}

.email-item-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.email-item-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.email-item-from {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.email-item-time {
	font-size: 0.75rem;
	color: var(--text-muted);
	flex-shrink: 0;
}

.email-item-subject {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.email-item-attachments {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.empty-icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 4rem;
	height: 4rem;
	border-radius: 8px;
	background: var(--surface-2);
	margin-bottom: 1rem;
	flex-shrink: 0;
}

.empty-icon-wrap .empty-icon,
.empty-icon-wrap svg {
	width: 2rem;
	height: 2rem;
	color: var(--text-muted);
}

#inbox-content .empty-title {
	font-size: 1.125rem;
	font-weight: 500;
	margin: 0 0 0.5rem;
	color: var(--text);
}

#inbox-content .empty-desc {
	font-size: 0.875rem;
	color: var(--text-muted);
	margin: 0;
	max-width: 24rem;
	line-height: 1.5;
}

#inbox-content .empty-email {
	color: var(--accent);
	font-family: ui-monospace, monospace;
	font-size: 0.875rem;
	font-weight: 500;
}

/* Email detail – Pataco Mail exact layout: topbar black, header black, body white */
.email-detail {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	max-width: 100%;
	padding: 0;
}

/* Top bar: só Back (como no Driftz oficial) */
.email-detail-topbar {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	padding: 0 1rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
	min-height: 60px;
}

.email-detail-back-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.5rem 0.75rem;
	margin-left: -0.5rem;
	color: var(--text-muted);
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: 6px;
	transition: color 0.15s, background 0.15s;
}
.email-detail-back-wrap:hover {
	color: var(--text);
	background: var(--surface-2);
}
.email-detail-back-wrap .back-arrow {
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
	margin-right: 0.25rem;
}

/* Header: avatar + from/to à esquerda; time + HTML/TXT + Delete à direita; assunto abaixo */
.email-detail-header {
	flex-shrink: 0;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--border);
}

.email-detail-header-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}

.email-detail-header-left {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	flex: 1;
	min-width: 0;
}

.email-detail-avatar {
	width: 48px;
	height: 48px;
	flex-shrink: 0;
	border-radius: 8px;
	background: var(--accent);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.125rem;
	font-weight: 500;
}

.email-detail-meta {
	flex: 1;
	min-width: 0;
}

.email-detail-from-line {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-bottom: 0.125rem;
}

.email-detail-from {
	font-weight: 600;
	color: var(--text);
	word-break: break-all;
}

.email-detail-from-address {
	font-size: 0.75rem;
	color: var(--text-muted);
	word-break: break-all;
}

.email-detail-to {
	font-size: 0.75rem;
	color: var(--text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.email-detail-header-right {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-shrink: 0;
	height: 2rem;
}

.email-detail-time {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.email-detail-time-desk {
	display: none;
}
@media (min-width: 640px) {
	.email-detail-time-desk {
		display: inline;
	}
}

.email-detail-time-mob {
	display: block;
	margin-top: 0.5rem;
	font-size: 0.75rem;
	color: var(--text-muted);
}
@media (min-width: 640px) {
	.email-detail-time-mob {
		display: none;
	}
}

/* Pills HTML/TXT: mesma altura e alinhamento que o botão Delete */
.email-view-pills {
	display: inline-flex;
	align-items: stretch;
	height: 2rem;
	padding: 2px;
	border-radius: 6px;
	border: 1px solid var(--border);
	background: var(--surface-2);
	box-sizing: border-box;
}

.email-view-pills .email-view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	padding: 0 0.625rem;
	font-size: 0.8125rem;
	font-family: ui-monospace, monospace;
	letter-spacing: 0.02em;
	border: none;
	border-radius: 4px;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	box-sizing: border-box;
}
.email-view-pills .email-view-btn:hover:not(:disabled) {
	color: var(--text);
}
.email-view-pills .email-view-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.email-view-pills .email-view-btn-active {
	background: var(--surface);
	color: var(--text);
}

.email-detail-delete {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 2rem;
	gap: 0.35rem;
	padding: 0 0.75rem;
	font-size: 0.8125rem;
	font-family: inherit;
	border: 1px solid rgba(239, 68, 68, 0.35);
	border-radius: 6px;
	background: rgba(239, 68, 68, 0.1);
	color: #f87171;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	box-sizing: border-box;
}
.email-detail-delete:hover {
	background: rgba(239, 68, 68, 0.2);
	color: #fca5a5;
	border-color: #ef4444;
}

.email-detail-subject {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--text);
	word-break: break-word;
	overflow: hidden;
	text-overflow: ellipsis;
}
@media (min-width: 640px) {
	.email-detail-subject {
		font-size: 1.5rem;
	}
}

/* Body: iframe branco (como no Driftz) */
.email-detail-body-wrap {
	flex: 1;
	min-height: 0;
	overflow: auto;
	display: flex;
	flex-direction: column;
}

.email-detail-body {
	flex: 1;
	min-height: 400px;
	display: flex;
	flex-direction: column;
	position: relative;
}

.email-body-content {
	min-height: 400px;
	width: 100%;
	box-sizing: border-box;
	flex: 1;
}

.email-body-txt {
	white-space: pre-wrap;
	word-break: break-word;
	color: var(--text);
	font-size: 0.9375rem;
	line-height: 1.6;
	padding: 1rem;
	background: var(--surface-2);
}

.email-body-html {
	white-space: normal;
	max-width: 100%;
	overflow: hidden;
	display: flex;
	flex: 1;
	min-height: 400px;
}

.email-body-html-iframe {
	width: 100%;
	min-height: 400px;
	flex: 1;
	border: none;
	background: #fff;
}
.email-body-html img {
	max-width: 100%;
	height: auto;
}
.email-body-html a {
	color: var(--accent);
}

.toast {
	position: fixed;
	bottom: 1.5rem;
	left: 50%;
	transform: translateX(-50%);
	padding: 0.5rem 1rem;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 8px;
	font-size: 0.875rem;
	z-index: 1000;
	animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.footer {
	text-align: center;
	padding: 1rem;
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 0.8125rem;
}

.footer p { margin: 0; }
