/* Enterprise-level color variables */
:root {
	--primary-blue: #0056b3;
	--primary-blue-dark: #004494;
	--_primary-blue-light: #0078d4;
	--secondary-blue: #106ebe;
	--accent-orange: #ff6b35;
	--accent-orange-hover: #e55a2b;
	--background-dark: #1a1a2e;
	--background-darker: #16213e;
	--background-light: #e8eaf6;
	--text-primary: #ffffff;
	--text-secondary: #b0b0c0;
	--text-muted: #6b7280;
	--border-color: #2d3748;
	--border-light: #e2e8f0;
	--success: #10b981;
	--warning: #f59e0b;
	--danger: #ef4444;
	--info: #3b82f6;
	--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
	--shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 5px 10px -5px rgba(0, 0, 0, 0.2);
}

body {
	background: linear-gradient(135deg, var(--background-darker) 0%, var(--background-dark) 100%);
	margin: 0px;
	min-height: 100vh;
}

body, td, a {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
	font-size: 9pt;
	color: var(--text-primary);
	line-height: 1.6;
}

a {
	text-decoration: none;
	color: var(--_primary-blue-light);
	transition: color 0.2s ease;
}

a:hover {
	color: #ffffff;
	text-decoration: underline;
}

#head a {
	color: #60a5fa;
	font-weight: 600;
	transition: color 0.2s ease;
}

#head a:hover {
	color: var(--accent-orange);
	text-decoration: none;
}

hr {
	border: 0px;
	border-top: 1px solid var(--border-color);
	height: 1px;
	margin: 20px 0;
}

.hr_big {
	border: 0px;
	border-top: 3px solid;
	border-image: linear-gradient(to right, var(--primary-blue), var(--secondary-blue)) 1;
	height: 1px;
	margin: 30px 0;
}

#head {
	background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
	padding: 20px 35px;
	color: #e2e8f0;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	border-bottom: 1px solid #334155;
}

#head::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-orange) 100%);
}

#head > img.logo {
	float: left;
	height: 44px;
	width: auto;
	margin-right: 24px;
	transition: transform 0.3s ease, opacity 0.3s ease;
	position: relative;
	z-index: 1;
	object-fit: contain;
	filter: invert(1) brightness(1.2);
}

#head > img.logo:hover {
	transform: scale(1.04);
	opacity: 0.85;
}

#head > .title {
	min-height: 44px;
	line-height: 1.4;
	vertical-align: baseline;
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
	z-index: 1;
}

#head > .title > div {
	font-size: 10pt;
	padding: 2px 0;
	color: #94a3b8;
}

#head > .title > div:first-child {
	font-weight: 700;
	font-size: 14pt;
	color: #f1f5f9;
	letter-spacing: -0.3px;
}

.header-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 12px;
	z-index: 1;
}

.header-nav {
	display: flex;
	align-items: center;
	gap: 8px;
}

.header-nav .nav-link {
	color: #94a3b8;
	padding: 6px 14px;
	border-radius: 6px;
	font-size: 9pt;
	font-weight: 500;
	transition: all 0.2s ease;
	text-decoration: none;
}

.header-nav .nav-link:hover {
	color: #e2e8f0;
	background: rgba(255, 255, 255, 0.08);
	text-decoration: none;
}

.language-switcher {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #94a3b8;
	font-size: 8.5pt;
}

.language-switcher::before {
	content: "🌐";
	font-size: 14px;
}

.header-actions select {
	background: transparent;
	border: none;
	border-bottom: 1px solid transparent;
	color: #e2e8f0;
	padding: 4px 8px;
	font-size: 9pt;
	cursor: pointer;
	transition: all 0.2s ease;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0 center;
	padding-right: 18px;
}

.header-actions select:hover {
	border-bottom-color: #64748b;
	color: #fff;
}

.header-actions select:focus {
	outline: none;
	border-bottom-color: var(--_primary-blue-light);
}

