/* Client Success Dashboard */

.csd-wrap {
	--csd-border: #d9dee3;
	--csd-muted: #6b7280;
	--csd-accent: #1f6feb;
	--csd-flag: #b42318;
	--csd-flag-bg: #fef3f2;
	font-size: 15px;
	line-height: 1.4;
}

.csd-error {
	padding: 12px 14px;
	border: 1px solid #f0b4b4;
	background: #fdf2f2;
	border-radius: 6px;
	color: #8a1f1f;
}

.csd-admin-bar {
	margin-bottom: 12px;
	font-size: 13px;
}
.csd-admin-note {
	color: var(--csd-muted);
	margin-left: 6px;
}

.csd-layout {
	display: flex;
	gap: 24px;
	align-items: flex-start;
}

/* Filters */
.csd-filters {
	flex: 0 0 240px;
	border: 1px solid var(--csd-border);
	border-radius: 8px;
	padding: 16px;
	position: sticky;
	top: 16px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
}

.csd-filter {
	margin-bottom: 14px;
}
.csd-filter label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 4px;
}
.csd-filter select {
	width: 100%;
	padding: 6px 8px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
}

.csd-flagged-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	margin: 16px 0;
	cursor: pointer;
}

.csd-reset-btn {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #f6f8fa;
	cursor: pointer;
	font-size: 14px;
}
.csd-reset-btn:hover {
	background: #eef1f4;
}

/* Results */
.csd-results {
	flex: 1;
	min-width: 0;
}

.csd-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
}

.csd-card {
	border: 1px solid var(--csd-border);
	border-radius: 8px;
	padding: 14px;
	text-align: center;
}
.csd-card-label {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--csd-muted);
}
.csd-card-value {
	font-size: 28px;
	font-weight: 700;
	margin: 4px 0 2px;
}

.csd-count {
	margin: 10px 0 16px;
	font-size: 13px;
	color: var(--csd-muted);
}

/* Response table */
.csd-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}
.csd-table th,
.csd-table td {
	padding: 8px 10px;
	border-bottom: 1px solid var(--csd-border);
	text-align: left;
	vertical-align: top;
}
.csd-table th.csd-num,
.csd-table td.csd-num {
	text-align: right;
}
.csd-table td.csd-low {
	color: var(--csd-flag);
	font-weight: 700;
}
.csd-flagged-row {
	background: var(--csd-flag-bg);
}
.csd-sub {
	display: block;
	font-size: 11px;
	color: var(--csd-muted);
}
.csd-empty {
	color: var(--csd-muted);
	font-style: italic;
}

@media (max-width: 760px) {
	.csd-layout {
		flex-direction: column;
	}
	.csd-filters {
		position: static;
		width: 100%;
		flex: none;
	}
	.csd-responses {
		overflow-x: auto;
	}
}

/* Context panel (shown when a Client is selected) */
.csd-context {
	margin: 4px 0 16px;
	padding: 12px 14px;
	border: 1px solid var(--csd-border);
	border-radius: 8px;
	background: #fafbfc;
	font-size: 14px;
}
.csd-context-row {
	margin: 2px 0;
}
.csd-context-label {
	font-weight: 600;
}

/* View details button */
.csd-details-cell {
	white-space: nowrap;
}
.csd-details-btn {
	padding: 4px 10px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
	color: var(--csd-accent);
	font-size: 12px;
	cursor: pointer;
}
.csd-details-btn:hover {
	background: #f0f6ff;
	border-color: var(--csd-accent);
}

/* Compare mode */
.csd-compare-btn {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
	color: var(--csd-accent);
	cursor: pointer;
	font-size: 14px;
	margin-bottom: 12px;
}
.csd-compare-btn:hover {
	background: #f0f6ff;
	border-color: var(--csd-accent);
}
.csd-compare-filters {
	border-top: 1px solid var(--csd-border);
	margin-bottom: 12px;
	padding-top: 12px;
}
.csd-set-heading {
	font-weight: 700;
	font-size: 13px;
	margin-bottom: 10px;
}
.csd-set-label {
	font-weight: 700;
	font-size: 14px;
	margin: 14px 0 8px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--csd-muted);
}
.csd-set-label:first-child {
	margin-top: 0;
}

/* Range filters (date + numeric min/max) */
.csd-range {
	display: flex;
	align-items: center;
	gap: 6px;
}
.csd-range input {
	width: 100%;
	min-width: 0;
	padding: 6px 8px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
	font-size: 13px;
}
.csd-range-sep {
	color: var(--csd-muted);
	font-size: 12px;
	flex: 0 0 auto;
}

/* Advanced Filters toggle + panel */
.csd-advanced-btn {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
	color: var(--csd-accent);
	cursor: pointer;
	font-size: 14px;
	margin-bottom: 12px;
}
.csd-advanced-btn:hover {
	background: #f0f6ff;
	border-color: var(--csd-accent);
}
.csd-advanced-controls {
	margin-bottom: 4px;
}

/* Simulated-viewer bar (top center) */
.csd-userbar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-bottom: 20px;
	font-size: 14px;
}
.csd-userbar label {
	font-weight: 600;
}
.csd-userbar select {
	padding: 6px 10px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
	font-size: 14px;
}

/* Advanced Filters modal */
.csd-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 16px;
}
.csd-modal-box {
	background: #fff;
	border-radius: 10px;
	padding: 20px 22px;
	width: min(460px, 94vw);
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 12px 44px rgba(0, 0, 0, 0.25);
}
.csd-modal-title {
	font-weight: 700;
	font-size: 16px;
	margin-bottom: 16px;
}
.csd-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 18px;
}
.csd-modal-btn {
	padding: 8px 16px;
	border: 1px solid var(--csd-border);
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font-size: 14px;
}
.csd-modal-btn:hover {
	background: #f6f8fa;
}
.csd-modal-apply {
	background: var(--csd-accent);
	color: #fff;
	border-color: var(--csd-accent);
}
.csd-modal-apply:hover {
	background: #1a5fd0;
}
