.nxtcc-history-screen,
.nxtcc-history-modal {
	--nxtcc-history-bg: #f6f7f7;
	--nxtcc-history-card: #ffffff;
	--nxtcc-history-border: #dcdcde;
	--nxtcc-history-border-soft: #f0f0f1;
	--nxtcc-history-text: #1d2327;
	--nxtcc-history-muted: #50575e;
	--nxtcc-history-accent: #0b6a62;
	--nxtcc-history-accent-dark: #0a5a53;
	--nxtcc-history-focus: rgba(11, 106, 98, 0.18);
	--nxtcc-history-radius: 8px;
	--nxtcc-history-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.nxtcc-history-widget {
	background: var(--nxtcc-history-bg);
	border: 1px solid var(--nxtcc-history-border);
	border-radius: var(--nxtcc-history-radius);
	padding: 16px;
	color: var(--nxtcc-history-text);
	box-sizing: border-box;
}

.nxtcc-history-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.nxtcc-history-subtitle {
	margin: 6px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--nxtcc-history-muted);
	max-width: 680px;
}

.nxtcc-history-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.nxtcc-history-toolbar-left,
.nxtcc-history-toolbar-right {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.nxtcc-history-toolbar-right {
	flex: 1 1 auto;
	justify-content: flex-end;
}

.nxtcc-history-toolbar-bulk {
	margin-top: -2px;
	justify-content: flex-start;
}

.nxtcc-history-toolbar-bulk .nxtcc-history-toolbar-left {
	justify-content: flex-start;
}

.nxtcc-history-search-input,
.nxtcc-history-select {
	height: 34px;
	padding: 6px 10px;
	border: 1px solid var(--nxtcc-history-border);
	border-radius: 7px;
	background: #fff;
	color: var(--nxtcc-history-text);
	font-size: 12px;
	line-height: 1.4;
	box-sizing: border-box;
}

.nxtcc-history-search-input {
	min-width: 320px;
	flex: 1 1 320px;
}

.nxtcc-history-select {
	min-width: 150px;
}

.nxtcc-history-search-input:focus,
.nxtcc-history-select:focus {
	outline: none;
	border-color: var(--nxtcc-history-accent);
	box-shadow: 0 0 0 3px var(--nxtcc-history-focus);
}

.nxtcc-history-button {
	height: 34px;
	padding: 0 12px;
	border: 1px solid var(--nxtcc-history-accent);
	border-radius: 7px;
	background: var(--nxtcc-history-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.nxtcc-history-button:hover {
	background: var(--nxtcc-history-accent-dark);
	border-color: var(--nxtcc-history-accent-dark);
	box-shadow: 0 6px 16px rgba(11, 106, 98, 0.2);
}

.nxtcc-history-button:focus-visible,
.nxtcc-history-modal-close:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--nxtcc-history-focus);
}

.nxtcc-history-button[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
	box-shadow: none;
}

.nxtcc-history-button-secondary {
	background: #fff;
	color: var(--nxtcc-history-text);
	border-color: var(--nxtcc-history-border);
}

.nxtcc-history-button-secondary:hover {
	background: #f2f7f6;
	border-color: #cad6d4;
	box-shadow: 0 4px 12px rgba(3, 28, 39, 0.1);
}

.nxtcc-history-table-wrap {
	overflow-x: auto;
	background: var(--nxtcc-history-card);
	border: 1px solid var(--nxtcc-history-border);
	border-radius: var(--nxtcc-history-radius);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
}

.nxtcc-history-table {
	width: 100%;
	min-width: 1180px;
	border-collapse: collapse;
	background: #fff;
}

.nxtcc-history-table th,
.nxtcc-history-table td {
	padding: 10px;
	border-bottom: 1px solid var(--nxtcc-history-border-soft);
	font-size: 12px;
	text-align: left;
	vertical-align: top;
	color: var(--nxtcc-history-text);
}

.nxtcc-history-table thead th {
	background: #f0f6f5;
	color: var(--nxtcc-history-text);
	font-weight: 600;
	position: sticky;
	top: 0;
	z-index: 2;
}

.nxtcc-history-table tbody tr {
	cursor: pointer;
}

.nxtcc-history-table tbody tr:hover td {
	background: #f8fbfa;
}

.nxtcc-history-table tbody tr:last-child td,
.nxtcc-history-table tfoot tr:last-child td {
	border-bottom: 0;
}

.nxtcc-history-checkbox-col {
	width: 38px;
}

.nxtcc-history-state-row td {
	padding: 14px;
	text-align: center;
	color: var(--nxtcc-history-muted);
	background: #fff;
}

.nxtcc-status-badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	border: 1px solid transparent;
}