.header-actions select option {
	background: #1e293b;
	color: #e2e8f0;
	padding: 8px;
}

.header-divider {
	width: 1px;
	height: 24px;
	background: linear-gradient(180deg, transparent 0%, #475569 50%, transparent 100%);
}

.btn-logout {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	color: #94a3b8;
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 8.5pt;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.25s ease;
	border: 1px solid transparent;
}

.btn-logout::before {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	transition: all 0.25s ease;
}

.btn-logout:hover {
	background: rgba(239, 68, 68, 0.1);
	color: #f87171;
	text-decoration: none;
	border-color: rgba(239, 68, 68, 0.3);
}

.btn-logout:hover::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f87171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}

.block {
	overflow: hidden;
	padding: 30px;
	margin: 20px 30px;
	background: rgba(255, 255, 255, 0.03);
	border-radius: 12px;
	border: 1px solid var(--border-color);
	backdrop-filter: blur(10px);
	box-shadow: var(--shadow);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.block:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
}

.block_title {
	font-family: inherit;
	font-size: 13pt;
	font-weight: 600;
	line-height: 2em;
	color: var(--text-primary);
	border-bottom: 2px solid;
	border-image: linear-gradient(to right, var(--primary-blue), transparent) 1;
	margin-bottom: 15px;
	padding-bottom: 10px;
	display: flex;
	align-items: center;
}

.block_title::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 20px;
	background: linear-gradient(to bottom, var(--primary-blue), var(--_primary-blue-light));
	margin-right: 12px;
	border-radius: 2px;
}

.pairs {
	width: 48%;
	float: left;
	margin-right: 2%;
}

.pairs:last-child {
	margin-right: 0;
}

.pairs::after {
	content: '';
	display: table;
	clear: both;
}

.pairs > .pair {
	padding: 12px 0;
	border-top: 1px solid var(--border-color);
	display: flex;
	align-items: flex-start;
	transition: background-color 0.2s ease;
}

.pairs > .pair:hover {
	background-color: rgba(255, 255, 255, 0.05);
}

.pairs > .pair > .key {
	display: inline-block;
	min-width: 200px;
	margin-right: 15px;
	color: var(--text-secondary);
	font-weight: 500;
	vertical-align: top;
	white-space: pre-wrap;
}

.pairs > .pair > .value {
	display: inline-block;
	flex: 1;
	vertical-align: top;
	white-space: pre-wrap;
	padding-right: 15px;
	color: var(--text-primary);
}

.buttons {
	white-space: nowrap;
	margin: 15px 0;
}

.button {
	display: inline-block;
	text-decoration: none;
	color: var(--text-primary);
	background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
	padding: 8px 20px;
	border-radius: 6px;
	font-weight: 500;
	font-family: inherit;
	font-size: inherit;
	border: none;
	box-shadow: var(--shadow);
	margin-right: 10px;
	margin-bottom: 10px;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
	text-decoration: none;
	background: linear-gradient(135deg, var(--_primary-blue-light) 0%, var(--primary-blue) 100%);
	color: #fff;
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
}

.button:active {
	transform: translateY(0);
}

iframe.message_preview {
	border: 2px solid var(--border-color);
	margin: 30px;
	width: calc(100% - 60px);
	height: 1000px;
	border-radius: 8px;
	box-shadow: var(--shadow);
}

/* Professional Email Viewer */
.email-viewer {
	padding: 0;
	overflow: hidden;
}

.email-viewer:hover {
	transform: none;
}

.email-viewer-header {
	background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
	border-bottom: 1px solid var(--border-color);
	padding: 20px 25px;
}

