#leadManagement.tab-content {
	max-width: none;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: visible;
}

#leadManagement.tab-content.active {
	display: block;
}

.lead-layout {
	display: grid;
	grid-template-columns: 248px minmax(0, 1fr);
	min-height: calc(100vh - 86px);
	align-items: stretch;
}

.lead-sidebar {
	display: flex;
	flex-direction: column;
	padding: 22px 14px 28px;
	background: #152033;
	color: #d7deea;
	overflow-y: auto;
}

.lead-sidebar__brand {
	display: grid;
	gap: 2px;
	padding: 4px 12px 22px;
}

.lead-sidebar__brand strong {
	font-size: 1.05rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	color: #fff;
}

.lead-sidebar__brand span {
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #8b97ab;
}

.lead-sidebar__nav {
	display: grid;
	align-content: start;
	gap: 4px;
}

.lead-sidebar__item,
.lead-sidebar__subitem {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.lead-sidebar__item {
	min-height: 42px;
	padding: 8px 12px;
	border-radius: 10px;
	font-size: 0.92rem;
	font-weight: 700;
}

.lead-sidebar__item.is-current,
.lead-sidebar__item:hover,
.lead-sidebar__subitem:hover,
.lead-sidebar__subitem.is-active {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
}

.lead-sidebar__subitem.is-active {
	background: #1f4f86;
}

.lead-sidebar__icon,
.lead-sidebar__chevron {
	flex: 0 0 auto;
}

.lead-sidebar__icon {
	display: inline-grid;
	place-items: center;
	width: 18px;
	height: 18px;
}

.lead-sidebar__icon svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.lead-sidebar__chevron {
	width: 8px;
	height: 8px;
	margin-left: auto;
	border-right: 1.6px solid currentColor;
	border-bottom: 1.6px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.7;
}

.lead-sidebar__group.is-open > .lead-sidebar__item .lead-sidebar__chevron {
	transform: rotate(-135deg);
	margin-top: 4px;
}

.lead-sidebar__sub {
	display: none;
	padding: 4px 0 8px 18px;
}

.lead-sidebar__group.is-open .lead-sidebar__sub {
	display: grid;
	gap: 2px;
}

.lead-sidebar__subitem {
	min-height: 36px;
	padding: 7px 12px;
	border-radius: 8px;
	font-size: 0.86rem;
	font-weight: 650;
	color: #b7c2d4;
}

.lead-main {
	min-width: 0;
	background: var(--config-beige-solid);
}

.lead-shell {
	max-width: 1520px;
	margin: 0 auto;
	padding: 28px 24px 72px;
}

.lead-kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin: 18px 0 22px;
}

.lead-kpi {
	display: grid;
	gap: 6px;
	padding: 18px;
	border: 1px solid rgba(16, 16, 16, 0.08);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--shadow-sm);
}

.lead-kpi span {
	color: var(--text-muted);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.lead-kpi strong {
	color: var(--primary);
	font-size: 1.8rem;
	line-height: 1;
}

.lead-section-empty {
	padding: 48px 20px;
	border: 1px solid rgba(16, 16, 16, 0.08);
	border-radius: 16px;
	background: #fff;
	color: var(--text-muted);
	text-align: center;
}

.lead-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 22px;
}

.lead-eyebrow {
	margin: 0 0 6px;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #8a7a6d;
}

.lead-header h2 {
	margin: 0 0 6px;
	color: var(--primary);
	font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.lead-header p {
	margin: 0;
	color: var(--text-muted);
}

.lead-header__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.lead-btn,
.lead-link-btn {
	min-height: 42px;
	padding: 9px 16px;
	border: 1px solid var(--primary);
	border-radius: 10px;
	background: var(--primary);
	color: #fff;
	font: inherit;
	font-weight: 800;
	cursor: pointer;
}

.lead-btn--ghost,
.lead-link-btn--ghost {
	border-color: rgba(16, 16, 16, 0.14);
	background: #fff;
	color: var(--primary);
}

.lead-btn--success {
	border-color: #1f8a4c;
	background: #edf9f1;
	color: #176b3b;
}

.lead-btn--danger {
	border-color: #d7b4b4;
	background: #fff;
	color: #b42318;
}

.lead-btn:disabled,
.lead-link-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.lead-btn:hover:not(:disabled),
.lead-link-btn:hover:not(:disabled) {
	filter: brightness(1.05);
}

.lead-filters {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 12px;
	margin-bottom: 16px;
	padding: 16px;
	border: 1px solid rgba(16, 16, 16, 0.08);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--shadow-sm);
}

.lead-filters[hidden] {
	display: none;
}

