/* ============================================================================
 * bwc-dash.css — the Reports dashboard (views/reports/index.php)
 *
 * Layout follows the CRM dashboard the user referenced
 * (apex-shadcn.dashboardpack.com/crm): a row of KPI tiles with deltas, a wide
 * trend chart beside a breakdown donut, then a recent-activity table beside a
 * performer leaderboard. Its domain is sales pipeline; ours is listings, so the
 * tiles/series are mapped to the real estate equivalents rather than copied.
 *
 * The palette and typography stay Bitrix's (design tokens + the accent hues
 * already used by the donuts) so Reports doesn't read as a different product to
 * the rest of the app.
 * ========================================================================= */

.bwc-dash {
	max-width: 1280px;
	margin: 0 auto;
	padding: 20px 24px 32px;
	font-family: var(--ui-font-family-primary, "Helvetica Neue", Arial, sans-serif);
	color: #535c69;
}

.bwc-dash-title {
	font-size: 20px;
	font-weight: 600;
	color: #333;
	margin: 0;
}

.bwc-dash-sub {
	font-size: 13px;
	color: #a8adb4;
	margin: 2px 0 18px;
}

/* ---- cards ---- */
.bwc-card {
	background: #fff;
	border: 1px solid #e6e8ea;
	border-radius: 8px;
	padding: 18px 20px;
}

.bwc-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.bwc-card-title { font-size: 15px; font-weight: 600; color: #333; }
.bwc-card-sub   { font-size: 12px; color: #a8adb4; margin-top: 2px; }

/* ---- KPI tiles ---- */
.bwc-kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.bwc-kpi-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.bwc-kpi-label {
	font-size: 12px;
	color: #a8adb4;
	text-transform: uppercase;
	letter-spacing: .03em;
}

.bwc-kpi-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	font-size: 13px;
	background: #eef7fe;
	color: var(--ui-color-primary, #2fc6f6);
	flex: none;
}

.bwc-kpi-value {
	font-size: 26px;
	font-weight: 600;
	color: #333;
	line-height: 1.2;
	margin-top: 10px;
	/* long money values must not widen the tile and break the 4-up grid */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bwc-kpi-foot {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	font-size: 12px;
	color: #a8adb4;
}

.bwc-delta {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 1px 6px;
	border-radius: 10px;
	font-weight: 600;
	font-size: 11px;
}

.bwc-delta-up   { background: #e2f1b3; color: #4f7a0b; }
.bwc-delta-down { background: #ffe0dc; color: #b03a28; }
.bwc-delta-flat { background: #eef2f4; color: #828b95; }

/* ---- main grids ---- */
.bwc-dash-row {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: 16px;
	margin-top: 16px;
}

/* The slider is often ~1100-1600px wide; below that the 2fr/1fr split leaves
   the donut too narrow to label, so stack instead. Media queries key off the
   iframe width, which IS the slider width. */
@media (max-width: 1100px) {
	.bwc-kpis    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.bwc-dash-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
	.bwc-kpis { grid-template-columns: minmax(0, 1fr); }
}

/* ---- recent listings table ---- */
.bwc-dash-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }

.bwc-dash-table th {
	text-align: left;
	font-weight: 400;
	color: #a8adb4;
	font-size: 12px;
	padding: 0 10px 8px 0;
	border-bottom: 1px solid #edeef0;
	white-space: nowrap;
}

.bwc-dash-table td {
	padding: 10px 10px 10px 0;
	border-bottom: 1px solid #eef2f4;
	color: #535c69;
	vertical-align: middle;
}

.bwc-dash-table tr:last-child td { border-bottom: 0; }

.bwc-dash-table .bwc-dash-name {
	color: var(--ui-color-primary, #2fc6f6);
	font-weight: 600;
	text-decoration: none;
	display: block;
	max-width: 260px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bwc-dash-table .bwc-dash-name:hover { text-decoration: underline; }

.bwc-num { text-align: right; white-space: nowrap; }

/* ---- top agents leaderboard ---- */
.bwc-rank { display: flex; flex-direction: column; gap: 14px; }

.bwc-rank-row { display: flex; align-items: center; gap: 10px; }

.bwc-rank-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	background: #eef2f4;
	flex: none;
}

.bwc-rank-body { flex: 1 1 auto; min-width: 0; }

.bwc-rank-name {
	font-size: 13px;
	font-weight: 600;
	color: #535c69;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bwc-rank-meta { font-size: 11px; color: #a8adb4; }

.bwc-rank-bar {
	height: 4px;
	border-radius: 2px;
	background: #eef2f4;
	margin-top: 5px;
	overflow: hidden;
}

.bwc-rank-fill { height: 100%; border-radius: 2px; background: var(--ui-color-primary, #2fc6f6); }

.bwc-rank-value { font-size: 13px; font-weight: 600; color: #333; white-space: nowrap; }

.bwc-dash-empty {
	padding: 28px 0;
	text-align: center;
	color: #a8adb4;
	font-size: 13px;
}