.email-meta {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.email-subject-line {
	display: flex;
	align-items: center;
	gap: 12px;
}

.email-icon {
	font-size: 24px;
	line-height: 1;
}

.email-subject {
	margin: 0;
	font-size: 15pt;
	font-weight: 600;
	color: #f1f5f9;
	line-height: 1.3;
}

.email-addresses {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	font-size: 9pt;
}

.email-addresses > div {
	display: flex;
	gap: 6px;
}

.email-addresses .label {
	color: #64748b;
	font-weight: 500;
}

.email-addresses .value {
	color: #e2e8f0;
}

.email-addresses .value strong {
	color: var(--_primary-blue-light);
}

.email-attachments {
	margin-top: 20px;
	padding-top: 15px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.attachments-header .attachment-icon {
	font-size: 16px;
}

.attachments-label {
	color: #94a3b8;
	font-size: 9pt;
	font-weight: 500;
}

.attachments-list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.attachment-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 6px;
	padding: 8px 14px;
	font-size: 8.5pt;
	color: #e2e8f0;
	transition: all 0.2s ease;
}

.attachment-item:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: var(--_primary-blue-light);
	cursor: default;
}

.attachment-item .attachment-icon {
	font-size: 16px;
	line-height: 1;
}

.attachment-item .attachment-name {
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.email-body-container {
	background: #fff;
	min-height: 500px;
	max-height: 800px;
	overflow: hidden;
}

.email-body-frame {
	width: 100%;
	height: 600px;
	border: none;
	background: #fff;
	display: block;
}

.email-viewer-footer {
	background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
	border-top: 1px solid var(--border-color);
	padding: 12px 25px;
	display: flex;
	justify-content: flex-end;
	align-items: center;
}

.view-options {
	display: flex;
	gap: 8px;
}

.btn-view-option {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #94a3b8;
	padding: 6px 16px;
	border-radius: 4px;
	font-size: 8.5pt;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
}

.btn-view-option:hover {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.3);
	color: #e2e8f0;
}

.btn-view-option.active {
	background: var(--primary-blue);
	border-color: var(--primary-blue);
	color: #fff;
}

.tableMessages {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	margin: 15px 0;
}

.tableMessages thead {
	background: linear-gradient(135deg, var(--primary-blue-dark) 0%, var(--secondary-blue) 100%);
}

.tableMessages th {
	white-space: nowrap;
	font-size: 9pt;
	font-weight: 600;
	text-align: left;
	color: var(--text-primary);
	padding: 14px 18px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border: none;
}

.tableMessages th:first-child {
	border-top-left-radius: 8px;
}

.tableMessages th:last-child {
	border-top-right-radius: 8px;
}

.tableMessages td {
	vertical-align: top;
	border-left: 1px solid var(--border-color);
	border-top: 1px solid var(--border-color);
	padding: 12px 18px;
	min-width: 70px;
	color: var(--text-secondary);
	background: rgba(255, 255, 255, 0.02);
	transition: background-color 0.2s ease;
}

.tableMessages tr:hover td {
	color: var(--text-primary);
	background: rgba(0, 86, 179, 0.08);
}

.tableMessages td:first-child {
	border-left: none;
}

.tableMessages tr:last-child td:first-child {
	border-bottom-left-radius: 8px;
}

.tableMessages tr:last-child td:last-child {
	border-bottom-right-radius: 8px;
}

.tableMessages tr:last-child td {
	border-bottom: 1px solid var(--border-color);
}

.tableMessages td:last-child {
	border-right: none;
}