.lead-filters label {
	display: grid;
	gap: 6px;
	font-size: 0.74rem;
	font-weight: 800;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.lead-filters select,
.lead-filters input,
.lead-modal input,
.lead-modal select,
.lead-modal textarea {
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	border: 1px solid rgba(16, 16, 16, 0.14);
	border-radius: 10px;
	background: #fff;
	color: var(--text);
	font: inherit;
}

.lead-count {
	margin: 0 0 10px;
	color: var(--text-muted);
	font-size: 0.9rem;
	font-weight: 700;
}

.lead-table-wrap {
	overflow-x: auto;
	border: 1px solid rgba(16, 16, 16, 0.08);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--shadow-sm);
}

.lead-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 860px;
}

.lead-table--leads {
	min-width: 1120px;
	table-layout: fixed;
}

.lead-table.lead-table--leads th,
.lead-table.lead-table--leads td {
	padding: 12px 9px;
	font-size: 0.82rem;
	overflow-wrap: anywhere;
}

.lead-table.lead-table--leads th {
	font-size: 0.66rem;
	letter-spacing: 0.045em;
}

.lead-table--leads th:nth-child(1) { width: 12%; }
.lead-table--leads th:nth-child(2) { width: 10%; }
.lead-table--leads th:nth-child(3) { width: 9%; }
.lead-table--leads th:nth-child(4) { width: 10%; }
.lead-table--leads th:nth-child(5) { width: 9%; }
.lead-table--leads th:nth-child(6) { width: 16%; }
.lead-table--leads th:nth-child(7) { width: 6%; }
.lead-table--leads th:nth-child(8) { width: 11%; }
.lead-table--leads th:nth-child(9) { width: 10%; }
.lead-table--leads th:nth-child(10) { width: 7%; }

.lead-table--leads .lead-person {
	gap: 8px;
}

.lead-table--leads .lead-avatar {
	width: 32px;
	height: 32px;
	flex-basis: 32px;
	font-size: 0.7rem;
}

.lead-table--leads .lead-person strong {
	font-size: 0.84rem;
}

.lead-table--leads .lead-status,
.lead-table--leads .lead-contact-visibility {
	padding-inline: 7px;
	font-size: 0.68rem;
	white-space: normal;
}

.lead-table--leads .lead-link-btn {
	min-height: 36px;
	padding: 7px 11px;
	font-size: 0.78rem;
}

.lead-table th,
.lead-table td {
	padding: 14px 16px;
	border-bottom: 1px solid rgba(16, 16, 16, 0.07);
	text-align: left;
	vertical-align: middle;
}

.lead-table th {
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #8a7a6d;
	background: #fbf9f7;
}

.lead-table tr:last-child td {
	border-bottom: 0;
}

.lead-table tbody tr {
	cursor: pointer;
}

.lead-table tbody tr:hover {
	background: #faf7f4;
}

.lead-person {
	display: flex;
	align-items: center;
	gap: 12px;
}

.lead-avatar {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 999px;
	background: #eef1f6;
	color: #31415a;
	font-size: 0.78rem;
	font-weight: 800;
	flex: 0 0 38px;
}

.lead-person strong {
	display: block;
	font-size: 0.95rem;
}

.lead-person small {
	color: var(--text-soft);
}

.lead-status {
	display: inline-flex;
	align-items: center;
	min-height: 26px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 800;
	white-space: nowrap;
}

.lead-status[data-status="nuovo"] {
	background: #e8f1ff;
	color: #1d4f9c;
}

.lead-status[data-status="in_lavorazione"] {
	background: #fff1e2;
	color: #b25b12;
}

.lead-status[data-status="contattato"] {
	background: #e7f7ee;
	color: #1c7a45;
}

.lead-status[data-status="appuntamento"] {
	background: #e6f7f4;
	color: #0f766e;
}

.lead-status[data-status="closed_lost"] {
	background: #fdecec;
	color: #b42318;
}

.lead-status[data-status="closed_won"] {
	background: #e8f6ee;
	color: #176b3b;
}

.lead-contact-visibility {
	display: inline-flex;
	align-items: center;
	min-height: 26px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 800;
	white-space: nowrap;
}

.lead-contact-visibility.is-visible {
	background: #e8f6ee;
	color: #176b3b;
}

.lead-contact-visibility.is-hidden {
	background: #f0f2f5;
	color: #5f6874;
}

.lead-pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 4px 0;
	color: var(--text-muted);
	font-size: 0.86rem;
}

.lead-pagination__pages {
	display: flex;
	gap: 6px;
}

