/**
 * CSC design system — shared tokens, login, overlays, focus
 */

:root {
	--csc-ink: #0b0d10;
	--csc-ink-muted: #3d4450;
	--csc-surface: #ffffff;
	--csc-surface-subtle: #f7f8fa;
	--csc-border: #e4e7ec;
	--csc-blue: #1e6fd9;
	--csc-blue-hover: #1859b0;
	--csc-yellow: #f5c518;
	--csc-red: #e53935;
	--csc-text: #111318;
	--csc-text-muted: #6b7280;
	--csc-radius-btn: 10px;
	--csc-radius-input: 10px;
	--csc-radius-card: 14px;
	--csc-radius-modal: 20px;
	--csc-shadow-modal: 0 24px 48px rgba(11, 13, 16, 0.14), 0 8px 16px rgba(11, 13, 16, 0.08);
	--csc-shadow-card: 0 4px 16px rgba(11, 13, 16, 0.06);
	--csc-font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
	--csc-ease-fast: 120ms ease;
	--csc-ease: 240ms ease;
	--csc-ease-slow: 360ms ease;
}

@media (prefers-reduced-motion: reduce) {
	:root {
		--csc-ease-fast: 0ms;
		--csc-ease: 0ms;
		--csc-ease-slow: 0ms;
	}
}

/* —— Login split layout —— */
.csc-login-page {
	min-height: 100vh;
	margin: 0;
	font-family: var(--csc-font);
	font-size: 15px;
	color: var(--csc-text);
	background: var(--csc-surface);
}

.csc-login-layout {
	display: flex;
	min-height: 100vh;
}

.csc-login-hero {
	position: relative;
	flex: 0 0 45%;
	max-width: 45%;
	background: var(--csc-ink);
	color: #fafafa;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	padding: 48px 40px 56px;
}

.csc-login-hero__mesh {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

.csc-login-hero__blob {
	position: absolute;
	border-radius: 50%;
	filter: blur(72px);
	opacity: 0.14;
}

.csc-login-hero__blob--blue {
	width: 55%;
	height: 55%;
	background: var(--csc-blue);
	top: -10%;
	left: -8%;
	animation: csc-mesh-drift-a 24s ease-in-out infinite;
}

.csc-login-hero__blob--yellow {
	width: 45%;
	height: 45%;
	background: var(--csc-yellow);
	bottom: 5%;
	right: -5%;
	animation: csc-mesh-drift-b 24s ease-in-out infinite;
}

.csc-login-hero__blob--red {
	width: 38%;
	height: 38%;
	background: var(--csc-red);
	top: 40%;
	left: 35%;
	animation: csc-mesh-drift-c 24s ease-in-out infinite;
}

@keyframes csc-mesh-drift-a {

	0%,
	100% {
		transform: translate(0, 0);
	}

	50% {
		transform: translate(8%, 6%);
	}
}

@keyframes csc-mesh-drift-b {

	0%,
	100% {
		transform: translate(0, 0);
	}

	50% {
		transform: translate(-6%, -8%);
	}
}

@keyframes csc-mesh-drift-c {

	0%,
	100% {
		transform: translate(0, 0);
	}

	50% {
		transform: translate(5%, -5%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.csc-login-hero__blob {
		animation: none;
	}
}

.csc-login-hero__glyph {
	position: absolute;
	right: 8%;
	top: 18%;
	width: min(200px, 40%);
	height: min(200px, 40%);
	opacity: 0.3;
	pointer-events: none;
	aria-hidden: true;
}

.csc-login-hero__glyph svg {
	width: 100%;
	height: 100%;
}

.csc-login-hero__inner {
	position: relative;
	z-index: 1;
	max-width: 18ch;
}

.csc-login-hero__tagline {
	margin: 0;
	font-size: clamp(2rem, 4.5vw, 3.5rem);
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: #fafafa;
}

.csc-login-hero__sub {
	margin: 16px 0 0;
	font-size: 15px;
	line-height: 1.5;
	color: rgba(250, 250, 250, 0.72);
	max-width: 32ch;
}

.csc-login-panel {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 40px 32px 32px;
	background: var(--csc-surface);
}

.csc-login-panel__inner {
	width: 100%;
	max-width: 420px;
	margin-top: clamp(0px, 8vh, 12vh);
}

.csc-login-logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 28px;
	text-decoration: none;
	color: var(--csc-ink);
	font-weight: 700;
	font-size: 1.125rem;
	letter-spacing: 0.06em;
}

.csc-login-logo:focus-visible {
	outline: 2px solid var(--csc-blue);
	outline-offset: 4px;
	border-radius: 4px;
}

.csc-login-logo__mark {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--csc-ink);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
}

.csc-login-heading {
	margin: 0 0 6px;
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--csc-ink);
}

.csc-login-lead {
	margin: 0 0 24px;
	font-size: 15px;
	color: var(--csc-text-muted);
	line-height: 1.45;
}

.csc-field {
	margin-bottom: 18px;
}