.nxtcc-status-badge.is-sent,
.nxtcc-status-badge.is-sending {
	background: #e9f3ff;
	color: #0b6ef3;
	border-color: #cfe2ff;
}

.nxtcc-status-badge.is-delivered {
	background: #e7f8f3;
	color: #0f927a;
	border-color: #bdeee2;
}

.nxtcc-status-badge.is-read {
	background: #ecfbe8;
	color: #1c7f2b;
	border-color: #caebcd;
}

.nxtcc-status-badge.is-failed {
	background: #ffecec;
	color: #cc1f1f;
	border-color: #f3baba;
}

.nxtcc-status-badge.is-pending,
.nxtcc-status-badge.is-scheduled {
	background: #fff7e6;
	color: #a66300;
	border-color: #ffd699;
}

.nxtcc-status-badge.is-received {
	background: #eef2ff;
	color: #3346d3;
	border-color: #cbd1ff;
}

.nxtcc-status-badge.is-unknown {
	background: #f2f2f2;
	color: #666;
	border-color: #e2e2e2;
}

.nxtcc-history-modal[hidden] {
	display: none;
}

.nxtcc-history-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.nxtcc-history-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(17, 24, 39, 0.4);
}

.nxtcc-history-modal-content {
	position: relative;
	z-index: 1;
	width: min(920px, 96vw);
	max-height: 88vh;
	overflow: auto;
	background: #fff;
	border: 1px solid var(--nxtcc-history-border);
	border-radius: var(--nxtcc-history-radius);
	box-shadow: var(--nxtcc-history-shadow);
}

.nxtcc-history-modal-header,
.nxtcc-history-modal-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--nxtcc-history-border-soft);
}

.nxtcc-history-modal-footer {
	justify-content: flex-end;
	border-top: 1px solid var(--nxtcc-history-border-soft);
	border-bottom: 0;
}

.nxtcc-history-modal-header {
	font-size: 16px;
	font-weight: 600;
	color: var(--nxtcc-history-text);
}

.nxtcc-history-modal-close {
	border: 1px solid var(--nxtcc-history-border);
	background: #fff;
	color: var(--nxtcc-history-text);
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.nxtcc-history-modal-body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.nxtcc-history-detail-lines {
	display: flex;
	flex-direction: column;
	gap: 0;
	border-top: 1px solid var(--nxtcc-history-border-soft);
	border-bottom: 1px solid var(--nxtcc-history-border-soft);
}

.nxtcc-history-detail-line {
	display: grid;
	grid-template-columns: 150px minmax(0, 1fr);
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--nxtcc-history-border-soft);
	align-items: start;
}

.nxtcc-history-detail-line:last-child {
	border-bottom: 0;
}

.nxtcc-history-detail-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--nxtcc-history-muted);
}

.nxtcc-history-detail-value {
	font-size: 13px;
	line-height: 1.55;
	word-break: break-word;
	color: var(--nxtcc-history-text);
}

.nxtcc-history-message-panel,
.nxtcc-history-media-panel {
	padding: 14px;
	border: 1px solid var(--nxtcc-history-border);
	border-radius: 7px;
	background: #fff;
}

.nxtcc-history-message-label {
	margin-bottom: 8px;
	font-size: 12px;
	font-weight: 600;
	color: var(--nxtcc-history-text);
}

.nxtcc-history-message-value {
	font-size: 13px;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
	color: var(--nxtcc-history-text);
}

#kv-media-preview img,
#kv-media-preview video,
#kv-media-preview a {
	display: block;
	max-width: 100%;
	border-radius: 7px;
	border: 1px solid var(--nxtcc-history-border);
	padding: 4px;
}

@media (max-width: 960px) {
	.nxtcc-history-header,
	.nxtcc-history-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.nxtcc-history-toolbar-left,
	.nxtcc-history-toolbar-right {
		justify-content: flex-start;
	}

	.nxtcc-history-search-input {
		min-width: 0;
	}
}

@media (max-width: 782px) {
	.nxtcc-history-widget {
		padding: 12px;
	}

	.nxtcc-history-detail-line {
		grid-template-columns: 1fr;
		gap: 4px;
	}

	.nxtcc-history-modal {
		padding: 12px;
	}

	.nxtcc-history-modal-content {
		width: min(96vw, 96vw);
	}

	.nxtcc-history-table {
		min-width: 980px;
	}
}