.lead-page-btn {
	min-width: 34px;
	min-height: 34px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.lead-page-btn.is-active,
.lead-page-btn:hover {
	border-color: rgba(16, 16, 16, 0.12);
	background: #fff;
	color: var(--primary);
}

.lead-detail {
	display: grid;
	gap: 18px;
}

.lead-detail__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.lead-card {
	padding: 22px;
	border: 1px solid rgba(16, 16, 16, 0.08);
	border-radius: 18px;
	background: #fff;
	box-shadow: var(--shadow-sm);
}

.lead-detail__identity {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 16px;
}

.lead-detail__identity .lead-avatar {
	width: 56px;
	height: 56px;
	flex-basis: 56px;
	font-size: 1rem;
}

.lead-detail__identity h2 {
	margin: 0 0 6px;
}

.lead-detail__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	margin: 0;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.lead-detail__facts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	margin: 16px 0 0;
}

.lead-detail__facts div {
	display: grid;
	gap: 4px;
}

.lead-detail__facts dt {
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #8a7a6d;
}

.lead-detail__facts dd {
	margin: 0;
	font-weight: 700;
}

.lead-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 18px;
}

.lead-banner {
	display: flex;
	gap: 10px;
	margin-top: 16px;
	padding: 12px 14px;
	border-radius: 12px;
	font-size: 0.9rem;
	line-height: 1.45;
}

.lead-banner--info {
	background: #eef4ff;
	color: #1d4f9c;
}

.lead-banner--warn {
	background: #fff6e8;
	color: #9a5b10;
}

.lead-banner--ok {
	background: #eaf8ef;
	color: #176b3b;
}

.lead-banner--danger {
	background: #fdecec;
	color: #9a2929;
}

.lead-outcome {
	display: grid;
	gap: 10px;
	margin-top: 16px;
}

.lead-outcome__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-weight: 800;
}

.lead-outcome__actions {
	display: grid;
	gap: 8px;
}

.lead-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 14px;
	border-bottom: 1px solid rgba(16, 16, 16, 0.08);
}

.lead-tab {
	padding: 10px 12px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	color: var(--text-muted);
	font: inherit;
	font-weight: 800;
	cursor: pointer;
}

.lead-tab.is-active {
	color: var(--primary);
	border-bottom-color: var(--primary);
}

.lead-tab-panel header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.lead-tab-panel h3 {
	margin: 0 0 4px;
}

.lead-tab-panel p {
	margin: 0;
	color: var(--text-muted);
}

.lead-empty {
	padding: 28px 12px;
	color: var(--text-muted);
	text-align: center;
}

.lead-modal[hidden] {
	display: none;
}

.lead-modal {
	position: fixed;
	inset: 0;
	z-index: 80;
	display: grid;
	place-items: center;
	padding: 24px;
}

.lead-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 22, 32, 0.45);
}

.lead-modal__dialog {
	position: relative;
	width: min(100%, 520px);
	max-height: min(88vh, 760px);
	overflow: auto;
	padding: 24px;
	border-radius: 18px;
	background: #fff;
	box-shadow: var(--shadow-lg);
}

.lead-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.lead-modal__dialog h2 {
	margin: 0 24px 16px 0;
}

.lead-form {
	display: grid;
	gap: 12px;
}

.lead-form label {
	display: grid;
	gap: 6px;
	font-size: 0.86rem;
	font-weight: 700;
}

.lead-form__check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
}

.lead-form__check input {
	width: auto;
	min-height: 0;
}

.lead-form__actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 8px;
}

@media (max-width: 980px) {
	.lead-layout {
		grid-template-columns: 1fr;
	}

	.lead-sidebar {
		position: sticky;
		top: 86px;
		z-index: 4;
		flex-direction: row;
		align-items: center;
		gap: 16px;
		padding: 12px 16px;
		overflow-x: auto;
	}

	.lead-sidebar__brand {
		padding: 0 8px 0 0;
		border-right: 1px solid rgba(255, 255, 255, 0.12);
	}

	.lead-sidebar__nav,
	.lead-sidebar__group.is-open .lead-sidebar__sub {
		display: flex;
		flex-wrap: nowrap;
		gap: 4px;
	}

	.lead-sidebar__item,
	.lead-sidebar__subitem {
		width: auto;
		white-space: nowrap;
	}

	.lead-sidebar__chevron {
		display: none;
	}

	.lead-kpis {
		grid-template-columns: 1fr 1fr;
	}

	.lead-filters,
	.lead-detail__facts {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 720px) {
	.lead-header,
	.lead-detail__nav,
	.lead-pagination {
		flex-direction: column;
		align-items: stretch;
	}

	.lead-filters,
	.lead-detail__facts {
		grid-template-columns: 1fr;
	}
}