/* Status badge styles */
.status-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 8pt;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.status-badge.success {
	background: linear-gradient(135deg, #10b981, #059669);
	color: white;
}

.status-badge.warning {
	background: linear-gradient(135deg, #f59e0b, #d97706);
	color: white;
}

.status-badge.danger {
	background: linear-gradient(135deg, #ef4444, #dc2626);
	color: white;
}

.status-badge.info {
	background: linear-gradient(135deg, #3b82f6, #2563eb);
	color: white;
}

/* Priority indicators */
.priority-immediate {
	color: var(--accent-orange);
	font-weight: 600;
}

.priority-high {
	color: var(--warning);
	font-weight: 600;
}

.priority-normal {
	color: var(--info);
}

.priority-low {
	color: var(--text-muted);
}

/* Warning/incidence row styles */
td[ colspan] {
	background: rgba(239, 68, 68, 0.1);
	color: var(--danger);
	font-weight: 500;
}

td[ colspan] img {
	margin-right: 8px;
	vertical-align: middle;
}

/* Navigation links */
.nav-back {
	display: inline-block;
	margin-bottom: 15px;
}

/* Animation and transitions */
@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.block {
	animation: fadeIn 0.3s ease-out;
}

/* Improved button styles for different actions */
.button.block {
	background: linear-gradient(135deg, var(--danger), #dc2626);
}

.button.block:hover {
	background: linear-gradient(135deg, #dc2626, #c5302b);
}

.button.cancel {
	background: linear-gradient(135deg, var(--warning), #d97706);
}

.button.cancel:hover {
	background: linear-gradient(135deg, #d97706, #ca6a04);
}

.button.requeue {
	background: linear-gradient(135deg, var(--success), #059669);
}

.button.requeue:hover {
	background: linear-gradient(135deg, #059669, #047857);
}

.highlight-number {
	color: var(--accent-orange);
	font-size: 1.1em;
	font-weight: 600;
}

/* Table row states */
.tableMessages tr.success-row:hover td {
	background: rgba(16, 185, 129, 0.1);
}

.tableMessages tr.warning-row:hover td {
	background: rgba(245, 158, 11, 0.1);
}

.tableMessages tr.danger-row:hover td {
	background: rgba(239, 68, 68, 0.1);
}

/* Scrollbar styling */
::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

::-webkit-scrollbar-track {
	background: var(--background-darker);
}

::-webkit-scrollbar-thumb {
	background: linear-gradient(to bottom, var(--primary-blue), var(--primary-blue-dark));
	border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(to bottom, var(--_primary-blue-light), var(--primary-blue));
}

/* Responsive adjustments */
@media (max-width: 768px) {
	#head {
		flex-direction: column;
		text-align: center;
		padding: 20px;
	}

	#head > img.logo {
		float: none;
		margin-bottom: 15px;
	}

	#head > .title {
		align-items: center;
	}

	.pair {
		flex-direction: column;
	}

	.pairs {
		width: 100%;
		float: none;
		margin-bottom: 20px;
	}

	.pairs > .pair > .key {
		min-width: auto;
		margin-bottom: 5px;
	}

	.block {
		margin: 10px 15px;
		padding: 20px;
	}

	.tableMessages {
		display: block;
		overflow-x: auto;
		border-radius: 8px;
	}

	.button {
		display: block;
		width: 100%;
		margin-right: 0;
		margin-bottom: 8px;
	}
}

@media (max-width: 480px) {
	#head > .title > div {
		font-size: 9pt;
	}

	.block_title {
		font-size: 11pt;
	}

	.tableMessages th,
	.tableMessages td {
		padding: 8px 10px;
		font-size: 8pt;
	}
}

/* Stats Summary Cards */
.stats-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 15px;
	margin-bottom: 25px;
}

.stat-card {
	background: linear-gradient(135deg, rgba(0, 86, 179, 0.15) 0%, rgba(16, 110, 190, 0.08) 100%);
	border: 1px solid rgba(0, 120, 212, 0.3);
	border-radius: 10px;
	padding: 18px 20px;
	text-align: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 86, 179, 0.2);
}

.stat-number {
	font-size: 24pt;
	font-weight: 700;
	color: var(--_primary-blue-light);
	line-height: 1.2;
}

.stat-label {
	font-size: 8.5pt;
	color: var(--text-secondary);
	margin-top: 5px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* No data message */
.no-data {
	text-align: center;
	color: var(--text-muted);
	padding: 40px 20px;
	font-size: 10pt;
}