.csc-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--csc-ink-muted);
}

.csc-field__hint {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--csc-text-muted);
	line-height: 1.4;
}

.csc-input {
	display: block;
	width: 100%;
	height: 48px;
	padding: 0 14px;
	font-size: 16px;
	font-family: inherit;
	color: var(--csc-text);
	background: var(--csc-surface);
	border: 1px solid var(--csc-border);
	border-radius: var(--csc-radius-input);
	transition: border-color var(--csc-ease-fast), box-shadow var(--csc-ease-fast);
}

.csc-input:focus {
	outline: none;
	border-color: var(--csc-blue);
	box-shadow: 0 0 0 3px rgba(30, 111, 217, 0.22);
}

.csc-input-wrap {
	position: relative;
}

/* .csc-input-wrap .csc-input {
	padding-right: 48px;
} */

.csc-password-toggle {
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: var(--csc-text-muted);
	border-radius: 8px;
	cursor: pointer;
	transition: color var(--csc-ease-fast), background var(--csc-ease-fast);
}

.csc-password-toggle:hover {
	color: var(--csc-ink);
	background: var(--csc-surface-subtle);
}

.csc-password-toggle:focus-visible {
	outline: 2px solid var(--csc-blue);
	outline-offset: 2px;
}

.csc-field-row {
	display: flex;
	justify-content: flex-end;
	margin: -8px 0 16px;
}

.csc-link {
	font-size: 14px;
	color: var(--csc-blue);
	text-decoration: none;
	font-weight: 500;
}

.csc-link:hover {
	text-decoration: underline;
}

.csc-link:focus-visible {
	outline: 2px solid var(--csc-blue);
	outline-offset: 2px;
	border-radius: 2px;
}

.csc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 48px;
	padding: 0 20px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	border: none;
	border-radius: var(--csc-radius-btn);
	cursor: pointer;
	transition: background var(--csc-ease-fast), transform var(--csc-ease-fast), opacity var(--csc-ease-fast);
}

.csc-btn:focus-visible {
	outline: 2px solid var(--csc-blue);
	outline-offset: 3px;
}

.csc-btn--primary {
	background: var(--csc-ink);
	color: #fafafa;
}

.csc-btn--primary:hover:not(:disabled) {
	background: #1a1d24;
}

.csc-btn--primary:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.csc-btn--ghost {
	background: transparent;
	color: var(--csc-text-muted);
	border: 1px solid var(--csc-border);
	width: auto;
	min-height: 40px;
	padding: 0 16px;
}

.csc-btn__spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: csc-spin 0.7s linear infinite;
}

.csc-btn.is-loading .csc-btn__spinner {
	display: inline-block;
}

.csc-btn.is-loading .csc-btn__label {
	opacity: 0.85;
}

@keyframes csc-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.csc-btn__spinner {
		animation: none;
		border-top-color: transparent;
	}
}

.csc-alert {
	display: none;
	margin-bottom: 16px;
	padding: 12px 14px;
	border-radius: var(--csc-radius-input);
	font-size: 14px;
	line-height: 1.45;
}

.csc-alert.is-visible {
	display: block;
}

.csc-alert--error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.csc-login-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 24px 0 16px;
	color: var(--csc-text-muted);
	font-size: 13px;
}

.csc-login-divider::before,
.csc-login-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--csc-border);
}

.csc-login-footer {
	margin-top: 32px;
	padding-top: 16px;
	border-top: 1px solid var(--csc-border);
	font-size: 12px;
	color: var(--csc-text-muted);
	text-align: center;
	line-height: 1.5;
}

/* Username → QR flow */
.csc-login-step {
	overflow: hidden;
	transition: opacity var(--csc-ease), max-height var(--csc-ease-slow);
}

.csc-login-step.is-collapsed {
	opacity: 0;
	max-height: 0;
	margin: 0;
	pointer-events: none;
}

.csc-login-step.is-expanded {
	opacity: 1;
	max-height: 800px;
}

.csc-qr-card {
	background: var(--csc-surface);
	border: 1px solid var(--csc-border);
	border-radius: var(--csc-radius-card);
	padding: 24px;
	box-shadow: var(--csc-shadow-card);
	text-align: center;
}

.csc-qr-card__ring-wrap {
	position: relative;
	width: 200px;
	height: 200px;
	margin: 0 auto 16px;
}

.csc-qr-card__ring {
	position: absolute;
	inset: 0;
	transform: rotate(-90deg);
}

.csc-qr-card__ring circle {
	fill: none;
	stroke-width: 4;
}

.csc-qr-card__ring-bg {
	stroke: var(--csc-border);
}

.csc-qr-card__ring-progress {
	stroke: var(--csc-blue);
	stroke-linecap: round;
	transition: stroke-dashoffset 1s linear;
}

.csc-qr-card__img {
	position: absolute;
	inset: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: #fff;
}

.csc-qr-card__img img,
.csc-qr-card__img canvas {
	max-width: 100%;
	max-height: 100%;
}

