/* Qualified Leads page — extends the transcript-viewer base styles (sitestaffr-tv-*). */

/* Wider than the 800px transcript/PDF shell — the leads table needs room. */
.sitestaffr-leads-page .sitestaffr-tv-topbar-inner,
.sitestaffr-leads-page .sitestaffr-tv-container {
	max-width: 1100px;
}

/* Billing-cycle navigator. */
.sitestaffr-leads-cyclenav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 16px;
	flex-wrap: wrap;
}
.sitestaffr-leads-cyclenav-label {
	text-align: center;
	color: #004D40;
	font-size: 15px;
}
.sitestaffr-leads-cyclenav-label .sitestaffr-leads-count {
	margin-left: 10px;
}
.sitestaffr-leads-cyclenav-btn {
	display: inline-block;
	padding: 8px 16px;
	border-radius: 8px;
	background: #E0F7FA;
	color: #00838F;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
}
.sitestaffr-leads-cyclenav-btn:hover { background: #b8ecf2; }
.sitestaffr-leads-cyclenav-btn.is-disabled {
	background: transparent;
	color: #bbb;
	cursor: default;
}

/* Top-bar actions (PDF + CSV). Desktop (>=601px) shows both buttons inline;
   narrower widths collapse them into a compact "Actions" dropdown. Pure CSS.
   The menu is a SIBLING of the <details>, not a child, so it is never subject
   to the browser's closed-<details> content hiding. (Modern Chrome hides closed
   <details> content via ::details-content/content-visibility, which
   display:!important CANNOT reveal -- so a *child* menu stayed invisible on
   desktop/tablet, where the toggle is hidden and the <details> never opens.)
   As a sibling it displays reliably inline on desktop, and the mobile dropdown
   is driven by [open] via the ~ sibling combinator. */
.sitestaffr-leads-actions { position: relative; }

/* The compact "Actions" toggle (shown below the desktop breakpoint). */
.sitestaffr-leads-actions-toggle-wrap > summary {
	list-style: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	background: #1FB6CC;
	color: #fff;
	padding: 9px 16px;
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
}
.sitestaffr-leads-actions-toggle-wrap > summary::-webkit-details-marker { display: none; }
.sitestaffr-leads-actions-toggle-wrap > summary::after { content: "\25BE"; }
.sitestaffr-leads-actions-toggle-wrap[open] > summary::after { content: "\25B4"; }

/* Both action buttons render at the SAME size (the Print <button> and the CSV
   <a> otherwise inherit different padding/font from their base classes). */
.sitestaffr-leads-actions-menu .sitestaffr-tv-print-btn,
.sitestaffr-leads-actions-menu .sitestaffr-leads-csv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 9px 18px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	border-radius: 8px;
	box-sizing: border-box;
}

/* Menu: hidden until the toggle opens, then a dropdown panel. */
.sitestaffr-leads-actions-menu { display: none; }
.sitestaffr-leads-actions-toggle-wrap[open] ~ .sitestaffr-leads-actions-menu {
	display: flex;
	flex-direction: column;
	gap: 8px;
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	z-index: 20;
	min-width: 210px;
	padding: 10px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
}
.sitestaffr-leads-actions-toggle-wrap[open] ~ .sitestaffr-leads-actions-menu .sitestaffr-tv-print-btn,
.sitestaffr-leads-actions-toggle-wrap[open] ~ .sitestaffr-leads-actions-menu .sitestaffr-leads-csv-btn {
	width: 100%;
}

/* Desktop (>=601px): hide the toggle, show both actions inline. The menu is a
   plain sibling <div> here, so it always renders (no <details> hiding). */
@media (min-width: 601px) {
	.sitestaffr-leads-actions-toggle-wrap { display: none; }
	.sitestaffr-leads-actions-menu {
		display: inline-flex !important;
		gap: 10px;
		align-items: center;
	}
}

/* Print / PDF: a wide 5-column table overflows the page edge. Reflow each lead
   into a stacked, labeled block (like the mobile card) so it fits the paper
   width and reads as a clean document, not a spreadsheet dump. */
@media print {
	/* Keep the logo top bar (branding); drop the interactive controls. */
	.sitestaffr-leads-actions,
	.sitestaffr-leads-cyclenav-btn {
		display: none !important;
	}
	.sitestaffr-leads-page .sitestaffr-tv-topbar-inner,
	.sitestaffr-leads-page .sitestaffr-tv-container { max-width: 100%; padding: 0; }
	.sitestaffr-leads-cyclenav { justify-content: flex-start; }

	/* Hide the column head and stack each row into a block that fits the page. */
	.sitestaffr-leads-table thead {
		position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
	}
	.sitestaffr-leads-table,
	.sitestaffr-leads-table tbody,
	.sitestaffr-leads-table td {
		display: block;
		width: 100%;
		box-sizing: border-box;
	}
	/* Flex column so order:-1 on Name can hoist it above Date in the PDF. */
	.sitestaffr-leads-table tr {
		display: flex;
		flex-direction: column;
		width: 100%;
		box-sizing: border-box;
		border: 1px solid #cfcfcf;
		border-radius: 6px;
		margin: 0 0 12px;
		padding: 4px 0;
		page-break-inside: avoid;
	}
	.sitestaffr-leads-table td {
		border: 0;
		padding: 3px 14px;
	}
	.sitestaffr-leads-table td::before {
		content: attr(data-label);
		display: block;
		color: #555;
		font-size: 9px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.04em;
	}
	.sitestaffr-leads-table td[data-label="Name"] {
		order: -1;
		font-size: 15px;
		font-weight: 700;
		color: #004D40;
		padding-top: 8px;
	}
	.sitestaffr-leads-table td[data-label="Name"]::before { display: none; }
	/* A transcript link is dead on paper — leave it out of the printed copy. */
	.sitestaffr-leads-table td[data-label="Conversation"] { display: none; }
	.sitestaffr-leads-table a { color: #000; text-decoration: none; }
}
.sitestaffr-leads-subhead {
	margin: 0 0 14px;
}
.sitestaffr-leads-count {
	display: inline-block;
	padding: 2px 10px;
	background: #E0F7FA;
	color: #004D40;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
}
.sitestaffr-leads-csv-btn {
	display: inline-block;
	background: #1FB6CC;
	color: #fff;
	padding: 10px 22px;
	border-radius: 8px;
	text-decoration: none;
	font-weight: 600;
}
.sitestaffr-leads-csv-btn:hover { background: #00838F; }
.sitestaffr-leads-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 6px;
	font-size: 14px;
}
.sitestaffr-leads-table th,
.sitestaffr-leads-table td {
	text-align: left;
	padding: 12px 14px;
	border-bottom: 1px solid #e0e0e0;
	vertical-align: top;
}
.sitestaffr-leads-table th {
	background: #E0F7FA;
	color: #004D40;
}
.sitestaffr-leads-table a { color: #1FB6CC; }
/* Desktop shows the compact "View"; the full "View Conversation" label is a
   mobile-only button (see the mobile block below). */
.sitestaffr-leads-view-full { display: none; }
/* Mobile: the 5-column table overflows on phones — stack each row into a
   labeled card (headers hidden, each cell prefixed with its column name). */
@media (max-width: 600px) {
	.sitestaffr-leads-page .sitestaffr-tv-container { padding-left: 12px; padding-right: 12px; }
	.sitestaffr-leads-cyclenav { justify-content: center; }
	.sitestaffr-leads-table { font-size: 14px; }
	.sitestaffr-leads-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}
	.sitestaffr-leads-table,
	.sitestaffr-leads-table tbody,
	.sitestaffr-leads-table td {
		display: block;
		width: 100%;
	}
	/* Each lead is a distinct card: flex column so the NAME can lead as the
	   heading (clear anchor to scan by), with separation between cards. */
	.sitestaffr-leads-table tr {
		display: flex;
		flex-direction: column;
		margin: 0 0 18px;
		border: 1px solid #d6d6d6;
		border-radius: 10px;
		overflow: hidden;
		background: #fff;
		box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
	}
	.sitestaffr-leads-table td {
		border-bottom: 1px solid #f0f0f0;
		padding: 9px 14px;
		text-align: left;
	}
	.sitestaffr-leads-table td:last-child { border-bottom: 0; }
	.sitestaffr-leads-table td::before {
		content: attr(data-label);
		display: block;
		margin-bottom: 2px;
		color: #6b7c7a;
		font-size: 10px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.04em;
	}
	/* NAME becomes the card title: first, prominent, no tiny label. */
	.sitestaffr-leads-table td[data-label="Name"] {
		order: -1;
		background: #004D40;
		padding: 12px 14px;
		border-bottom: 1px solid #e0e0e0;
		font-size: 17px;
		font-weight: 700;
		color: #fff;
	}
	.sitestaffr-leads-table td[data-label="Name"]::before { display: none; }
	/* Conversation: drop the tiny label; show "View Conversation" as a plain
	   text link (not a button). */
	.sitestaffr-leads-table td[data-label="Conversation"]::before { display: none; }
	.sitestaffr-leads-table td[data-label="Conversation"] .sitestaffr-leads-view {
		font-weight: 600;
		color: #1FB6CC;
		text-decoration: underline;
	}
	.sitestaffr-leads-table td[data-label="Conversation"] .sitestaffr-leads-view-short { display: none; }
	.sitestaffr-leads-table td[data-label="Conversation"] .sitestaffr-leads-view-full { display: inline; }
}

/* ── Filter tabs: All (default) / Follow-up / Handled ── */
.sitestaffr-leads-filter {
	display: flex;
	gap: 8px;
	margin: 0 0 14px;
	flex-wrap: wrap;
}
.sitestaffr-leads-filter-tab {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 16px;
	border: 1px solid #cfeef2;
	border-radius: 999px;
	background: #fff;
	color: #00838F;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
}
.sitestaffr-leads-filter-tab:hover { background: #E0F7FA; }
.sitestaffr-leads-filter-tab.is-active {
	background: #00838F;
	border-color: #00838F;
	color: #fff;
}
.sitestaffr-leads-filter-count {
	display: inline-block;
	min-width: 20px;
	padding: 1px 7px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.08);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}
.sitestaffr-leads-filter-tab.is-active .sitestaffr-leads-filter-count {
	background: rgba(255, 255, 255, 0.25);
}
.sitestaffr-leads-empty-filter {
	margin: 8px 0 0;
	color: #6b7c7a;
	font-style: italic;
}

/* The table/mobile/print rules set `display` on <tr>, so the native [hidden]
   attribute the filter JS toggles needs an explicit override to take effect. */
.sitestaffr-leads-table tr[hidden] { display: none !important; }

/* Handled rows: a faint tint so the eye lands on the still-open follow-ups. */
.sitestaffr-leads-table tr[data-handled="1"] { background: #f6fdfa; }

/* ── Mark-handled toggle ── */
.sitestaffr-leads-handled-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: 8px;
	border: 1px solid #1FB6CC;
	background: #fff;
	color: #00838F;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
	cursor: pointer;
}
.sitestaffr-leads-handled-btn:hover { background: #E0F7FA; }
.sitestaffr-leads-handled-btn:disabled { opacity: 0.6; cursor: default; }
/* Labels swap on state (aria-pressed): not-handled shows "Mark handled";
   handled shows a green "✓ Handled" plus a subdued "Undo". */
.sitestaffr-leads-handled-done,
.sitestaffr-leads-handled-undo { display: none; }
.sitestaffr-leads-handled-btn[aria-pressed="true"] {
	border-color: #10b981;
	background: #ecfdf5;
	color: #0f7a54;
}
.sitestaffr-leads-handled-btn[aria-pressed="true"]:hover { background: #d7f7e8; }
.sitestaffr-leads-handled-btn[aria-pressed="true"] .sitestaffr-leads-handled-mark { display: none; }
.sitestaffr-leads-handled-btn[aria-pressed="true"] .sitestaffr-leads-handled-done { display: inline; }
.sitestaffr-leads-handled-btn[aria-pressed="true"] .sitestaffr-leads-handled-undo {
	display: inline;
	margin-left: 2px;
	padding-left: 8px;
	border-left: 1px solid #b6e6d3;
	font-weight: 600;
	color: #6b7c7a;
}

/* Mobile: make the toggle a full-width tap target at the bottom of each card. */
@media (max-width: 600px) {
	.sitestaffr-leads-handled-cell { text-align: center; }
	.sitestaffr-leads-handled-btn { width: 100%; justify-content: center; padding: 11px 14px; font-size: 14px; }
}

/* Print: the filter and the interactive Follow-up control are meaningless on
   paper — drop them (the tint stays to show what's already handled). */
@media print {
	.sitestaffr-leads-filter,
	.sitestaffr-leads-empty-filter,
	.sitestaffr-leads-table td[data-label="Follow-up"] {
		display: none !important;
	}
}