.csc-qr-card.is-expired .csc-qr-card__img {
	opacity: 0.35;
	filter: grayscale(1);
}

.csc-qr-card__subtitle {
	margin: 0 0 12px;
	font-size: 15px;
	color: var(--csc-text-muted);
	line-height: 1.45;
}

.csc-qr-card__timer {
	font-variant-numeric: tabular-nums;
	font-size: 14px;
	color: var(--csc-text-muted);
	margin-bottom: 12px;
}

.csc-qr-help {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--csc-blue);
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	margin-bottom: 16px;
}

.csc-qr-help:focus-visible {
	outline: 2px solid var(--csc-blue);
	outline-offset: 2px;
}

.csc-login-reset {
	display: block;
	margin-top: 16px;
	text-align: center;
	font-size: 14px;
}

@media (max-width: 900px) {
	.csc-login-layout {
		flex-direction: column;
	}

	.csc-login-hero {
		flex: none;
		max-width: none;
		min-height: 200px;
		padding: 32px 24px 40px;
	}

	.csc-login-hero__tagline {
		font-size: 2rem;
	}

	.csc-login-panel {
		padding: 32px 20px 24px;
	}

	.csc-login-panel__inner {
		margin-top: 0;
		max-width: 100%;
	}
}

/* —— CSC overlay modals (index.php) —— */
.rvc-csc-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 1050;
	padding: 24px 16px;
	background: rgba(11, 13, 16, 0.48);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	overflow-y: auto;
	align-items: flex-start;
	justify-content: center;
}

.rvc-csc-overlay.is-open,
.rvc-csc-overlay[style*='display: block'],
.rvc-csc-overlay[style*='display:block'] {
	display: flex !important;
}

.rvc-csc-modal {
	width: 100%;
	max-width: min(960px, 96vw);
	background: var(--csc-surface);
	border-radius: var(--csc-radius-modal);
	box-shadow: var(--csc-shadow-modal);
	display: flex;
	flex-direction: column;
	max-height: min(88vh, 900px);
	animation: csc-modal-in var(--csc-ease-slow) both;
}

@keyframes csc-modal-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.rvc-csc-modal {
		animation: none;
	}
}

.rvc-csc-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px;
	border-bottom: 1px solid var(--csc-border);
	flex-shrink: 0;
}

.rvc-csc-modal__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--csc-ink);
}

.rvc-csc-modal__subtitle {
	margin: 4px 0 0;
	font-size: 14px;
	color: var(--csc-text-muted);
}

.rvc-csc-modal__close {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border: none;
	background: var(--csc-surface-subtle);
	color: var(--csc-ink-muted);
	border-radius: 10px;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--csc-ease-fast), color var(--csc-ease-fast);
}

.rvc-csc-modal__close:hover {
	background: var(--csc-border);
	color: var(--csc-ink);
}

.rvc-csc-modal__close:focus-visible {
	outline: 2px solid var(--csc-blue);
	outline-offset: 2px;
}

.rvc-csc-modal__body {
	padding: 16px 24px 24px;
	overflow: auto;
	flex: 1;
	-webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
	.rvc-csc-overlay {
		padding: 0;
		align-items: stretch;
	}

	.rvc-csc-modal {
		max-width: none;
		min-height: 100%;
		border-radius: 0;
		max-height: none;
	}
}

/* Bootstrap modals on index — backdrop behind dialog, centered on screen */
body.modal-open .modal-backdrop {
	z-index: 1040 !important;
}

body.modal-open .modal.fade.in {
	z-index: 1060 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 16px !important;
	overflow-x: hidden;
	overflow-y: auto;
}

body.modal-open .modal.fade.in .modal-dialog {
	z-index: 1061;
	position: relative;
	margin: 0 auto !important;
	left: auto !important;
	right: auto !important;
	top: auto !important;
	float: none;
	max-height: calc(100vh - 32px);
}

/* Bootstrap modals on index — CSC elevation */
#profile .modal-content,
#CallsModal .modal-content,
#Calllogmodal .modal-content {
	border: none;
	border-radius: var(--csc-radius-modal);
	box-shadow: var(--csc-shadow-modal);
}

#profile .modal-header,
#CallsModal .modal-header,
#Calllogmodal .modal-header {
	border-bottom: 1px solid var(--csc-border);
	padding: 18px 22px;
}

#profile .modal-title,
#CallsModal .modal-title,
#Calllogmodal .modal-title {
	font-size: 1.2rem;
	font-weight: 600;
	color: var(--csc-ink);
}

#profile .modal-body,
#CallsModal .modal-body,
#Calllogmodal .modal-body {
	padding: 18px 22px;
	font-size: 15px;
}

#profile .modal-footer,
#CallsModal .modal-footer,
#Calllogmodal .modal-footer {
	border-top: 1px solid var(--csc-border);
	padding: 14px 22px;
}

.swal2-popup.agentsource-swal-popup {
	border-radius: var(--csc-radius-modal);
}